当前位置: 首页>>代码示例>>C++>>正文


C++ ManualObject::clear方法代码示例

本文整理汇总了C++中ogre::ManualObject::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ ManualObject::clear方法的具体用法?C++ ManualObject::clear怎么用?C++ ManualObject::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ogre::ManualObject的用法示例。


在下文中一共展示了ManualObject::clear方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RenderLineSegments

 void RenderSystem::RenderLineSegments(std::string lsName, std::string materialName, const std::vector<MagicMath::Vector3>& startPos, const std::vector<MagicMath::Vector3>& endPos)
 {
     Ogre::ManualObject* pMObj = NULL;
     if (mpSceneMgr->hasManualObject(lsName))
     {
         pMObj = mpSceneMgr->getManualObject(lsName);
         pMObj->clear();
     }
     else
     {
         pMObj = mpSceneMgr->createManualObject(lsName);
         if (mpSceneMgr->hasSceneNode("ModelNode"))
         {
             mpSceneMgr->getSceneNode("ModelNode")->attachObject(pMObj);
         }
         else
         {
             mpSceneMgr->getRootSceneNode()->createChildSceneNode("ModelNode")->attachObject(pMObj);
         }
     }
     pMObj->begin(materialName, Ogre::RenderOperation::OT_LINE_LIST);
     int lineNum = startPos.size();
     for (int i = 0; i < lineNum; i++)
     {
         MagicMath::Vector3 start = startPos.at(i);
         MagicMath::Vector3 end = endPos.at(i);
         pMObj->position(start[0], start[1], start[2]);
         pMObj->position(end[0], end[1], end[2]);
     }
     pMObj->end();
 }
开发者ID:jinghuaguo,项目名称:magic3d,代码行数:31,代码来源:RenderSystem.cpp

示例2:

 void RenderSystem::RenderPoint3DSet(std::string psName, std::string psMaterialName, const MagicDGP::Point3DSet* pPS)
 {
     Ogre::ManualObject* pMObj = NULL;
     if (mpSceneMgr->hasManualObject(psName))
     {
         pMObj = mpSceneMgr->getManualObject(psName);
         pMObj->clear();
     }
     else
     {
         pMObj = mpSceneMgr->createManualObject(psName);
         if (mpSceneMgr->hasSceneNode("ModelNode"))
         {
             mpSceneMgr->getSceneNode("ModelNode")->attachObject(pMObj);
         }
         else
         {
             mpSceneMgr->getRootSceneNode()->createChildSceneNode("ModelNode")->attachObject(pMObj);
         }
     }
     if (pPS->HasNormal())
     {
         int pointNum = pPS->GetPointNumber();
         pMObj->begin(psMaterialName, Ogre::RenderOperation::OT_POINT_LIST);
         for (int i = 0; i < pointNum; i++)
         {
             const MagicDGP::Point3D* pPoint = pPS->GetPoint(i);
             if (pPoint->IsValid() == false)
             {
                 continue;
             }
             MagicMath::Vector3 pos = pPoint->GetPosition();
             MagicMath::Vector3 nor = pPoint->GetNormal();
             MagicMath::Vector3 color = pPoint->GetColor();
             pMObj->position(pos[0], pos[1], pos[2]);
             pMObj->normal(nor[0], nor[1], nor[2]);
             pMObj->colour(color[0], color[1], color[2]);
         }
         pMObj->end();
     }
     else
     {
         int pointNum = pPS->GetPointNumber();
         pMObj->begin(psMaterialName, Ogre::RenderOperation::OT_POINT_LIST);
         for (int i = 0; i < pointNum; i++)
         {
             const MagicDGP::Point3D* pPoint = pPS->GetPoint(i);
             if (pPoint->IsValid() == false)
             {
                 continue;
             }
             MagicMath::Vector3 pos = pPoint->GetPosition();
             MagicMath::Vector3 color = pPoint->GetColor();
             pMObj->position(pos[0], pos[1], pos[2]);
             pMObj->colour(color[0], color[1], color[2]);
         }
         pMObj->end();
     }
     
 }
开发者ID:jinghuaguo,项目名称:magic3d,代码行数:60,代码来源:RenderSystem.cpp

示例3: if

void
	Player::drawLine(std::string bone, int joint1, int joint2)
{
	if (!initSkel)
		createLine(bone, joint1, joint2);
	else if (initSkel)
	{
		vector<Ogre::Vector3> skeletonNodes = mKinect->getSkeletonNodes();
		Ogre::ManualObject* myManualObject = mSceneManager->getManualObject(bone);

		myManualObject->clear();

		Ogre::Vector3 bone1 = 20 * skeletonNodes[joint1] + Ogre::Vector3(-50, 30, 20);
		Ogre::Vector3 bone2 = 20 * skeletonNodes[joint2] + Ogre::Vector3(-50, 30, 20);

		myManualObject->begin(bone + "Material", Ogre::RenderOperation::OT_LINE_LIST);
		myManualObject->position(bone1.x, bone1.y, bone1.z); 
		myManualObject->position(bone2.x, bone2.y, bone2.z); 
		myManualObject->end();
	}
}
开发者ID:simonkwong,项目名称:Shamoov,代码行数:21,代码来源:Player.cpp

示例4: createRecastPolyMesh

void AwarenessVisualizer::createRecastPolyMesh(const std::string& name, const unsigned short *verts, const int nverts, const unsigned short *polys, const int npolys, const unsigned char *areas, const int maxpolys, const unsigned short *regions, const int nvp, const float cs, const float ch, const float *orig, bool colorRegions)
{

	// Demo specific parameters
	float m_navMeshOffsetFromGround = 0.2; //ch / 5;         // Distance above ground for drawing navmesh polygons
	float m_navMeshEdgesOffsetFromGround = 0.5; //ch / 3;    // Distance above ground for drawing edges of navmesh (should be slightly higher than navmesh polygons)
//	float m_pathOffsetFromGround = 1 + m_navMeshOffsetFromGround; // Distance above ground for drawing path debug lines relative to cellheight (should be higher than navmesh polygons)

	// Colors for navmesh debug drawing
	static Ogre::ColourValue m_navmeshNeighbourEdgeCol(0.9, 0.9, 0.9);   // Light Grey
	static Ogre::ColourValue m_navmeshOuterEdgeCol(0, 0, 0);         // Black
	static Ogre::ColourValue m_navmeshGroundPolygonCol(0, 0.7, 0);       // Green
	static Ogre::ColourValue m_navmeshOtherPolygonCol(0, 0.175, 0);     // Dark green
	static Ogre::ColourValue m_pathCol(1, 0, 0);         // Red

	// When drawing regions choose different random colors for each region
	Ogre::ColourValue* regionColors = NULL;
	if (colorRegions) {
		regionColors = new Ogre::ColourValue[maxpolys];
		for (int i = 0; i < maxpolys; ++i) {
			regionColors[i] = Ogre::ColourValue(Ogre::Math::RangeRandom(0, 1), Ogre::Math::RangeRandom(0, 1), Ogre::Math::RangeRandom(0, 1), 1);
		}
	}

	int nIndex = 0;

	if (npolys) {
		// start defining the manualObject with the navmesh planes
		Ogre::ManualObject* pRecastMOWalk;
		if (mSceneManager.hasManualObject("RecastMOWalk_" + name)) {
			pRecastMOWalk = mSceneManager.getManualObject("RecastMOWalk_" + name);
			pRecastMOWalk->clear();
		} else {
			pRecastMOWalk = mSceneManager.createManualObject("RecastMOWalk_" + name);
			//Remove from the overhead map.
			pRecastMOWalk->setVisibilityFlags(pRecastMOWalk->getVisibilityFlags() & ~Ogre::SceneManager::WORLD_GEOMETRY_TYPE_MASK);
			mTileSceneNode->attachObject(pRecastMOWalk);
		}
		pRecastMOWalk->begin("/common/base/authoring/awareness", Ogre::RenderOperation::OT_TRIANGLE_LIST);
		for (int i = 0; i < npolys; ++i) {    // go through all polygons
			if (areas[i] == Navigation::POLYAREA_GROUND || areas[i] == DT_TILECACHE_WALKABLE_AREA) {
				const unsigned short* p = &polys[i * nvp * 2];

				unsigned short vi[3];
				for (int j = 2; j < nvp; ++j) // go through all verts in the polygon
						{
					if (p[j] == RC_MESH_NULL_IDX)
						break;
					vi[0] = p[0];
					vi[1] = p[j - 1];
					vi[2] = p[j];
					for (int k = 0; k < 3; ++k) // create a 3-vert triangle for each 3 verts in the polygon.
							{
						const unsigned short* v = &verts[vi[k] * 3];
						const float x = orig[0] + v[0] * cs;
						const float y = orig[1] + (v[1]/*+1*/) * ch;
						const float z = -orig[2] - v[2] * cs;

						pRecastMOWalk->position(x, y + m_navMeshOffsetFromGround, z);

						if (colorRegions) {
							pRecastMOWalk->colour(regionColors[regions[i]]);  // Assign vertex color
						} else {
							if (areas[i] == Navigation::POLYAREA_GROUND)
								pRecastMOWalk->colour(m_navmeshGroundPolygonCol);
							else
								pRecastMOWalk->colour(m_navmeshOtherPolygonCol);
						}

					}
					pRecastMOWalk->triangle(nIndex, nIndex + 2, nIndex + 1);
					nIndex += 3;
				}
			}
		}
		pRecastMOWalk->end();

		// Define manualObject with the navmesh edges between neighbouring polygons
		Ogre::ManualObject* pRecastMONeighbour;
		if (mSceneManager.hasManualObject("RecastMONeighbour_" + name)) {
			pRecastMONeighbour = mSceneManager.getManualObject("RecastMONeighbour_" + name);
			pRecastMONeighbour->clear();
		} else {
			pRecastMONeighbour = mSceneManager.createManualObject("RecastMONeighbour_" + name);
			//Remove from the overhead map.
			pRecastMONeighbour->setVisibilityFlags(pRecastMONeighbour->getVisibilityFlags() & ~Ogre::SceneManager::WORLD_GEOMETRY_TYPE_MASK);
			mTileSceneNode->attachObject(pRecastMONeighbour);
		}

		pRecastMONeighbour->begin("/common/base/authoring/awareness", Ogre::RenderOperation::OT_LINE_LIST);

		for (int i = 0; i < npolys; ++i) {
			const unsigned short* p = &polys[i * nvp * 2];
			for (int j = 0; j < nvp; ++j) {
				if (p[j] == RC_MESH_NULL_IDX)
					break;
				if (p[nvp + j] == RC_MESH_NULL_IDX)
					continue;
				int vi[2];
				vi[0] = p[j];
//.........这里部分代码省略.........
开发者ID:Chimangoo,项目名称:ember,代码行数:101,代码来源:AwarenessVisualizer.cpp

示例5: createTank

Tank* TankManager::createTank(const Ogre::Vector3& position, int side, Graph* pathFindingGraph, PathFinding mPathFinder){
	int tankNumber = tankSideA.size() + tankSideB.size();
	std::ostringstream oss1;
	oss1 << "tankbody" << tankNumber;

	Ogre::Entity* tankBody = mSceneMgr->createEntity(oss1.str(), "lpbody.mesh");
	tankBody->setCastShadows(true);

	std::ostringstream oss2;
	oss2 << "tankturret" << tankNumber;

	// Create tank turret entity
	Ogre::Entity* tankTurret = mSceneMgr->createEntity(oss2.str(), "lpturret.mesh");
	tankTurret->setCastShadows(true);

	std::ostringstream oss3;
	oss3 << "tankbarrel" << tankNumber;

	// Create tank barrel entity
	Ogre::Entity* tankBarrel = mSceneMgr->createEntity(oss3.str(), "lpbarrel.mesh");
	tankBarrel->setCastShadows(true);

	// Create a child scene node and attach tank body to it
	Ogre::SceneNode* mTankBodyNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
	mTankBodyNode->attachObject(tankBody);
	// Move it above the ground
	mTankBodyNode->translate(position.x, position.y + 13.f, position.z);

	if(side == 1){
		tankBody->setMaterialName("lp_tank_materialred");
		tankTurret->setMaterialName("lp_tank_materialred");
		tankBarrel->setMaterialName("lp_tank_materialred");

		mTankBodyNode->yaw(Ogre::Degree(180.f));
	}
	else if(side == 2)
	{
		tankBody->setMaterialName("lp_tank_materialblue");
		tankTurret->setMaterialName("lp_tank_materialblue");
		tankBarrel->setMaterialName("lp_tank_materialblue");
	}

	// Create a child scene node from tank body's scene node and attach the tank turret to it
	Ogre::SceneNode* mTankTurretNode = mTankBodyNode->createChildSceneNode();
	mTankTurretNode->attachObject(tankTurret);
	// Move it above tank body
	mTankTurretNode->translate(0.f, 3.f, 0.f);

	// Create a child scene node from tank turret's scene node and attach the tank barrel to it
	Ogre::SceneNode* mTankBarrelNode = mTankTurretNode->createChildSceneNode();
	mTankBarrelNode->attachObject(tankBarrel);
	// Move it to the appropriate position on the turret
	mTankBarrelNode->translate(-30.f, 10.f, -1.5f);

	//WEE ADDED HERE TO MAKE THE MANUAL OBJECT
		std::string pathName = "AStarPath" + std::to_string(tankNumber);
		Ogre::ManualObject* aStarPath = mSceneMgr->createManualObject(pathName);
		aStarPath->clear();
		aStarPath->setQueryFlags(0);
		mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(aStarPath);

	Tank* newTank = new Tank(mSceneMgr->createBillboardSet(), mSceneMgr->createBillboardSet(),
		mTankBodyNode, mTankTurretNode, mTankBarrelNode, this, pathFindingGraph, mPathFinder, aStarPath, side, mSceneMgr, tankBody, tankTurret, tankBarrel);

	newTank->resetAll();
	
	if (side == 1)
	{
		tankSideA.insert(newTank);
	} else if(side == 2){
		tankSideB.insert(newTank);
	}

	return newTank;
}
开发者ID:swn881,项目名称:CSCI356_JUSTDOEET,代码行数:75,代码来源:TankManager.cpp

示例6: generateMeshObstacles

void Map::generateMeshObstacles(std::string materialName)
{
    Ogre::ManualObject* obstacles = new Ogre::ManualObject("obstacles");
    obstacles->estimateIndexCount(m_length * m_width * 8);
    obstacles->estimateVertexCount(m_length * m_width * 8);
    obstacles->clear();
    obstacles->begin(materialName);

    Ogre::Vector3 pos = Ogre::Vector3(0, 0, 0);
    Ogre::Quaternion quat;
    Ogre::Quaternion quatNext;
    unsigned long planeNum = 0;

    m_obstaclePositions.clear();

    for (unsigned int i = 0; i < m_length; i++) {
        quat = m_rotationalSpline.getPoint(i);
        quatNext = m_rotationalSpline.getPoint(i + 1);

        for (int x = -100 * (m_width / (double) 2), j = 0; (unsigned) j < m_width; j++, x += 100) {
            int back = -100;
            int left = x;
            int right = x + 100;
            int up = 100;

            Ogre::Vector3 nextPos =             pos + quat * Ogre::Vector3(0, 0, back);
            Ogre::Vector3 posMinus50 =          pos + quat * Ogre::Vector3(left, 0, 0);
            Ogre::Vector3 posPlus50 =           pos + quat * Ogre::Vector3(right, 0, 0);
            Ogre::Vector3 nextPosMinus50 =      nextPos + quatNext * Ogre::Vector3(left, 0, 0);
            Ogre::Vector3 nextPosPlus50 =       nextPos + quatNext * Ogre::Vector3(right, 0, 0);

            //TODO: fix normals
            obstacles->position(posMinus50);
            obstacles->normal((quat * Vector3(0, 1, 0)).normalisedCopy());
            obstacles->textureCoord(1, 1);
            obstacles->position(nextPosMinus50);
            obstacles->normal((quat * Vector3(0, 1, 0)).normalisedCopy());
            obstacles->textureCoord(1, 0);
            obstacles->position(posPlus50);
            obstacles->normal((quat * Vector3(0, 1, 0)).normalisedCopy());
            obstacles->textureCoord(0, 1);
            obstacles->position(nextPosPlus50);
            obstacles->normal((quat * Vector3(0, 1, 0)).normalisedCopy());
            obstacles->textureCoord(0, 0);

            Ogre::Vector3 nextPosUp =           nextPos + quat * Ogre::Vector3(0, up, 0);
            Ogre::Vector3 posMinus50Up =        posMinus50 + quat * Ogre::Vector3(0, up, 0);
            Ogre::Vector3 posPlus50Up =         posPlus50 + quat * Ogre::Vector3(0, up, 0);
            Ogre::Vector3 nextPosMinus50Up =    nextPosMinus50 + quatNext * Ogre::Vector3(0, up, 0);
            Ogre::Vector3 nextPosPlus50Up =     nextPosPlus50 + quatNext * Ogre::Vector3(0, up, 0);

            //TODO: fix normals
            obstacles->position(posMinus50Up);
            obstacles->normal((quat * Vector3(-1, 1, 1)).normalisedCopy());
            obstacles->textureCoord(0, 0);
            obstacles->position(nextPosMinus50Up);
            obstacles->normal((quat * Vector3(-1, 1, -1)).normalisedCopy());
            obstacles->textureCoord(0, 1);
            obstacles->position(posPlus50Up);
            obstacles->normal((quat * Vector3(1, 1, 1)).normalisedCopy());
            obstacles->textureCoord(1, 0);
            obstacles->position(nextPosPlus50Up);
            obstacles->normal((quat * Vector3(1, 1, -1)).normalisedCopy());
            obstacles->textureCoord(1, 1);

            if (m_cubes[planeNum / (double) m_width][planeNum % m_width] == OBSTACLE) {

                //TODO: check if this hack works..
                m_obstaclePositions.push_back(posMinus50);

                //top
                obstacles->triangle(4 + planeNum * 8, 5 + planeNum * 8, 6 + planeNum * 8);
                obstacles->triangle(6 + planeNum * 8, 5 + planeNum * 8, 4 + planeNum * 8);
                obstacles->triangle(5 + planeNum * 8, 7 + planeNum * 8, 6 + planeNum * 8);
                obstacles->triangle(6 + planeNum * 8, 7 + planeNum * 8, 5 + planeNum * 8);

                if (planeNum % m_width == 0 || m_cubes[planeNum / (double) m_width][(planeNum - 1) % m_width] != OBSTACLE) {
                    //left
                    obstacles->triangle(0 + planeNum * 8, 4 + planeNum * 8, 5 + planeNum * 8);
                    obstacles->triangle(5 + planeNum * 8, 4 + planeNum * 8, 0 + planeNum * 8);
                    obstacles->triangle(0 + planeNum * 8, 1 + planeNum * 8, 5 + planeNum * 8);
                    obstacles->triangle(5 + planeNum * 8, 1 + planeNum * 8, 0 + planeNum * 8);
                }

                if (planeNum % m_width == m_width - 1 || m_cubes[planeNum / (double) m_width][(planeNum + 1) % m_width] != OBSTACLE) {
                    //right
                    obstacles->triangle(2 + planeNum * 8, 6 + planeNum * 8, 7 + planeNum * 8);
                    obstacles->triangle(7 + planeNum * 8, 6 + planeNum * 8, 2 + planeNum * 8);
                    obstacles->triangle(2 + planeNum * 8, 3 + planeNum * 8, 7 + planeNum * 8);
                    obstacles->triangle(7 + planeNum * 8, 3 + planeNum * 8, 2 + planeNum * 8);
                }

                if (planeNum / (double) m_width >= m_length - 1 || m_cubes[(planeNum + m_width) / (double) m_width][planeNum % m_width] != OBSTACLE) {
                    //back
                    obstacles->triangle(5 + planeNum * 8, 7 + planeNum * 8, 1 + planeNum * 8);
                    obstacles->triangle(1 + planeNum * 8, 7 + planeNum * 8, 5 + planeNum * 8);
                    obstacles->triangle(1 + planeNum * 8, 3 + planeNum * 8, 7 + planeNum * 8);
                    obstacles->triangle(7 + planeNum * 8, 3 + planeNum * 8, 1 + planeNum * 8);
                }

//.........这里部分代码省略.........
开发者ID:prettyv,项目名称:rauschabstand,代码行数:101,代码来源:Map.cpp

示例7: generateMesh

void Map::generateMesh(std::string materialName)
{
    Ogre::ManualObject* plane = new Ogre::ManualObject("plane");
    plane->estimateIndexCount(m_length * m_width * 8);
    plane->estimateVertexCount(m_length * m_width * 8);
    plane->clear();
    plane->begin(materialName);

    Ogre::Vector3 pos = Ogre::Vector3(0, 0, 0);
    Ogre::Quaternion quat;
    Ogre::Quaternion quatNext;
    unsigned long planeNum = 0;

    for (unsigned int i = 0; i < m_length; i++) {
        quat = m_rotationalSpline.getPoint(i);
        quatNext = m_rotationalSpline.getPoint(i + 1);

        for (int x = -100 * (m_width / (double) 2), j = 0; (unsigned) j < m_width; j++, x += 100) {
            int back = -100;
            int left = x;
            int right = x + 100;
            int down = -20 ;

            Ogre::Vector3 nextPos =             pos + quat * Ogre::Vector3(0, 0, back);
            Ogre::Vector3 posMinus50 =          pos + quat * Ogre::Vector3(left, 0, 0);
            Ogre::Vector3 posPlus50 =           pos + quat * Ogre::Vector3(right, 0, 0);
            Ogre::Vector3 nextPosMinus50 =      nextPos + quatNext * Ogre::Vector3(left, 0, 0);
            Ogre::Vector3 nextPosPlus50 =       nextPos + quatNext * Ogre::Vector3(right, 0, 0);

            //TODO: fix normals?
            plane->position(posMinus50);
            plane->normal((quat * Vector3(0, 1, 0)).normalisedCopy());
            plane->textureCoord(1, 1);
            plane->position(nextPosMinus50);
            plane->normal((quat * Vector3(0, 1, 0)).normalisedCopy());
            plane->textureCoord(1, 0);
            plane->position(posPlus50);
            plane->normal((quat * Vector3(0, 1, 0)).normalisedCopy());
            plane->textureCoord(0, 1);
            plane->position(nextPosPlus50);
            plane->normal((quat * Vector3(0, 1, 0)).normalisedCopy());
            plane->textureCoord(0, 0);

            Ogre::Vector3 nextPosDown =         nextPos + quat * Ogre::Vector3(0, down, 0);
            Ogre::Vector3 posMinus50Down =      posMinus50 + quat * Ogre::Vector3(0, down, 0);
            Ogre::Vector3 posPlus50Down =       posPlus50 + quat * Ogre::Vector3(0, down, 0);
            Ogre::Vector3 nextPosMinus50Down =  nextPosMinus50 + quatNext * Ogre::Vector3(0, down, 0);
            Ogre::Vector3 nextPosPlus50Down =   nextPosPlus50 + quatNext * Ogre::Vector3(0, down, 0);

            //TODO: fix normals?
            plane->position(posMinus50Down);
            plane->normal((quat * Vector3(-1, -1, 1)).normalisedCopy());
            plane->textureCoord(0, 0);
            plane->position(nextPosMinus50Down);
            plane->normal((quat * Vector3(-1, -1, -1)).normalisedCopy());
            plane->textureCoord(0, 1);
            plane->position(posPlus50Down);
            plane->normal((quat * Vector3(1, -1, 1)).normalisedCopy());
            plane->textureCoord(1, 0);
            plane->position(nextPosPlus50Down);
            plane->normal((quat * Vector3(1, -1, -1)).normalisedCopy());
            plane->textureCoord(1, 1);

            if (m_cubes[planeNum / (double) m_width][planeNum % m_width] != HOLE) {
                //if (m_cubes[planeNum / (double) m_width][planeNum % m_width] == NORMAL)
                //{
                //top
                plane->triangle(0 + planeNum * 8, 1 + planeNum * 8, 2 + planeNum * 8);
                plane->triangle(2 + planeNum * 8, 1 + planeNum * 8, 0 + planeNum * 8);
                plane->triangle(1 + planeNum * 8, 3 + planeNum * 8, 2 + planeNum * 8);
                plane->triangle(2 + planeNum * 8, 3 + planeNum * 8, 1 + planeNum * 8);
                //}

                //bottom
                plane->triangle(4 + planeNum * 8, 5 + planeNum * 8, 6 + planeNum * 8);
                plane->triangle(6 + planeNum * 8, 5 + planeNum * 8, 4 + planeNum * 8);
                plane->triangle(5 + planeNum * 8, 7 + planeNum * 8, 6 + planeNum * 8);
                plane->triangle(6 + planeNum * 8, 7 + planeNum * 8, 5 + planeNum * 8);

                if (planeNum % m_width == 0 || m_cubes[planeNum / (double) m_width][(planeNum - 1) % m_width] == HOLE) {
                    //left
                    plane->triangle(0 + planeNum * 8, 4 + planeNum * 8, 5 + planeNum * 8);
                    plane->triangle(5 + planeNum * 8, 4 + planeNum * 8, 0 + planeNum * 8);
                    plane->triangle(0 + planeNum * 8, 1 + planeNum * 8, 5 + planeNum * 8);
                    plane->triangle(5 + planeNum * 8, 1 + planeNum * 8, 0 + planeNum * 8);
                }

                if (planeNum % m_width == m_width - 1 || m_cubes[planeNum / (double) m_width][(planeNum + 1) % m_width] == HOLE) {
                    //right
                    plane->triangle(2 + planeNum * 8, 6 + planeNum * 8, 7 + planeNum * 8);
                    plane->triangle(7 + planeNum * 8, 6 + planeNum * 8, 2 + planeNum * 8);
                    plane->triangle(2 + planeNum * 8, 3 + planeNum * 8, 7 + planeNum * 8);
                    plane->triangle(7 + planeNum * 8, 3 + planeNum * 8, 2 + planeNum * 8);
                }

                if (planeNum / (double) m_width >= m_length - 1 || m_cubes[(planeNum + m_width) / (double) m_width][planeNum % m_width] == HOLE) {
                    //back
                    plane->triangle(5 + planeNum * 8, 7 + planeNum * 8, 1 + planeNum * 8);
                    plane->triangle(1 + planeNum * 8, 7 + planeNum * 8, 5 + planeNum * 8);
                    plane->triangle(1 + planeNum * 8, 3 + planeNum * 8, 7 + planeNum * 8);
//.........这里部分代码省略.........
开发者ID:prettyv,项目名称:rauschabstand,代码行数:101,代码来源:Map.cpp


注:本文中的ogre::ManualObject::clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。