//--- 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; } }
//--- 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++; } } }