Changeset 1332
- Timestamp:
- May 2, 2012, 1:47:32 PM (11 years ago)
- Location:
- trunk/orbital
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/orbital/mesh.h
r1330 r1332 224 224 } 225 225 226 void Render(mat4 const &modelview, mat4 const &proj) 227 { 226 void Render(mat4 const &model) 227 { 228 mat4 modelview = Scene::GetDefault()->GetViewMatrix() * model; 228 229 mat3 normalmat = transpose(inverse(mat3(modelview))); 229 230 230 231 m_gpu.shader->Bind(); 231 232 m_gpu.shader->SetUniform(m_gpu.modelview, modelview); 232 m_gpu.shader->SetUniform(m_gpu.proj, proj);233 m_gpu.shader->SetUniform(m_gpu.proj, Scene::GetDefault()->GetProjMatrix()); 233 234 m_gpu.shader->SetUniform(m_gpu.normalmat, normalmat); 234 235 m_gpu.vdecl->SetStream(m_gpu.vbo, m_gpu.coord, m_gpu.norm, m_gpu.color); -
trunk/orbital/orbital.cpp
r1330 r1332 149 149 mat4 model = mat4::translate(vec3(0)); 150 150 151 m_modelview = m_camera->GetViewMatrix() * model * anim; 152 m_proj = m_camera->GetProjMatrix(); 151 m_model = model * anim; 153 152 } 154 153 … … 167 166 Video::SetClearColor(vec4(0.0f, 0.0f, 0.0f, 1.0f)); 168 167 169 m.Render(m_model view, m_proj);168 m.Render(m_model); 170 169 } 171 170 -
trunk/orbital/orbital.h
r1330 r1332 28 28 float m_auto_cam_timer; 29 29 vec3 m_angle, m_angular_velocity; 30 31 mat4 m_modelview, m_proj; 30 mat4 m_model; 32 31 33 32 ParticleSystem *m_particlesystem; -
trunk/orbital/particlesystem.h
r1330 r1332 60 60 m_ready = true; 61 61 } 62 mat4 anim = mat4::rotate(m_angle, vec3(0, 1, 0));63 mat4 view = mat4::lookat(vec3(0, 2, 0), vec3(0, 0, -4), vec3(0, 1, 0));64 mat4 proj = mat4::perspective(45.0f, 640.0f, 480.0f, 0.1f, 10.0f);65 62 66 63 for (int i = 0; i < m_particles.Count(); i++) 67 64 { 68 mat4 model = mat4::translate(vec3(0, 0, -4.5)) 69 * mat4::scale(vec3(0.025)) 70 * mat4::translate(m_particles[i].m1); 71 mat4 modelview = view * model * anim; 65 mat4 model = mat4::translate(vec3(0, 0, -100)) 66 * mat4::translate(m_particles[i].m1);; 72 67 73 m_mesh.Render(model view, proj);68 m_mesh.Render(model); 74 69 } 75 70 }
Note: See TracChangeset
for help on using the changeset viewer.