Example #1
0
	static void clearStaticBuffers()
	{
		posnormVertexBuffer = HardwareVertexBufferSharedPtr() ;
		indexBuffer = HardwareIndexBufferSharedPtr() ;
		for(int i=0;i<16;i++) {
			texcoordsVertexBuffers[i] = HardwareVertexBufferSharedPtr() ;
		}
		delete [] texcoordsVertexBuffers;
	}
Example #2
0
    //-----------------------------------------------------------------------
    HardwareVertexBufferSharedPtr 
    D3D9HardwareBufferManager::
    createVertexBuffer(size_t vertexSize, size_t numVerts, HardwareBuffer::Usage usage,
		bool useShadowBuffer)
    {
		assert (numVerts > 0);
#if OGRE_D3D_MANAGE_BUFFERS
        // Override shadow buffer setting; managed buffers are automatically
        // backed by system memory
        // Don't override shadow buffer if discardable, since then we use
        // unmanaged buffers for speed (avoids write-through overhead)
        if (useShadowBuffer && !(usage & HardwareBuffer::HBU_DISCARDABLE))
        {
            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
		D3D9HardwareVertexBuffer* vbuf = new D3D9HardwareVertexBuffer(
			vertexSize, numVerts, usage, mlpD3DDevice, false, useShadowBuffer);
		{
			OGRE_LOCK_MUTEX(mVertexBuffersMutex)
			mVertexBuffers.insert(vbuf);
		}
        return HardwareVertexBufferSharedPtr(vbuf);
    }
    //-----------------------------------------------------------------------
	HardwareVertexBufferSharedPtr 
        DefaultHardwareBufferManagerBase::createVertexBuffer(size_t vertexSize, 
		size_t numVerts, HardwareBuffer::Usage usage, bool useShadowBuffer)
	{
        DefaultHardwareVertexBuffer* vb = OGRE_NEW DefaultHardwareVertexBuffer(this, vertexSize, numVerts, usage);
        return HardwareVertexBufferSharedPtr(vb);
	}
 HardwareVertexBufferSharedPtr
     GLES2DefaultHardwareBufferManagerBase::createVertexBuffer(size_t vertexSize,
     size_t numVerts, HardwareBuffer::Usage usage, bool useShadowBuffer)
 {
     return HardwareVertexBufferSharedPtr(
         OGRE_NEW GLES2DefaultHardwareVertexBuffer(vertexSize, numVerts, usage));
 }
 HardwareVertexBufferSharedPtr
 GL3PlusDefaultHardwareBufferManagerBase::createVertexBuffer(size_t vertexSize,
                                                             size_t numVerts, HardwareBuffer::Usage usage, bool useShadowBuffer)
 {
     return HardwareVertexBufferSharedPtr(
         new GL3PlusDefaultHardwareVertexBuffer(this,vertexSize, numVerts, usage));
 }
	HardwareVertexBufferSharedPtr NULLHardwareBufferManager::createVertexBuffer(
			size_t vertexSize, size_t numVerts, HardwareBuffer::Usage usage,
			bool useShadowBuffer) {
		HardwareVertexBuffer* vbuf = new NULLHardwareVertexBuffer(vertexSize,
				numVerts, usage, false, false);
		mVertexBuffers.insert(vbuf);
	
		return HardwareVertexBufferSharedPtr(vbuf);
	}
    //-----------------------------------------------------------------------
    HardwareVertexBufferSharedPtr GLHardwareBufferManagerBase::createVertexBuffer(
        size_t vertexSize, size_t numVerts, HardwareBuffer::Usage usage, bool useShadowBuffer)
    {
		GLHardwareVertexBuffer* buf = 
			new GLHardwareVertexBuffer(this, vertexSize, numVerts, usage, useShadowBuffer);
		{
                    OGRE_LOCK_MUTEX(mVertexBuffersMutex);
			mVertexBuffers.insert(buf);
		}
		return HardwareVertexBufferSharedPtr(buf);
    }
	//-----------------------------------------------------------------------
	HardwareVertexBufferSharedPtr
		D3D11HardwareBufferManagerBase::
		createStreamOutputVertexBuffer(size_t vertexSize, size_t numVerts, HardwareBuffer::Usage usage,
		bool useShadowBuffer)
	{
		assert(numVerts > 0);
		D3D11HardwareVertexBuffer* vbuf = new D3D11HardwareVertexBuffer(
			this, vertexSize, numVerts, usage, mlpD3DDevice, false, useShadowBuffer, true);
		{
			OGRE_LOCK_MUTEX(mVertexBuffersMutex);
			mVertexBuffers.insert(vbuf);
		}
		return HardwareVertexBufferSharedPtr(vbuf);
	}
 HardwareVertexBufferSharedPtr
     GLESHardwareBufferManagerBase::createVertexBuffer(size_t vertexSize,
                                                   size_t numVerts,
                                                   HardwareBuffer::Usage usage,
                                                   bool useShadowBuffer)
 {
     // always use shadowBuffer
     GLESHardwareVertexBuffer* buf =
         OGRE_NEW GLESHardwareVertexBuffer(this, vertexSize, numVerts, usage, true);
     {
         OGRE_LOCK_MUTEX(mVertexBuffersMutex);
         mVertexBuffers.insert(buf);
     }
     return HardwareVertexBufferSharedPtr(buf);
 }
    HardwareVertexBufferSharedPtr
        GLES2HardwareBufferManagerBase::createVertexBuffer(size_t vertexSize,
                                                      size_t numVerts,
                                                      HardwareBuffer::Usage usage,
                                                      bool useShadowBuffer)
    {
        GLES2HardwareVertexBuffer* buf = 0;

        if(getGLES2SupportRef()->checkExtension("GL_EXT_map_buffer_range") || gleswIsSupported(3, 0))
            buf = OGRE_NEW GLES2HardwareVertexBuffer(this, vertexSize, numVerts, usage, useShadowBuffer);
        else
            // always use shadowBuffer
            buf = OGRE_NEW GLES2HardwareVertexBuffer(this, vertexSize, numVerts, usage, true);

        {
            OGRE_LOCK_MUTEX(mVertexBuffersMutex);
            mVertexBuffers.insert(buf);
        }
        return HardwareVertexBufferSharedPtr(buf);
    }
Example #11
0
			setTextureLevel();
		}
	}
	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 ;