Changeset 1354 for trunk/orbital/player.h
- Timestamp:
- May 9, 2012, 3:13:26 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/orbital/player.h
r1353 r1354 13 13 { 14 14 public: 15 Player( )15 Player(int type) 16 16 : m_stick(0), 17 17 m_ready(false) 18 18 { 19 /* FIXME: this is the orange ship; add code for the other one later */ 20 m_ship_mesh.SendCommand("sc1,.5,0,1"); 21 m_ship_mesh.SendCommand("afcb5,1,3,0.6,fl,sc1,1,1,1,afcb1,5,3,0.6,tz-1,irb"); 22 m_ship_mesh.SendCommand("sc1,.5,0,1"); 23 m_ship_mesh.SendCommand("afcb3,6,7,.4,t0,0,7,sc1,1,1,1,afcb3,4,4,.4,t4,0,-4,mx,fl"); 24 m_ship_mesh.SendCommand("sc1,.5,0,1"); 25 m_ship_mesh.SendCommand("afcb3,6,5,.4,sc1,1,1,1,afcb2,3,9,.4,fl"); 26 m_ship_mesh.SendCommand("scb1,1,1,1,ac4,15,.2,.6,1,1,tz-2,ac4,15,.2,.6,1,1,rx90,t0,-2,-7,fl"); 19 vec4 color[2] = { vec4(0.8f,0.2f,0.1f,1.0f), 20 vec4(0.1f,0.1f,0.6f,1.0f) }; 27 21 28 m_exhaust_mesh.SendCommand("sc0,1,1,scb0,0,0,1,ac5,15,0,1.5,0,1,ac7,35,1.1,4,0,1,rx90,t-3,0,27,mx,fl"); 22 if (type == 0) 23 { 24 m_ship_mesh.SetCurColor(color[type]); 25 m_ship_mesh.SendCommand("afcb3,6,7,.4,t0,0,7,sc1,1,1,1,afcb3,4,4,.4,t4,0,-4,mx,fl"); 26 m_ship_mesh.SetCurColor(color[type]); 27 m_ship_mesh.SendCommand("afcb3,6,5,.4,sc1,1,1,1,afcb2,3,9,.4,fl"); 28 m_ship_mesh.SendCommand("scb1,1,1,1,ac4,15,.2,.6,1,1,tz-2,ac4,15,.2,.6,1,1,rx90,t0,-2,-7,fl"); 29 29 30 m_drone_mesh.SendCommand("sc0.2,0.7,0,1,afcb3,6,10,0.4,tx-8,afcb3,6,10,0.4,tx4,ty13,fl,sc1,1,1,1,afcb3,6,10,0.4,rx-30,ty13,fl"); 30 m_exhaust_mesh.SendCommand("sc0,1,1,1,scb0,0,0,1,ac5,15,0,1.5,0,1,ac7,35,1.1,4,0,1,rx90,t-3,0,27,mx,fl"); 31 } 32 else 33 { 34 m_ship_mesh.SendCommand("sc1,1,1,1,scb1,1,1,1,ac4,15,.2,.6,1,1,t0,0,-4,ac4,1.5,.2,.6,1,1,rx90,t1.3,-2,-6,afcb3,6,5,.4,t0,0,-7"); 35 m_ship_mesh.SetCurColor(color[type]); 36 m_ship_mesh.SendCommand("afcb3,4,7,.4,t4,0,0,mx,fl,afcb3,6,5,.4,sc1,1,1,1,afcb2,3,9,.4"); 31 37 32 m_position = vec3(0.f, 3.5f + 50.f, 0.f); 38 m_exhaust_mesh.SendCommand("sc0,1,1,1,scb0,0,0,1,ac5,10,0,1.5,0,1,ac7,25,1.1,4,0,1,rx90,t0,0,25"); 39 } 40 41 m_option_mesh.SetCurColor(color[type]); 42 m_option_mesh.SendCommand("afcb5,1,3,0.6,fl,sc1,1,1,1,afcb1,5,3,0.6,tz-1,fl"); 43 44 m_position = vec3(0.f + type * 80.f, 3.5f + 50.f, 0.f); 45 46 m_options.Push(vec3(0.f), vec3(20.f, 0.f, 0.f)); 47 m_options.Push(vec3(0.f), vec3(-20.f, 0.f, 0.f)); 48 m_options.Push(vec3(0.f), vec3(20.f, 0.f, 0.f)); 49 m_options.Push(vec3(0.f), vec3(-20.f, 0.f, 0.f)); 33 50 } 34 51 … … 59 76 } 60 77 78 for (int i = 0; i < m_options.Count(); i++) 79 { 80 vec3 pos[4] = { vec3(11.f, 0.f, 0.f), 81 vec3(-11.f, 0.f, 0.f), 82 vec3(21.f, 0.f, 0.f), 83 vec3(-21.f, 0.f, 0.f) }; 84 /* FIXME: this is not delta-timed */ 85 m_options[i].m1 = 0.1f * (m_position + pos[i]) 86 + 0.9f * m_options[i].m1; 87 m_options[i].m2[2] += seconds * (i & 1 ? 600.f : -600.f); 88 } 89 61 90 m_position += vec3(rightleft, 0.f, -updown) * 200.f * seconds; 62 91 } … … 70 99 m_ship_mesh.SendCommand("irb"); 71 100 m_exhaust_mesh.SendCommand("irb"); 72 m_ drone_mesh.SendCommand("irb");101 m_option_mesh.SendCommand("irb"); 73 102 m_ready = true; 74 103 } … … 78 107 m_exhaust_mesh.Render(model); 79 108 80 for (int i = 0; i < m_ drones.Count(); i++)109 for (int i = 0; i < m_options.Count(); i++) 81 110 { 82 m_drone_mesh.Render(model * mat4::translate(m_drones[i])); 111 mat4 t = mat4::translate(m_options[i].m1) 112 * mat4::fromeuler_yxz(m_options[i].m2); 113 114 m_option_mesh.Render(t); 83 115 } 84 116 } 85 117 86 118 private: 87 Mesh m_ship_mesh, m_ drone_mesh, m_exhaust_mesh;119 Mesh m_ship_mesh, m_option_mesh, m_exhaust_mesh; 88 120 Stick *m_stick; 89 121 90 Array<vec3> m_drones; 122 Array<vec3, vec3> m_options; 123 91 124 bool m_ready; 92 125 };
Note: See TracChangeset
for help on using the changeset viewer.