| @@ -100,6 +100,7 @@ liblolcore_sources = \ | |||||
| generated/lolfx-scanner.cpp \ | generated/lolfx-scanner.cpp \ | ||||
| \ | \ | ||||
| mesh/mesh.cpp mesh/mesh.h \ | mesh/mesh.cpp mesh/mesh.h \ | ||||
| mesh/primitive.cpp mesh/primitive.h \ | |||||
| \ | \ | ||||
| sys/init.cpp sys/timer.cpp sys/file.cpp \ | sys/init.cpp sys/timer.cpp sys/file.cpp \ | ||||
| sys/threadbase.h \ | sys/threadbase.h \ | ||||
| @@ -183,6 +183,7 @@ static inline int isnan(float f) | |||||
| #include "map.h" | #include "map.h" | ||||
| #include "layer.h" | #include "layer.h" | ||||
| #include "mesh/mesh.h" | #include "mesh/mesh.h" | ||||
| #include "mesh/primitive.h" | |||||
| #include "application/application.h" | #include "application/application.h" | ||||
| #include "easymesh/csgbsp.h" | #include "easymesh/csgbsp.h" | ||||
| #include "easymesh/easymesh.h" | #include "easymesh/easymesh.h" | ||||
| @@ -6,12 +6,12 @@ attribute vec3 in_Position; | |||||
| attribute vec4 in_Color; | attribute vec4 in_Color; | ||||
| varying vec4 pass_Color; | varying vec4 pass_Color; | ||||
| uniform mat4 proj_matrix; | |||||
| uniform mat4 view_matrix; | |||||
| uniform mat4 u_projection; | |||||
| uniform mat4 u_view; | |||||
| void main() | void main() | ||||
| { | { | ||||
| gl_Position = proj_matrix * view_matrix | |||||
| gl_Position = u_projection * u_view | |||||
| * vec4(in_Position, 1.0); | * vec4(in_Position, 1.0); | ||||
| pass_Color = in_Color; | pass_Color = in_Color; | ||||
| } | } | ||||
| @@ -35,12 +35,12 @@ void main() | |||||
| void main(float4 in_Position : POSITION, | void main(float4 in_Position : POSITION, | ||||
| float4 in_Color : COLOR, | float4 in_Color : COLOR, | ||||
| uniform float4x4 proj_matrix, | |||||
| uniform float4x4 view_matrix, | |||||
| uniform float4x4 u_projection, | |||||
| uniform float4x4 u_view, | |||||
| out float4 out_Color : COLOR, | out float4 out_Color : COLOR, | ||||
| out float4 out_Position : POSITION) | out float4 out_Position : POSITION) | ||||
| { | { | ||||
| out_Position = mul(proj_matrix, mul(view_matrix, in_Position)); | |||||
| out_Position = mul(u_projection, mul(u_view, in_Position)); | |||||
| out_Color = in_Color; | out_Color = in_Color; | ||||
| } | } | ||||
| @@ -6,13 +6,13 @@ attribute vec3 in_Position; | |||||
| attribute vec2 in_TexCoord; | attribute vec2 in_TexCoord; | ||||
| varying vec2 pass_TexCoord; | varying vec2 pass_TexCoord; | ||||
| uniform mat4 proj_matrix; | |||||
| uniform mat4 view_matrix; | |||||
| uniform mat4 model_matrix; | |||||
| uniform mat4 u_projection; | |||||
| uniform mat4 u_view; | |||||
| uniform mat4 u_model; | |||||
| void main() | void main() | ||||
| { | { | ||||
| gl_Position = proj_matrix * view_matrix * model_matrix | |||||
| gl_Position = u_projection * u_view * u_model | |||||
| * vec4(in_Position, 1.0); | * vec4(in_Position, 1.0); | ||||
| pass_TexCoord = in_TexCoord; | pass_TexCoord = in_TexCoord; | ||||
| } | } | ||||
| @@ -39,9 +39,9 @@ void main() | |||||
| void main(float4 in_Position : POSITION, | void main(float4 in_Position : POSITION, | ||||
| float2 in_TexCoord : TEXCOORD0, | float2 in_TexCoord : TEXCOORD0, | ||||
| uniform float4x4 proj_matrix, | |||||
| uniform float4x4 view_matrix, | |||||
| uniform float4x4 model_matrix, | |||||
| uniform float4x4 u_projection, | |||||
| uniform float4x4 u_view, | |||||
| uniform float4x4 u_model, | |||||
| uniform float2 in_TexSize, | uniform float2 in_TexSize, | ||||
| out float2 out_TexCoord : TEXCOORD0, | out float2 out_TexCoord : TEXCOORD0, | ||||
| out float4 out_Position : POSITION) | out float4 out_Position : POSITION) | ||||
| @@ -51,7 +51,7 @@ void main(float4 in_Position : POSITION, | |||||
| #else | #else | ||||
| float2 delta = float2(0.0, 0.0); | float2 delta = float2(0.0, 0.0); | ||||
| #endif | #endif | ||||
| out_Position = mul(proj_matrix, mul(view_matrix, mul(model_matrix, in_Position))); | |||||
| out_Position = mul(u_projection, mul(u_view, mul(u_model, in_Position))); | |||||
| out_TexCoord = in_TexCoord + delta; | out_TexCoord = in_TexCoord + delta; | ||||
| } | } | ||||
| @@ -93,11 +93,11 @@ void Gradient::TickDraw(float seconds) | |||||
| data->shader->Bind(); | data->shader->Bind(); | ||||
| uni_mat = data->shader->GetUniformLocation("proj_matrix"); | |||||
| uni_mat = data->shader->GetUniformLocation("u_projection"); | |||||
| data->shader->SetUniform(uni_mat, g_scene->GetCamera()->GetProjection()); | data->shader->SetUniform(uni_mat, g_scene->GetCamera()->GetProjection()); | ||||
| uni_mat = data->shader->GetUniformLocation("view_matrix"); | |||||
| uni_mat = data->shader->GetUniformLocation("u_view"); | |||||
| data->shader->SetUniform(uni_mat, g_scene->GetCamera()->GetView()); | data->shader->SetUniform(uni_mat, g_scene->GetCamera()->GetView()); | ||||
| uni_mat = data->shader->GetUniformLocation("model_matrix"); | |||||
| uni_mat = data->shader->GetUniformLocation("u_model"); | |||||
| data->shader->SetUniform(uni_mat, model_matrix); | data->shader->SetUniform(uni_mat, model_matrix); | ||||
| data->shader->Bind(); | data->shader->Bind(); | ||||
| @@ -6,13 +6,13 @@ attribute vec3 in_Position; | |||||
| attribute vec4 in_Color; | attribute vec4 in_Color; | ||||
| varying vec4 pass_Color; | varying vec4 pass_Color; | ||||
| uniform mat4 proj_matrix; | |||||
| uniform mat4 view_matrix; | |||||
| uniform mat4 model_matrix; | |||||
| uniform mat4 u_projection; | |||||
| uniform mat4 u_view; | |||||
| uniform mat4 u_model; | |||||
| void main() | void main() | ||||
| { | { | ||||
| gl_Position = proj_matrix * view_matrix * model_matrix | |||||
| gl_Position = u_projection * u_view * u_model | |||||
| * vec4(in_Position, 1.0); | * vec4(in_Position, 1.0); | ||||
| pass_Color = in_Color; | pass_Color = in_Color; | ||||
| } | } | ||||
| @@ -81,13 +81,13 @@ void main() | |||||
| void main(float4 in_Vertex : POSITION, | void main(float4 in_Vertex : POSITION, | ||||
| float4 in_Color : COLOR, | float4 in_Color : COLOR, | ||||
| uniform float4x4 proj_matrix, | |||||
| uniform float4x4 view_matrix, | |||||
| uniform float4x4 model_matrix, | |||||
| uniform float4x4 u_projection, | |||||
| uniform float4x4 u_view, | |||||
| uniform float4x4 u_model, | |||||
| out float4 out_Color : COLOR, | out float4 out_Color : COLOR, | ||||
| out float4 out_Position : POSITION) | out float4 out_Position : POSITION) | ||||
| { | { | ||||
| out_Position = mul(proj_matrix, mul(view_matrix, mul(model_matrix, in_Vertex))); | |||||
| out_Position = mul(u_projection, mul(u_view, mul(u_model, in_Vertex))); | |||||
| out_Color = in_Color; | out_Color = in_Color; | ||||
| } | } | ||||
| @@ -158,6 +158,7 @@ | |||||
| <ClCompile Include="math\trig.cpp" /> | <ClCompile Include="math\trig.cpp" /> | ||||
| <ClCompile Include="math\vector.cpp" /> | <ClCompile Include="math\vector.cpp" /> | ||||
| <ClCompile Include="mesh\mesh.cpp" /> | <ClCompile Include="mesh\mesh.cpp" /> | ||||
| <ClCompile Include="mesh\primitive.cpp" /> | |||||
| <ClCompile Include="messageservice.cpp" /> | <ClCompile Include="messageservice.cpp" /> | ||||
| <ClCompile Include="platform.cpp" /> | <ClCompile Include="platform.cpp" /> | ||||
| <ClCompile Include="platform\d3d9\d3d9input.cpp" /> | <ClCompile Include="platform\d3d9\d3d9input.cpp" /> | ||||
| @@ -307,6 +308,7 @@ | |||||
| <ClInclude Include="lol\sys\timer.h" /> | <ClInclude Include="lol\sys\timer.h" /> | ||||
| <ClInclude Include="lol\unit.h" /> | <ClInclude Include="lol\unit.h" /> | ||||
| <ClInclude Include="mesh\mesh.h" /> | <ClInclude Include="mesh\mesh.h" /> | ||||
| <ClInclude Include="mesh\primitive.h" /> | |||||
| <ClInclude Include="map.h" /> | <ClInclude Include="map.h" /> | ||||
| <ClInclude Include="messageservice.h" /> | <ClInclude Include="messageservice.h" /> | ||||
| <ClInclude Include="numeric.h" /> | <ClInclude Include="numeric.h" /> | ||||
| @@ -117,6 +117,9 @@ | |||||
| <ClCompile Include="mesh\mesh.cpp"> | <ClCompile Include="mesh\mesh.cpp"> | ||||
| <Filter>mesh</Filter> | <Filter>mesh</Filter> | ||||
| </ClCompile> | </ClCompile> | ||||
| <ClCompile Include="mesh\primitive.cpp"> | |||||
| <Filter>mesh</Filter> | |||||
| </ClCompile> | |||||
| <ClCompile Include="gpu\rendercontext.cpp"> | <ClCompile Include="gpu\rendercontext.cpp"> | ||||
| <Filter>gpu</Filter> | <Filter>gpu</Filter> | ||||
| </ClCompile> | </ClCompile> | ||||
| @@ -378,6 +381,9 @@ | |||||
| <ClInclude Include="mesh\mesh.h"> | <ClInclude Include="mesh\mesh.h"> | ||||
| <Filter>mesh</Filter> | <Filter>mesh</Filter> | ||||
| </ClInclude> | </ClInclude> | ||||
| <ClInclude Include="mesh\primitive.h"> | |||||
| <Filter>mesh</Filter> | |||||
| </ClInclude> | |||||
| <ClInclude Include="application\application.h"> | <ClInclude Include="application\application.h"> | ||||
| <Filter>application</Filter> | <Filter>application</Filter> | ||||
| </ClInclude> | </ClInclude> | ||||
| @@ -715,4 +721,4 @@ | |||||
| </None> | </None> | ||||
| <None Include="Makefile.am" /> | <None Include="Makefile.am" /> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| </Project> | |||||
| </Project> | |||||
| @@ -46,9 +46,6 @@ SubMesh::SubMesh(lol::VertexDeclaration* vdecl) | |||||
| : m_mesh_prim(MeshPrimitive::Triangles) | : m_mesh_prim(MeshPrimitive::Triangles) | ||||
| { | { | ||||
| m_vdecl = vdecl; | m_vdecl = vdecl; | ||||
| m_vbos = new VertexBuffer*[vdecl->GetStreamCount()]; | |||||
| memset(m_vbos, 0, sizeof(VertexBuffer*) * vdecl->GetStreamCount()); | |||||
| m_vertex_count = -1; | |||||
| } | } | ||||
| SubMesh::~SubMesh() | SubMesh::~SubMesh() | ||||
| @@ -63,9 +60,10 @@ void SubMesh::SetMeshPrimitive(MeshPrimitive mesh_primitive) | |||||
| void SubMesh::SetVertexBuffer(int index, VertexBuffer* vbo) | void SubMesh::SetVertexBuffer(int index, VertexBuffer* vbo) | ||||
| { | { | ||||
| while (index >= m_vbos.Count()) | |||||
| m_vbos.Push(nullptr); | |||||
| m_vbos[index] = vbo; | m_vbos[index] = vbo; | ||||
| if (m_vertex_count < 0) | |||||
| m_vertex_count = vbo->GetSize() / m_vdecl->GetStream(index).GetSize(); | |||||
| } | } | ||||
| void SubMesh::AddTexture(const char* name, Texture* texture) | void SubMesh::AddTexture(const char* name, Texture* texture) | ||||
| @@ -75,10 +73,9 @@ void SubMesh::AddTexture(const char* name, Texture* texture) | |||||
| void SubMesh::Render(Shader* shader) | void SubMesh::Render(Shader* shader) | ||||
| { | { | ||||
| ShaderAttrib attribs[12]; | |||||
| int vertex_count = 0; | |||||
| int c = 0; | |||||
| for (int i = 0; i < m_vdecl->GetStreamCount(); ++i) | |||||
| for (int i = 0; i < m_vbos.Count(); ++i) | |||||
| { | { | ||||
| ShaderAttrib attribs[12]; | ShaderAttrib attribs[12]; | ||||
| @@ -98,18 +95,20 @@ void SubMesh::Render(Shader* shader) | |||||
| attribs[j] = shader->GetAttribLocation(usage, indices[usage]++); | attribs[j] = shader->GetAttribLocation(usage, indices[usage]++); | ||||
| } | } | ||||
| vertex_count = m_vbos[i]->GetSize() / m_vdecl->GetStream(i).GetSize(); | |||||
| m_vdecl->SetStream(m_vbos[i], attribs); | m_vdecl->SetStream(m_vbos[i], attribs); | ||||
| } | } | ||||
| for (int i = 0; i < m_textures.Count(); ++i) | for (int i = 0; i < m_textures.Count(); ++i) | ||||
| { | { | ||||
| // TODO: might be good to cache this | // TODO: might be good to cache this | ||||
| ShaderUniform uniform = shader->GetUniformLocation(m_textures[i].m1.C()); | |||||
| shader->SetUniform(uniform, m_textures[i].m2->GetTexture(), i); | |||||
| ShaderUniform u_tex = shader->GetUniformLocation(m_textures[i].m1.C()); | |||||
| shader->SetUniform(u_tex, m_textures[i].m2->GetTexture(), i); | |||||
| } | } | ||||
| m_vdecl->Bind(); | m_vdecl->Bind(); | ||||
| m_vdecl->DrawElements(MeshPrimitive::Triangles, 0, m_vertex_count); | |||||
| m_vdecl->DrawElements(MeshPrimitive::Triangles, 0, vertex_count); | |||||
| m_vdecl->Unbind(); | m_vdecl->Unbind(); | ||||
| } | } | ||||
| @@ -19,6 +19,31 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| /* | |||||
| * A mesh contains a list of submeshes. This is a convenient way to | |||||
| * handle different materials or mesh types (static, skeletal, morph | |||||
| * targets, etc.) within the same container object. | |||||
| */ | |||||
| class Mesh | |||||
| { | |||||
| public: | |||||
| Mesh(); | |||||
| ~Mesh(); | |||||
| void Render(mat4 const &model); | |||||
| private: | |||||
| Array<class SubMesh *> m_submeshes; | |||||
| }; | |||||
| /* | |||||
| * A submesh contains: | |||||
| * - a vertex declaration | |||||
| * - a list of VBOs | |||||
| * - a list of textures | |||||
| */ | |||||
| class SubMesh | class SubMesh | ||||
| { | { | ||||
| public: | public: | ||||
| @@ -34,24 +59,11 @@ public: | |||||
| protected: | protected: | ||||
| VertexDeclaration* m_vdecl; | VertexDeclaration* m_vdecl; | ||||
| MeshPrimitive m_mesh_prim; | MeshPrimitive m_mesh_prim; | ||||
| VertexBuffer** m_vbos; | |||||
| int m_vertex_count; | |||||
| Array<VertexBuffer *> m_vbos; | |||||
| Array<String, Texture*> m_textures; | Array<String, Texture*> m_textures; | ||||
| }; | }; | ||||
| class Mesh | |||||
| { | |||||
| public: | |||||
| Mesh(); | |||||
| ~Mesh(); | |||||
| void Render(mat4 const &model); | |||||
| private: | |||||
| Array<SubMesh *> m_submeshes; | |||||
| }; | |||||
| } /* namespace lol */ | } /* namespace lol */ | ||||
| #endif /* __MESH_MESH_H__ */ | #endif /* __MESH_MESH_H__ */ | ||||
| @@ -0,0 +1,39 @@ | |||||
| // | |||||
| // Lol Engine | |||||
| // | |||||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | |||||
| // modify it under the terms of the Do What The Fuck You Want To | |||||
| // Public License, Version 2, as published by Sam Hocevar. See | |||||
| // http://www.wtfpl.net/ for more details. | |||||
| // | |||||
| #if defined HAVE_CONFIG_H | |||||
| # include "config.h" | |||||
| #endif | |||||
| #include <cstring> | |||||
| #include <cstdlib> | |||||
| #include "core.h" | |||||
| namespace lol | |||||
| { | |||||
| /* | |||||
| * Primitive class | |||||
| */ | |||||
| Primitive::Primitive(Mesh *mesh, Shader *shader, mat4 const &matrix) | |||||
| : m_mesh(mesh), | |||||
| m_shader(shader), | |||||
| m_matrix(matrix) | |||||
| { | |||||
| } | |||||
| Primitive::~Primitive() | |||||
| { | |||||
| } | |||||
| } /* namespace lol */ | |||||
| @@ -0,0 +1,42 @@ | |||||
| // | |||||
| // Lol Engine | |||||
| // | |||||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | |||||
| // modify it under the terms of the Do What The Fuck You Want To | |||||
| // Public License, Version 2, as published by Sam Hocevar. See | |||||
| // http://www.wtfpl.net/ for more details. | |||||
| // | |||||
| // | |||||
| // The Primitive class | |||||
| // ------------------- | |||||
| // | |||||
| #if !defined __MESH_PRIMITIVE_H__ | |||||
| #define __MESH_PRIMITIVE_H__ | |||||
| #include "mesh/mesh.h" | |||||
| namespace lol | |||||
| { | |||||
| class Primitive | |||||
| { | |||||
| friend class Scene; | |||||
| public: | |||||
| Primitive(Mesh *mesh, Shader *shader, mat4 const &matrix); | |||||
| ~Primitive(); | |||||
| private: | |||||
| Mesh *m_mesh; | |||||
| Shader *m_shader; | |||||
| mat4 m_matrix; | |||||
| }; | |||||
| } /* namespace lol */ | |||||
| #endif /* __MESH_PRIMITIVE_H__ */ | |||||
| @@ -56,6 +56,10 @@ class SceneData | |||||
| friend class Scene; | friend class Scene; | ||||
| private: | private: | ||||
| /* New scenegraph */ | |||||
| Array<Primitive> m_primitives; | |||||
| /* Old API */ | |||||
| Array<vec3, vec3, vec4> m_lines; | Array<vec3, vec3, vec4> m_lines; | ||||
| Shader *m_line_shader; | Shader *m_line_shader; | ||||
| VertexDeclaration *m_line_vdecl; | VertexDeclaration *m_line_vdecl; | ||||
| @@ -144,6 +148,11 @@ void Scene::Reset() | |||||
| data->m_lights.Empty(); | data->m_lights.Empty(); | ||||
| } | } | ||||
| void Scene::AddPrimitive(Mesh *mesh, Shader *shader, mat4 const &matrix) | |||||
| { | |||||
| data->m_primitives.Push(Primitive(mesh, shader, matrix)); | |||||
| } | |||||
| void Scene::AddTile(TileSet *tileset, int id, vec3 pos, int o, vec2 scale) | void Scene::AddTile(TileSet *tileset, int id, vec3 pos, int o, vec2 scale) | ||||
| { | { | ||||
| ASSERT(id < tileset->GetTileCount()); | ASSERT(id < tileset->GetTileCount()); | ||||
| @@ -179,6 +188,36 @@ void Scene::RenderPrimitives() | |||||
| { | { | ||||
| /* TODO: this should be the main entry for rendering of all | /* TODO: this should be the main entry for rendering of all | ||||
| * primitives found in the scene graph. When we have one. */ | * primitives found in the scene graph. When we have one. */ | ||||
| Shader *shader = nullptr; | |||||
| ShaderUniform u_model, uni_tex, uni_texsize; | |||||
| ShaderAttrib a_pos, a_tex; | |||||
| for (int i = 0; i < data->m_primitives.Count(); ++i) | |||||
| { | |||||
| Primitive &p = data->m_primitives[i]; | |||||
| /* If this primitive uses a new shader, update attributes */ | |||||
| if (p.m_shader != shader) | |||||
| { | |||||
| shader = p.m_shader; | |||||
| a_pos = shader->GetAttribLocation(VertexUsage::Position, 0); | |||||
| a_tex = shader->GetAttribLocation(VertexUsage::TexCoord, 0); | |||||
| shader->Bind(); | |||||
| ShaderUniform u_mat; | |||||
| u_mat = shader->GetUniformLocation("u_projection"); | |||||
| shader->SetUniform(u_mat, GetCamera()->GetProjection()); | |||||
| u_mat = shader->GetUniformLocation("u_view"); | |||||
| shader->SetUniform(u_mat, GetCamera()->GetView()); | |||||
| u_model = shader->GetUniformLocation("u_model"); | |||||
| } | |||||
| shader->SetUniform(u_model, p.m_matrix); | |||||
| } | |||||
| } | } | ||||
| void Scene::RenderTiles() // XXX: rename to Blit() | void Scene::RenderTiles() // XXX: rename to Blit() | ||||
| @@ -207,11 +246,11 @@ void Scene::RenderTiles() // XXX: rename to Blit() | |||||
| data->m_tile_shader->Bind(); | data->m_tile_shader->Bind(); | ||||
| uni_mat = data->m_tile_shader->GetUniformLocation("proj_matrix"); | |||||
| uni_mat = data->m_tile_shader->GetUniformLocation("u_projection"); | |||||
| data->m_tile_shader->SetUniform(uni_mat, GetCamera()->GetProjection()); | data->m_tile_shader->SetUniform(uni_mat, GetCamera()->GetProjection()); | ||||
| uni_mat = data->m_tile_shader->GetUniformLocation("view_matrix"); | |||||
| uni_mat = data->m_tile_shader->GetUniformLocation("u_view"); | |||||
| data->m_tile_shader->SetUniform(uni_mat, GetCamera()->GetView()); | data->m_tile_shader->SetUniform(uni_mat, GetCamera()->GetView()); | ||||
| uni_mat = data->m_tile_shader->GetUniformLocation("model_matrix"); | |||||
| uni_mat = data->m_tile_shader->GetUniformLocation("u_model"); | |||||
| data->m_tile_shader->SetUniform(uni_mat, mat4(1.f)); | data->m_tile_shader->SetUniform(uni_mat, mat4(1.f)); | ||||
| uni_tex = data->m_tile_shader->GetUniformLocation("in_Texture"); | uni_tex = data->m_tile_shader->GetUniformLocation("in_Texture"); | ||||
| @@ -312,9 +351,9 @@ void Scene::RenderLines() // XXX: rename to Blit() | |||||
| data->m_line_shader->Bind(); | data->m_line_shader->Bind(); | ||||
| uni_mat = data->m_line_shader->GetUniformLocation("proj_matrix"); | |||||
| uni_mat = data->m_line_shader->GetUniformLocation("u_projection"); | |||||
| data->m_line_shader->SetUniform(uni_mat, GetCamera()->GetProjection()); | data->m_line_shader->SetUniform(uni_mat, GetCamera()->GetProjection()); | ||||
| uni_mat = data->m_line_shader->GetUniformLocation("view_matrix"); | |||||
| uni_mat = data->m_line_shader->GetUniformLocation("u_view"); | |||||
| data->m_line_shader->SetUniform(uni_mat, GetCamera()->GetView()); | data->m_line_shader->SetUniform(uni_mat, GetCamera()->GetView()); | ||||
| data->m_line_vdecl->Bind(); | data->m_line_vdecl->Bind(); | ||||
| @@ -21,6 +21,7 @@ | |||||
| #include "tileset.h" | #include "tileset.h" | ||||
| #include "light.h" | #include "light.h" | ||||
| #include "camera.h" | #include "camera.h" | ||||
| #include "mesh/primitive.h" | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| @@ -46,6 +47,9 @@ public: | |||||
| void RenderTiles(); | void RenderTiles(); | ||||
| void RenderLines(); | void RenderLines(); | ||||
| /* New scenegraph */ | |||||
| void AddPrimitive(Mesh *mesh, Shader *shader, mat4 const &matrix); | |||||
| /* FIXME: this should be deprecated -- it doesn't really match | /* FIXME: this should be deprecated -- it doesn't really match | ||||
| * the architecture we want to build */ | * the architecture we want to build */ | ||||
| void AddTile(TileSet *tileset, int id, vec3 pos, int o, vec2 scale); | void AddTile(TileSet *tileset, int id, vec3 pos, int o, vec2 scale); | ||||