mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
Add OpenGL support.
This commit is contained in:
parent
c354f59b72
commit
dd08fd2e7d
55 changed files with 2957 additions and 802 deletions
|
|
@ -28,9 +28,7 @@
|
|||
#include "gfx/gfxDevice.h"
|
||||
#include "gfx/gfxInit.h"
|
||||
|
||||
#ifndef GL_GGL_H
|
||||
#include "gfx/gl/ggl/ggl.h"
|
||||
#endif
|
||||
#include "gfx/gl/tGL/tGL.h"
|
||||
|
||||
#include "windowManager/platformWindow.h"
|
||||
#include "gfx/gfxFence.h"
|
||||
|
|
@ -41,6 +39,8 @@ class GFXGLVertexBuffer;
|
|||
class GFXGLPrimitiveBuffer;
|
||||
class GFXGLTextureTarget;
|
||||
class GFXGLCubemap;
|
||||
class GFXGLStateCache;
|
||||
class GFXGLVertexDecl;
|
||||
|
||||
class GFXGLDevice : public GFXDevice
|
||||
{
|
||||
|
|
@ -59,12 +59,13 @@ public:
|
|||
virtual void deactivate() { }
|
||||
virtual GFXAdapterType getAdapterType() { return OpenGL; }
|
||||
|
||||
virtual void enterDebugEvent(ColorI color, const char *name) { }
|
||||
virtual void leaveDebugEvent() { }
|
||||
virtual void setDebugMarker(ColorI color, const char *name) { }
|
||||
virtual void enterDebugEvent(ColorI color, const char *name);
|
||||
virtual void leaveDebugEvent();
|
||||
virtual void setDebugMarker(ColorI color, const char *name);
|
||||
|
||||
virtual void enumerateVideoModes();
|
||||
|
||||
virtual U32 getTotalVideoMemory_GL_EXT();
|
||||
virtual U32 getTotalVideoMemory();
|
||||
|
||||
virtual GFXCubemap * createCubemap();
|
||||
|
|
@ -135,7 +136,16 @@ public:
|
|||
|
||||
///
|
||||
bool supportsAnisotropic() const { return mSupportsAnisotropic; }
|
||||
|
||||
|
||||
GFXGLStateCache* getOpenglCache() { return mOpenglStateCache; }
|
||||
|
||||
GFXTextureObject* getDefaultDepthTex() const;
|
||||
|
||||
/// Returns the number of vertex streams supported by the device.
|
||||
const U32 getNumVertexStreams() const { return mNumVertexStream; }
|
||||
|
||||
bool glUseMap() const { return mUseGlMap; }
|
||||
|
||||
protected:
|
||||
/// Called by GFXDevice to create a device specific stateblock
|
||||
virtual GFXStateBlockRef createStateBlockInternal(const GFXStateBlockDesc& desc);
|
||||
|
|
@ -170,16 +180,12 @@ protected:
|
|||
// NOTE: The GL device doesn't need a vertex declaration at
|
||||
// this time, but we need to return something to keep the system
|
||||
// from retrying to allocate one on every call.
|
||||
virtual GFXVertexDecl* allocVertexDecl( const GFXVertexFormat *vertexFormat )
|
||||
{
|
||||
static GFXVertexDecl decl;
|
||||
return &decl;
|
||||
}
|
||||
virtual GFXVertexDecl* allocVertexDecl( const GFXVertexFormat *vertexFormat );
|
||||
|
||||
virtual void setVertexDecl( const GFXVertexDecl *decl ) { }
|
||||
virtual void setVertexDecl( const GFXVertexDecl *decl );
|
||||
|
||||
virtual void setVertexStream( U32 stream, GFXVertexBuffer *buffer );
|
||||
virtual void setVertexStreamFrequency( U32 stream, U32 frequency );
|
||||
virtual void setVertexStreamFrequency( U32 stream, U32 frequency );
|
||||
|
||||
private:
|
||||
typedef GFXDevice Parent;
|
||||
|
|
@ -194,8 +200,16 @@ private:
|
|||
|
||||
U32 mAdapterIndex;
|
||||
|
||||
StrongRefPtr<GFXGLVertexBuffer> mCurrentVB;
|
||||
StrongRefPtr<GFXGLVertexBuffer> mCurrentVB[VERTEX_STREAM_COUNT];
|
||||
U32 mCurrentVB_Divisor[VERTEX_STREAM_COUNT];
|
||||
bool mNeedUpdateVertexAttrib;
|
||||
StrongRefPtr<GFXGLPrimitiveBuffer> mCurrentPB;
|
||||
U32 mDrawInstancesCount;
|
||||
|
||||
GFXShader* mCurrentShader;
|
||||
GFXShaderRef mGenericShader[GS_COUNT];
|
||||
GFXShaderConstBufferRef mGenericShaderBuffer[GS_COUNT];
|
||||
GFXShaderConstHandle *mModelViewProjSC[GS_COUNT];
|
||||
|
||||
/// Since GL does not have separate world and view matrices we need to track them
|
||||
MatrixF m_mCurrentWorld;
|
||||
|
|
@ -206,11 +220,15 @@ private:
|
|||
|
||||
F32 mPixelShaderVersion;
|
||||
|
||||
bool mSupportsAnisotropic;
|
||||
bool mSupportsAnisotropic;
|
||||
|
||||
U32 mNumVertexStream;
|
||||
|
||||
U32 mMaxShaderTextures;
|
||||
U32 mMaxFFTextures;
|
||||
|
||||
U32 mMaxTRColors;
|
||||
|
||||
RectI mClip;
|
||||
|
||||
GFXGLStateBlockRef mCurrentGLStateBlock;
|
||||
|
|
@ -232,6 +250,13 @@ private:
|
|||
GFXFence* _createPlatformSpecificFence(); ///< If our platform (e.g. OS X) supports a fence extenstion (e.g. GL_APPLE_fence) this will create one, otherwise returns NULL
|
||||
|
||||
void setPB(GFXGLPrimitiveBuffer* pb); ///< Sets mCurrentPB
|
||||
|
||||
GFXGLStateCache *mOpenglStateCache;
|
||||
|
||||
GFXWindowTargetRef *mWindowRT;
|
||||
|
||||
bool mUseGlMap;
|
||||
};
|
||||
|
||||
#define GFXGL static_cast<GFXGLDevice*>(GFXDevice::get())
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue