Changeset 1364
- Timestamp:
- May 10, 2012, 10:02:12 PM (11 years ago)
- Location:
- trunk/orbital
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/orbital/orbital.cpp
r1363 r1364 90 90 //Ticker::Ref(m_particlesystem); 91 91 92 m_starfield = new StarField(100, 100, 1.f, 2.f, 10.f, 20.f); 93 Ticker::Ref(m_starfield); 92 m_small_stars = new StarField(100, 1.f, 20.f); 93 Ticker::Ref(m_small_stars); 94 m_large_stars = new StarField(100, 2.f, 10.f); 95 Ticker::Ref(m_large_stars); 94 96 95 97 /* Create a camera that matches the settings of XNA Orbital */ … … 190 192 } 191 193 192 Video::SetClearColor(vec4(0.0f, 0.0f, 0. 0f, 1.0f));194 Video::SetClearColor(vec4(0.0f, 0.0f, 0.12f, 1.0f)); 193 195 194 196 m.Render(m_model); … … 202 204 Ticker::Unref(m_players[i]); 203 205 //Ticker::Unref(m_particlesystem); 204 Ticker::Unref(m_starfield); 206 Ticker::Unref(m_small_stars); 207 Ticker::Unref(m_large_stars); 205 208 Ticker::Unref(m_camera); 206 209 } -
trunk/orbital/orbital.h
r1363 r1364 33 33 34 34 ParticleSystem *m_particlesystem; 35 StarField *m_s tarfield;35 StarField *m_small_stars, *m_large_stars; 36 36 Camera *m_camera; 37 37 Array<Player *> m_players; -
trunk/orbital/starfield.h
r1363 r1364 13 13 { 14 14 public: 15 StarField(int count 3, int count4, float z3, float z4, float speed3, float speed4)15 StarField(int count, float z, float speed) 16 16 : m_ready(false) 17 17 { 18 m_star3_mesh.SendCommand("sc1,1,1,1,scb1,1,1,0,ad4,1.8,1"); 19 m_star4_mesh.SendCommand("sc1,1,1,1,scb1,1,1,0,ad3,0.8,1"); 18 if (z == 1.f) 19 m_mesh.SendCommand("sc1,1,1,1,scb1,1,1,0,ad4,1.8,1"); 20 else 21 m_mesh.SendCommand("sc1,1,1,1,scb1,1,1,0,ad3,0.8,1"); 20 22 21 for (int i = 0; i < count3; i++) 22 m_star3.Push(vec3(RandF(800.f) - 400.f, z3, RandF(600.f) - 300.f), 23 vec3(0.f, 0.f, speed3), 24 RandF(0.f, 10.f)); 25 26 for (int i = 0; i < count4; i++) 27 m_star4.Push(vec3(RandF(800.f) - 400.f, z4, RandF(600.f) - 300.f), 28 vec3(0.f, 0.f, speed4), 23 for (int i = 0; i < count; i++) 24 m_stars.Push(vec3(RandF(440.f) - 220.f, z, RandF(600.f) - 300.f), 25 vec3(0.f, 0.f, speed), 29 26 RandF(0.f, 10.f)); 30 27 } … … 34 31 } 35 32 36 char const *GetName() { return "< particlesystem>"; }33 char const *GetName() { return "<starfield>"; } 37 34 38 35 protected: … … 41 38 WorldEntity::TickGame(seconds); 42 39 43 for (int i = 0; i < m_star 3.Count(); i++)40 for (int i = 0; i < m_stars.Count(); i++) 44 41 { 45 m_star3[i].m3 += 10.f * seconds; 46 m_star3[i].m1 += seconds * m_star3[i].m2; 47 if (m_star3[i].m1.z > 300.f) 48 m_star3[i].m1.z = -300.f; 49 } 50 51 for (int i = 0; i < m_star4.Count(); i++) 52 { 53 m_star4[i].m3 += 10.f * seconds; 54 m_star4[i].m1 += seconds * m_star4[i].m2; 55 if (m_star4[i].m1.z > 300.f) 56 m_star4[i].m1.z = -300.f; 42 m_stars[i].m3 += 10.f * seconds; 43 m_stars[i].m1 += seconds * m_stars[i].m2; 44 if (m_stars[i].m1.z > 300.f) 45 { 46 m_stars[i].m1.x = RandF(440.f) - 220.f; 47 m_stars[i].m1.z = -300.f; 48 } 57 49 } 58 50 } … … 64 56 if (!m_ready) 65 57 { 66 m_star3_mesh.SendCommand("irb"); 67 m_star4_mesh.SendCommand("irb"); 58 m_mesh.SendCommand("irb"); 68 59 m_ready = true; 69 60 } 70 61 71 for (int i = 0; i < m_star 3.Count(); i++)62 for (int i = 0; i < m_stars.Count(); i++) 72 63 { 73 mat4 model = mat4::translate(m_star 3[i].m1)74 * mat4::rotate(m_star 3[i].m3, 0.f, 1.f, 0.f);64 mat4 model = mat4::translate(m_stars[i].m1) 65 * mat4::rotate(m_stars[i].m3, 0.f, 1.f, 0.f); 75 66 76 m_star3_mesh.Render(model); 77 } 78 79 for (int i = 0; i < m_star4.Count(); i++) 80 { 81 mat4 model = mat4::translate(m_star4[i].m1) 82 * mat4::rotate(m_star4[i].m3, 0.f, 1.f, 0.f); 83 84 m_star4_mesh.Render(model); 67 m_mesh.Render(model); 85 68 } 86 69 } 87 70 88 71 private: 89 Mesh m_ star3_mesh, m_star4_mesh;90 Array<vec3, vec3, float> m_star 3, m_star4;72 Mesh m_mesh; 73 Array<vec3, vec3, float> m_stars; 91 74 bool m_ready; 92 75 };
Note: See TracChangeset
for help on using the changeset viewer.