//--- Non Standard Singleton Methods void BoundingBoxManagerSingleton::GenerateBoundingBox(matrix4 a_mModelToWorld, String a_sInstanceName) { MeshManagerSingleton* pMeshMngr = MeshManagerSingleton::GetInstance(); //Verify the instance is loaded if(pMeshMngr->IsInstanceCreated(a_sInstanceName)) {//if it is check if the Box has already been created int nBox = IdentifyBox(a_sInstanceName); if(nBox == -1) { //Create a new bounding Box BoundingBoxClass* pBB = new BoundingBoxClass(); //construct its information out of the instance name pBB->GenerateOrientedBoundingBox(a_sInstanceName); //Push the Box back into the list m_lBox.push_back(pBB); //Push a new matrix into the list m_lMatrix.push_back(matrix4(IDENTITY)); //Specify the color the Box is going to have m_lColor.push_back(vector3(1.0f)); //Increase the number of Boxes m_nBoxs++; } else //If the box has already been created you will need to check its global orientation { m_lBox[nBox]->GenerateAxisAlignedBoundingBox(a_mModelToWorld); } nBox = IdentifyBox(a_sInstanceName); m_lMatrix[nBox] = a_mModelToWorld; } }
void BoundingBoxManagerSingleton::SetBoundingBoxSpace(matrix4 a_mModelToWorld, String a_sInstanceName) { int nBox = IdentifyBox(a_sInstanceName); //If the Box was found if(nBox != -1) { //Set up the new matrix in the appropriate index m_lMatrix[nBox] = a_mModelToWorld; } }
void BoundingBoxManagerSingleton::AddBoxToRenderList(String a_sInstanceName) { //If I need to render all if(a_sInstanceName == "ALL") { for(int nBox = 0; nBox < m_nBoxs; nBox++) { m_lBox[nBox]->AddBoxToRenderList(m_lMatrix[nBox], m_lColor[nBox], true); } } else { int nBox = IdentifyBox(a_sInstanceName); if(nBox != -1) { m_lBox[nBox]->AddBoxToRenderList(m_lMatrix[nBox], m_lColor[nBox], true); } } }
//--- Non Standard Singleton Methods void BoundingBoxManagerSingleton::GenerateBoundingBox(String a_sInstanceName) { MeshManagerSingleton* pMeshMngr = MeshManagerSingleton::GetInstance(); //Verify the instance is loaded if(pMeshMngr->IsInstanceCreated(a_sInstanceName)) {//if it is check if the Box has already been created if(IdentifyBox(a_sInstanceName) == -1) { //Create a new bounding Box BoundingBoxClass* pBS = new BoundingBoxClass(); //construct its information out of the instance name pBS->GenerateBoundingBox(a_sInstanceName); //Push the Box back into the list m_lBox.push_back(pBS); //Push a new matrix into the list m_lMatrix.push_back(matrix4(IDENTITY)); //Specify the color the Box is going to have m_lColor.push_back(vector3(1.0f)); //Increase the number of Boxs m_nBoxs++; } } }