void FamilyNode::SetWorldRecurse( const Matrix &world) { CalcWorldMatrix( world); NList<FamilyNode>::Iterator kids(&children); FamilyNode *node; while ((node = kids++) != NULL) { node->SetWorldRecurse( WorldMatrix()); } }
void CTerrain::Draw(IRenderer* _pRendererManager) { CalcWorldMatrix(_pRendererManager); //Set the material _pRendererManager->SetMaterial(m_iMaterialID); //Set the Texture _pRendererManager->SetTexture(m_iTextureID, 0); _pRendererManager->Render(m_iBufferID); }
void Camera::SetWorldRecurseRender( const Matrix &world, FamilyState *stateArray) { CalcWorldMatrix( world); NList<FamilyNode>::Iterator kids(&children); FamilyNode *node; while ((node = kids++) != NULL) { node->SetWorldRecurseRender( statePtr->WorldMatrix(), stateArray); } SetupMatrix(); }
void FamilyNode::SetWorldRecurseRender( const Matrix &world, FamilyState *stateArray) { FamilyState & state = stateArray[name.index]; CalcWorldMatrix( world, state); NList<FamilyNode>::Iterator kids(&children); FamilyNode *node; while ((node = kids++) != NULL) { node->SetWorldRecurseRender( state.WorldMatrix(), stateArray); } }
void Physics_Cloth::Process(eCollisionType _collisionType) { CalcWorldMatrix(); // Adding Gravity AddForce({ 0.0f, -9.81f, 0.0f }, FT_GENERIC, false); TVertexColor* pVertexBuffer = m_pMesh->GetVertexBufferCloth(); DWORD* pIndices = m_pMesh->GetIndexBuffer(); // Process each Particle for (int i = 0; i < m_particleCount; i++) { m_pParticles[i].Process(); } // Calculate each constraint multiple times for (int i = 0; i < m_constraintIterations; i++) { for (int j = 0; j < (int)m_contraints.size(); j++) { if (m_contraints[j].SatisfyConstraint() == false) { // Constraint is broken. Stop drawing the line pIndices[(j * 2) + 1] = pIndices[j * 2] = 0; } } // Calculate the collisions with object, if any switch (_collisionType) { case CT_SPHERE: { SphereCollision({ 0.0f, 0.0f, 7.0f }, 5.0f); } break; case CT_CAPSULE: { CapsuleCollision({ 0.0f, -3.0f, 6.0f }, { 0.0f, 3.0f, 6.0f }, 3.0f); } break; case CT_PYRAMID: { // Hard coded points for the pyramid to use v3float _pyraPointA = { 0.0f, 0.408248f * 10.0f, 0.0f + 7.0f }; v3float _pyraPointB = { 0.5f * 10.0f, -0.408248f * 10.0f, -0.288675f * 10.0f + 7.0f }; v3float _pyraPointC = { 0.0f, -0.408248f * 10.0f, 0.577350f * 10.0f + 7.0f }; v3float _pyraPointD = { -0.5f * 10.0f, -0.408248f * 10.0f, -0.288675f * 10.0f + 7.0f }; PyramidCollision(_pyraPointA, _pyraPointB, _pyraPointC, _pyraPointD); } default: break; } // Calculate the permanent collisions FloorCollision(-20.0f); CollisionsWithSelf(); } // Cycle through all constraints and check their burning status for (int j = 0; j < (int)m_contraints.size(); j++) { Physics_Particle* pIgnitedParticle = 0; switch (m_contraints[j].BurnDown(m_timeStep, pIgnitedParticle)) { case IA_IGNITEPARTICLE: { // The constraint burnt long enough to ignite the particle on the other end IgniteConnectedConstraints(pIgnitedParticle); } break; case IA_DESTROYCONSTRAINT: { // The constraint burnt long enough to be destroyed pIndices[(j * 2) + 1] = pIndices[j * 2] = 0; } break; case IA_NOACTION: // Fall Through default: break; } // End Switch } // Update the vertex for each Particle for (int i = 0; i < m_particleCount; i++) { pVertexBuffer[i].pos.x = m_pParticles[i].GetPosition()->x; pVertexBuffer[i].pos.y = m_pParticles[i].GetPosition()->y; pVertexBuffer[i].pos.z = m_pParticles[i].GetPosition()->z; } // Update the Buffer m_pMesh->UpdateBufferCloth(); }