Changeset 2405
 Timestamp:
 Feb 13, 2013, 4:42:11 PM (7 years ago)
 Location:
 trunk
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/easymesh/easymesh.cpp
r2404 r2405 1007 1007 1008 1008 // 1009 void EasyMesh::AppendCylinder(int nsides, float h, float r1, float r2,1009 void EasyMesh::AppendCylinder(int nsides, float h, float d1, float d2, 1010 1010 int dualside, int smooth, int close) 1011 1011 { 1012 //XXX : This operation is done to convert radius to diameter without changing all the code. 1013 float r1 = d1 * .5f; 1014 float r2 = d2 * .5f; 1015 1012 1016 //SAVE 1013 1017 vec4 Saved_Color = m_color; … … 1091 1095 1092 1096 // 1093 void EasyMesh::AppendSphere(int ndivisions, float r) 1094 { 1095 AppendCapsule(ndivisions, 0.f, r); 1096 } 1097 1098 // 1099 void EasyMesh::AppendCapsule(int ndivisions, float h, float r) 1100 { 1097 void EasyMesh::AppendSphere(int ndivisions, float d) 1098 { 1099 AppendCapsule(ndivisions, 0.f, d); 1100 } 1101 1102 // 1103 void EasyMesh::AppendCapsule(int ndivisions, float h, float d) 1104 { 1105 //XXX : This operation is done to convert radius to diameter without changing all the code. 1106 float r = d * .5f; 1107 1101 1108 int ibase = m_indices.Count(); 1102 1109 … … 1238 1245 1239 1246 // 1240 void EasyMesh::AppendTorus(int ndivisions, float r1, float r2) 1241 { 1247 void EasyMesh::AppendTorus(int ndivisions, float d1, float d2) 1248 { 1249 //XXX : This operation is done to convert radius to diameter without changing all the code. 1250 float r1 = d1 * .5f; 1251 float r2 = d2 * .5f; 1252 1242 1253 int ibase = m_indices.Count(); 1243 1254 int nidiv = ndivisions; /* Crosssection */ … … 1419 1430 1420 1431 // 1421 void EasyMesh::AppendStar(int nbranches, float r1, float r2,1432 void EasyMesh::AppendStar(int nbranches, float d1, float d2, 1422 1433 int fade, int fade2) 1423 1434 { 1435 //XXX : This operation is done to convert radius to diameter without changing all the code. 1436 float r1 = d1 * .5f; 1437 float r2 = d2 * .5f; 1438 1424 1439 //TODO: It would probably be good to think of another way of UV painting this, like "branch repeating" 1425 1440 int vbase = m_vert.Count(); … … 1455 1470 1456 1471 // 1457 void EasyMesh::AppendExpandedStar(int nbranches, float r1, 1458 float r2, float extrar) 1459 { 1472 void EasyMesh::AppendExpandedStar(int nbranches, float d1, float d2, float extrad) 1473 { 1474 //XXX : This operation is done to convert radius to diameter without changing all the code. 1475 float r1 = d1 * .5f; 1476 float r2 = d2 * .5f; 1477 float extrar = extrad * .5f; 1478 1460 1479 int vbase = m_vert.Count(); 1461 1480 float maxr = (float)max(max(r1, r2), max(r1 + extrar, r2 + extrar)); … … 1495 1514 1496 1515 // 1497 void EasyMesh::AppendDisc(int nsides, float r, int fade) 1498 { 1516 void EasyMesh::AppendDisc(int nsides, float d, int fade) 1517 { 1518 //XXX : This operation is done to convert radius to diameter without changing all the code. 1519 float r = d * .5f; 1520 1499 1521 int vbase = m_vert.Count(); 1500 1522 … … 1517 1539 1518 1540 // 1519 void EasyMesh::AppendSimpleTriangle(float size, int fade) 1520 { 1541 void EasyMesh::AppendSimpleTriangle(float d, int fade) 1542 { 1543 //XXX : This operation is done to convert radius to diameter without changing all the code. 1544 float size = d * .5f; 1545 1521 1546 mat3 m = mat3::rotate(120.f, 0.f, 1.f, 0.f); 1522 1547 vec3 p(0.f, 0.f, size); … … 1558 1583 1559 1584 // 1560 void EasyMesh::AppendCog(int nbsides, float h, float r10, float r20,1561 float r1, float r2, float r12, float r22,1585 void EasyMesh::AppendCog(int nbsides, float h, float d10, float d20, 1586 float d1, float d2, float d12, float d22, 1562 1587 float sidemul, int offset) 1563 1588 { 1589 //XXX : This operation is done to convert radius to diameter without changing all the code. 1590 float r10 = d10 * .5f; 1591 float r20 = d20 * .5f; 1592 float r1 = d1 * .5f; 1593 float r2 = d2 * .5f; 1594 float r12 = d12 * .5f; 1595 float r22 = d22 * .5f; 1596 1564 1597 int ibase = m_indices.Count(); 1565 1598 int vbase = m_vert.Count(); 
trunk/src/easymesh/easymesh.h
r2404 r2405 236 236 // 237 237 238 /* [cmd:ac] Cylinder centered on (0,0,0) with BBox [ max(r1, r2), .5*h, max(r1, r2)][max(r1, r2), .5*h, max(r1, r2)]239  nbsides : Number of sides. 238 /* [cmd:ac] Cylinder centered on (0,0,0) with BBox [.5*max(d1, d2), .5*h, .5*max(d1, d2)] 239  nbsides : Number of sides. [+.5*max(d1, d2), +.5*h, +.5*max(d1, d2)] 240 240  h : Height of the cylinder. 241  r1 : Lower radius. TODO:convert to diameter to be coherent with other funcs242  r2 : Upper radius. TODO:convert to diameter to be coherent with other funcs241  d1 : Lower diameter. 242  d2 : Upper diameter. 243 243  dualside : if (1) will also create inner sides : TOOD:TOREMOVE?? : needed ? 244 244  smooth : if (1) will smooth normals : TOOD:TOREMOVE : smooth should be handled elsewhere 245 245  close : if (1) will add discs to close the cylinder 246 246 */ 247 void AppendCylinder(int nsides, float h, float r1, float r2,247 void AppendCylinder(int nsides, float h, float d1, float d2, 248 248 int dualside, int smooth, int close); 249 /* [cmd:asph] Sphere centered on (0,0,0) with BBox [ size][size]249 /* [cmd:asph] Sphere centered on (0,0,0) with BBox [.5*d][.5*d] 250 250  ndivisions : number of subdivisions each Sphere triangle will sustain. 251  size : size of the Sphere.252 */ 253 void AppendSphere(int ndivisions, float r);254 /* [cmd:acap] Capsule centered on (0,0,0) with BBox [ r, (r+h) ,r][r, (r+h) ,r]251  d : Diameter. 252 */ 253 void AppendSphere(int ndivisions, float d); 254 /* [cmd:acap] Capsule centered on (0,0,0) with BBox [.5*d, (.5*d+h), .5*d][.5*d, (.5*d+h), .5*d] 255 255  ndivisions : number of subdivisions each Sphere triangle will sustain. 256 256  h : Inner height. 257  r : Radius. TODO:convert to diameter to be coherent with other funcs258 */ 259 void AppendCapsule(int ndivisions, float h, float r);260 /* [cmd:ato] Torus centered on (0,0,0) with BBox [ r2][r2]257  d : Diameter. 258 */ 259 void AppendCapsule(int ndivisions, float h, float d); 260 /* [cmd:ato] Torus centered on (0,0,0) with BBox [.5*d2][.5*d2] 261 261  ndivisions : number of subdivisions of the torus. 262  r1 : Inner radius. TODO:convert to diameter to be coherent with other funcs263  r2 : Outer radius. TODO:convert to diameter to be coherent with other funcs264 */ 265 void AppendTorus(int ndivisions, float r1, float r2);262  d1 : Inner diameter. 263  d2 : Outer diameter. 264 */ 265 void AppendTorus(int ndivisions, float d1, float d2); 266 266 /* [cmd:ab] Box centered on (0,0,0) with BBox [.5 * size][.5 * size] 267 267  size : size of the box. … … 277 277 void AppendBox(vec3 const &size, float chamf, bool smooth); 278 278 /* [cmd:as] 279 Append a Star centered on (0,0,0) contained within a disc of "max( r1, r2)" radius.279 Append a Star centered on (0,0,0) contained within a disc of "max(d1, d2)" diameter. 280 280  nbranches : Number of branches. 281  r1 :Length of the branches.282  r2 : Length of the "branch" located between r1branches.281  d1 : double Length of the branches. 282  d2 : double Length of the "branch" located between d1branches. 283 283  fade : if (1) inbetween branches use Color2. 284 284  fade2 : if (1) Star branches use Color2. 285 285 */ 286 void AppendStar(int nbranches, float r1, float r2,286 void AppendStar(int nbranches, float d1, float d2, 287 287 int fade = 0, int fade2 = 0); 288 /* [cmd:aes] Star centered on (0,0,0) contained within a disc of "max(max( r1, r2), max(r1 + extrar, r2 + extrar))" radius.288 /* [cmd:aes] Star centered on (0,0,0) contained within a disc of "max(max(d1, d2), max(d1 + extrad, d2 + extrad))" diameter. 289 289 Expanded star branches use Color2. 290 290  nbranches : Number of branches. 291  r1 :Length of the branches.292  r2 :Length of the "branch" located between r1branches.293  extra r: Extra length added to expand all branches.294 */ 295 void AppendExpandedStar(int nbranches, float r1, float r2, float extrar);296 /* [cmd:ad] Disc centered on (0,0,0) with BBox [size][size]291  d1 : Double Length of the branches. 292  d2 : Double Length of the "branch" located between r1branches. 293  extrad : Extra length added to expand all branches. 294 */ 295 void AppendExpandedStar(int nbranches, float d1, float d2, float extrad); 296 /* [cmd:ad] Disc centered on (0,0,0) with d diameter. 297 297  nbsides : Number of sides. 298  r : Radius. TODO:convert to diameter to be coherent with other funcs298  d : Diameter. 299 299  fade : if (1) Outer vertices will use Color2 300 300 */ 301 void AppendDisc(int nsides, float r, int fade = 0);302 /* [cmd:at] Triangle centered on (0,0,0) contained within a disc of " size" radius.303  size : Size of vector : originTOvertex.301 void AppendDisc(int nsides, float d, int fade = 0); 302 /* [cmd:at] Triangle centered on (0,0,0) contained within a disc of "d" diameter. 303  d : diameter of the containing disc.. 304 304  fade : if (1) 2nd & 3rd Vertices will use Color2 305 305 */ 306 void AppendSimpleTriangle(float size, int fade = 0);307 /* [cmd:aq] Quad centered on (0,0,0) contained within BBox [size ,0,size][size,0,size]306 void AppendSimpleTriangle(float d, int fade = 0); 307 /* [cmd:aq] Quad centered on (0,0,0) contained within BBox [size*.5f, 0, size*.5f][size*.5f, 0, size*.5f] 308 308  size : Size of quad. 309 309  fade : if (1) 3rd & 4th Vertices will use Color2 … … 314 314 void AppendSimpleQuad(vec2 p1, vec2 p2, float z = 0.f, int fade = 0); 315 315 public: 316 /* [cmd:acg] Gear centered on (0,0,0) contained within BBox [ max(r1,r2), .5*h, max(r1, r2)][max(r1, r2), .5*h, max(r1, r2)]317  h : Height of the Gear. 318  r10 : Upper Inner radius.319  r20 : Lower Inner radius.320  r1 : Upper Outer radius.321  r2 : Lower Outer radius.322  r12 : Upper Cog radius.323  r22 : Lower Cog radius.316 /* [cmd:acg] Gear centered on (0,0,0) contained within BBox [.5*max(d1,d2), .5*h, .5*max(d1, d2)] 317  h : Height of the Gear. [+.5*max(d1,d2), +.5*h, +.5*max(d1, d2)] 318  d10 : Upper Inner diameter. 319  d20 : Lower Inner diameter. 320  d1 : Upper Outer diameter. 321  d2 : Lower Outer diameter. 322  d12 : Upper Cog diameter. 323  d22 : Lower Cog diameter. 324 324  sidemul : multiplier for the size of the cogs. 325 325  offset : useless 326 326 */ 327 void AppendCog(int nbsides, float h, float r10, float r20, float r1,328 float r2, float r12, float r22, float sidemul, int offset);327 void AppendCog(int nbsides, float h, float d10, float d20, float d1, 328 float d2, float d12, float d22, float sidemul, int offset); 329 329 330 330 // 
trunk/test/MeshViewerBuffer.txt
r2404 r2405 1 [sc#88f ab 4 4 4 tx 4 ab 4 4 4 tx 2 tax .4 .4 0] 1 //[sc#88f ab 4 4 4 tx 4 ab 4 4 4 tx 2 tax .4 .4 0] 2 //[sc#88f ab 4 4 4] 2 3 //[sc#ff2 asph 2 4 tx 4 tax 1 1 0] 4 [sc#ff2 asph 2 4] 3 5 //[sc#ff2 acap 1 4 4] 4 6 //[sc#ff2 scb#ff2 ac 10 4 4 4 0 0 1] … … 8 10 //[sc#ff2 scb#2ff aq 4 0] 9 11 //[sc#ff2 scb#2ff aes 5 3 6 2] 10 //[sc#ff2 scb#2ff as 5 2 50 0]12 //[sc#ff2 scb#2ff as 4 2 4 0 0] 11 13 //[sc#ff2 scb#2ff acg 2 10 .1 .1 .4 .4 .1 .1 0 1] 12 14
Note: See TracChangeset
for help on using the changeset viewer.