void RedBuilding::finishDrawing() { drawStorey(); addBoundingBox(2); drawFloor(); drawSpacer(); drawRooftop(); }
void Character::setCollisionBox() { GamaGameEngine::Polygon poly; poly.setBox(30.0f, 10.0f); glm::vec2 pos = getCentrePos(); if (m_isNPC == true) pos.y += 20; m_attackBox = addBoundingBox(&poly, (int)pos.x, (int)pos.y); m_attackBox->setOrient(0); m_attackBox->setMass(0.9f); m_attackBox->setRestitution(0.2f); m_attackBox->setDynFriction(0.2f); m_attackBox->setStatFriction(0.4f); }
void OgreBuilding::drawLedge() { addBoundingBox(1); drawFloor(); Point lowerBound = cursor.getPosition(); cursor.move(ledgeHeight); Point higherBound = cursor.getPosition(); renderStorey(ledgeMaterial, lowerBound, higherBound); drawFloor(); substractBoundingBox(1); }
void OgreBuilding::drawObliqueLedge() { Polygon bottomBase = boundingBox->base(); Point lowerBound = cursor.getPosition(); cursor.move(ledgeHeight); Point higherBound = cursor.getPosition(); addBoundingBox(2); Polygon topBase = boundingBox->base(); renderObliqueShape(ledgeMaterial, bottomBase, topBase, lowerBound, higherBound); drawFloor(); substractBoundingBox(2); }
void OgreBuilding::interpretSymbol(char symbol) { switch (symbol) { case 'B': drawBasement(); break; case 'F': drawStorey(); break; case 'G': drawFloor(); break; case 'S': drawSpacer(); break; case 'O': drawObliqueLedge(); break; case 'L': drawLedge(); break; case 'R': drawRooftop(); break; case 'H': drawHoweRooftop(); break; case '-': substractBoundingBox(5); break; case '+': addBoundingBox(5); break; default: /* Try to interpret symbols defined in parent. */ Building::interpretSymbol(symbol); break; } }
//----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- BspNode* BspSceneManager::walkTree(Camera* camera, VisibleObjectsBoundsInfo *visibleBounds, bool onlyShadowCasters) { if (mLevel.isNull()) return 0; // Locate the leaf node where the camera is located BspNode* cameraNode = mLevel->findLeaf(camera->getDerivedPosition()); mMatFaceGroupMap.clear(); mFaceGroupSet.clear(); // Scan through all the other leaf nodes looking for visibles int i = mLevel->mNumNodes - mLevel->mLeafStart; BspNode* nd = mLevel->mRootNode + mLevel->mLeafStart; /* if (firstTime) { camera->getViewMatrix(); // Force update view before report of.open("BspSceneManager.log"); of << *camera << std::endl; of << "Camera Node: " << *cameraNode << std::endl; of << "Vertex Data: " << std::endl; for (int testi = 0; testi < mLevel->mNumVertices; ++testi) { of << " " << testi << ": pos(" << mLevel->mVertices[testi].position[0] << ", " << mLevel->mVertices[testi].position[1] << ", " << mLevel->mVertices[testi].position[2] << ")" << " uv(" << mLevel->mVertices[testi].texcoords[0] << ", " << mLevel->mVertices[testi].texcoords[1] << ")" << " lm(" << mLevel->mVertices[testi].lightmap[0] << ", " << mLevel->mVertices[testi].lightmap[1] << ")" << std::endl; } of << "Element data:" << std::endl; for (testi = 0; testi < mLevel->mNumElements; ++testi) { of << " " << testi << ": " << mLevel->mElements[testi] << std::endl; } } */ while (i--) { if (mLevel->isLeafVisible(cameraNode, nd)) { // Visible according to PVS, check bounding box against frustum FrustumPlane plane; if (camera->isVisible(nd->getBoundingBox(), &plane)) { //if (firstTime) //{ // of << "Visible Node: " << *nd << std::endl; //} processVisibleLeaf(nd, camera, visibleBounds, onlyShadowCasters); if (mShowNodeAABs) addBoundingBox(nd->getBoundingBox(), true); } } nd++; } // TEST //if (firstTime) //{ // of.close(); // firstTime = false; //} return cameraNode; }