Sfoglia il codice sorgente

easymesh: set the capsule's main axis to Y, not Z.

legacy
Sam Hocevar sam 12 anni fa
parent
commit
aa6ce4c34d
2 ha cambiato i file con 9 aggiunte e 9 eliminazioni
  1. +3
    -3
      src/easymesh/easymesh.cpp
  2. +6
    -6
      test/PhysicObject.h

+ 3
- 3
src/easymesh/easymesh.cpp Vedi File

@@ -367,10 +367,10 @@ void EasyMesh::AppendCapsule(int ndivisions, float h, float r)
Array<vec3> vertices;

/* Fill in the icosahedron vertices, rotating them so that there
* is a vertex at [0 0 1] and [0 0 -1] after normalisation. */
* is a vertex at [0 1 0] and [0 -1 0] after normalisation. */
float phi = 0.5f + 0.5f * sqrt(5.f);
mat3 mat = mat3::rotate(asin(1.f / sqrt(2.f + phi)) * (180.f / M_PI),
vec3(1.f, 0.f, 0.f));
vec3(0.f, 0.f, 1.f));
for (int i = 0; i < 4; i++)
{
float x = (i & 1) ? 0.5f : -0.5f;
@@ -418,7 +418,7 @@ void EasyMesh::AppendCapsule(int ndivisions, float h, float r)
if (h > 0.f)
{
for (int k = 0; k < 4; k++)
p[k].z += (p[k].z > 0.f) ? 0.5f * h : -0.5f * h;
p[k].y += (p[k].y > 0.f) ? 0.5f * h : -0.5f * h;
}

/* Add zero, one or two triangles */


+ 6
- 6
test/PhysicObject.h Vedi File

@@ -74,12 +74,12 @@ public:

int CapsLimit = MeshRand.Count();

MeshRand << "[sc#add scb#add asph6 1 1 1 ty-1 my ac16 2 1 1 0 0]";
MeshRand << "[sc#dad scb#dad asph6 1 1 1 ty-1 my ac16 2 1 1 0 0]";
MeshRand << "[sc#dda scb#dda asph6 1 1 1 ty-1 my ac16 2 1 1 0 0]";
MeshRand << "[sc#daa scb#daa asph6 1 1 1 ty-1 my ac16 2 1 1 0 0]";
MeshRand << "[sc#ada scb#ada asph6 1 1 1 ty-1 my ac16 2 1 1 0 0]";
MeshRand << "[sc#aad scb#aad asph6 1 1 1 ty-1 my ac16 2 1 1 0 0]";
MeshRand << "[sc#add scb#add acap3 2 1]";
MeshRand << "[sc#dad scb#dad acap3 2 1]";
MeshRand << "[sc#dda scb#dda acap3 2 1]";
MeshRand << "[sc#daa scb#daa acap3 2 1]";
MeshRand << "[sc#ada scb#ada acap3 2 1]";
MeshRand << "[sc#aad scb#aad acap3 2 1]";

int RandValue = (int)(lol::RandF() * (MeshRand.Count() - 1));



Caricamento…
Annulla
Salva