diff options
author | sanine-a <sanine.not@pm.me> | 2020-11-23 02:07:49 -0600 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2020-11-23 02:07:49 -0600 |
commit | b97f172e948872cfe1bf030f95ff50e5d0b2a1bc (patch) | |
tree | 4281b319ac62799253d1974a50e3015b3d11b25f | |
parent | 7bdeedd394e4b51d4c2ef4a0dd0470ed0492ac5f (diff) |
fix bug in mesh loading
-rw-r--r-- | demo/main.lua | 12 | ||||
-rw-r--r-- | src/mesh/mesh.c | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/demo/main.lua b/demo/main.lua index aa91acd..660614d 100644 --- a/demo/main.lua +++ b/demo/main.lua @@ -21,11 +21,17 @@ local sceneRoot = Node.new(nil, Vector.Vec3.new{1,1,1}) local shader = SpatialShader.new(tex) +local lightDirection = Vector.Vec3.new{1,1,1} +lightDirection:normalize() +shader:setVec3('directional_lights[0].direction', lightDirection) +shader:setVec3('directional_lights[0].color', Vector.Vec3.new{0,1,0}) +local meshes = honey.mesh.load('Suzanne.obj') +print(#meshes) local suzanne = MeshInstance.new(sceneRoot, Vector.Vec3.new{0,0,-3}, Vector.Vec3.new{0,math.pi,0}, Vector.Vec3.new{0.5,1,0.5}, - honey.mesh.load('Suzanne.obj')[1], + meshes[1], shader) local plane = MeshInstance.new(suzanne, Vector.Vec3.new{1,0,0}, @@ -41,8 +47,8 @@ local plane2 = MeshInstance.new(suzanne, shader) suzanne.update = function(self, dt) - local angle = dt * math.pi - self:yaw(angle) + --local angle = dt * math.pi + --self:yaw(angle) end local total_frames = 0 diff --git a/src/mesh/mesh.c b/src/mesh/mesh.c index 2f3b330..68e39d7 100644 --- a/src/mesh/mesh.c +++ b/src/mesh/mesh.c @@ -111,7 +111,7 @@ static void process_nodes_recursively(lua_State* L, struct aiMesh* assimp_mesh = scene->mMeshes[node->mMeshes[i]]; *mesh = assimp_to_honey_mesh(assimp_mesh, scene); lua_rawseti(L, -2, *n_meshes); - *n_meshes++; + (*n_meshes)++; } for (int i=0; i<node->mNumChildren; i++) { |