void DumpVisitor::ApplyStaticGeometry(StaticGeometry &g) { if (g.GetNodeMask() & NODE_TRANSPARENT) m_stats.transGeomCount++; else m_stats.opaqueGeomCount++; for (unsigned int i = 0; i < g.GetNumMeshes(); i++) m_stats.triangles += g.GetMeshAt(i).indexBuffer->GetSize() / 3; ApplyNode(static_cast<Node&>(g)); }
void DumpVisitor::ApplyLOD(LOD &l) { ApplyNode(l); m_level++; for (unsigned int i = 0; i < l.GetNumChildren(); i++) { l.GetChildAt(i)->Accept(*this); m_lodStats.push_back(m_stats); memset(&m_stats, 0, sizeof(LodStatistics)); } m_level--; }
void* CPyramidAllocator::CreateObject() { bool bFull; uint8 nBit; uint32 pIndex[7]; void* pNode[7]; uint32 nIdx, nMod; m_oMutex.Enter(); if(!ApplyNode(pIndex, pNode)) { m_oMutex.Leave(); return NULL; } CLeafNode* pLeaf = (CLeafNode*)pNode[6]; nIdx = pIndex[6]/8; nMod = pIndex[6]%8; nBit = 1; if(nMod) nBit <<= nMod; pLeaf->nMask.pFlag[nIdx] |= nBit; bFull = (pLeaf->nMask.nFlag == 0xFFFFFFFF); void* pObject = pLeaf->pObjects + pIndex[6] * m_nInstanceSize; for(uint32 j=0; bFull && j<6; ++j) { uint32 k = 5 - j; CBranchNode* pBranch = (CBranchNode*)pNode[k]; if(!pBranch) break; nIdx = pIndex[k]/8; nMod = pIndex[k]%8; nBit = 1; if(nMod) nBit <<= nMod; pBranch->nMask.pFlag[nIdx] |= nBit; bFull = (pBranch->nMask.nFlag == 0xFFFFFFFF); } ++m_nSize; m_oMutex.Leave(); return pObject; }
void NodeVisitor::ApplyCollisionGeometry(CollisionGeometry &g) { ApplyNode(static_cast<Node&>(g)); }
void NodeVisitor::ApplyThruster(Thruster &t) { ApplyNode(static_cast<Node&>(t)); }
void NodeVisitor::ApplyBillboard(Billboard &b) { ApplyNode(static_cast<Node&>(b)); }
void NodeVisitor::ApplyLabel(Label3D &l) { ApplyNode(static_cast<Node&>(l)); }
void NodeVisitor::ApplyStaticGeometry(StaticGeometry &g) { ApplyNode(static_cast<Node&>(g)); }
void NodeVisitor::ApplyGroup(Group &g) { ApplyNode(static_cast<Node&>(g)); }
virtual void ApplyMatrixTransform(MatrixTransform &mt) { ApplyNode(mt); }
virtual void ApplyLOD(LOD &lod) { ApplyNode(lod); }