More models

This commit is contained in:
Ben Kyd
2019-08-07 09:05:49 +01:00
parent 250c2643b9
commit 8b6aa8fdb8
7 changed files with 686082 additions and 14 deletions

View File

@@ -0,0 +1,12 @@
# Blender MTL File: 'None'
# Material Count: 1
newmtl wire_087224198
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.0 0.0 0.0
Ni 1.450000
d 1.000000
illum 2

269329
resources/dragon-normals.obj Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
# Blender MTL File: 'None'
# Material Count: 1
newmtl Default_OBJ
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.0 0.0 0.0
Ni 1.450000
d 1.000000
illum 2

266632
resources/lucy-normals.obj Normal file

File diff suppressed because it is too large Load Diff

150078
resources/lucy.obj Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -59,29 +59,29 @@ std::vector<Triangle*> LoadTrianglesBasic(std::string path) {
avy[v] = attrib.vertices[3 * idx.vertex_index + 1];
avz[v] = attrib.vertices[3 * idx.vertex_index + 2];
// anx[v] = attrib.normals[3 * idx.normal_index + 0];
// any[v] = attrib.normals[3 * idx.normal_index + 1];
// anz[v] = attrib.normals[3 * idx.normal_index + 2];
anx[v] = attrib.normals[3 * idx.normal_index + 0];
any[v] = attrib.normals[3 * idx.normal_index + 1];
anz[v] = attrib.normals[3 * idx.normal_index + 2];
}
// tinyobj::material_t material = materials[shapes[s].mesh.material_ids[f]];
glm::vec3 normal = getNormal(
{avx[0], avy[0], avz[0]},
{avx[1], avy[1], avz[1]},
{avx[2], avy[2], avz[2]}
);
// glm::vec3 normal = getNormal(
// {avx[0], avy[0], avz[0]},
// {avx[1], avy[1], avz[1]},
// {avx[2], avy[2], avz[2]}
// );
Triangle* tmp = new Triangle {
{avx[0], avy[0], avz[0]},
{avx[1], avy[1], avz[1]},
{avx[2], avy[2], avz[2]},
normal, normal, normal
// normal, normal, normal
// {anx[0], any[0], anz[0]},
// {anx[1], any[1], anz[1]},
// {anx[2], any[2], anz[2]},
{anx[0], any[0], anz[0]},
{anx[1], any[1], anz[1]},
{anx[2], any[2], anz[2]},
};
triangles.push_back(tmp);

View File

@@ -19,9 +19,14 @@ int main(int argc, char** argv) {
// scene->objects.push_back(new Sphere({0.0f, 0.0f, -4.0f}, 1.0f));
std::vector<Triangle*> tris = LoadTrianglesBasic("/home/ben/programming/inferno/resources/dragon.obj");
// std::vector<Triangle*> tris = LoadTrianglesBasic("/home/ben/programming/inferno/resources/dragon-normals.obj");
// for (const auto& object : tris)
// object->Translate({ 0.0f, -5.0f, -20.0f });
// std::cout << "loaded" << std::endl;
std::vector<Triangle*> tris = LoadTrianglesBasic("/home/ben/programming/inferno/resources/lucy-normals.obj");
for (const auto& object : tris)
object->Translate({ 0.0f, -5.0f, -20.0f });
object->Translate({ 0.0f, -3.9f, -10.6f });
std::cout << "loaded" << std::endl;
Mesh* mesh = new Mesh(tris);