Esempio n. 1
0
    cVec4 cVec4::operator / (const float rhs) const
    {
      if (rhs==0.0f) return cVec4(0.0f, 0.0f, 0.0f, 0.0f);  //cant divide by 0

      float newX=x / rhs;
      float newY=y / rhs;
      float newZ=z / rhs;
      float newW=w / rhs;

      return cVec4(newX, newY, newZ, newW);
    }
Esempio n. 2
0
//Plain the hierarchy
void cScene::ConvertNodesToObjects( aiNode * lpNode, cMatrix lTransform)
{
  // Create a new scene object for the node if this has meshes
  cMatrix lNodeTransform( cVec4 ( lpNode->mTransformation.a1,
    lpNode->mTransformation.b1,
    lpNode->mTransformation.c1,
    lpNode->mTransformation.d1),
    cVec4 ( lpNode->mTransformation.a2,
    lpNode->mTransformation.b2,
    lpNode->mTransformation.c2,
    lpNode->mTransformation.d2),
    cVec4 ( lpNode->mTransformation.a3,
    lpNode->mTransformation.b3,
    lpNode->mTransformation.c3,
    lpNode->mTransformation.d3),
    cVec4 ( lpNode->mTransformation.a4,
    lpNode->mTransformation.b4,
    lpNode->mTransformation.c4,
    lpNode->mTransformation.d4));

  lTransform = lNodeTransform * lTransform;

  if ( lpNode->mNumMeshes > 0)
  {
    cObject *lpObject = new cObject;
    lpObject->Init();
    lpObject->SetName( lpNode->mName.data );
    lpObject->SetWorldMatrix(lTransform);

    for (unsigned luiIndex=0; luiIndex<lpNode->mNumMeshes; ++luiIndex)
    {
      unsigned luiMeshIndex = lpNode->mMeshes[luiIndex];
      unsigned luiMaterialIndex;
      luiMaterialIndex = mMeshMaterialIndexList[luiMeshIndex];
      lpObject->AddMesh(mMeshList[luiMeshIndex], 
        mMaterialList[luiMaterialIndex]);
    }
    mObjectList.push_back(lpObject);
  }

  //Recursive call
  for(unsigned luiIndex = 0; luiIndex<lpNode->mNumChildren; ++luiIndex)
  {
    ConvertNodesToObjects(lpNode->mChildren[luiIndex], lTransform);
  }

}
Esempio n. 3
0
    cVec4 cVec4::GetRotatedAxis(double angle, const cVec3 & axis) const
    {
      cVec3 v3d(x, y, z);

      v3d.RotateAxis(angle, axis);

      return cVec4(v3d.x, v3d.y, v3d.z, w);
    }
Esempio n. 4
0
    cVec4 cVec4::GetRotatedZ(double angle) const
    {
      cVec3 v3d(x, y, z);

      v3d.RotateZ(angle);

      return cVec4(v3d.x, v3d.y, v3d.z, w);
    }
Esempio n. 5
0
    cVec4 cVec4::operator * (const float rhs) const
    {
      float newX=x * rhs;
      float newY=y * rhs;
      float newZ=z * rhs;
      float newW=w * rhs;

      return cVec4(newX, newY, newZ, newW);
    }
Esempio n. 6
0
    cVec4 cVec4::operator - (const cVec4 & rhs) const
    {
      float newX=x - rhs.x;
      float newY=y - rhs.y;
      float newZ=z - rhs.z;
      float newW=w - rhs.w;

      return cVec4(newX, newY, newZ, newW);
    }
Esempio n. 7
0
    cVec4 cVec4::operator + (const cVec4 & rhs) const
    {
      float newX=x + rhs.x;
      float newY=y + rhs.y;
      float newZ=z + rhs.z;
      float newW=w + rhs.w;

      return cVec4(newX, newY, newZ, newW);
    }