本文整理汇总了C++中Quad::sBoneNo方法的典型用法代码示例。如果您正苦于以下问题:C++ Quad::sBoneNo方法的具体用法?C++ Quad::sBoneNo怎么用?C++ Quad::sBoneNo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quad
的用法示例。
在下文中一共展示了Quad::sBoneNo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: segmentMatrixMake
/*Subroutine of transformHeiararchy(), this function calculates the position and rotation for a given bone segment and
* generates quaderlaterals with those transformations */
void Keyframe::segmentMatrixMake( GLfloat segmentRot[], GLfloat segLength[], Mesh *mesh, int segments, glQuaternion *glQuat, int curSegment,
MyMat *stackMatrix, float start, float end, int isDownstream)
{
double rotate = segmentRot[curSegment]; //get rotation of current segment
//current shark model segment
MyMat Matrix = *stackMatrix;
MyMat transrix;
transrix.makeTranslate(Vector3f((isDownstream == 2 ? segLength[curSegment] : -segLength[curSegment]), 0, 0));
MyMat secondStack = MyMat();
GLfloat glm[16];
glQuat->CreateFromAxisAngle(0,1,0,isDownstream == 2? -rotate : rotate);
glQuat->CreateMatrix(glm);
MyMat rotatrix = MyMat(glm[0], glm[4], glm[8], glm[12], glm[1], glm[5],glm[9],
glm[13],glm[2],glm[6],glm[10],glm[14],glm[3],glm[7],
glm[11],glm[15]);
Matrix = Matrix.multRight(rotatrix); //roatation goes before translates
Matrix = Matrix.multRight(transrix); //doesnt matter which order translates are done
*stackMatrix = Matrix; //advance heirarchy
MyMat transrix2;
transrix2.makeTranslate(Vector3f(isDownstream == 2? -end : -start, 0, 0));
Matrix = Matrix.multRight(transrix2);
//------------------------------------
float center;
for(int in = 0; in < mesh->vertCounter; in+=4)
{
//find center of face
center = (mesh->vertList[in].x + mesh->vertList[in+1].x + mesh->vertList[in+2].x
+ mesh->vertList[in+3].x ) / 4;
//draw if face is between start and end
if(center >= start && center <= end )
{
Quad *curQuad = new Quad();
curQuad->gNormal() = Vector3f(0,0,0);
for(int corn = 0; corn < 4; corn++) //corner iteration
{
SharkVertex *curVert = new SharkVertex(); //current vertex
curVert->local = mesh->vertList[in+corn]; //setting untransformed vertex
curVert->transformed = Vector3f(Matrix.multVec(mesh->vertList[in+corn], true)); //setting transformed vertex
curVert->normal = Vector3f(0,0,0); //normal of the vertex, away from mesh
map<Vector3f, SharkVertex*, compareVect3>::iterator findTest
= uVertices.find(mesh->vertList[in+corn]); //checking to see if vertex is already in the list.
if(findTest == uVertices.end())
{
//vertex not in list. Add it to the list and to the quad.
uVertices.insert(pair<Vector3f, SharkVertex*>(mesh->vertList[in+corn]
, curVert));
curQuad->sVert(corn, curVert);
}
else //vertex is in the list, so it's added to the existing quad.
{
delete curVert;
curQuad->sVert(corn, (*findTest).second);
}
curQuad->gNormal() += Matrix.multVec(mesh->normals[in+corn], false); //setting normal of the face
}//end corners
curQuad->gNormal() /= 4.0; //take average of normals to get the actual normal.
curQuad->sBoneNo(curSegment); //record the bone this quad belongs to the most.
faces.push_back(curQuad);
}//end if
}//end quads
}