Add dummy code to dump models to code
This commit is contained in:
parent
c480a575f8
commit
a4f15c7179
|
@ -22,7 +22,9 @@
|
||||||
#include <fs_SkyGradient.h>
|
#include <fs_SkyGradient.h>
|
||||||
#include <fs_Red.h>
|
#include <fs_Red.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <spng.h>
|
#include <spng.h>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
using namespace orange;
|
using namespace orange;
|
||||||
|
|
||||||
|
@ -215,7 +217,9 @@ int main(int argc, char** argv)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
//auto r_objData = fs::OpenFileIntoTextBuffer("/home/joshua/gman.obj");
|
//auto r_objData = fs::OpenFileIntoTextBuffer("/home/joshua/gman.obj");
|
||||||
auto r_objData = fs::OpenFileIntoTextBuffer("/home/joshua/chair.obj");
|
//auto r_objData = fs::OpenFileIntoTextBuffer("/home/joshua/chair.obj");
|
||||||
|
auto r_objData = fs::OpenFileIntoTextBuffer("/home/joshua/frog.obj");
|
||||||
|
//auto r_objData = fs::OpenFileIntoTextBuffer("/home/joshua/deck.obj");
|
||||||
//auto r_objData = fs::OpenFileIntoTextBuffer("/home/joshua/cube.obj");
|
//auto r_objData = fs::OpenFileIntoTextBuffer("/home/joshua/cube.obj");
|
||||||
if (!r_objData)
|
if (!r_objData)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -238,6 +242,46 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
auto r_mesh = ParseOBJ(*r_objData);
|
auto r_mesh = ParseOBJ(*r_objData);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::cout << std::endl;
|
||||||
|
for (auto& vertex : r_mesh->vertexData.GetStaticVertices()) {
|
||||||
|
std::cout << std::hexfloat;
|
||||||
|
std::cout << "{ ";
|
||||||
|
|
||||||
|
std::cout << "{ " << std::setw(16) << vertex.pos[0] << ", " << std::setw(16) << vertex.pos[1] << ", " << std::setw(16) << vertex.pos[2] << " }, ";
|
||||||
|
std::cout << "{ " << std::setw(16) << vertex.uv[0] << ", " << std::setw(16) << vertex.uv[1] << " }, ";
|
||||||
|
std::cout << "{ " << std::setw(16) << vertex.normal[0] << ", " << std::setw(16) << vertex.normal[1] << ", " << std::setw(16) << vertex.normal[2] << " } ";
|
||||||
|
|
||||||
|
std::cout << "},";
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::cout << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::cout << std::endl;
|
||||||
|
int count = 0;
|
||||||
|
for (auto& index : r_mesh->indices) {
|
||||||
|
std::cout << std::setw(4) << index << "u, ";
|
||||||
|
count++;
|
||||||
|
if (count >= 16) {
|
||||||
|
std::cout << std::endl;
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::cout << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
auto newVertexSlice = *pooler.AllocSlice(sizeof(StaticVertex) * r_mesh->vertexData.VertexCount(), sizeof(StaticVertex));
|
auto newVertexSlice = *pooler.AllocSlice(sizeof(StaticVertex) * r_mesh->vertexData.VertexCount(), sizeof(StaticVertex));
|
||||||
auto newIndexSlice = *pooler.AllocSlice(sizeof(IndexType) * r_mesh->indices.size(), sizeof(IndexType));
|
auto newIndexSlice = *pooler.AllocSlice(sizeof(IndexType) * r_mesh->indices.size(), sizeof(IndexType));
|
||||||
r_mesh->vertexData.GetStaticVertices().copy((uint8_t*)(r_buffer->ptr) + newVertexSlice.offset);
|
r_mesh->vertexData.GetStaticVertices().copy((uint8_t*)(r_buffer->ptr) + newVertexSlice.offset);
|
||||||
|
@ -449,7 +493,9 @@ int main(int argc, char** argv)
|
||||||
};
|
};
|
||||||
Vector<ImageUpload> imageUploads;
|
Vector<ImageUpload> imageUploads;
|
||||||
|
|
||||||
auto r_pngData = fs::OpenFileIntoBuffer("/home/joshua/chair_color.png");
|
//auto r_pngData = fs::OpenFileIntoBuffer("/home/joshua/chair_color.png");
|
||||||
|
auto r_pngData = fs::OpenFileIntoBuffer("/home/joshua/frog001.png");
|
||||||
|
//auto r_pngData = fs::OpenFileIntoBuffer("/home/joshua/deck.png");
|
||||||
if (!r_pngData)
|
if (!r_pngData)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue