示例#1
0
    TerrainGrid::~TerrainGrid()
    {
        destroyRenderable();

		if(mBaseSceneNode)
		{
			mBaseSceneNode->getCreator()->destroySceneNode(mBaseSceneNode);
			mBaseSceneNode = NULL;
		}
    }
示例#2
0
void OGRE3DRenderSystem::destroySoftBody(NxOgre::SoftBody* cloth)
{
 if (cloth == 0)
  return;

 OGRE3DRenderable* renderable = static_cast<OGRE3DRenderable*>(cloth->getRenderable());

 mSceneManager->getRootSceneNode()->detachObject(renderable);
 destroyRenderable(renderable);
 mScene->destroySoftBody(cloth);
}
示例#3
0
OGRE3DRenderSystem::~OGRE3DRenderSystem(void)
{
 ::NxOgre::TimeController::getSingleton()->removeTimeListener(this, ::NxOgre::Enums::Priority_MediumLow);
 
 if (mVisualDebuggerRenderable)
 {
  mVisualDebuggerNode->detachObject(mVisualDebuggerRenderable);
  mSceneManager->getRootSceneNode()->removeAndDestroyChild(mVisualDebuggerNode->getName());
  destroyRenderable(mVisualDebuggerRenderable);
 }
 
 mBodies.destroyAll();
 mRenderables.destroyAll();
 mPointRenderables.destroyAll();
}
示例#4
0
    void
    TerrainGrid::createRenderable()
    {
		destroyRenderable();

		//base on terrain tile,create the TerrainGridRenderable
		int zTile = Ogre::Math::Ceil((float)(mTerrData->mZSize)/(float)(STRIDE));
		int xTile = Ogre::Math::Ceil((float)(mTerrData->mXSize)/(float)(STRIDE));
		
        for (int z=0; z<zTile; ++z)
            for (int x=0; x<xTile; ++x)
            {
                TerrainGridRenderable* terrGridRend = new TerrainGridRenderable(mSceneManipulator);

                int xStart, xEnd, zStart, zEnd;
                xStart = xEnd = zStart = zEnd = 0;

                xStart = x*STRIDE;
                zStart = z*STRIDE;
                xEnd = xStart + STRIDE;
                zEnd = zStart + STRIDE;

                // 如果当前块的原定大小超出了地形的tile size(reshape后有可能出现这种情况),就得计算块的大小
                if (xEnd > mTerrData->mXSize)
                    xEnd = xStart + STRIDE - ( xEnd - mTerrData->mXSize );

                if (zEnd > mTerrData->mZSize)
                    zEnd = zStart + STRIDE - ( zEnd - mTerrData->mZSize );

                terrGridRend->init(xStart, zStart, xEnd, zEnd);

                mBaseSceneNode->attachObject(terrGridRend);

                mTerrGridRend.push_back(terrGridRend);
            }
    }
示例#5
0
    TerrainGrid::~TerrainGrid()
    {
        destroyRenderable();

		mBaseSceneNode->destroy();
    }