Ejemplo n.º 1
0
    //-----------------------------------------------------------------------------------
    ObjectMemoryManager::~ObjectMemoryManager()
    {
        ArrayMemoryManagerVec::iterator itor = mMemoryManagers.begin();
        ArrayMemoryManagerVec::iterator end  = mMemoryManagers.end();

        while( itor != end )
        {
            itor->destroy();
            ++itor;
        }

        mMemoryManagers.clear();

        delete mDummyNode;
        mDummyNode = 0;

        delete mDummyObject;
        mDummyObject = 0;

        /*OGRE_FREE_SIMD( mDummyTransformPtrs.mPosition, MEMCATEGORY_SCENE_OBJECTS );
        OGRE_FREE_SIMD( mDummyTransformPtrs.mOrientation, MEMCATEGORY_SCENE_OBJECTS );
        OGRE_FREE_SIMD( mDummyTransformPtrs.mScale, MEMCATEGORY_SCENE_OBJECTS );*/

        OGRE_FREE_SIMD( mDummyTransformPtrs.mDerivedPosition, MEMCATEGORY_SCENE_OBJECTS );
        OGRE_FREE_SIMD( mDummyTransformPtrs.mDerivedOrientation, MEMCATEGORY_SCENE_OBJECTS );
        OGRE_FREE_SIMD( mDummyTransformPtrs.mDerivedScale, MEMCATEGORY_SCENE_OBJECTS );

        OGRE_FREE_SIMD( mDummyTransformPtrs.mDerivedTransform, MEMCATEGORY_SCENE_OBJECTS );
        /*OGRE_FREE_SIMD( mDummyTransformPtrs.mInheritOrientation, MEMCATEGORY_SCENE_OBJECTS );
        OGRE_FREE_SIMD( mDummyTransformPtrs.mInheritScale, MEMCATEGORY_SCENE_OBJECTS );*/
        mDummyTransformPtrs = Transform();
    }
Ejemplo n.º 2
0
void GfxBody::destroyGraphics (void)
{
    for (SubList::iterator i=subList.begin(),i_=subList.end() ; i!=i_ ; ++i) {
        delete *i;
    }
    subList.clear();
    
    if (skeleton) {
        OGRE_FREE_SIMD(boneWorldMatrixes, Ogre::MEMCATEGORY_ANIMATION);
        OGRE_DELETE skeleton;
        OGRE_FREE_SIMD(boneMatrixes, Ogre::MEMCATEGORY_ANIMATION);
    }
}
Ejemplo n.º 3
0
    //-----------------------------------------------------------------------
    void InstancedEntity::destroySkeletonInstance()
    {
        if( mSkeletonInstance )
        {
            //Tell the ones sharing skeleton with us to use their own
            //sharing partners will remove themselves from notifyUnlink
            while( mSharingPartners.empty() == false )
            {
                mSharingPartners.front()->stopSharingTransform();
            }
            mSharingPartners.clear();

            OGRE_DELETE mSkeletonInstance;
            OGRE_DELETE mAnimationState;
            OGRE_FREE_SIMD( mBoneMatrices, MEMCATEGORY_ANIMATION );
            OGRE_FREE_SIMD( mBoneWorldMatrices, MEMCATEGORY_ANIMATION );

            mSkeletonInstance   = 0;
            mAnimationState     = 0;
            mBoneMatrices       = 0;
            mBoneWorldMatrices  = 0;
        }
    }
	//-----------------------------------------------------------------------
    DefaultHardwareVertexBuffer::~DefaultHardwareVertexBuffer()
	{
		OGRE_FREE_SIMD(mData, MEMCATEGORY_GEOMETRY);
	}
Ejemplo n.º 5
0
 //-----------------------------------------------------------------------------------
 NULLStagingBuffer::~NULLStagingBuffer()
 {
     OGRE_FREE_SIMD( mNullDataPtr, MEMCATEGORY_RENDERSYS );
     mNullDataPtr = 0;
 }
 GLES2DefaultHardwareUniformBuffer::~GLES2DefaultHardwareUniformBuffer()
 {
     OGRE_FREE_SIMD(mData, MEMCATEGORY_GEOMETRY);
 }
 GL3PlusDefaultHardwareCounterBuffer::~GL3PlusDefaultHardwareCounterBuffer()
 {
     OGRE_FREE_SIMD(mData, MEMCATEGORY_GEOMETRY);
 }
Ejemplo n.º 8
0
    //-----------------------------------------------------------------------------------
    void WireAabb::createBuffers(void)
    {
        const float c_vertexData[8*3] =
        {
            -1, -1,  1,
             1, -1,  1,
             1,  1,  1,
            -1,  1,  1,
            -1, -1, -1,
             1, -1, -1,
             1,  1, -1,
            -1,  1, -1
        };

        //Create the indices.
        const Ogre::uint16 c_indexData[2 * 4 * 3] =
        {
            0, 1,   1, 2,   2, 3,   3, 0,	//Front
            4, 5,   5, 6,   6, 7,   7, 4,	//Back
            0, 4,   1, 5,   2, 6,   3, 7
        };

        Ogre::uint16 *cubeIndices = reinterpret_cast<Ogre::uint16*>( OGRE_MALLOC_SIMD(
                                                                         sizeof(Ogre::uint16) * 2 * 4 * 3,
                                                                         Ogre::MEMCATEGORY_GEOMETRY ) );
        memcpy( cubeIndices, c_indexData, sizeof( c_indexData ) );

        VaoManager *vaoManager = mManager->getDestinationRenderSystem()->getVaoManager();
        Ogre::IndexBufferPacked *indexBuffer = 0;

        try
        {
            indexBuffer = vaoManager->createIndexBuffer( Ogre::IndexBufferPacked::IT_16BIT,
                                                         2 * 4 * 3,
                                                         Ogre::BT_IMMUTABLE,
                                                         cubeIndices, true );
        }
        catch( Ogre::Exception &e )
        {
            // When keepAsShadow = true, the memory will be freed when the index buffer is destroyed.
            // However if for some weird reason there is an exception raised, the memory will
            // not be freed, so it is up to us to do so.
            // The reasons for exceptions are very rare. But we're doing this for correctness.
            OGRE_FREE_SIMD( indexBuffer, Ogre::MEMCATEGORY_GEOMETRY );
            indexBuffer = 0;
            throw e;
        }

        //Create the vertex buffer

        //Vertex declaration
        VertexElement2Vec vertexElements;
        vertexElements.push_back( VertexElement2( VET_FLOAT3, VES_POSITION ) );

        //For immutable buffers, it is mandatory that cubeVertices is not a null pointer.
        float *cubeVertices = reinterpret_cast<float*>( OGRE_MALLOC_SIMD( sizeof(float) * 8 * 3,
                                                                          Ogre::MEMCATEGORY_GEOMETRY ) );
        //Fill the data.
        memcpy( cubeVertices, c_vertexData, sizeof(float) * 8 * 3 );

        Ogre::VertexBufferPacked *vertexBuffer = 0;
        try
        {
            //Create the actual vertex buffer.
            vertexBuffer = vaoManager->createVertexBuffer( vertexElements, 8,
                                                           BT_IMMUTABLE,
                                                           cubeVertices, true );
        }
        catch( Ogre::Exception &e )
        {
            OGRE_FREE_SIMD( vertexBuffer, Ogre::MEMCATEGORY_GEOMETRY );
            vertexBuffer = 0;
            throw e;
        }

        //Now the Vao. We'll just use one vertex buffer source
        VertexBufferPackedVec vertexBuffers;
        vertexBuffers.push_back( vertexBuffer );
        Ogre::VertexArrayObject *vao = vaoManager->createVertexArrayObject(
                    vertexBuffers, indexBuffer, OT_LINE_LIST );

        mVaoPerLod[0].push_back( vao );
        mVaoPerLod[1].push_back( vao );
    }