Esempio n. 1
0
    //-----------------------------------------------------------------------
	HardwareIndexBufferSharedPtr 
    D3D9HardwareBufferManager::
    createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes, 
        HardwareBuffer::Usage usage, bool useShadowBuffer)
    {
		assert (numIndexes > 0);
#if OGRE_D3D_MANAGE_BUFFERS
        // Override shadow buffer setting; managed buffers are automatically
        // backed by system memory
        if (useShadowBuffer)
        {
            useShadowBuffer = false;
            // Also drop any WRITE_ONLY so we can read direct
            if (usage == HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY)
            {
                usage = HardwareBuffer::HBU_DYNAMIC;
            }
            else if (usage == HardwareBuffer::HBU_STATIC_WRITE_ONLY)
            {
                usage = HardwareBuffer::HBU_STATIC;
            }
        }
#endif
		D3D9HardwareIndexBuffer* idx = new D3D9HardwareIndexBuffer(
			itype, numIndexes, usage, mlpD3DDevice, false, useShadowBuffer);
		{
			OGRE_LOCK_MUTEX(mIndexBuffersMutex)
			mIndexBuffers.insert(idx);
		}
		return HardwareIndexBufferSharedPtr(idx);
            
    }
    //-----------------------------------------------------------------------
	HardwareIndexBufferSharedPtr 
        DefaultHardwareBufferManagerBase::createIndexBuffer(HardwareIndexBuffer::IndexType itype, 
		size_t numIndexes, HardwareBuffer::Usage usage, bool useShadowBuffer)
	{
        DefaultHardwareIndexBuffer* ib = OGRE_NEW DefaultHardwareIndexBuffer(itype, numIndexes, usage);
		return HardwareIndexBufferSharedPtr(ib);
	}
 HardwareIndexBufferSharedPtr
     GLES2DefaultHardwareBufferManagerBase::createIndexBuffer(HardwareIndexBuffer::IndexType itype,
     size_t numIndexes, HardwareBuffer::Usage usage, bool useShadowBuffer)
 {
     return HardwareIndexBufferSharedPtr(
         OGRE_NEW GLES2DefaultHardwareIndexBuffer(itype, numIndexes, usage));
 }
Esempio n. 4
0
	static void clearStaticBuffers()
	{
		posnormVertexBuffer = HardwareVertexBufferSharedPtr() ;
		indexBuffer = HardwareIndexBufferSharedPtr() ;
		for(int i=0;i<16;i++) {
			texcoordsVertexBuffers[i] = HardwareVertexBufferSharedPtr() ;
		}
		delete [] texcoordsVertexBuffers;
	}
	HardwareIndexBufferSharedPtr NULLHardwareBufferManager::createIndexBuffer(
			HardwareIndexBuffer::IndexType itype, size_t numIndexes,
			HardwareBuffer::Usage usage, bool useShadowBuffer) {
		NULLHardwareIndexBuffer* idx = new NULLHardwareIndexBuffer(itype,
				numIndexes, usage, false, useShadowBuffer);
		mIndexBuffers.insert(idx);
	
		return HardwareIndexBufferSharedPtr(idx);
	
	}
    //-----------------------------------------------------------------------
    HardwareIndexBufferSharedPtr 
    GLHardwareBufferManagerBase::createIndexBuffer(
        HardwareIndexBuffer::IndexType itype, size_t numIndexes, 
        HardwareBuffer::Usage usage, bool useShadowBuffer)
    {
		GLHardwareIndexBuffer* buf = 
			new GLHardwareIndexBuffer(this, itype, numIndexes, usage, useShadowBuffer);
		{
                    OGRE_LOCK_MUTEX(mIndexBuffersMutex);
			mIndexBuffers.insert(buf);
		}
		return HardwareIndexBufferSharedPtr(buf);
    }
 HardwareIndexBufferSharedPtr GLES2HardwareBufferManagerBase::createIndexBuffer(HardwareIndexBuffer::IndexType itype,
                                                                           size_t numIndexes,
                                                                           HardwareBuffer::Usage usage,
                                                                           bool useShadowBuffer)
 {
     // always use shadowBuffer
     GLES2HardwareIndexBuffer* buf =
         OGRE_NEW GLES2HardwareIndexBuffer(this, itype, numIndexes, usage, true);
     {
         OGRE_LOCK_MUTEX(mIndexBuffersMutex)
         mIndexBuffers.insert(buf);
     }
     return HardwareIndexBufferSharedPtr(buf);
 }
	//-----------------------------------------------------------------------
	HardwareIndexBufferSharedPtr
		D3D11HardwareBufferManagerBase::
		createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes,
		HardwareBuffer::Usage usage, bool useShadowBuffer)
	{
		assert(numIndexes > 0);
		D3D11HardwareIndexBuffer* idx = new D3D11HardwareIndexBuffer(
			this, itype, numIndexes, usage, mlpD3DDevice, false, useShadowBuffer);
		{
			OGRE_LOCK_MUTEX(mIndexBuffersMutex);
			mIndexBuffers.insert(idx);
		}
		return HardwareIndexBufferSharedPtr(idx);

	}
    HardwareIndexBufferSharedPtr GLES2HardwareBufferManagerBase::createIndexBuffer(HardwareIndexBuffer::IndexType itype,
                                                                              size_t numIndexes,
                                                                              HardwareBuffer::Usage usage,
                                                                              bool useShadowBuffer)
    {
        GLES2HardwareIndexBuffer* buf = 0;
        if(getGLES2SupportRef()->checkExtension("GL_EXT_map_buffer_range") || gleswIsSupported(3, 0))
            buf = OGRE_NEW GLES2HardwareIndexBuffer(this, itype, numIndexes, usage, useShadowBuffer);
        else
            // always use shadowBuffer
            buf = OGRE_NEW GLES2HardwareIndexBuffer(this, itype, numIndexes, usage, true);

        {
            OGRE_LOCK_MUTEX(mIndexBuffersMutex);
            mIndexBuffers.insert(buf);
        }
        return HardwareIndexBufferSharedPtr(buf);
    }
Esempio n. 10
0
	}
	static void clearStaticBuffers()
	{
		posnormVertexBuffer = HardwareVertexBufferSharedPtr() ;
		indexBuffer = HardwareIndexBufferSharedPtr() ;
		for(int i=0;i<16;i++) {
			texcoordsVertexBuffers[i] = HardwareVertexBufferSharedPtr() ;
		}
		delete [] texcoordsVertexBuffers;
	}
} ;
bool WaterCircle::first = true ;
HardwareVertexBufferSharedPtr WaterCircle::posnormVertexBuffer =
	HardwareVertexBufferSharedPtr() ;
HardwareIndexBufferSharedPtr WaterCircle::indexBuffer =
	HardwareIndexBufferSharedPtr() ;
HardwareVertexBufferSharedPtr* WaterCircle::texcoordsVertexBuffers = 0 ;

/* =========================================================================*/
/*               WaterListener class                                          */
/* =========================================================================*/
// Event handler
class WaterListener: public ExampleFrameListener
{
protected:
	WaterMesh *waterMesh ;
	Entity *waterEntity ;
	int materialNumber ;
	bool skyBoxOn ;
	Real timeoutDelay ;