Changeset 1271
 Timestamp:
 Apr 22, 2012, 3:03:57 PM (9 years ago)
 Location:
 trunk/orbital
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/orbital/mesh.h
r1269 r1271 278 278 } 279 279 280 void RotateZ(float t) 281 { 282 /* FIXME: use mat3 instead of mat4 when it's working */ 283 mat4 m = mat4::rotate(t, 0, 0, 1); 284 for (int i = m_vert_cursor; i < m_vert.Count(); i++) 285 m_vert[i].m1 = (m * vec4(m_vert[i].m1, 1.f)).xyz; 286 } 287 288 void RotateY(float t) 289 { 290 mat4 m = mat4::rotate(t, 0, 1, 0); 291 for (int i = m_vert_cursor; i < m_vert.Count(); i++) 292 m_vert[i].m1 = (m * vec4(m_vert[i].m1, 1.f)).xyz; 293 } 294 295 void RotateX(float t) 296 { 297 mat4 m = mat4::rotate(t, 1, 0, 0); 298 for (int i = m_vert_cursor; i < m_vert.Count(); i++) 299 m_vert[i].m1 = (m * vec4(m_vert[i].m1, 1.f)).xyz; 280 void RotateX(float t) { Rotate(t, vec3(1, 0, 0)); } 281 void RotateY(float t) { Rotate(t, vec3(0, 1, 0)); } 282 void RotateZ(float t) { Rotate(t, vec3(0, 0, 1)); } 283 284 void Rotate(float t, vec3 const &axis) 285 { 286 mat3 m = mat3::rotate(t, axis); 287 for (int i = m_vert_cursor; i < m_vert.Count(); i++) 288 { 289 m_vert[i].m1 = m * m_vert[i].m1; 290 m_vert[i].m2 = m * m_vert[i].m2; 291 } 300 292 } 301 293 302 294 void TaperX(float y, float z, float xoff) 303 295 { 296 /* FIXME: this code breaks normals! */ 304 297 for (int i = m_vert_cursor; i < m_vert.Count(); i++) 305 298 { … … 329 322 void Scale(vec3 const &s) 330 323 { 324 /* FIXME: this code breaks normals! */ 331 325 for (int i = m_vert_cursor; i < m_vert.Count(); i++) 332 326 { … … 468 462 qibase = m_quadidx.Count(); 469 463 464 /* The 8 quads at each edge of the box */ 470 465 if (chamf) 471 466 { 472 /* The 8 quads at each edge of the box */473 467 static int const quadlist[48] = 474 468 { … … 487 481 quadlist[i + 2], quadlist[i + 3], vbase); 488 482 } 489 490 /* The 8 triangles at each corner of the box */ 483 } 484 485 /* The 8 triangles at each corner of the box */ 486 if (chamf) 487 { 491 488 static int const trilist[24] = 492 489 { 
trunk/orbital/orbital.cpp
r1268 r1271 29 29 { 30 30 m.SetCurColor(vec4(1.0, 1.0, 0.0, 1.0)); 31 m.AppendSphere(vec3( 1.0, 0.5, 1.0), 32);32 m.Translate(vec3(0.0,  0.4, 0.0));31 m.AppendSphere(vec3(2.0, 1.6, 2.0), 24); 32 m.Translate(vec3(0.0, 1.0, 0.0)); 33 33 m.Flush(); 34 34 35 35 m.SetCurColor(vec4(1.0, 0.0, 1.0, 1.0)); 36 m.Append SmoothChamfBox(vec3(0.5, 0.5, 0.5), 0.1);36 m.AppendFlatChamfBox(vec3(1.0, 1.0, 1.0), 0.1); 37 37 m.RotateX(45.0); 38 38 m.RotateZ(45.0); 39 m.Translate(vec3(0.0, 0.6, 0.0)); 40 m.Flush(); 41 42 m.SetCurColor(vec4(0.0, 1.0, 0.5, 1.0)); 43 m.SetCurColor2(vec4(0.0, 0.5, 1.0, 1.0)); 44 m.AppendStar(5, 0.4, 0.7, 1, 1); 39 m.Translate(vec3(0.0, 1.0, 0.0)); 45 40 m.Flush(); 46 41
Note: See TracChangeset
for help on using the changeset viewer.