Changeset 1398
 Timestamp:
 May 16, 2012, 2:54:37 PM (7 years ago)
 Location:
 trunk/orbital
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/orbital/mesh.h
r1386 r1398 555 555 SetCurVertColor(m_color2); 556 556 557 AppendQuad(0, (2 * i + 3) % (2 * nbranches),558 2 * i + 2, 2 * i + 1,vbase);557 AppendQuad(0, 2 * i + 1, (2 * i + 3) % (2 * nbranches), 558 2 * i + 2, vbase); 559 559 560 560 p1 = rotmat * p1; … … 649 649 SetCurVertColor(m_color2); 650 650 651 AppendQuad(0, 3, 2, 1, m_vert.Count()  4);651 AppendQuad(0, 1, 2, 3, m_vert.Count()  4); 652 652 ComputeQuadNormals(m_quadidx.Count()  4, 4); 653 653 } 
trunk/orbital/player.h
r1393 r1398 21 21 vec4(0.1f,0.1f,0.6f,1.0f) }; 22 22 23 23 //Red Mesh 24 24 if (type == 0) 25 25 { … … 32 32 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,t0,0,27,fl"); 33 33 } 34 34 //Blue Mesh 35 35 else 36 36 { … … 45 45 m_option_mesh.SendCommand("afcb5,1,3,0.6,fl,sc1,1,1,1,afcb1,5,3,0.6,tz1,fl"); 46 46 47 m_laser_mesh.SendCommand("sc1,1,1,1,scb0,0,0,1,aq8,1,sx0.25,tx3,sc1,0,0,1,scb0,0,0,1,aq8,1,tx4,sz50,sx0.3,tz200,mx,as10,12,8,1,1,fl"); 48 47 49 m_position = vec3(0.f + type * 80.f, 3.5f + 50.f, 0.f); 48 50 … … 52 54 m_options.Push(m_position, vec3(0.f, 0.f, 0.f)); 53 55 54 56 move_rotation_timer = 0.0f; 55 57 } 56 58 … … 94 96 } 95 97 96 97 98 99 98 damped_stick.x = damped_stick.x + (seconds / (seconds + 0.18f)) * (rightleft  damped_stick.x); 99 damped_stick.z = damped_stick.z + (seconds / (seconds + 0.18f)) * (updown  damped_stick.z); 100 vec3 applied_stick = vec3(abs(damped_stick.x), 0.0f, damped_stick.z); 101 vec3 offset = vec3(((damped_stick.x < 0.0f)?(abs(damped_stick.x) * 30.f):(0.f)), 0.0f, 0.0f); 100 102 101 103 for (int i = 0; i < m_options.Count(); i++) 102 104 { 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 105 vec3 rot[4] = { 106 vec3(20.f, 0.f, 0.f), 107 vec3(20.f, 0.f, 0.f), 108 vec3(20.f, 0.f, 0.f), 109 vec3(20.f, 0.f, 0.f) }; 110 111 vec3 pos[4] = { 112 vec3(11.f, 0.f, 0.f), 113 vec3(11.f, 0.f, 0.f), 114 vec3(21.f, 0.f, 0.f), 115 vec3(21.f, 0.f, 0.f) }; 116 117 vec3 move_pos[4] = { 118 vec3( 8.f, 0.f, 5.f), 119 vec3(19.f, 0.f, 5.f), 120 vec3( 3.f, 0.f, 5.f), 121 vec3(30.f, 0.f, 5.f) }; 120 122 121 123 /* FIXME: this is not deltatimed */ 122 124 vec3 target_pos = m_position + pos[i] + (move_pos[i]  pos[i]) * applied_stick + offset; 123 125 m_options[i].m1 = m_options[i].m1 + (seconds / (seconds + 0.1f)) * (target_pos  m_options[i].m1); 124 m_options[i].m2[0] = rot[i][0] + (((damped_stick.x < 0.0f)?(20.0f):(20.0f))  rot[i][0]) * abs(damped_stick.x); 125 126 if (damped_stick.x < 0.3f && damped_stick.x > 0.3f) 127 m_options[i].m2[2] += seconds * (i & 1 ? 600.f : 600.f); 128 else 129 m_options[i].m2[2] += seconds * ((damped_stick.x < 0.0f)?(600.0f):(600.0f)); 130 } 131 132 if (damped_stick.x > 0.5f  damped_stick.x < 0.5f) 133 { 134 if (move_rotation_timer > 0.8f) 135 move_rotation.z += damped_stick.x * 420.f * seconds; 136 else 137 move_rotation_timer += seconds; 138 } 139 else 140 { 141 move_rotation_timer = 0.0f; 142 move_rotation.z = move_rotation.z * (seconds / (seconds + 0.2f)); 143 } 144 145 exhaust_rotation.z += 600.0f * seconds; 146 147 if (move_rotation.z > 180.f) 148 move_rotation.z = 360.f; 149 else if (move_rotation.z < 180.f) 150 move_rotation.z += 360.f; 151 152 if (exhaust_rotation.z > 180.f) 153 exhaust_rotation.z = 360.f; 154 else if (exhaust_rotation.z < 180.f) 155 exhaust_rotation.z += 360.f; 156 157 m_rotation = quat::fromeuler_xyz(vec3(((damped_stick.z <= 0.0f)?(damped_stick.z):(0.0f)) * 60.0f, 0.f, damped_stick.x * 50.0f) + move_rotation); 158 m_position += vec3(rightleft, 0.f, updown) * 200.f * seconds; 126 m_options[i].m2[0] = rot[i][0] + (((damped_stick.x < 0.0f)?(20.0f):(20.0f))  rot[i][0]) * abs(damped_stick.x); 127 128 if (damped_stick.x < 0.3f && damped_stick.x > 0.3f) 129 m_options[i].m2[2] += seconds * (i & 1 ? 600.f : 600.f); 130 else 131 m_options[i].m2[2] += seconds * ((damped_stick.x < 0.0f)?(600.0f):(600.0f)); 132 } 133 134 if (damped_stick.x > 0.5f  damped_stick.x < 0.5f) 135 { 136 if (move_rotation_timer > 0.8f) 137 move_rotation.z += damped_stick.x * 420.f * seconds; 138 else 139 move_rotation_timer += seconds; 140 } 141 else 142 { 143 move_rotation_timer = 0.0f; 144 move_rotation.z = move_rotation.z * (seconds / (seconds + 0.2f)); 145 } 146 147 exhaust_rotation.z += 600.0f * seconds; 148 149 if (move_rotation.z > 180.f) 150 move_rotation.z = 360.f; 151 else if (move_rotation.z < 180.f) 152 move_rotation.z += 360.f; 153 154 if (exhaust_rotation.z > 180.f) 155 exhaust_rotation.z = 360.f; 156 else if (exhaust_rotation.z < 180.f) 157 exhaust_rotation.z += 360.f; 158 159 m_rotation = quat::fromeuler_xyz(vec3(((damped_stick.z <= 0.0f)?(damped_stick.z):(0.0f)) * 60.0f, 0.f, damped_stick.x * 50.0f) + move_rotation); 160 161 if (m_type == 0) 162 m_position += vec3(rightleft, 0.f, updown) * 200.f * seconds; 163 else 164 m_position += vec3(rightleft, 0.f, updown) * 140.f * seconds; 159 165 } 160 166 … … 166 172 { 167 173 m_ship_mesh.SendCommand("irb"); 174 m_option_mesh.SendCommand("irb"); 175 m_laser_mesh.SendCommand("irb"); 168 176 m_exhaust_mesh.SendCommand("irb"); 169 m_option_mesh.SendCommand("irb");170 177 m_ready = true; 171 178 } … … 173 180 mat4 model = mat4::translate(m_position) * mat4(m_rotation); 174 181 175 176 177 178 179 180 181 182 183 182 m_ship_mesh.Render(model); 183 184 if (m_type == 0) 185 { 186 m_exhaust_mesh.Render(model * mat4::translate(vec3(4.f,0.f,0.f)) * mat4::fromeuler_xyz(exhaust_rotation * 1.0f)); 187 m_exhaust_mesh.Render(model * mat4::translate(vec3( 4.f,0.f,0.f)) * mat4::fromeuler_xyz(exhaust_rotation)); 188 } 189 else 190 m_exhaust_mesh.Render(model * mat4::fromeuler_xyz(exhaust_rotation)); 184 191 185 192 for (int i = 0; i < m_options.Count(); i++) 186 193 { 187 mat4 t = mat4::translate(m_options[i].m1) 188 * mat4::fromeuler_yxz(m_options[i].m2); 189 194 mat4 t = mat4::translate(m_options[i].m1); 195 if (m_stick && m_stick>GetButtonCount() >= 4 196 && m_stick>GetButton(12)) 197 m_laser_mesh.Render(t); 198 t *= mat4::fromeuler_yxz(m_options[i].m2); 190 199 m_option_mesh.Render(t); 191 200 } … … 194 203 private: 195 204 int m_type; 196 Mesh m_ship_mesh, m_option_mesh, m_ exhaust_mesh;205 Mesh m_ship_mesh, m_option_mesh, m_laser_mesh, m_exhaust_mesh; 197 206 Stick *m_stick; 198 207 199 208 Array<vec3, vec3> m_options; 200 209 201 202 203 204 210 vec3 damped_stick; 211 vec3 move_rotation; 212 vec3 exhaust_rotation; 213 float move_rotation_timer; 205 214 206 215 bool m_ready;
Note: See TracChangeset
for help on using the changeset viewer.