diff --git a/Engine/source/T3D/fx/fxFoliageReplicator.cpp b/Engine/source/T3D/fx/fxFoliageReplicator.cpp index 4f21482f8..eef88d24a 100644 --- a/Engine/source/T3D/fx/fxFoliageReplicator.cpp +++ b/Engine/source/T3D/fx/fxFoliageReplicator.cpp @@ -1520,14 +1520,10 @@ void fxFoliageReplicator::renderObject(ObjectRenderInst *ri, SceneRenderState *s // Debug SB desc.samplersDefined = true; - desc.samplers[0].textureColorOp = GFXTOPDisable; - desc.samplers[1].textureColorOp = GFXTOPDisable; mDebugSB = GFX->createStateBlock(desc); // Render SB - desc.samplers[0].textureColorOp = GFXTOPModulate; - desc.samplers[1].textureColorOp = GFXTOPModulate; desc.samplers[1].addressModeU = GFXAddressClamp; desc.samplers[1].addressModeV = GFXAddressClamp; diff --git a/Engine/source/T3D/fx/precipitation.cpp b/Engine/source/T3D/fx/precipitation.cpp index 4f7694482..7c022b528 100644 --- a/Engine/source/T3D/fx/precipitation.cpp +++ b/Engine/source/T3D/fx/precipitation.cpp @@ -1608,14 +1608,6 @@ void Precipitation::renderObject(ObjectRenderInst *ri, SceneRenderState *state, mDefaultSB = GFX->createStateBlock(desc); desc.samplersDefined = true; - desc.samplers[0].textureColorOp = GFXTOPModulate; - desc.samplers[0].colorArg1 = GFXTATexture; - desc.samplers[0].colorArg2 = GFXTADiffuse; - desc.samplers[0].alphaOp = GFXTOPSelectARG1; - desc.samplers[0].alphaArg1 = GFXTATexture; - - desc.samplers[1].textureColorOp = GFXTOPDisable; - desc.samplers[1].alphaOp = GFXTOPDisable; mDistantSB = GFX->createStateBlock(desc); } diff --git a/Engine/source/T3D/vehicles/guiSpeedometer.cpp b/Engine/source/T3D/vehicles/guiSpeedometer.cpp index b5be88cdd..07e176438 100644 --- a/Engine/source/T3D/vehicles/guiSpeedometer.cpp +++ b/Engine/source/T3D/vehicles/guiSpeedometer.cpp @@ -203,7 +203,6 @@ void GuiSpeedometerHud::onRender(Point2I offset, const RectI &updateRect) GFXStateBlockDesc desc; desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha); desc.samplersDefined = true; - desc.samplers[0].textureColorOp = GFXTOPDisable; mBlendSB = GFX->createStateBlock(desc); } GFX->setStateBlock(mBlendSB); diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index 2b04236b1..8b75b7afd 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -2799,5 +2799,5 @@ DefineEngineFunction( getMaxDynamicVerts, S32, (),, "Get max number of allowable dynamic vertices in a single vertex buffer.\n\n" "@return the max number of allowable dynamic vertices in a single vertex buffer" ) { - return MAX_DYNAMIC_VERTS / 2; + return GFX_MAX_DYNAMIC_VERTS / 2; } diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index 8374af42f..9623e197b 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -960,7 +960,6 @@ bool VolumetricFog::setupRenderer() descD.samplers[0].magFilter = GFXTextureFilterLinear; descD.samplers[0].minFilter = GFXTextureFilterLinear; descD.samplers[0].mipFilter = GFXTextureFilterLinear; - descD.samplers[0].textureColorOp = GFXTOPDisable; // DepthBuffer sampler descD.samplers[1].addressModeU = GFXAddressClamp; @@ -969,7 +968,6 @@ bool VolumetricFog::setupRenderer() descD.samplers[1].magFilter = GFXTextureFilterLinear; descD.samplers[1].minFilter = GFXTextureFilterLinear; descD.samplers[1].mipFilter = GFXTextureFilterLinear; - descD.samplers[1].textureColorOp = GFXTOPModulate; // FrontBuffer sampler descD.samplers[2].addressModeU = GFXAddressClamp; @@ -978,7 +976,6 @@ bool VolumetricFog::setupRenderer() descD.samplers[2].magFilter = GFXTextureFilterLinear; descD.samplers[2].minFilter = GFXTextureFilterLinear; descD.samplers[2].mipFilter = GFXTextureFilterLinear; - descD.samplers[2].textureColorOp = GFXTOPModulate; // animated density modifier map sampler descD.samplers[3].addressModeU = GFXAddressWrap; @@ -987,7 +984,6 @@ bool VolumetricFog::setupRenderer() descD.samplers[3].magFilter = GFXTextureFilterLinear; descD.samplers[3].minFilter = GFXTextureFilterLinear; descD.samplers[3].mipFilter = GFXTextureFilterLinear; - descD.samplers[3].textureColorOp = GFXTOPModulate; dMemcpy(&descF, &descD, sizeof(GFXStateBlockDesc)); descF.setCullMode(GFXCullCCW); diff --git a/Engine/source/environment/basicClouds.cpp b/Engine/source/environment/basicClouds.cpp index 0352c4e1a..ef3728848 100644 --- a/Engine/source/environment/basicClouds.cpp +++ b/Engine/source/environment/basicClouds.cpp @@ -150,7 +150,6 @@ bool BasicClouds::onAdd() desc.samplers[0].magFilter = GFXTextureFilterLinear; desc.samplers[0].minFilter = GFXTextureFilterLinear; desc.samplers[0].mipFilter = GFXTextureFilterLinear; - desc.samplers[0].textureColorOp = GFXTOPModulate; mStateblock = GFX->createStateBlock( desc ); } diff --git a/Engine/source/environment/cloudLayer.cpp b/Engine/source/environment/cloudLayer.cpp index 6c7fafb7f..f29dec3e9 100644 --- a/Engine/source/environment/cloudLayer.cpp +++ b/Engine/source/environment/cloudLayer.cpp @@ -170,7 +170,6 @@ bool CloudLayer::onAdd() desc.samplers[0].magFilter = GFXTextureFilterLinear; desc.samplers[0].minFilter = GFXTextureFilterLinear; desc.samplers[0].mipFilter = GFXTextureFilterLinear; - desc.samplers[0].textureColorOp = GFXTOPModulate; mStateblock = GFX->createStateBlock( desc ); } diff --git a/Engine/source/environment/river.cpp b/Engine/source/environment/river.cpp index 9606584f7..9bb1d7aac 100644 --- a/Engine/source/environment/river.cpp +++ b/Engine/source/environment/river.cpp @@ -2254,7 +2254,7 @@ void River::_makeHighLODBuffers() } } - if ( numVerts > MAX_DYNAMIC_VERTS || numTriangles * 3 > MAX_DYNAMIC_INDICES ) + if ( numVerts > GFX_MAX_DYNAMIC_VERTS || numTriangles * 3 > GFX_MAX_DYNAMIC_INDICES ) { mVB_high = NULL; mPB_high = NULL; diff --git a/Engine/source/gfx/D3D11/gfxD3D11Device.cpp b/Engine/source/gfx/D3D11/gfxD3D11Device.cpp index 01fd8056f..1b578c34b 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11Device.cpp +++ b/Engine/source/gfx/D3D11/gfxD3D11Device.cpp @@ -961,7 +961,7 @@ void GFXD3D11Device::reacquireDefaultPoolResources() mDynamicPB = new GFXD3D11PrimitiveBuffer(this, 0, 0, GFXBufferTypeDynamic); D3D11_BUFFER_DESC desc; - desc.ByteWidth = sizeof(U16) * MAX_DYNAMIC_INDICES; + desc.ByteWidth = sizeof(U16) * GFX_MAX_DYNAMIC_INDICES; desc.Usage = D3D11_USAGE_DYNAMIC; desc.BindFlags = D3D11_BIND_INDEX_BUFFER; desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; @@ -1019,7 +1019,7 @@ GFXD3D11VertexBuffer * GFXD3D11Device::createVBPool( const GFXVertexFormat *vert vertexFormat->getDecl(); D3D11_BUFFER_DESC desc; - desc.ByteWidth = vertSize * MAX_DYNAMIC_VERTS; + desc.ByteWidth = vertSize * GFX_MAX_DYNAMIC_VERTS; desc.Usage = D3D11_USAGE_DYNAMIC; desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; @@ -1283,7 +1283,7 @@ GFXPrimitiveBuffer * GFXD3D11Device::allocPrimitiveBuffer(U32 numIndices, U32 nu if(bufferType == GFXBufferTypeVolatile) { // Get it from the pool if it's a volatile... - AssertFatal(numIndices < MAX_DYNAMIC_INDICES, "Cannot allocate that many indices in a volatile buffer, increase MAX_DYNAMIC_INDICES."); + AssertFatal(numIndices < GFX_MAX_DYNAMIC_INDICES, "Cannot allocate that many indices in a volatile buffer, increase GFX_MAX_DYNAMIC_INDICES."); res->ib = mDynamicPB->ib; res->mVolatileBuffer = mDynamicPB; @@ -1362,7 +1362,7 @@ GFXVertexBuffer * GFXD3D11Device::allocVertexBuffer(U32 numVerts, const GFXVerte if(bufferType == GFXBufferTypeVolatile) { // NOTE: Volatile VBs are pooled and will be allocated at lock time. - AssertFatal(numVerts <= MAX_DYNAMIC_VERTS, "GFXD3D11Device::allocVertexBuffer - Volatile vertex buffer is too big... see MAX_DYNAMIC_VERTS!"); + AssertFatal(numVerts <= GFX_MAX_DYNAMIC_VERTS, "GFXD3D11Device::allocVertexBuffer - Volatile vertex buffer is too big... see GFX_MAX_DYNAMIC_VERTS!"); } else { diff --git a/Engine/source/gfx/D3D11/gfxD3D11Device.h b/Engine/source/gfx/D3D11/gfxD3D11Device.h index b60e5d2a6..c1b775152 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11Device.h +++ b/Engine/source/gfx/D3D11/gfxD3D11Device.h @@ -176,11 +176,6 @@ protected: /// Called by base GFXDevice to actually set a const buffer virtual void setShaderConstBufferInternal(GFXShaderConstBuffer* buffer); - virtual void setMatrix( GFXMatrixType /*mtype*/, const MatrixF &/*mat*/ ) { }; - virtual void setLightInternal(U32 /*lightStage*/, const GFXLightInfo /*light*/, bool /*lightEnable*/) { }; - virtual void setLightMaterialInternal(const GFXLightMaterial /*mat*/) { }; - virtual void setGlobalAmbientInternal(LinearColorF /*color*/) { }; - // } // Index buffer management @@ -286,8 +281,8 @@ public: virtual void setVertexStreamFrequency( U32 stream, U32 frequency ); // } - virtual U32 getMaxDynamicVerts() { return MAX_DYNAMIC_VERTS; } - virtual U32 getMaxDynamicIndices() { return MAX_DYNAMIC_INDICES; } + virtual U32 getMaxDynamicVerts() { return GFX_MAX_DYNAMIC_VERTS; } + virtual U32 getMaxDynamicIndices() { return GFX_MAX_DYNAMIC_INDICES; } inline U32 primCountToIndexCount(GFXPrimitiveType primType, U32 primitiveCount); diff --git a/Engine/source/gfx/D3D11/gfxD3D11EnumTranslate.cpp b/Engine/source/gfx/D3D11/gfxD3D11EnumTranslate.cpp index 6e1b7688c..60982078a 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11EnumTranslate.cpp +++ b/Engine/source/gfx/D3D11/gfxD3D11EnumTranslate.cpp @@ -87,8 +87,6 @@ void GFXD3D11EnumTranslate::init() GFXD3D11TextureFilter[GFXTextureFilterPoint] = D3D11_FILTER_MIN_MAG_MIP_POINT; GFXD3D11TextureFilter[GFXTextureFilterLinear] = D3D11_FILTER_MIN_MAG_MIP_LINEAR; GFXD3D11TextureFilter[GFXTextureFilterAnisotropic] = D3D11_FILTER_ANISOTROPIC; - GFXD3D11TextureFilter[GFXTextureFilterPyramidalQuad] = D3D11_FILTER_ANISOTROPIC; - GFXD3D11TextureFilter[GFXTextureFilterGaussianQuad] = D3D11_FILTER_ANISOTROPIC; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ GFXD3D11Blend[GFXBlendZero] = D3D11_BLEND_ZERO; diff --git a/Engine/source/gfx/D3D11/gfxD3D11PrimitiveBuffer.cpp b/Engine/source/gfx/D3D11/gfxD3D11PrimitiveBuffer.cpp index 74e5dbc4e..532750331 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11PrimitiveBuffer.cpp +++ b/Engine/source/gfx/D3D11/gfxD3D11PrimitiveBuffer.cpp @@ -48,7 +48,7 @@ void GFXD3D11PrimitiveBuffer::lock(U32 indexStart, U32 indexEnd, void **indexPtr case GFXBufferTypeVolatile: // Get our range now... AssertFatal(indexStart == 0, "Cannot get a subrange on a volatile buffer."); - AssertFatal(indexEnd < MAX_DYNAMIC_INDICES, "Cannot get more than MAX_DYNAMIC_INDICES in a volatile buffer. Up the constant!"); + AssertFatal(indexEnd < GFX_MAX_DYNAMIC_INDICES, "Cannot get more than GFX_MAX_DYNAMIC_INDICES in a volatile buffer. Up the constant!"); // Get the primtive buffer mVolatileBuffer = D3D11->mDynamicPB; @@ -56,7 +56,7 @@ void GFXD3D11PrimitiveBuffer::lock(U32 indexStart, U32 indexEnd, void **indexPtr AssertFatal( mVolatileBuffer, "GFXD3D11PrimitiveBuffer::lock - No dynamic primitive buffer was available!"); // We created the pool when we requested this volatile buffer, so assume it exists... - if(mVolatileBuffer->mIndexCount + indexEnd > MAX_DYNAMIC_INDICES) + if(mVolatileBuffer->mIndexCount + indexEnd > GFX_MAX_DYNAMIC_INDICES) { flags = D3D11_MAP_WRITE_DISCARD; mVolatileStart = indexStart = 0; diff --git a/Engine/source/gfx/D3D11/gfxD3D11StateBlock.h b/Engine/source/gfx/D3D11/gfxD3D11StateBlock.h index d6988dead..e2205b036 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11StateBlock.h +++ b/Engine/source/gfx/D3D11/gfxD3D11StateBlock.h @@ -63,12 +63,12 @@ private: D3D11_BLEND_DESC mBlendDesc; D3D11_RASTERIZER_DESC mRasterizerDesc; D3D11_DEPTH_STENCIL_DESC mDepthStencilDesc; - D3D11_SAMPLER_DESC mSamplerDesc[TEXTURE_STAGE_COUNT]; + D3D11_SAMPLER_DESC mSamplerDesc[GFX_TEXTURE_STAGE_COUNT]; ID3D11BlendState* mBlendState; ID3D11DepthStencilState* mDepthStencilState; ID3D11RasterizerState* mRasterizerState; - ID3D11SamplerState* mSamplerStates[TEXTURE_STAGE_COUNT]; + ID3D11SamplerState* mSamplerStates[GFX_TEXTURE_STAGE_COUNT]; GFXStateBlockDesc mDesc; U32 mCachedHashValue; diff --git a/Engine/source/gfx/D3D11/gfxD3D11TextureManager.h b/Engine/source/gfx/D3D11/gfxD3D11TextureManager.h index fa32941d8..9698f4a6e 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11TextureManager.h +++ b/Engine/source/gfx/D3D11/gfxD3D11TextureManager.h @@ -54,7 +54,7 @@ protected: bool _freeTexture(GFXTextureObject *texture, bool zombify = false); private: - U32 mCurTexSet[TEXTURE_STAGE_COUNT]; + U32 mCurTexSet[GFX_TEXTURE_STAGE_COUNT]; void _innerCreateTexture(GFXD3D11TextureObject *obj, U32 height, U32 width, U32 depth, GFXFormat format, GFXTextureProfile *profile, U32 numMipLevels, bool forceMips = false, S32 antialiasLevel = 0); }; diff --git a/Engine/source/gfx/D3D11/gfxD3D11VertexBuffer.cpp b/Engine/source/gfx/D3D11/gfxD3D11VertexBuffer.cpp index 1a8729e76..f131111a5 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11VertexBuffer.cpp +++ b/Engine/source/gfx/D3D11/gfxD3D11VertexBuffer.cpp @@ -62,11 +62,11 @@ void GFXD3D11VertexBuffer::lock(U32 vertexStart, U32 vertexEnd, void **vertexPtr // Get our range now... AssertFatal(vertexStart == 0, "Cannot get a subrange on a volatile buffer."); - AssertFatal(vertexEnd <= MAX_DYNAMIC_VERTS, "Cannot get more than MAX_DYNAMIC_VERTS in a volatile buffer. Up the constant!"); + AssertFatal(vertexEnd <= GFX_MAX_DYNAMIC_VERTS, "Cannot get more than GFX_MAX_DYNAMIC_VERTS in a volatile buffer. Up the constant!"); AssertFatal(mVolatileBuffer->lockedVertexStart == 0 && mVolatileBuffer->lockedVertexEnd == 0, "Got more than one lock on the volatile pool."); // We created the pool when we requested this volatile buffer, so assume it exists... - if( mVolatileBuffer->mNumVerts + vertexEnd > MAX_DYNAMIC_VERTS ) + if( mVolatileBuffer->mNumVerts + vertexEnd > GFX_MAX_DYNAMIC_VERTS ) { flags = D3D11_MAP_WRITE_DISCARD; mVolatileStart = vertexStart = 0; diff --git a/Engine/source/gfx/Null/gfxNullDevice.cpp b/Engine/source/gfx/Null/gfxNullDevice.cpp index 92e688a48..98f6c87e2 100644 --- a/Engine/source/gfx/Null/gfxNullDevice.cpp +++ b/Engine/source/gfx/Null/gfxNullDevice.cpp @@ -354,11 +354,6 @@ void GFXNullDevice::enumerateAdapters( Vector &adapterList ) adapterList.push_back(toAdd); } -void GFXNullDevice::setLightInternal(U32 lightStage, const GFXLightInfo light, bool lightEnable) -{ - -} - void GFXNullDevice::init( const GFXVideoMode &mode, PlatformWindow *window ) { mCardProfiler = new GFXNullCardProfiler(); diff --git a/Engine/source/gfx/Null/gfxNullDevice.h b/Engine/source/gfx/Null/gfxNullDevice.h index e50c3583b..320c3fee1 100644 --- a/Engine/source/gfx/Null/gfxNullDevice.h +++ b/Engine/source/gfx/Null/gfxNullDevice.h @@ -99,9 +99,6 @@ protected: virtual void setTextureInternal(U32 textureUnit, const GFXTextureObject*texture) { }; - virtual void setLightInternal(U32 lightStage, const GFXLightInfo light, bool lightEnable); - virtual void setLightMaterialInternal(const GFXLightMaterial mat) { }; - virtual void setGlobalAmbientInternal(LinearColorF color) { }; /// @name State Initalization. /// @{ @@ -110,8 +107,6 @@ protected: /// is created. virtual void initStates() { }; - virtual void setMatrix( GFXMatrixType mtype, const MatrixF &mat ) { }; - virtual GFXVertexBuffer *allocVertexBuffer( U32 numVerts, const GFXVertexFormat *vertexFormat, U32 vertSize, diff --git a/Engine/source/gfx/bitmap/gBitmap.cpp b/Engine/source/gfx/bitmap/gBitmap.cpp index b317107f2..a31e81faf 100644 --- a/Engine/source/gfx/bitmap/gBitmap.cpp +++ b/Engine/source/gfx/bitmap/gBitmap.cpp @@ -882,20 +882,8 @@ U8 GBitmap::getChanelValueAt(U32 x, U32 y, U32 chan) //----------------------------------------------------------------------------- -bool GBitmap::combine( const GBitmap *bitmapA, const GBitmap *bitmapB, const GFXTextureOp combineOp ) +bool GBitmap::combine( const GBitmap *bitmapA, const GBitmap *bitmapB, const TextureOp combineOp ) { - // Check valid texture ops - switch( combineOp ) - { - case GFXTOPAdd: - case GFXTOPSubtract: - break; - - default: - Con::errorf( "GBitmap::combine - Invalid op type" ); - return false; - } - // Check bitmapA format switch( bitmapA->getFormat() ) { @@ -970,11 +958,11 @@ bool GBitmap::combine( const GBitmap *bitmapA, const GBitmap *bitmapB, const GFX // Combine them (clamp values 0-U8_MAX) switch( combineOp ) { - case GFXTOPAdd: + case Add: *destBits++ = getMin( U8( pxA + pxB ), U8_MAX ); break; - case GFXTOPSubtract: + case Subtract: *destBits++ = getMax( U8( pxA - pxB ), U8( 0 ) ); break; default: diff --git a/Engine/source/gfx/bitmap/gBitmap.h b/Engine/source/gfx/bitmap/gBitmap.h index 00960c047..dbae0f876 100644 --- a/Engine/source/gfx/bitmap/gBitmap.h +++ b/Engine/source/gfx/bitmap/gBitmap.h @@ -62,6 +62,12 @@ public: c_maxMipLevels = 13 }; + enum TextureOp + { + Add, + Subtract + }; + struct Registration { /// The read function prototype. @@ -218,7 +224,7 @@ public: /// /// @note There are some restrictions on ops and formats that will probably change /// based on how we use this function. - bool combine( const GBitmap *bitmapA, const GBitmap *bitmapB, const GFXTextureOp combineOp ); + bool combine( const GBitmap *bitmapA, const GBitmap *bitmapB, const TextureOp combineOp ); /// Fills the first mip level of the bitmap with the specified color. void fill( const ColorI &rColor ); diff --git a/Engine/source/gfx/gfxAPI.cpp b/Engine/source/gfx/gfxAPI.cpp index d4e614276..6c59e2ff4 100644 --- a/Engine/source/gfx/gfxAPI.cpp +++ b/Engine/source/gfx/gfxAPI.cpp @@ -98,74 +98,9 @@ ImplementEnumType( GFXTextureFilterType, { GFXTextureFilterPoint, "GFXTextureFilterPoint" }, { GFXTextureFilterLinear, "GFXTextureFilterLinear" }, { GFXTextureFilterAnisotropic, "GFXTextureFilterAnisotropic" }, - { GFXTextureFilterPyramidalQuad, "GFXTextureFilterPyramidalQuad" }, - { GFXTextureFilterGaussianQuad, "GFXTextureFilterGaussianQuad" } EndImplementEnumType; -ImplementEnumType( GFXTextureOp, - "The texture operators.\n" - "@ingroup GFX" ) - - { GFXTOPDisable, "GFXTOPDisable" }, - { GFXTOPSelectARG1, "GFXTOPSelectARG1" }, - { GFXTOPSelectARG2, "GFXTOPSelectARG2" }, - { GFXTOPModulate, "GFXTOPModulate" }, - { GFXTOPModulate2X, "GFXTOPModulate2X" }, - { GFXTOPModulate4X, "GFXTOPModulate4X" }, - { GFXTOPAdd, "GFXTOPAdd" }, - { GFXTOPAddSigned, "GFXTOPAddSigned" }, - { GFXTOPAddSigned2X, "GFXTOPAddSigned2X" }, - { GFXTOPSubtract, "GFXTOPSubtract" }, - { GFXTOPAddSmooth, "GFXTOPAddSmooth" }, - { GFXTOPBlendDiffuseAlpha, "GFXTOPBlendDiffuseAlpha" }, - { GFXTOPBlendTextureAlpha, "GFXTOPBlendTextureAlpha" }, - { GFXTOPBlendFactorAlpha, "GFXTOPBlendFactorAlpha" }, - { GFXTOPBlendTextureAlphaPM, "GFXTOPBlendTextureAlphaPM" }, - { GFXTOPBlendCURRENTALPHA, "GFXTOPBlendCURRENTALPHA" }, - { GFXTOPPreModulate, "GFXTOPPreModulate" }, - { GFXTOPModulateAlphaAddColor, "GFXTOPModulateAlphaAddColor" }, - { GFXTOPModulateColorAddAlpha, "GFXTOPModulateColorAddAlpha" }, - { GFXTOPModulateInvAlphaAddColor, "GFXTOPModulateInvAlphaAddColor" }, - { GFXTOPModulateInvColorAddAlpha, "GFXTOPModulateInvColorAddAlpha" }, - { GFXTOPBumpEnvMap, "GFXTOPBumpEnvMap" }, - { GFXTOPBumpEnvMapLuminance, "GFXTOPBumpEnvMapLuminance" }, - { GFXTOPDotProduct3, "GFXTOPDotProduct3" }, - { GFXTOPLERP, "GFXTOPLERP" } - -EndImplementEnumType; - -ImplementEnumType( GFXTextureArgument, - "The texture arguments.\n" - "@ingroup GFX" ) - - { GFXTADiffuse, "GFXTADiffuse" }, - { GFXTACurrent, "GFXTACurrent" }, - { GFXTATexture, "GFXTATexture" }, - { GFXTATFactor, "GFXTATFactor" }, - { GFXTASpecular, "GFXTASpecular" }, - { GFXTATemp, "GFXTATemp" }, - { GFXTAConstant, "GFXTAConstant" }, - - { GFXTAComplement, "OneMinus" }, - { GFXTAAlphaReplicate, "AlphaReplicate" } - -EndImplementEnumType; - -ImplementEnumType( GFXTextureTransformFlags, - "The texture transform state flags.\n" - "@ingroup GFX" ) - - { GFXTTFFDisable, "GFXTTFDisable" }, - { GFXTTFFCoord1D, "GFXTTFFCoord1D" }, - { GFXTTFFCoord2D, "GFXTTFFCoord2D" }, - { GFXTTFFCoord3D, "GFXTTFFCoord3D" }, - { GFXTTFFCoord4D, "GFXTTFFCoord4D" }, - { GFXTTFFProjected, "GFXTTFProjected" } - -EndImplementEnumType; - - ImplementEnumType( GFXFormat, "The texture formats.\n" "@note Not all formats are supported on all platforms.\n" diff --git a/Engine/source/gfx/gfxAPI.h b/Engine/source/gfx/gfxAPI.h index 1faedff2a..2c7f420d0 100644 --- a/Engine/source/gfx/gfxAPI.h +++ b/Engine/source/gfx/gfxAPI.h @@ -40,10 +40,7 @@ DefineEnumType( GFXBlend ); DefineEnumType( GFXCmpFunc ); DefineEnumType( GFXTextureAddressMode ); DefineEnumType( GFXFormat ); -DefineEnumType( GFXTextureTransformFlags ); DefineEnumType( GFXTextureFilterType ); -DefineEnumType( GFXTextureOp ); -DefineEnumType( GFXTextureArgument ); DefineEnumType( GFXCullMode ); DefineEnumType( GFXStencilOp ); DefineEnumType( GFXBlendOp ); @@ -56,10 +53,7 @@ DefineConsoleType( TypeGFXBlend, GFXBlend ); DefineConsoleType( TypeGFXCmpFunc, GFXCmpFunc ); DefineConsoleType( TypeGFXTextureAddressMode, GFXTextureAddressMode ); DefineConsoleType( TypeGFXFormat, GFXFormat ); -DefineConsoleType( TypeGFXTextureTransformFlags, GFXTextureTransformFlags ); DefineConsoleType( TypeGFXTextureFilterType, GFXTextureFilterType ); -DefineConsoleType( TypeGFXTextureOp, GFXTextureOp ); -DefineConsoleType( TypeGFXTextureArgument, GFXTextureArgument ); DefineConsoleType( TypeGFXCullMode, GFXCullMode ); DefineConsoleType( TypeGFXStencilOp, GFXStencilOp ); DefineConsoleType( TypeGFXBlendOp, GFXBlendOp ); diff --git a/Engine/source/gfx/gfxDevice.cpp b/Engine/source/gfx/gfxDevice.cpp index 5dfc4dab2..9895057a7 100644 --- a/Engine/source/gfx/gfxDevice.cpp +++ b/Engine/source/gfx/gfxDevice.cpp @@ -94,16 +94,12 @@ GFXDevice::GFXDevice() VECTOR_SET_ASSOCIATION( mVideoModes ); VECTOR_SET_ASSOCIATION( mRTStack ); - mWorldMatrixDirty = false; mWorldStackSize = 0; - mProjectionMatrixDirty = false; - mViewMatrixDirty = false; - mTextureMatrixCheckDirty = false; mViewMatrix.identity(); mProjectionMatrix.identity(); - for( S32 i = 0; i < WORLD_STACK_MAX; i++ ) + for( S32 i = 0; i < GFX_WORLD_STACK_MAX; i++ ) mWorldMatrix[i].identity(); AssertFatal(smGFXDevice == NULL, "Already a GFXDevice created! Bad!"); @@ -123,8 +119,8 @@ GFXDevice::GFXDevice() mPrimitiveBufferDirty = false; mTexturesDirty = false; - // Use of TEXTURE_STAGE_COUNT in initialization is okay [7/2/2007 Pat] - for(U32 i = 0; i < TEXTURE_STAGE_COUNT; i++) + // Use of GFX_TEXTURE_STAGE_COUNT in initialization is okay [7/2/2007 Pat] + for(U32 i = 0; i < GFX_TEXTURE_STAGE_COUNT; i++) { mTextureDirty[i] = false; mCurrentTexture[i] = NULL; @@ -136,24 +132,8 @@ GFXDevice::GFXDevice() mCurrentTextureArray[i] = NULL; mNewCubemapArray[i] = NULL; mTexType[i] = GFXTDT_Normal; - - mTextureMatrix[i].identity(); - mTextureMatrixDirty[i] = false; } - mLightsDirty = false; - for(U32 i = 0; i < LIGHT_STAGE_COUNT; i++) - { - mLightDirty[i] = false; - mCurrentLightEnable[i] = false; - } - - mGlobalAmbientColorDirty = false; - mGlobalAmbientColor = LinearColorF(0.0f, 0.0f, 0.0f, 1.0f); - - mLightMaterialDirty = false; - dMemset(&mCurrentLightMaterial, 0, sizeof(GFXLightMaterial)); - // State block mStateBlockDirty = false; mCurrentStateBlock = NULL; @@ -173,8 +153,6 @@ GFXDevice::GFXDevice() mViewport = RectI::Zero; mViewportDirty = false; - mCurrentFrontBufferIdx = 0; - mDeviceSwizzle32 = NULL; mDeviceSwizzle24 = NULL; @@ -260,7 +238,7 @@ GFXDevice::~GFXDevice() mCurrentVertexBuffer[i] = NULL; // Clear out our current texture references - for (U32 i = 0; i < TEXTURE_STAGE_COUNT; i++) + for (U32 i = 0; i < GFX_TEXTURE_STAGE_COUNT; i++) { mCurrentTexture[i] = NULL; mNewTexture[i] = NULL; @@ -367,10 +345,6 @@ void GFXDevice::updateStates(bool forceSetAll /*=false*/) rememberToEndScene = true; } - setMatrix( GFXMatrixProjection, mProjectionMatrix ); - setMatrix( GFXMatrixWorld, mWorldMatrix[mWorldStackSize] ); - setMatrix( GFXMatrixView, mViewMatrix ); - setVertexDecl( mCurrVertexDecl ); for ( U32 i=0; i < VERTEX_STREAM_COUNT; i++ ) @@ -430,15 +404,6 @@ void GFXDevice::updateStates(bool forceSetAll /*=false*/) } } - // Set our material - setLightMaterialInternal(mCurrentLightMaterial); - - // Set our lights - for(U32 i = 0; i < LIGHT_STAGE_COUNT; i++) - { - setLightInternal(i, mCurrentLight[i], mCurrentLightEnable[i]); - } - _updateRenderTargets(); if(rememberToEndScene) @@ -453,42 +418,6 @@ void GFXDevice::updateStates(bool forceSetAll /*=false*/) // Normal update logic begins here. mStateDirty = false; - // Update Projection Matrix - if( mProjectionMatrixDirty ) - { - setMatrix( GFXMatrixProjection, mProjectionMatrix ); - mProjectionMatrixDirty = false; - } - - // Update World Matrix - if( mWorldMatrixDirty ) - { - setMatrix( GFXMatrixWorld, mWorldMatrix[mWorldStackSize] ); - mWorldMatrixDirty = false; - } - - // Update View Matrix - if( mViewMatrixDirty ) - { - setMatrix( GFXMatrixView, mViewMatrix ); - mViewMatrixDirty = false; - } - - - if( mTextureMatrixCheckDirty ) - { - for( S32 i = 0; i < getNumSamplers(); i++ ) - { - if( mTextureMatrixDirty[i] ) - { - mTextureMatrixDirty[i] = false; - setMatrix( (GFXMatrixType)(GFXMatrixTexture + i), mTextureMatrix[i] ); - } - } - - mTextureMatrixCheckDirty = false; - } - // Update the vertex declaration. if ( mVertexDeclDirty ) { @@ -587,27 +516,6 @@ void GFXDevice::updateStates(bool forceSetAll /*=false*/) } } } - - // Set light material - if(mLightMaterialDirty) - { - setLightMaterialInternal(mCurrentLightMaterial); - mLightMaterialDirty = false; - } - - // Set our lights - if(mLightsDirty) - { - mLightsDirty = false; - for(U32 i = 0; i < LIGHT_STAGE_COUNT; i++) - { - if(!mLightDirty[i]) - continue; - - mLightDirty[i] = false; - setLightInternal(i, mCurrentLight[i], mCurrentLightEnable[i]); - } - } _updateRenderTargets(); @@ -762,43 +670,6 @@ Point2F GFXDevice::getWorldToScreenScale() const return scale; } -//----------------------------------------------------------------------------- -// Set Light -//----------------------------------------------------------------------------- -void GFXDevice::setLight(U32 stage, GFXLightInfo* light) -{ - AssertFatal(stage < LIGHT_STAGE_COUNT, "GFXDevice::setLight - out of range stage!"); - - if(!mLightDirty[stage]) - { - mStateDirty = true; - mLightsDirty = true; - mLightDirty[stage] = true; - } - mCurrentLightEnable[stage] = (light != NULL); - if(mCurrentLightEnable[stage]) - mCurrentLight[stage] = *light; -} - -//----------------------------------------------------------------------------- -// Set Light Material -//----------------------------------------------------------------------------- -void GFXDevice::setLightMaterial(const GFXLightMaterial& mat) -{ - mCurrentLightMaterial = mat; - mLightMaterialDirty = true; - mStateDirty = true; -} - -void GFXDevice::setGlobalAmbientColor(const LinearColorF& color) -{ - if(mGlobalAmbientColor != color) - { - mGlobalAmbientColor = color; - mGlobalAmbientColorDirty = true; - } -} - //----------------------------------------------------------------------------- // Set texture //----------------------------------------------------------------------------- diff --git a/Engine/source/gfx/gfxDevice.h b/Engine/source/gfx/gfxDevice.h index 4caecd55b..8c022115a 100644 --- a/Engine/source/gfx/gfxDevice.h +++ b/Engine/source/gfx/gfxDevice.h @@ -72,9 +72,7 @@ class GFXShaderConstBuffer; class GFXTextureManager; // Global macro -#define GFX GFXDevice::get() - -#define MAX_MRT_TARGETS 4 +#define GFX GFXDevice::get() //----------------------------------------------------------------------------- @@ -185,10 +183,6 @@ private: friend class GFXTextureObject; friend class GFXTexHandle; friend class GFXVertexFormat; - friend class GFXTestFullscreenToggle; - friend class TestGFXTextureCube; - friend class TestGFXRenderTargetCube; - friend class TestGFXRenderTargetStack; friend class GFXResource; friend class LightMatInstance; // For stencil interface @@ -220,11 +214,11 @@ public: /// The device has started rendering a frame's field (such as for side-by-side rendering) deStartOfField, - /// left stereo frame has been rendered - deLeftStereoFrameRendered, + /// left stereo frame has been rendered + deLeftStereoFrameRendered, - /// right stereo frame has been rendered - deRightStereoFrameRendered, + /// right stereo frame has been rendered + deRightStereoFrameRendered, /// The device is about to finish rendering a frame's field deEndOfField, @@ -255,7 +249,7 @@ public: { RS_Standard = 0, RS_StereoSideBySide = (1<<0), // Render into current Render Target side-by-side - RS_StereoSeparate = (1<<1) // Render in two separate passes (then combined by vr compositor) + RS_StereoSeparate = (1<<1) // Render in two separate passes (then combined by vr compositor) }; enum GFXDeviceLimits @@ -503,17 +497,17 @@ protected: GFXTDT_TextureArray }; - GFXTexHandle mCurrentTexture[TEXTURE_STAGE_COUNT]; - GFXTexHandle mNewTexture[TEXTURE_STAGE_COUNT]; - GFXCubemapHandle mCurrentCubemap[TEXTURE_STAGE_COUNT]; - GFXCubemapHandle mNewCubemap[TEXTURE_STAGE_COUNT]; - GFXCubemapArrayHandle mCurrentCubemapArray[TEXTURE_STAGE_COUNT]; - GFXCubemapArrayHandle mNewCubemapArray[TEXTURE_STAGE_COUNT]; - GFXTextureArrayHandle mCurrentTextureArray[TEXTURE_STAGE_COUNT]; - GFXTextureArrayHandle mNewTextureArray[TEXTURE_STAGE_COUNT]; + GFXTexHandle mCurrentTexture[GFX_TEXTURE_STAGE_COUNT]; + GFXTexHandle mNewTexture[GFX_TEXTURE_STAGE_COUNT]; + GFXCubemapHandle mCurrentCubemap[GFX_TEXTURE_STAGE_COUNT]; + GFXCubemapHandle mNewCubemap[GFX_TEXTURE_STAGE_COUNT]; + GFXCubemapArrayHandle mCurrentCubemapArray[GFX_TEXTURE_STAGE_COUNT]; + GFXCubemapArrayHandle mNewCubemapArray[GFX_TEXTURE_STAGE_COUNT]; + GFXTextureArrayHandle mCurrentTextureArray[GFX_TEXTURE_STAGE_COUNT]; + GFXTextureArrayHandle mNewTextureArray[GFX_TEXTURE_STAGE_COUNT]; - TexDirtyType mTexType[TEXTURE_STAGE_COUNT]; - bool mTextureDirty[TEXTURE_STAGE_COUNT]; + TexDirtyType mTexType[GFX_TEXTURE_STAGE_COUNT]; + bool mTextureDirty[GFX_TEXTURE_STAGE_COUNT]; bool mTexturesDirty; // This maps a GFXStateBlockDesc hash value to a GFXStateBlockRef @@ -542,60 +536,26 @@ protected: /// @} - /// @name Light Tracking - /// @{ - - GFXLightInfo mCurrentLight[LIGHT_STAGE_COUNT]; - bool mCurrentLightEnable[LIGHT_STAGE_COUNT]; - bool mLightDirty[LIGHT_STAGE_COUNT]; - bool mLightsDirty; - - LinearColorF mGlobalAmbientColor; - bool mGlobalAmbientColorDirty; - - /// @} - - /// @name Fixed function material tracking - /// @{ - - GFXLightMaterial mCurrentLightMaterial; - bool mLightMaterialDirty; - - /// @} - - /// @name Bitmap modulation and color stack - /// @{ - - /// - - /// @} - /// @see getDeviceSwizzle32 Swizzle *mDeviceSwizzle32; /// @see getDeviceSwizzle24 Swizzle *mDeviceSwizzle24; - //----------------------------------------------------------------------------- /// @name Matrix managing variables /// @{ /// - MatrixF mWorldMatrix[WORLD_STACK_MAX]; - bool mWorldMatrixDirty; + MatrixF mWorldMatrix[GFX_WORLD_STACK_MAX]; + S32 mWorldStackSize; MatrixF mProjectionMatrix; - bool mProjectionMatrixDirty; MatrixF mViewMatrix; - bool mViewMatrixDirty; - MatrixF mTextureMatrix[TEXTURE_STAGE_COUNT]; - bool mTextureMatrixDirty[TEXTURE_STAGE_COUNT]; - bool mTextureMatrixCheckDirty; /// @} /// @name Current frustum planes @@ -621,10 +581,6 @@ protected: virtual void setTextureInternal(U32 textureUnit, const GFXTextureObject*texture) = 0; - virtual void setLightInternal(U32 lightStage, const GFXLightInfo light, bool lightEnable) = 0; - virtual void setGlobalAmbientInternal(LinearColorF color) = 0; - virtual void setLightMaterialInternal(const GFXLightMaterial mat) = 0; - virtual bool beginSceneInternal() = 0; virtual void endSceneInternal() = 0; @@ -637,21 +593,6 @@ protected: /// @} //----------------------------------------------------------------------------- - - /// This function must be implemented differently per - /// API and it should set ONLY the current matrix. - /// For example, in OpenGL, there should be NO matrix stack - /// activity, all the stack stuff is managed in the GFX layer. - /// - /// OpenGL does not have separate world and - /// view matrices. It has ModelView which is world * view. - /// You must take this into consideration. - /// - /// @param mtype Which matrix to set, world/view/projection - /// @param mat Matrix to assign - virtual void setMatrix( GFXMatrixType mtype, const MatrixF &mat ) = 0; - - //----------------------------------------------------------------------------- protected: @@ -711,14 +652,8 @@ protected: /// @} - //--------------------------------------- - // SFX buffer - //--------------------------------------- protected: - GFXTexHandle mFrontBuffer[2]; - U32 mCurrentFrontBufferIdx; - //--------------------------------------- // Render target related //--------------------------------------- @@ -850,8 +785,6 @@ public: virtual void endField(); PlatformTimer *mFrameTime; - virtual GFXTexHandle & getFrontBuffer(){ return mFrontBuffer[mCurrentFrontBufferIdx]; } - void setPrimitiveBuffer( GFXPrimitiveBuffer *buffer ); /// Sets the vertex buffer. @@ -924,7 +857,6 @@ public: void drawPrimitive( const GFXPrimitive &prim ); void drawPrimitive( U32 primitiveIndex ); void drawPrimitives(); - void drawPrimitiveBuffer( GFXPrimitiveBuffer *buffer ); /// @} //----------------------------------------------------------------------------- @@ -936,18 +868,8 @@ public: /// Returns a hardware occlusion query object or NULL /// if this device does not support them. - virtual GFXOcclusionQuery* createOcclusionQuery() { return NULL; } - - /// @name Light Settings - /// NONE of these should be overridden by API implementations - /// because of the state caching stuff. - /// @{ - void setLight(U32 stage, GFXLightInfo* light); - void setLightMaterial(const GFXLightMaterial& mat); - void setGlobalAmbientColor(const LinearColorF& color); - - /// @} - + virtual GFXOcclusionQuery* createOcclusionQuery() { return NULL; } + /// @name Texture State Settings /// NONE of these should be overridden by API implementations /// because of the state caching stuff. @@ -1136,23 +1058,20 @@ public: inline void GFXDevice::setWorldMatrix( const MatrixF &newWorld ) { - mWorldMatrixDirty = true; mStateDirty = true; mWorldMatrix[mWorldStackSize] = newWorld; } inline void GFXDevice::pushWorldMatrix() { - mWorldMatrixDirty = true; mStateDirty = true; mWorldStackSize++; - AssertFatal( mWorldStackSize < WORLD_STACK_MAX, "GFX: Exceeded world matrix stack size" ); + AssertFatal( mWorldStackSize < GFX_WORLD_STACK_MAX, "GFX: Exceeded world matrix stack size" ); mWorldMatrix[mWorldStackSize] = mWorldMatrix[mWorldStackSize - 1]; } inline void GFXDevice::popWorldMatrix() { - mWorldMatrixDirty = true; mStateDirty = true; mWorldStackSize--; AssertFatal( mWorldStackSize >= 0, "GFX: Negative WorldStackSize!" ); @@ -1160,14 +1079,12 @@ inline void GFXDevice::popWorldMatrix() inline void GFXDevice::multWorld( const MatrixF &mat ) { - mWorldMatrixDirty = true; mStateDirty = true; mWorldMatrix[mWorldStackSize].mul(mat); } inline void GFXDevice::setProjectionMatrix( const MatrixF &newProj ) { - mProjectionMatrixDirty = true; mStateDirty = true; mProjectionMatrix = newProj; } @@ -1175,19 +1092,9 @@ inline void GFXDevice::setProjectionMatrix( const MatrixF &newProj ) inline void GFXDevice::setViewMatrix( const MatrixF &newView ) { mStateDirty = true; - mViewMatrixDirty = true; mViewMatrix = newView; } -inline void GFXDevice::setTextureMatrix( const U32 stage, const MatrixF &texMat ) -{ - AssertFatal( stage < TEXTURE_STAGE_COUNT, "Out of range texture sampler" ); - mStateDirty = true; - mTextureMatrixDirty[stage] = true; - mTextureMatrix[stage] = texMat; - mTextureMatrixCheckDirty = true; -} - //----------------------------------------------------------------------------- // Buffer management diff --git a/Engine/source/gfx/gfxEnums.h b/Engine/source/gfx/gfxEnums.h index 748afacd4..1b2301eed 100644 --- a/Engine/source/gfx/gfxEnums.h +++ b/Engine/source/gfx/gfxEnums.h @@ -27,31 +27,35 @@ // These are for the enum translation. It will help with porting to other platforms // and API's. -#define GFX_UNSUPPORTED_VAL 0xDEADBEEF -#define GFX_UNINIT_VAL 0xDECAFBAD +#define GFX_UNSUPPORTED_VAL 0xDEADBEEFULL +#define GFX_UNINIT_VAL 0xDECAFBADULL // Adjust these pools to your app's needs. Be aware dynamic vertices are much more // expensive than static vertices. These are in gfxEnums because they should be // consistant across all APIs/platforms so that the dynamic buffer performance // and behavior is also consistant. -patw -#define MAX_DYNAMIC_VERTS (8192*2) -#define MAX_DYNAMIC_INDICES (8192*4) +#define GFX_MAX_DYNAMIC_VERTS (8192*2) +#define GFX_MAX_DYNAMIC_INDICES (8192*4) + +#define GFX_WORLD_STACK_MAX 24 + +#define GFX_TEXTURE_STAGE_COUNT 16 enum GFXBufferType { - GFXBufferTypeStatic, ///< Static vertex buffers are created and rarely updated. - ///< Updating might incur a performance penalty. Resizing a static vertex buffer is not - ///< allowed. - GFXBufferTypeDynamic, ///< Dynamic vertex buffers are meant for vertices that can be changed - ///< often. Vertices written into dynamic vertex buffers will remain valid - ///< until the dynamic vertex buffer is released. Resizing a dynamic vertex buffer is not - ///< allowed. - GFXBufferTypeVolatile, ///< Volatile vertex or index buffers are meant for vertices or indices that are essentially - ///< only used once. They can be resized without any performance penalty. + GFXBufferTypeStatic, ///< Static vertex buffers are created and rarely updated. + ///< Updating might incur a performance penalty. Resizing a static vertex buffer is not + ///< allowed. + GFXBufferTypeDynamic, ///< Dynamic vertex buffers are meant for vertices that can be changed + ///< often. Vertices written into dynamic vertex buffers will remain valid + ///< until the dynamic vertex buffer is released. Resizing a dynamic vertex buffer is not + ///< allowed. + GFXBufferTypeVolatile, ///< Volatile vertex or index buffers are meant for vertices or indices that are essentially + ///< only used once. They can be resized without any performance penalty. - GFXBufferTypeImmutable, ///< Immutable buffers must specify the data when creating the buffer. Cannot be modified. + GFXBufferTypeImmutable, ///< Immutable buffers must specify the data when creating the buffer. Cannot be modified. - GFXBufferType_COUNT ///< Number of buffer types. + GFXBufferType_COUNT ///< Number of buffer types. }; enum GFXTexCallbackCode @@ -60,7 +64,6 @@ enum GFXTexCallbackCode GFXResurrect, }; - enum GFXPrimitiveType { GFXPT_FIRST = 0, @@ -72,15 +75,6 @@ enum GFXPrimitiveType GFXPT_COUNT }; -enum GFXTextureType -{ - GFXTextureType_Normal, - GFXTextureType_KeepBitmap, - GFXTextureType_Dynamic, - GFXTextureType_RenderTarget, - GFXTextureType_Count -}; - enum GFXBitmapFlip { GFXBitmapFlip_None = 0, @@ -89,37 +83,6 @@ enum GFXBitmapFlip GFXBitmapFlip_XY = GFXBitmapFlip_X | GFXBitmapFlip_Y }; -enum GFXTextureOp -{ - GFXTOP_FIRST = 0, - GFXTOPDisable = 0, - GFXTOPSelectARG1, - GFXTOPSelectARG2, - GFXTOPModulate, - GFXTOPModulate2X, - GFXTOPModulate4X, - GFXTOPAdd, - GFXTOPAddSigned, - GFXTOPAddSigned2X, - GFXTOPSubtract, - GFXTOPAddSmooth, - GFXTOPBlendDiffuseAlpha, - GFXTOPBlendTextureAlpha, - GFXTOPBlendFactorAlpha, - GFXTOPBlendTextureAlphaPM, - GFXTOPBlendCURRENTALPHA, - GFXTOPPreModulate, - GFXTOPModulateAlphaAddColor, - GFXTOPModulateColorAddAlpha, - GFXTOPModulateInvAlphaAddColor, - GFXTOPModulateInvColorAddAlpha, - GFXTOPBumpEnvMap, - GFXTOPBumpEnvMapLuminance, - GFXTOPDotProduct3, - GFXTOPLERP, - GFXTOP_COUNT -}; - enum GFXTextureAddressMode { GFXAddress_FIRST = 0, @@ -138,8 +101,6 @@ enum GFXTextureFilterType GFXTextureFilterPoint, GFXTextureFilterLinear, GFXTextureFilterAnisotropic, - GFXTextureFilterPyramidalQuad, - GFXTextureFilterGaussianQuad, GFXTextureFilter_COUNT }; @@ -248,13 +209,6 @@ inline U32 GFXFormat_getByteSize( GFXFormat format ) return 16; } -enum GFXShadeMode -{ - GFXShadeFlat = 1, - GFXShadeGouraud, - GFXShadePhong, -}; - enum GFXClearFlags { GFXClearTarget = 1 << 0, @@ -328,13 +282,6 @@ enum GFXStencilOp GFXStencilOp_COUNT }; -enum GFXMaterialColorSource -{ - GFXMCSMaterial = 0, - GFXMCSColor1, - GFXMCSColor2, -}; - enum GFXBlendOp { GFXBlendOp_FIRST = 0, @@ -346,195 +293,6 @@ enum GFXBlendOp GFXBlendOp_COUNT }; -enum GFXRenderState -{ - GFXRenderState_FIRST = 0, - GFXRSZEnable = 0, - GFXRSFillMode, - GFXRSShadeMode, - GFXRSZWriteEnable, - GFXRSAlphaTestEnable, - GFXRSLastPixel, - GFXRSSrcBlend, - GFXRSDestBlend, - GFXRSCullMode, - GFXRSZFunc, - GFXRSAlphaRef, - GFXRSAlphaFunc, - GFXRSDitherEnable, - GFXRSAlphaBlendEnable, - GFXRSFogEnable, - GFXRSSpecularEnable, - GFXRSFogColor, - GFXRSFogTableMode, - GFXRSFogStart, - GFXRSFogEnd, - GFXRSFogDensity, - GFXRSRangeFogEnable, - GFXRSStencilEnable, - GFXRSStencilFail, - GFXRSStencilZFail, - GFXRSStencilPass, - GFXRSStencilFunc, - GFXRSStencilRef, - GFXRSStencilMask, - GFXRSStencilWriteMask, - GFXRSTextureFactor, - GFXRSWrap0, - GFXRSWrap1, - GFXRSWrap2, - GFXRSWrap3, - GFXRSWrap4, - GFXRSWrap5, - GFXRSWrap6, - GFXRSWrap7, - GFXRSClipping, - GFXRSLighting, - GFXRSAmbient, - GFXRSFogVertexMode, - GFXRSColorVertex, - GFXRSLocalViewer, - GFXRSNormalizeNormals, - GFXRSDiffuseMaterialSource, - GFXRSSpecularMaterialSource, - GFXRSAmbientMaterialSource, - GFXRSEmissiveMaterialSource, - GFXRSVertexBlend, - GFXRSClipPlaneEnable, - GFXRSPointSize, - GFXRSPointSizeMin, - GFXRSPointSpriteEnable, - GFXRSPointScaleEnable, - GFXRSPointScale_A, - GFXRSPointScale_B, - GFXRSPointScale_C, - GFXRSMultiSampleantiAlias, - GFXRSMultiSampleMask, - GFXRSPatchEdgeStyle, - GFXRSDebugMonitorToken, - GFXRSPointSize_Max, - GFXRSIndexedVertexBlendEnable, - GFXRSColorWriteEnable, - GFXRSTweenFactor, - GFXRSBlendOp, - GFXRSPositionDegree, - GFXRSNormalDegree, - GFXRSScissorTestEnable, - GFXRSSlopeScaleDepthBias, - GFXRSAntiAliasedLineEnable, - GFXRSMinTessellationLevel, - GFXRSMaxTessellationLevel, - GFXRSAdaptiveTess_X, - GFXRSAdaptiveTess_Y, - GFXRSdaptiveTess_Z, - GFXRSAdaptiveTess_W, - GFXRSEnableAdaptiveTesselation, - GFXRSTwoSidedStencilMode, - GFXRSCCWStencilFail, - GFXRSCCWStencilZFail, - GFXRSCCWStencilPass, - GFXRSCCWStencilFunc, - GFXRSColorWriteEnable1, - GFXRSColorWriteEnable2, - GFXRSolorWriteEnable3, - GFXRSBlendFactor, - GFXRSSRGBWriteEnable, - GFXRSDepthBias, - GFXRSWrap8, - GFXRSWrap9, - GFXRSWrap10, - GFXRSWrap11, - GFXRSWrap12, - GFXRSWrap13, - GFXRSWrap14, - GFXRSWrap15, - GFXRSSeparateAlphaBlendEnable, - GFXRSSrcBlendAlpha, - GFXRSDestBlendAlpha, - GFXRSBlendOpAlpha, - GFXRenderState_COUNT ///< Don't use this one, this is a counter -}; - -#define GFXCOLORWRITEENABLE_RED 1 -#define GFXCOLORWRITEENABLE_GREEN 2 -#define GFXCOLORWRITEENABLE_BLUE 4 -#define GFXCOLORWRITEENABLE_ALPHA 8 - -enum GFXTextureStageState -{ - GFXTSS_FIRST = 0, - GFXTSSColorOp = 0, - GFXTSSColorArg1, - GFXTSSColorArg2, - GFXTSSAlphaOp, - GFXTSSAlphaArg1, - GFXTSSAlphaArg2, - GFXTSSBumpEnvMat00, - GFXTSSBumpEnvMat01, - GFXTSSBumpEnvMat10, - GFXTSSBumpEnvMat11, - GFXTSSTexCoordIndex, - GFXTSSBumpEnvlScale, - GFXTSSBumpEnvlOffset, - GFXTSSTextureTransformFlags, - GFXTSSColorArg0, - GFXTSSAlphaArg0, - GFXTSSResultArg, - GFXTSSConstant, - GFXTSS_COUNT ///< Don't use this one, this is a counter -}; - -enum GFXTextureTransformFlags -{ - GFXTTFFDisable = 0, - GFXTTFFCoord1D = 1, - GFXTTFFCoord2D = 2, - GFXTTFFCoord3D = 3, - GFXTTFFCoord4D = 4, - GFXTTFFProjected = 256, -}; - -// CodeReview: This number is used for the declaration of variables, but it -// should *not* be used for any run-time purposes [7/2/2007 Pat] -#define TEXTURE_STAGE_COUNT 16 - -enum GFXSamplerState -{ - GFXSAMP_FIRST = 0, - GFXSAMPAddressU = 0, - GFXSAMPAddressV, - GFXSAMPAddressW, - GFXSAMPBorderColor, - GFXSAMPMagFilter, - GFXSAMPMinFilter, - GFXSAMPMipFilter, - GFXSAMPMipMapLODBias, - GFXSAMPMaxMipLevel, - GFXSAMPMaxAnisotropy, - GFXSAMPSRGBTexture, - GFXSAMPElementIndex, - GFXSAMPDMapOffset, - GFXSAMP_COUNT ///< Don't use this one, this is a counter -}; - -enum GFXTextureArgument -{ - GFXTA_FIRST = 0, - GFXTADiffuse = 0, - GFXTACurrent, - GFXTATexture, - GFXTATFactor, - GFXTASpecular, - GFXTATemp, - GFXTAConstant, - GFXTA_COUNT, - GFXTAComplement = 0x00000010, // take 1.0 - x (read modifier) - GFXTAAlphaReplicate = 0x00000020, // replicate alpha to color components (read modifier) -}; - -// Matrix stuff -#define WORLD_STACK_MAX 24 - enum GFXMatrixType { GFXMatrixWorld = 256, @@ -551,30 +309,6 @@ enum GFXMatrixType GFXMatrixTexture7 = 23, }; -// Light define -#define LIGHT_STAGE_COUNT 8 - -#define GFXVERTEXFLAG_F32 3 -#define GFXVERTEXFLAG_POINT2F 0 -#define GFXVERTEXFLAG_POINT3F 1 -#define GFXVERTEXFLAG_POINT4F 2 - -#define GFXVERTEXFLAG_TEXCOORD_F32(CoordIndex) ( GFXVERTEXFLAG_F32 << ( CoordIndex * 2 + 16 ) ) -#define GFXVERTEXFLAG_TEXCOORD_POINT2F(CoordIndex) ( GFXVERTEXFLAG_POINT2F ) -#define GFXVERTEXFLAG_TEXCOORD_POINT3F(CoordIndex) ( GFXVERTEXFLAG_POINT3F << ( CoordIndex * 2 + 16 ) ) -#define GFXVERTEXFLAG_TEXCOORD_POINT4F(CoordIndex) ( GFXVERTEXFLAG_POINT4F << ( CoordIndex * 2 + 16 ) ) - -#define STATE_STACK_SIZE 32 - -// Index Formats -enum GFXIndexFormat -{ - GFXIndexFormat_FIRST = 0, - GFXIndexFormat16 = 0, - GFXIndexFormat32, - GFXIndexFormat_COUNT -}; - enum GFXShaderConstType { /// GFX"S"hader"C"onstant"T"ype @@ -603,7 +337,6 @@ enum GFXShaderConstType GFXSCT_SamplerTextureArray }; - /// Defines a vertex declaration type. /// @see GFXVertexElement /// @see GFXVertexFormat diff --git a/Engine/source/gfx/gfxFontRenderBatcher.cpp b/Engine/source/gfx/gfxFontRenderBatcher.cpp index 4b7722b7e..4fce36b4e 100644 --- a/Engine/source/gfx/gfxFontRenderBatcher.cpp +++ b/Engine/source/gfx/gfxFontRenderBatcher.cpp @@ -40,18 +40,10 @@ FontRenderBatcher::FontRenderBatcher() : mStorage(8096) f.blendSrc = GFXBlendSrcAlpha; f.blendDest = GFXBlendInvSrcAlpha; f.samplersDefined = true; - f.samplers[0].alphaOp = GFXTOPModulate; f.samplers[0].magFilter = GFXTextureFilterPoint; f.samplers[0].minFilter = GFXTextureFilterPoint; f.samplers[0].addressModeU = GFXAddressClamp; f.samplers[0].addressModeV = GFXAddressClamp; - f.samplers[0].alphaArg1 = GFXTATexture; - f.samplers[0].alphaArg2 = GFXTADiffuse; - // This is an add operation because in D3D, when a texture of format D3DFMT_A8 - // is used, the RGB channels are all set to 0. Therefore a modulate would - // result in the text always being black. This may not be the case in OpenGL - // so it may have to change. -bramage - f.samplers[0].textureColorOp = GFXTOPAdd; f.setColorWrites(true, true, true, false); // NOTE: comment this out if alpha write is needed mFontSB = GFX->createStateBlock(f); diff --git a/Engine/source/gfx/gfxStateBlock.cpp b/Engine/source/gfx/gfxStateBlock.cpp index 2ab02fc23..5fb7a31dc 100644 --- a/Engine/source/gfx/gfxStateBlock.cpp +++ b/Engine/source/gfx/gfxStateBlock.cpp @@ -88,9 +88,6 @@ GFXStateBlockDesc::GFXStateBlockDesc() stencilMask = 0xFFFFFFFF; stencilWriteMask = 0xFFFFFFFF; - // FF lighting - ffLighting = false; - vertexColorEnable = false; fillMode = GFXFillSolid; @@ -183,7 +180,7 @@ void GFXStateBlockDesc::addDesc(const GFXStateBlockDesc& desc) if (desc.samplersDefined) { samplersDefined = true; - for (U32 i = 0; i < TEXTURE_STAGE_COUNT; i++) + for (U32 i = 0; i < GFX_TEXTURE_STAGE_COUNT; i++) { samplers[i] = desc.samplers[i]; } @@ -214,8 +211,6 @@ const String GFXStateBlockDesc::describeSelf() const ret += String::ToString(" Stencil: %d, StencilFailOp: %s, StencilZFailOp: %s, StencilPassOp: %s, \n stencilFunc: %s, stencilRef: %d, stencilMask: 0x%x, stencilWriteMask: 0x%x\n", stencilEnable, GFXStringCmpFunc[stencilFailOp], GFXStringCmpFunc[stencilZFailOp], GFXStringCmpFunc[stencilPassOp], GFXStringCmpFunc[stencilFunc], stencilRef, stencilMask, stencilWriteMask); - ret += String::ToString(" FF Lighting: %d, VertexColors: %d, fillMode: %s", - ffLighting, vertexColorEnable, GFXStringFillMode[fillMode]); return ret; } @@ -274,7 +269,6 @@ void GFXStateBlockDesc::setColorWrites( bool red, bool green, bool blue, bool al GFXSamplerStateDesc::GFXSamplerStateDesc() { - textureColorOp = GFXTOPDisable; addressModeU = GFXAddressWrap; addressModeV = GFXAddressWrap; addressModeW = GFXAddressWrap; @@ -283,15 +277,6 @@ GFXSamplerStateDesc::GFXSamplerStateDesc() mipFilter = GFXTextureFilterLinear; samplerFunc = GFXCmpNever; maxAnisotropy = 1; - alphaArg1 = GFXTATexture; - alphaArg2 = GFXTADiffuse; - alphaArg3 = GFXTACurrent; - colorArg1 = GFXTACurrent; - colorArg2 = GFXTATexture; - colorArg3 = GFXTACurrent; - alphaOp = GFXTOPModulate; - textureTransform = GFXTTFFDisable; - resultArg = GFXTACurrent; mipLODBias = 0.0f; } @@ -299,14 +284,12 @@ GFXSamplerStateDesc GFXSamplerStateDesc::getWrapLinear() { // Linear with wrapping is already the default GFXSamplerStateDesc ssd; - ssd.textureColorOp = GFXTOPModulate; return ssd; } GFXSamplerStateDesc GFXSamplerStateDesc::getWrapPoint() { GFXSamplerStateDesc ssd; - ssd.textureColorOp = GFXTOPModulate; ssd.magFilter = GFXTextureFilterPoint; ssd.minFilter = GFXTextureFilterPoint; ssd.mipFilter = GFXTextureFilterPoint; @@ -316,7 +299,6 @@ GFXSamplerStateDesc GFXSamplerStateDesc::getWrapPoint() GFXSamplerStateDesc GFXSamplerStateDesc::getClampLinear() { GFXSamplerStateDesc ssd; - ssd.textureColorOp = GFXTOPModulate; ssd.addressModeU = GFXAddressClamp; ssd.addressModeV = GFXAddressClamp; ssd.addressModeW = GFXAddressClamp; @@ -326,7 +308,6 @@ GFXSamplerStateDesc GFXSamplerStateDesc::getClampLinear() GFXSamplerStateDesc GFXSamplerStateDesc::getClampPoint() { GFXSamplerStateDesc ssd; - ssd.textureColorOp = GFXTOPModulate; ssd.addressModeU = GFXAddressClamp; ssd.addressModeV = GFXAddressClamp; ssd.addressModeW = GFXAddressClamp; @@ -334,4 +315,4 @@ GFXSamplerStateDesc GFXSamplerStateDesc::getClampPoint() ssd.minFilter = GFXTextureFilterPoint; ssd.mipFilter = GFXTextureFilterPoint; return ssd; -} \ No newline at end of file +} diff --git a/Engine/source/gfx/gfxStateBlock.h b/Engine/source/gfx/gfxStateBlock.h index 930cdd54b..f8f19f360 100644 --- a/Engine/source/gfx/gfxStateBlock.h +++ b/Engine/source/gfx/gfxStateBlock.h @@ -63,21 +63,6 @@ struct GFXSamplerStateDesc /// Defaults to zero. F32 mipLODBias; - GFXTextureOp textureColorOp; - - GFXTextureOp alphaOp; - GFXTextureArgument alphaArg1; - GFXTextureArgument alphaArg2; - GFXTextureArgument alphaArg3; - - GFXTextureArgument colorArg1; - GFXTextureArgument colorArg2; - GFXTextureArgument colorArg3; - - GFXTextureArgument resultArg; - - GFXTextureTransformFlags textureTransform; - GFXSamplerStateDesc(); /// Returns an modulate, wrap, and linear sampled state. @@ -153,16 +138,13 @@ struct GFXStateBlockDesc U32 stencilMask; U32 stencilWriteMask; - // FF lighting - bool ffLighting; - bool vertexColorEnable; GFXFillMode fillMode; // Sampler states bool samplersDefined; - GFXSamplerStateDesc samplers[TEXTURE_STAGE_COUNT]; + GFXSamplerStateDesc samplers[GFX_TEXTURE_STAGE_COUNT]; ColorI textureFactor; GFXStateBlockDesc(); diff --git a/Engine/source/gfx/gfxStringEnumTranslate.cpp b/Engine/source/gfx/gfxStringEnumTranslate.cpp index 8c08c939e..93f1c25cf 100644 --- a/Engine/source/gfx/gfxStringEnumTranslate.cpp +++ b/Engine/source/gfx/gfxStringEnumTranslate.cpp @@ -28,12 +28,9 @@ //------------------------------------------------------------------------------ -const char *GFXStringIndexFormat[GFXIndexFormat_COUNT]; -const char *GFXStringSamplerState[GFXSAMP_COUNT]; const char *GFXStringTextureFormat[GFXFormat_COUNT]; const char *GFXStringTiledTextureFormat[GFXFormat_COUNT]; const char *GFXStringRenderTargetFormat[GFXFormat_COUNT]; -const char *GFXStringRenderState[GFXRenderState_COUNT]; const char *GFXStringTextureFilter[GFXTextureFilter_COUNT]; const char *GFXStringBlend[GFXBlend_COUNT]; const char *GFXStringBlendOp[GFXBlendOp_COUNT]; @@ -41,15 +38,9 @@ const char *GFXStringStencilOp[GFXStencilOp_COUNT]; const char *GFXStringCmpFunc[GFXCmp_COUNT]; const char *GFXStringCullMode[GFXCull_COUNT]; const char *GFXStringPrimType[GFXPT_COUNT]; -const char *GFXStringTextureStageState[GFXTSS_COUNT]; const char *GFXStringTextureAddress[GFXAddress_COUNT]; -const char *GFXStringTextureOp[GFXTOP_COUNT]; const char *GFXStringFillMode[GFXFill_COUNT]; -StringValueLookupFn GFXStringRenderStateValueLookup[GFXRenderState_COUNT]; -StringValueLookupFn GFXStringSamplerStateValueLookup[GFXSAMP_COUNT]; -StringValueLookupFn GFXStringTextureStageStateValueLookup[GFXTSS_COUNT]; - //------------------------------------------------------------------------------ const char *defaultStringValueLookup( const U32 &value ) @@ -67,7 +58,6 @@ const char *defaultStringValueLookup( const U32 &value ) _STRING_VALUE_LOOKUP_FXN(GFXStringTextureAddress); _STRING_VALUE_LOOKUP_FXN(GFXStringTextureFilter); _STRING_VALUE_LOOKUP_FXN(GFXStringBlend); -_STRING_VALUE_LOOKUP_FXN(GFXStringTextureOp); _STRING_VALUE_LOOKUP_FXN(GFXStringCmpFunc); _STRING_VALUE_LOOKUP_FXN(GFXStringStencilOp); _STRING_VALUE_LOOKUP_FXN(GFXStringCullMode); @@ -106,29 +96,6 @@ void GFXStringEnumTranslate::init() sInitCalled = true; - INIT_LOOKUPTABLE( GFXStringIndexFormat, GFXIndexFormat, const char * ); - GFX_STRING_ASSIGN_MACRO( GFXStringIndexFormat, GFXIndexFormat16 ); - GFX_STRING_ASSIGN_MACRO( GFXStringIndexFormat, GFXIndexFormat32 ); - VALIDATE_LOOKUPTABLE( GFXStringIndexFormat, GFXIndexFormat ); -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - INIT_LOOKUPTABLE_EX( GFXStringSamplerState, GFXSAMP, const char *, GFXStringSamplerStateValueLookup ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringSamplerState, GFXSAMPAddressU, GFXStringTextureAddress ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringSamplerState, GFXSAMPAddressV, GFXStringTextureAddress ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringSamplerState, GFXSAMPAddressW, GFXStringTextureAddress ); - GFX_STRING_ASSIGN_MACRO( GFXStringSamplerState, GFXSAMPBorderColor ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringSamplerState, GFXSAMPMagFilter, GFXStringTextureFilter ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringSamplerState, GFXSAMPMinFilter, GFXStringTextureFilter ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringSamplerState, GFXSAMPMipFilter, GFXStringTextureFilter ); - GFX_STRING_ASSIGN_MACRO( GFXStringSamplerState, GFXSAMPMipMapLODBias ); - GFX_STRING_ASSIGN_MACRO( GFXStringSamplerState, GFXSAMPMaxMipLevel ); - GFX_STRING_ASSIGN_MACRO( GFXStringSamplerState, GFXSAMPMaxAnisotropy ); - - GFX_STRING_ASSIGN_MACRO( GFXStringSamplerState, GFXSAMPSRGBTexture ); - GFX_STRING_ASSIGN_MACRO( GFXStringSamplerState, GFXSAMPElementIndex ); - GFX_STRING_ASSIGN_MACRO( GFXStringSamplerState, GFXSAMPDMapOffset ); - - VALIDATE_LOOKUPTABLE( GFXStringSamplerState, GFXSAMP ); //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ INIT_LOOKUPTABLE( GFXStringTextureFormat, GFXFormat, const char * ); @@ -171,126 +138,7 @@ void GFXStringEnumTranslate::init() GFX_STRING_ASSIGN_MACRO( GFXStringTextureFormat, GFXFormatBC2_SRGB ); GFX_STRING_ASSIGN_MACRO( GFXStringTextureFormat, GFXFormatBC3_SRGB ); VALIDATE_LOOKUPTABLE( GFXStringTextureFormat, GFXFormat); -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - INIT_LOOKUPTABLE_EX( GFXStringRenderState, GFXRenderState, const char *, GFXStringRenderStateValueLookup ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSZEnable ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSFillMode ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSZWriteEnable ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSAlphaTestEnable ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringRenderState, GFXRSSrcBlend, GFXStringBlend ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringRenderState, GFXRSDestBlend, GFXStringBlend ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringRenderState, GFXRSCullMode, GFXStringCullMode ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringRenderState, GFXRSZFunc, GFXStringCmpFunc ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSAlphaRef ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringRenderState, GFXRSAlphaFunc, GFXStringCmpFunc ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSAlphaBlendEnable ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSStencilEnable ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringRenderState, GFXRSStencilFail, GFXStringStencilOp ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringRenderState, GFXRSStencilZFail, GFXStringStencilOp ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringRenderState, GFXRSStencilPass, GFXStringStencilOp ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringRenderState, GFXRSStencilFunc, GFXStringCmpFunc ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSStencilRef ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSStencilMask ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSStencilWriteMask ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSWrap0 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSWrap1 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSWrap2 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSWrap3 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSWrap4 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSWrap5 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSWrap6 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSWrap7 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSClipPlaneEnable ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSPointSize ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSPointSizeMin ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSPointSize_Max ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSPointSpriteEnable ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSMultiSampleantiAlias ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSMultiSampleMask ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSShadeMode ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSLastPixel ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSClipping ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSPointScaleEnable ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSPointScale_A ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSPointScale_B ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSPointScale_C ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSLighting ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSAmbient ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSFogVertexMode ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSColorVertex ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSLocalViewer ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSNormalizeNormals ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSDiffuseMaterialSource ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSSpecularMaterialSource ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSAmbientMaterialSource ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSEmissiveMaterialSource ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSVertexBlend ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSFogEnable ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSSpecularEnable ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSFogColor ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSFogTableMode ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSFogStart ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSFogEnd ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSFogDensity ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSRangeFogEnable ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSDebugMonitorToken ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSIndexedVertexBlendEnable ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSTweenFactor ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSTextureFactor ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSPatchEdgeStyle ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSDitherEnable ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSColorWriteEnable ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringRenderState, GFXRSBlendOp, GFXStringBlendOp ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSPositionDegree ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSNormalDegree ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSAntiAliasedLineEnable ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSAdaptiveTess_X ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSAdaptiveTess_Y ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSdaptiveTess_Z ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSAdaptiveTess_W ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSEnableAdaptiveTesselation ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSScissorTestEnable ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSSlopeScaleDepthBias ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSMinTessellationLevel ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSMaxTessellationLevel ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSTwoSidedStencilMode ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSCCWStencilFail ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSCCWStencilZFail ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSCCWStencilPass ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSCCWStencilFunc ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSColorWriteEnable1 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSColorWriteEnable2 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSolorWriteEnable3 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSBlendFactor ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSSRGBWriteEnable ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSDepthBias ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSWrap8 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSWrap9 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSWrap10 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSWrap11 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSWrap12 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSWrap13 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSWrap14 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSWrap15 ); - GFX_STRING_ASSIGN_MACRO( GFXStringRenderState, GFXRSSeparateAlphaBlendEnable ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringRenderState, GFXRSSrcBlendAlpha, GFXStringBlend ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringRenderState, GFXRSDestBlendAlpha, GFXStringBlend ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringRenderState, GFXRSBlendOpAlpha, GFXStringBlendOp ); - VALIDATE_LOOKUPTABLE( GFXStringRenderState, GFXRenderState ); -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - INIT_LOOKUPTABLE( GFXStringTextureFilter, GFXTextureFilter, const char * ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureFilter, GFXTextureFilterNone ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureFilter, GFXTextureFilterPoint ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureFilter, GFXTextureFilterLinear ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureFilter, GFXTextureFilterAnisotropic ); - - GFX_STRING_ASSIGN_MACRO( GFXStringTextureFilter, GFXTextureFilterPyramidalQuad ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureFilter, GFXTextureFilterGaussianQuad ); - - VALIDATE_LOOKUPTABLE( GFXStringTextureFilter, GFXTextureFilter ); //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ INIT_LOOKUPTABLE( GFXStringBlend, GFXBlend, const char * ); @@ -356,29 +204,6 @@ void GFXStringEnumTranslate::init() GFX_STRING_ASSIGN_MACRO( GFXStringPrimType, GFXTriangleStrip ); VALIDATE_LOOKUPTABLE( GFXStringPrimType, GFXPT ); //------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - INIT_LOOKUPTABLE_EX( GFXStringTextureStageState, GFXTSS, const char *, GFXStringTextureStageStateValueLookup ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringTextureStageState, GFXTSSColorOp, GFXStringTextureOp ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureStageState, GFXTSSColorArg1 ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureStageState, GFXTSSColorArg2 ); - GFX_STRING_ASSIGN_MACRO_EX( GFXStringTextureStageState, GFXTSSAlphaOp, GFXStringTextureOp ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureStageState, GFXTSSAlphaArg1 ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureStageState, GFXTSSAlphaArg2 ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureStageState, GFXTSSBumpEnvMat00 ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureStageState, GFXTSSBumpEnvMat01 ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureStageState, GFXTSSBumpEnvMat10 ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureStageState, GFXTSSBumpEnvMat11 ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureStageState, GFXTSSTexCoordIndex ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureStageState, GFXTSSBumpEnvlScale ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureStageState, GFXTSSBumpEnvlOffset ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureStageState, GFXTSSTextureTransformFlags ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureStageState, GFXTSSColorArg0 ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureStageState, GFXTSSAlphaArg0 ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureStageState, GFXTSSResultArg ); - - GFX_STRING_ASSIGN_MACRO( GFXStringTextureStageState, GFXTSSConstant ); - VALIDATE_LOOKUPTABLE( GFXStringTextureStageState, GFXTSS ); -//------------------------------------------------------------------------------ //------------------------------------------------------------------------------ INIT_LOOKUPTABLE( GFXStringTextureAddress, GFXAddress, const char * ); GFX_STRING_ASSIGN_MACRO( GFXStringTextureAddress, GFXAddressWrap ); @@ -389,34 +214,6 @@ void GFXStringEnumTranslate::init() VALIDATE_LOOKUPTABLE(GFXStringTextureAddress, GFXAddress ); //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ - INIT_LOOKUPTABLE( GFXStringTextureOp, GFXTOP, const char * ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPDisable ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPSelectARG1 ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPSelectARG2 ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPModulate ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPModulate2X ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPModulate4X ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPAdd ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPAddSigned ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPAddSigned2X ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPSubtract ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPAddSmooth ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPBlendDiffuseAlpha ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPBlendTextureAlpha ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPBlendFactorAlpha ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPBlendTextureAlphaPM ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPBlendCURRENTALPHA ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPPreModulate ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPModulateAlphaAddColor ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPModulateColorAddAlpha ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPModulateInvAlphaAddColor ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPModulateInvColorAddAlpha ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPBumpEnvMap ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPBumpEnvMapLuminance ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPDotProduct3 ); - GFX_STRING_ASSIGN_MACRO( GFXStringTextureOp, GFXTOPLERP ); - VALIDATE_LOOKUPTABLE( GFXStringTextureOp, GFXTOP ); - INIT_LOOKUPTABLE( GFXStringFillMode, GFXFill, const char * ); GFX_STRING_ASSIGN_MACRO( GFXStringFillMode, GFXFillPoint ); GFX_STRING_ASSIGN_MACRO( GFXStringFillMode, GFXFillWireframe ); diff --git a/Engine/source/gfx/gfxStringEnumTranslate.h b/Engine/source/gfx/gfxStringEnumTranslate.h index 37aab7590..4675b9c0f 100644 --- a/Engine/source/gfx/gfxStringEnumTranslate.h +++ b/Engine/source/gfx/gfxStringEnumTranslate.h @@ -48,10 +48,7 @@ namespace GFXStringEnumTranslate //------------------------------------------------------------------------------ -extern const char *GFXStringIndexFormat[GFXIndexFormat_COUNT]; -extern const char *GFXStringSamplerState[GFXSAMP_COUNT]; extern const char *GFXStringTextureFormat[GFXFormat_COUNT]; -extern const char *GFXStringRenderState[GFXRenderState_COUNT]; extern const char *GFXStringTextureFilter[GFXTextureFilter_COUNT]; extern const char *GFXStringBlend[GFXBlend_COUNT]; extern const char *GFXStringBlendOp[GFXBlendOp_COUNT]; @@ -59,17 +56,11 @@ extern const char *GFXStringStencilOp[GFXStencilOp_COUNT]; extern const char *GFXStringCmpFunc[GFXCmp_COUNT]; extern const char *GFXStringCullMode[GFXCull_COUNT]; extern const char *GFXStringPrimType[GFXPT_COUNT]; -extern const char *GFXStringTextureStageState[GFXTSS_COUNT]; extern const char *GFXStringTextureAddress[GFXAddress_COUNT]; -extern const char *GFXStringTextureOp[GFXTOP_COUNT]; extern const char *GFXStringFillMode[GFXFill_COUNT]; typedef const char *(*StringValueLookupFn)( const U32 &value ); -extern StringValueLookupFn GFXStringRenderStateValueLookup[GFXRenderState_COUNT]; -extern StringValueLookupFn GFXStringSamplerStateValueLookup[GFXSAMP_COUNT]; -extern StringValueLookupFn GFXStringTextureStageStateValueLookup[GFXTSS_COUNT]; - #define GFXREVERSE_LOOKUP( tablearray, enumprefix, val ) \ for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \ if( (S32)tablearray##[i] == val ) \ @@ -86,4 +77,4 @@ extern EnumTable gTextureArgumentEnumTable_M; //extern EnumTable::Enums srcBlendFactorLookup[9]; //extern EnumTable::Enums dstBlendFactorLookup[9]; -#endif \ No newline at end of file +#endif diff --git a/Engine/source/gfx/gfxStructs.h b/Engine/source/gfx/gfxStructs.h index 65d0781bb..56ff5411d 100644 --- a/Engine/source/gfx/gfxStructs.h +++ b/Engine/source/gfx/gfxStructs.h @@ -48,53 +48,6 @@ #include "gfx/gfxVertexTypes.h" #endif - -//----------------------------------------------------------------------------- -// This class is used to interact with an API's fixed function lights. See GFX->setLight -class GFXLightInfo -{ -public: - enum Type { - Point = 0, - Spot = 1, - Vector = 2, - Ambient = 3, - }; - Type mType; - - Point3F mPos; - VectorF mDirection; - LinearColorF mColor; - LinearColorF mAmbient; - F32 mRadius; - F32 mInnerConeAngle; - F32 mOuterConeAngle; - - /// @todo Revisit below (currently unused by fixed function lights) - Point3F position; - LinearColorF ambient; - LinearColorF diffuse; - LinearColorF specular; - VectorF spotDirection; - F32 spotExponent; - F32 spotCutoff; - F32 constantAttenuation; - F32 linearAttenuation; - F32 quadraticAttenuation; -}; - -//----------------------------------------------------------------------------- - -// Material definition for FF lighting -struct GFXLightMaterial -{ - LinearColorF ambient; - LinearColorF diffuse; - LinearColorF specular; - LinearColorF emissive; - F32 shininess; -}; - //----------------------------------------------------------------------------- struct GFXVideoMode @@ -144,7 +97,6 @@ struct GFXVideoMode const String toString() const; }; - //----------------------------------------------------------------------------- struct GFXPrimitive @@ -195,5 +147,4 @@ struct GFXShaderMacro static void stringize( const Vector ¯os, String *outString ); }; - #endif // _GFXSTRUCTS_H_ diff --git a/Engine/source/gfx/gl/gfxGLDevice.cpp b/Engine/source/gfx/gl/gfxGLDevice.cpp index d0e9db09f..6179bd618 100644 --- a/Engine/source/gfx/gl/gfxGLDevice.cpp +++ b/Engine/source/gfx/gl/gfxGLDevice.cpp @@ -234,7 +234,7 @@ GFXGLDevice::GFXGLDevice(U32 adapterIndex) : mTextureManager = new GFXGLTextureManager(); gScreenShot = new ScreenShotGL(); - for(U32 i = 0; i < TEXTURE_STAGE_COUNT; i++) + for(U32 i = 0; i < GFX_TEXTURE_STAGE_COUNT; i++) mActiveTextureType[i] = GL_ZERO; mNumVertexStream = 2; @@ -260,7 +260,7 @@ GFXGLDevice::~GFXGLDevice() mVolatilePBs[i] = NULL; // Clear out our current texture references - for (U32 i = 0; i < TEXTURE_STAGE_COUNT; i++) + for (U32 i = 0; i < GFX_TEXTURE_STAGE_COUNT; i++) { mCurrentTexture[i] = NULL; mNewTexture[i] = NULL; @@ -711,21 +711,6 @@ void GFXGLDevice::setPB(GFXGLPrimitiveBuffer* pb) mCurrentPB = pb; } -void GFXGLDevice::setLightInternal(U32 lightStage, const GFXLightInfo light, bool lightEnable) -{ - // ONLY NEEDED ON FFP -} - -void GFXGLDevice::setLightMaterialInternal(const GFXLightMaterial mat) -{ - // ONLY NEEDED ON FFP -} - -void GFXGLDevice::setGlobalAmbientInternal(LinearColorF color) -{ - // ONLY NEEDED ON FFP -} - void GFXGLDevice::setTextureInternal(U32 textureUnit, const GFXTextureObject*texture) { GFXGLTextureObject *tex = static_cast(const_cast(texture)); @@ -791,11 +776,6 @@ void GFXGLDevice::setTextureArrayInternal(U32 textureUnit, const GFXGLTextureArr } } -void GFXGLDevice::setMatrix( GFXMatrixType mtype, const MatrixF &mat ) -{ - // ONLY NEEDED ON FFP -} - void GFXGLDevice::setClipRect( const RectI &inRect ) { AssertFatal(mCurrentRT.isValid(), "GFXGLDevice::setClipRect - must have a render target set to do any rendering operations!"); @@ -838,8 +818,6 @@ void GFXGLDevice::setClipRect( const RectI &inRect ) mProjectionMatrix *= translate; - setMatrix(GFXMatrixProjection, mProjectionMatrix); - MatrixF mTempMatrix(true); setViewMatrix( mTempMatrix ); setWorldMatrix( mTempMatrix ); @@ -985,7 +963,7 @@ void GFXGLDevice::setShaderConstBufferInternal(GFXShaderConstBuffer* buffer) U32 GFXGLDevice::getNumSamplers() const { - return getMin((U32)TEXTURE_STAGE_COUNT,mPixelShaderVersion > 0.001f ? mMaxShaderTextures : mMaxFFTextures); + return getMin((U32)GFX_TEXTURE_STAGE_COUNT,mPixelShaderVersion > 0.001f ? mMaxShaderTextures : mMaxFFTextures); } GFXTextureObject* GFXGLDevice::getDefaultDepthTex() const diff --git a/Engine/source/gfx/gl/gfxGLDevice.h b/Engine/source/gfx/gl/gfxGLDevice.h index 0282a103f..bec934367 100644 --- a/Engine/source/gfx/gl/gfxGLDevice.h +++ b/Engine/source/gfx/gl/gfxGLDevice.h @@ -140,8 +140,8 @@ public: virtual void preDestroy() { Parent::preDestroy(); } - virtual U32 getMaxDynamicVerts() { return MAX_DYNAMIC_VERTS; } - virtual U32 getMaxDynamicIndices() { return MAX_DYNAMIC_INDICES; } + virtual U32 getMaxDynamicVerts() { return GFX_MAX_DYNAMIC_VERTS; } + virtual U32 getMaxDynamicIndices() { return GFX_MAX_DYNAMIC_INDICES; } GFXFence *createFence(); @@ -177,10 +177,6 @@ protected: virtual void setCubemapArrayInternal(U32 textureUnit, const GFXGLCubemapArray* texture); virtual void setTextureArrayInternal(U32 textureUnit, const GFXGLTextureArray* texture); - virtual void setLightInternal(U32 lightStage, const GFXLightInfo light, bool lightEnable); - virtual void setLightMaterialInternal(const GFXLightMaterial mat); - virtual void setGlobalAmbientInternal(LinearColorF color); - /// @name State Initalization. /// @{ @@ -188,8 +184,6 @@ protected: /// is created. virtual void initStates() { } - virtual void setMatrix( GFXMatrixType mtype, const MatrixF &mat ); - virtual GFXVertexBuffer *allocVertexBuffer( U32 numVerts, const GFXVertexFormat *vertexFormat, U32 vertSize, @@ -255,7 +249,7 @@ private: GFXGLStateBlockRef mCurrentGLStateBlock; - GLenum mActiveTextureType[TEXTURE_STAGE_COUNT]; + GLenum mActiveTextureType[GFX_TEXTURE_STAGE_COUNT]; Vector< StrongRefPtr > mVolatileVBs; ///< Pool of existing volatile VBs so we can reuse previously created ones Vector< StrongRefPtr > mVolatilePBs; ///< Pool of existing volatile PBs so we can reuse previously created ones diff --git a/Engine/source/gfx/gl/gfxGLEnumTranslate.cpp b/Engine/source/gfx/gl/gfxGLEnumTranslate.cpp index 422f25bc1..e2e9cab66 100644 --- a/Engine/source/gfx/gl/gfxGLEnumTranslate.cpp +++ b/Engine/source/gfx/gl/gfxGLEnumTranslate.cpp @@ -26,7 +26,6 @@ GLenum GFXGLPrimType[GFXPT_COUNT]; GLenum GFXGLBlend[GFXBlend_COUNT]; GLenum GFXGLBlendOp[GFXBlendOp_COUNT]; -GLenum GFXGLSamplerState[GFXSAMP_COUNT]; GLenum GFXGLTextureFilter[GFXTextureFilter_COUNT]; GLenum GFXGLTextureAddress[GFXAddress_COUNT]; GLenum GFXGLCmpFunc[GFXCmp_COUNT]; @@ -75,14 +74,7 @@ void GFXGLEnumTranslate::init() GFXGLBlendOp[GFXBlendOpMin] = GL_MIN; GFXGLBlendOp[GFXBlendOpMax] = GL_MAX; - // Sampler - GFXGLSamplerState[GFXSAMPMagFilter] = GL_TEXTURE_MAG_FILTER; - GFXGLSamplerState[GFXSAMPMinFilter] = GL_TEXTURE_MIN_FILTER; - GFXGLSamplerState[GFXSAMPAddressU] = GL_TEXTURE_WRAP_S; - GFXGLSamplerState[GFXSAMPAddressV] = GL_TEXTURE_WRAP_T; - GFXGLSamplerState[GFXSAMPAddressW] = GL_TEXTURE_WRAP_R; - GFXGLSamplerState[GFXSAMPMipMapLODBias] = GL_TEXTURE_LOD_BIAS; - + // Comparison GFXGLCmpFunc[GFXCmpNever] = GL_NEVER; GFXGLCmpFunc[GFXCmpLess] = GL_LESS; @@ -96,10 +88,7 @@ void GFXGLEnumTranslate::init() GFXGLTextureFilter[GFXTextureFilterNone] = GL_NEAREST; GFXGLTextureFilter[GFXTextureFilterPoint] = GL_NEAREST; GFXGLTextureFilter[GFXTextureFilterLinear] = GL_LINEAR; - GFXGLTextureFilter[GFXTextureFilterAnisotropic] = GL_LINEAR; - GFXGLTextureFilter[GFXTextureFilterPyramidalQuad] = GL_LINEAR; - GFXGLTextureFilter[GFXTextureFilterGaussianQuad] = GL_LINEAR; GFXGLTextureAddress[GFXAddressWrap] = GL_REPEAT; GFXGLTextureAddress[GFXAddressMirror] = GL_REPEAT; @@ -116,8 +105,7 @@ void GFXGLEnumTranslate::init() GFXGLStencilOp[GFXStencilOpInvert] = GL_INVERT; GFXGLStencilOp[GFXStencilOpIncr] = GL_INCR_WRAP; - GFXGLStencilOp[GFXStencilOpDecr] = GL_DECR_WRAP; - + GFXGLStencilOp[GFXStencilOpDecr] = GL_DECR_WRAP; // Texture formats for(int i = 0; i < GFXFormat_COUNT; ++i) diff --git a/Engine/source/gfx/gl/gfxGLEnumTranslate.h b/Engine/source/gfx/gl/gfxGLEnumTranslate.h index 02a6b87b6..1f3ddb3aa 100644 --- a/Engine/source/gfx/gl/gfxGLEnumTranslate.h +++ b/Engine/source/gfx/gl/gfxGLEnumTranslate.h @@ -34,7 +34,6 @@ namespace GFXGLEnumTranslate extern GLenum GFXGLPrimType[GFXPT_COUNT]; extern GLenum GFXGLBlend[GFXBlend_COUNT]; extern GLenum GFXGLBlendOp[GFXBlendOp_COUNT]; -extern GLenum GFXGLSamplerState[GFXSAMP_COUNT]; extern GLenum GFXGLTextureFilter[GFXTextureFilter_COUNT]; extern GLenum GFXGLTextureAddress[GFXAddress_COUNT]; extern GLenum GFXGLCmpFunc[GFXCmp_COUNT]; diff --git a/Engine/source/gfx/gl/gfxGLStateBlock.cpp b/Engine/source/gfx/gl/gfxGLStateBlock.cpp index 5b2fe2838..5be2e43d5 100644 --- a/Engine/source/gfx/gl/gfxGLStateBlock.cpp +++ b/Engine/source/gfx/gl/gfxGLStateBlock.cpp @@ -41,7 +41,7 @@ GFXGLStateBlock::GFXGLStateBlock(const GFXStateBlockDesc& desc) : { static Map mSamplersMap; - for(int i = 0; i < TEXTURE_STAGE_COUNT; ++i) + for(int i = 0; i < GFX_TEXTURE_STAGE_COUNT; ++i) { GLuint &id = mSamplerObjects[i]; GFXSamplerStateDesc &ssd = mDesc.samplers[i]; @@ -172,7 +172,7 @@ void GFXGLStateBlock::activate(const GFXGLStateBlock* oldState) #undef CHECK_TOGGLE_STATE //sampler objects - for (U32 i = 0; i < getMin(getOwningDevice()->getNumSamplers(), (U32) TEXTURE_STAGE_COUNT); i++) + for (U32 i = 0; i < getMin(getOwningDevice()->getNumSamplers(), (U32) GFX_TEXTURE_STAGE_COUNT); i++) { if(!oldState || oldState->mSamplerObjects[i] != mSamplerObjects[i]) glBindSampler(i, mSamplerObjects[i] ); diff --git a/Engine/source/gfx/gl/gfxGLStateBlock.h b/Engine/source/gfx/gl/gfxGLStateBlock.h index 234b3fd56..1a9ec9c3e 100644 --- a/Engine/source/gfx/gl/gfxGLStateBlock.h +++ b/Engine/source/gfx/gl/gfxGLStateBlock.h @@ -63,7 +63,7 @@ public: private: GFXStateBlockDesc mDesc; U32 mCachedHashValue; - U32 mSamplerObjects[TEXTURE_STAGE_COUNT]; + U32 mSamplerObjects[GFX_TEXTURE_STAGE_COUNT]; }; typedef StrongRefPtr GFXGLStateBlockRef; diff --git a/Engine/source/gfx/gl/gfxGLStateCache.h b/Engine/source/gfx/gl/gfxGLStateCache.h index c35a2423f..36f80e746 100644 --- a/Engine/source/gfx/gl/gfxGLStateCache.h +++ b/Engine/source/gfx/gl/gfxGLStateCache.h @@ -141,7 +141,7 @@ public: protected: GLuint mActiveTexture, mBindedVBO, mBindedIBO, mBindedFBO_W, mBindedFBO_R; - TextureUnit mTextureUnits[TEXTURE_STAGE_COUNT]; + TextureUnit mTextureUnits[GFX_TEXTURE_STAGE_COUNT]; U32 mVertexAttribActive; }; diff --git a/Engine/source/gfx/primBuilder.cpp b/Engine/source/gfx/primBuilder.cpp index f47cb116f..db257b47d 100644 --- a/Engine/source/gfx/primBuilder.cpp +++ b/Engine/source/gfx/primBuilder.cpp @@ -199,9 +199,9 @@ void end( bool useGenericShaders ) if ( stripStart > 0 ) { - // TODO: Fix this to allow > MAX_DYNAMIC_VERTS! + // TODO: Fix this to allow > GFX_MAX_DYNAMIC_VERTS! - U32 copyVerts = getMin( (U32)MAX_DYNAMIC_VERTS, numVerts ); + U32 copyVerts = getMin( (U32)GFX_MAX_DYNAMIC_VERTS, numVerts ); mVertBuff.set( GFX, copyVerts, GFXBufferTypeVolatile ); GFXVertexPCT *verts = mVertBuff.lock(); @@ -216,7 +216,7 @@ void end( bool useGenericShaders ) { while ( numVerts > 0 ) { - U32 copyVerts = getMin( (U32)MAX_DYNAMIC_VERTS, numVerts ); + U32 copyVerts = getMin( (U32)GFX_MAX_DYNAMIC_VERTS, numVerts ); copyVerts -= copyVerts % vertStride; mVertBuff.set( GFX, copyVerts, GFXBufferTypeVolatile ); diff --git a/Engine/source/gfx/sim/gfxStateBlockData.cpp b/Engine/source/gfx/sim/gfxStateBlockData.cpp index 6bd3effee..913dbbf00 100644 --- a/Engine/source/gfx/sim/gfxStateBlockData.cpp +++ b/Engine/source/gfx/sim/gfxStateBlockData.cpp @@ -59,7 +59,7 @@ ConsoleDocClass( GFXStateBlockData, GFXStateBlockData::GFXStateBlockData() { - for (U32 i = 0; i < TEXTURE_STAGE_COUNT; i++) + for (U32 i = 0; i < GFX_TEXTURE_STAGE_COUNT; i++) mSamplerStates[i] = NULL; } @@ -210,9 +210,6 @@ void GFXStateBlockData::initPersistFields() addGroup( "Fixed Function" ); - addField( "ffLighting", TypeBool, Offset(mState.ffLighting, GFXStateBlockData), - "Enables fixed function lighting when rendering without a shader on geometry with vertex normals. The default is false." ); - addField( "vertexColorEnable", TypeBool, Offset(mState.vertexColorEnable, GFXStateBlockData), "Enables fixed function vertex coloring when rendering without a shader. The default is false." ); @@ -224,7 +221,7 @@ void GFXStateBlockData::initPersistFields() addField( "samplersDefined", TypeBool, Offset(mState.samplersDefined, GFXStateBlockData), "Set to true if the sampler states are not all defaults." ); - addField( "samplerStates", TYPEID(), Offset(mSamplerStates, GFXStateBlockData), TEXTURE_STAGE_COUNT, + addField( "samplerStates", TYPEID(), Offset(mSamplerStates, GFXStateBlockData), GFX_TEXTURE_STAGE_COUNT, "The array of texture sampler states.\n" "@note Not all graphics devices support 16 samplers. In general " "all systems support 4 samplers with most modern cards doing 8." ); @@ -243,7 +240,7 @@ bool GFXStateBlockData::onAdd() if (!Parent::onAdd()) return false; - for (U32 i = 0; i < TEXTURE_STAGE_COUNT; i++) + for (U32 i = 0; i < GFX_TEXTURE_STAGE_COUNT; i++) { if (mSamplerStates[i]) mSamplerStates[i]->setSamplerState(mState.samplers[i]); @@ -284,38 +281,6 @@ void GFXSamplerStateData::initPersistFields() { Parent::initPersistFields(); - addGroup( "Color Op" ); - - addField("textureColorOp", TypeGFXTextureOp, Offset(mState.textureColorOp, GFXSamplerStateData), - "The texture color blending operation. The default value is GFXTOPDisable which disables the sampler." ); - - addField("colorArg1", TYPEID< GFXTextureArgument >(), Offset(mState.colorArg1, GFXSamplerStateData), - "The first color argument for the texture stage. The default value is GFXTACurrent." ); - - addField("colorArg2", TYPEID< GFXTextureArgument >(), Offset(mState.colorArg2, GFXSamplerStateData), - "The second color argument for the texture stage. The default value is GFXTATexture." ); - - addField("colorArg3", TYPEID< GFXTextureArgument >(), Offset(mState.colorArg3, GFXSamplerStateData), - "The third color argument for triadic operations (multiply, add, and linearly interpolate). The default value is GFXTACurrent." ); - - endGroup( "Color Op" ); - - addGroup( "Alpha Op" ); - - addField("alphaOp", TypeGFXTextureOp, Offset(mState.alphaOp, GFXSamplerStateData), - "The texture alpha blending operation. The default value is GFXTOPModulate." ); - - addField("alphaArg1", TYPEID< GFXTextureArgument >(), Offset(mState.alphaArg1, GFXSamplerStateData), - "The first alpha argument for the texture stage. The default value is GFXTATexture." ); - - addField("alphaArg2", TYPEID< GFXTextureArgument >(), Offset(mState.alphaArg2, GFXSamplerStateData), - "The second alpha argument for the texture stage. The default value is GFXTADiffuse." ); - - addField("alphaArg3", TYPEID< GFXTextureArgument >(), Offset(mState.alphaArg3, GFXSamplerStateData), - "The third alpha channel selector operand for triadic operations (multiply, add, and linearly interpolate). The default value is GFXTACurrent." ); - - endGroup( "Alpha Op" ); - addGroup( "Address Mode" ); addField("addressModeU", TypeGFXTextureAddressMode, Offset(mState.addressModeU, GFXSamplerStateData), @@ -348,12 +313,6 @@ void GFXSamplerStateData::initPersistFields() endGroup( "Filter State" ); - addField("textureTransform", TypeGFXTextureTransformFlags, Offset(mState.textureTransform, GFXSamplerStateData), - "Sets the texture transform state. The default is GFXTTFFDisable." ); - - addField("resultArg", TypeGFXTextureArgument, Offset(mState.resultArg, GFXSamplerStateData), - "The selection of the destination register for the result of this stage. The default is GFXTACurrent." ); - addField("samplerFunc", TypeGFXCmpFunc, Offset(mState.samplerFunc, GFXSamplerStateData), "Compares sampled data against existing sampled data. The default is GFXCmpNever."); } diff --git a/Engine/source/gfx/sim/gfxStateBlockData.h b/Engine/source/gfx/sim/gfxStateBlockData.h index b8c6f7ea4..7fb7731c6 100644 --- a/Engine/source/gfx/sim/gfxStateBlockData.h +++ b/Engine/source/gfx/sim/gfxStateBlockData.h @@ -38,7 +38,7 @@ class GFXStateBlockData : public SimObject typedef SimObject Parent; GFXStateBlockDesc mState; - GFXSamplerStateData* mSamplerStates[TEXTURE_STAGE_COUNT]; + GFXSamplerStateData* mSamplerStates[GFX_TEXTURE_STAGE_COUNT]; public: GFXStateBlockData(); diff --git a/Engine/source/gui/worldEditor/guiTerrPreviewCtrl.cpp b/Engine/source/gui/worldEditor/guiTerrPreviewCtrl.cpp index 0d3c988bf..12699c7ca 100644 --- a/Engine/source/gui/worldEditor/guiTerrPreviewCtrl.cpp +++ b/Engine/source/gui/worldEditor/guiTerrPreviewCtrl.cpp @@ -68,14 +68,11 @@ bool GuiTerrPreviewCtrl::onAdd() desc.samplersDefined = true; desc.samplers[0].addressModeU = GFXAddressWrap; desc.samplers[0].addressModeV = GFXAddressWrap; - desc.samplers[0].textureColorOp = GFXTOPSelectARG1; - desc.samplers[0].colorArg1 = GFXTATexture; desc.setCullMode(GFXCullNone); desc.setZReadWrite(false); mTerrainBitmapStateBlock = GFX->createStateBlock(desc); - desc.samplers[0].textureColorOp = GFXTOPDisable; mControlsStateBlock = GFX->createStateBlock(desc); diff --git a/Engine/source/gui/worldEditor/terrainEditor.cpp b/Engine/source/gui/worldEditor/terrainEditor.cpp index 8cc2c5648..85e7bddd4 100644 --- a/Engine/source/gui/worldEditor/terrainEditor.cpp +++ b/Engine/source/gui/worldEditor/terrainEditor.cpp @@ -1339,7 +1339,7 @@ void TerrainEditor::renderPoints( const Vector &pointList ) while ( vertsLeft > 0 ) { - U32 vertsThisDrawCall = getMin( (U32)vertsLeft, (U32)MAX_DYNAMIC_VERTS ); + U32 vertsThisDrawCall = getMin( (U32)vertsLeft, (U32)GFX_MAX_DYNAMIC_VERTS ); vertsLeft -= vertsThisDrawCall; GFXVertexBufferHandle vbuff( GFX, vertsThisDrawCall, GFXBufferTypeVolatile ); diff --git a/Engine/source/gui/worldEditor/worldEditor.cpp b/Engine/source/gui/worldEditor/worldEditor.cpp index 4f8d31577..d052d5698 100644 --- a/Engine/source/gui/worldEditor/worldEditor.cpp +++ b/Engine/source/gui/worldEditor/worldEditor.cpp @@ -1500,7 +1500,6 @@ void WorldEditor::renderSplinePath(SimPath::Path *path) desc.setCullMode( GFXCullNone ); desc.setBlend( true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha); desc.samplersDefined = true; - desc.samplers[0].textureColorOp = GFXTOPDisable; mSplineSB = GFX->createStateBlock( desc ); } diff --git a/Engine/source/lighting/lightInfo.cpp b/Engine/source/lighting/lightInfo.cpp index 10e6f0b01..c32132cfc 100644 --- a/Engine/source/lighting/lightInfo.cpp +++ b/Engine/source/lighting/lightInfo.cpp @@ -91,35 +91,6 @@ void LightInfo::set( const LightInfo *light ) } } -void LightInfo::setGFXLight( GFXLightInfo *outLight ) -{ - switch( getType() ) - { - case LightInfo::Point : - outLight->mType = GFXLightInfo::Point; - break; - case LightInfo::Spot : - outLight->mType = GFXLightInfo::Spot; - break; - case LightInfo::Vector: - outLight->mType = GFXLightInfo::Vector; - break; - case LightInfo::Ambient: - outLight->mType = GFXLightInfo::Ambient; - break; - default: - break; - } - - outLight->mPos = getPosition(); - outLight->mDirection = getDirection(); - outLight->mColor = mColor * mBrightness; - outLight->mAmbient = mAmbient; - outLight->mRadius = mRange.x; - outLight->mInnerConeAngle = mInnerConeAngle; - outLight->mOuterConeAngle = mOuterConeAngle; -} - void LightInfo::setDirection( const VectorF &dir ) { MathUtils::getMatrixFromForwardVector( mNormalize( dir ), &mTransform ); diff --git a/Engine/source/lighting/lightInfo.h b/Engine/source/lighting/lightInfo.h index ba45fdc59..78001209f 100644 --- a/Engine/source/lighting/lightInfo.h +++ b/Engine/source/lighting/lightInfo.h @@ -159,9 +159,6 @@ public: // Copies data passed in from light void set( const LightInfo *light ); - // Sets a fixed function GFXLight with our properties - void setGFXLight( GFXLightInfo *light ); - // Accessors Type getType() const { return mType; } void setType( Type val ) { mType = val; } diff --git a/Engine/source/materials/matInstance.cpp b/Engine/source/materials/matInstance.cpp index 5fd6509c8..eeb049129 100644 --- a/Engine/source/materials/matInstance.cpp +++ b/Engine/source/materials/matInstance.cpp @@ -26,7 +26,6 @@ #include "materials/materialManager.h" #include "materials/customMaterialDefinition.h" #include "materials/processedMaterial.h" -#include "materials/processedFFMaterial.h" #include "materials/processedShaderMaterial.h" #include "materials/processedCustomMaterial.h" #include "materials/materialFeatureTypes.h" @@ -347,16 +346,14 @@ bool MatInstance::processMaterial() { AssertWarn(custMat->mVersion == 0.0f, avar("Can't load CustomMaterial %s for %s, using generic FF fallback", String(mMaterial->getName()).isEmpty() ? "Unknown" : mMaterial->getName(), custMat->mMapTo.c_str())); - mProcessedMaterial = new ProcessedFFMaterial(*mMaterial); } } else mProcessedMaterial = new ProcessedCustomMaterial(*mMaterial); } - else if(GFX->getPixelShaderVersion() > 0.001) - mProcessedMaterial = getShaderMaterial(); else - mProcessedMaterial = new ProcessedFFMaterial(*mMaterial); + mProcessedMaterial = getShaderMaterial(); + if (mProcessedMaterial) { diff --git a/Engine/source/materials/processedFFMaterial.cpp b/Engine/source/materials/processedFFMaterial.cpp deleted file mode 100644 index 2ce79e127..000000000 --- a/Engine/source/materials/processedFFMaterial.cpp +++ /dev/null @@ -1,375 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#include "platform/platform.h" -#include "materials/processedFFMaterial.h" - -#include "gfx/sim/cubemapData.h" -#include "materials/sceneData.h" -#include "materials/customMaterialDefinition.h" -#include "materials/materialFeatureTypes.h" -#include "gfx/sim/gfxStateBlockData.h" -#include "gfx/gfxDevice.h" -#include "gfx/genericConstBuffer.h" -#include "materials/materialParameters.h" -#include "lighting/lightInfo.h" -#include "scene/sceneRenderState.h" -#include "core/util/safeDelete.h" -#include "math/util/matrixSet.h" - -class FFMaterialParameterHandle : public MaterialParameterHandle -{ -public: - virtual ~FFMaterialParameterHandle() {} - virtual const String& getName() const { return mName; } - virtual bool isValid() const { return false; } - virtual S32 getSamplerRegister( U32 pass ) const { return -1; } -private: - String mName; -}; - -ProcessedFFMaterial::ProcessedFFMaterial() -{ - VECTOR_SET_ASSOCIATION( mParamDesc ); - - _construct(); -} - -ProcessedFFMaterial::ProcessedFFMaterial(Material &mat, const bool isLightingMaterial) -{ - VECTOR_SET_ASSOCIATION( mParamDesc ); - - _construct(); - mMaterial = &mat; - mIsLightingMaterial = isLightingMaterial; -} - -void ProcessedFFMaterial::_construct() -{ - mHasSetStageData = false; - mHasGlow = false; - mHasAccumulation = false; - mIsLightingMaterial = false; - mDefaultHandle = new FFMaterialParameterHandle(); - mDefaultParameters = new MaterialParameters(); - mCurrentParams = mDefaultParameters; -} - -ProcessedFFMaterial::~ProcessedFFMaterial() -{ - SAFE_DELETE(mDefaultParameters); - SAFE_DELETE( mDefaultHandle ); -} - -void ProcessedFFMaterial::_createPasses( U32 stageNum, const FeatureSet &features ) -{ - FixedFuncFeatureData featData; - _determineFeatures(stageNum, featData, features); - // Just create a simple pass! - _addPass(0, featData); - - mFeatures.clear(); - if ( featData.features[FixedFuncFeatureData::DiffuseMap] ) - mFeatures.addFeature( MFT_DiffuseMap ); - if ( featData.features[FixedFuncFeatureData::LightMap] ) - mFeatures.addFeature( MFT_LightMap ); - if ( featData.features[FixedFuncFeatureData::ToneMap] ) - mFeatures.addFeature( MFT_ToneMap ); - -} - -void ProcessedFFMaterial::_determineFeatures( U32 stageNum, - FixedFuncFeatureData& featData, - const FeatureSet &features ) -{ - if ( mStages[stageNum].getTex( MFT_DiffuseMap ) ) - featData.features[FixedFuncFeatureData::DiffuseMap] = true; - - if ( features.hasFeature( MFT_LightMap ) ) - featData.features[FixedFuncFeatureData::LightMap] = true; - if ( features.hasFeature( MFT_ToneMap )) - featData.features[FixedFuncFeatureData::ToneMap] = true; -} - -U32 ProcessedFFMaterial::getNumStages() -{ - // Loops through all stages to determine how many stages we actually use - U32 numStages = 0; - - U32 i; - for( i=0; imCubemapData || mMaterial->mDynamicCubemap ) - { - numStages++; - continue; - } - } - - // If we have a texture for the a feature the - // stage is active. - if ( mStages[i].hasValidTex() ) - stageActive = true; - - // If we have a Material that is vertex lit - // then it may not have a texture - if( mMaterial->mVertLit[i] ) - { - stageActive = true; - } - - // Increment the number of active stages - numStages += stageActive; - } - - - return numStages; -} - -bool ProcessedFFMaterial::setupPass( SceneRenderState *state, const SceneData &sgData, U32 pass ) -{ - PROFILE_SCOPE( ProcessedFFMaterial_SetupPass ); - - // Make sure we have a pass - if(pass >= mPasses.size()) - return false; - - _setRenderState( state, sgData, pass ); - - // Bind our textures - setTextureStages( state, sgData, pass ); - return true; -} - -void ProcessedFFMaterial::setTextureStages(SceneRenderState * state, const SceneData& sgData, U32 pass) -{ - // We may need to do some trickery in here for fixed function, this is just copy/paste from MatInstance -#ifdef TORQUE_DEBUG - AssertFatal( passmNumTex; i++ ) - { - U32 currTexFlag = rpd->mTexType[i]; - if (!LIGHTMGR || !LIGHTMGR->setTextureStage(sgData, currTexFlag, i, NULL, NULL)) - { - switch( currTexFlag ) - { - case Material::NoTexture: - if (rpd->mTexSlot[i].texObject) - GFX->setTexture( i, rpd->mTexSlot[i].texObject ); - break; - - case Material::NormalizeCube: - GFX->setCubeTexture(i, Material::GetNormalizeCube()); - break; - - case Material::Lightmap: - GFX->setTexture( i, sgData.lightmap ); - break; - - case Material::Cube: - // TODO: Is this right? - GFX->setTexture( i, rpd->mTexSlot[0].texObject ); - break; - - case Material::SGCube: - // No cubemap support just yet - //GFX->setCubeTexture( i, sgData.cubemap ); - GFX->setTexture( i, rpd->mTexSlot[0].texObject ); - break; - - case Material::BackBuff: - GFX->setTexture( i, sgData.backBuffTex ); - break; - } - } - } -} - -MaterialParameters* ProcessedFFMaterial::allocMaterialParameters() -{ - return new MaterialParameters(); -} - -MaterialParameters* ProcessedFFMaterial::getDefaultMaterialParameters() -{ - return mDefaultParameters; -} - -MaterialParameterHandle* ProcessedFFMaterial::getMaterialParameterHandle(const String& name) -{ - return mDefaultHandle; -} - -void ProcessedFFMaterial::setTransforms(const MatrixSet &matrixSet, SceneRenderState *state, const U32 pass) -{ - GFX->setWorldMatrix(matrixSet.getObjectToWorld()); - GFX->setViewMatrix(matrixSet.getWorldToCamera()); - GFX->setProjectionMatrix(matrixSet.getCameraToScreen()); -} - -void ProcessedFFMaterial::setSceneInfo(SceneRenderState * state, const SceneData& sgData, U32 pass) -{ - _setPrimaryLightInfo(*sgData.objTrans, sgData.lights[0], pass); - _setSecondaryLightInfo(*sgData.objTrans, sgData.lights[1]); -} - -void ProcessedFFMaterial::_setPrimaryLightInfo(const MatrixF &_objTrans, LightInfo* light, U32 pass) -{ - // Just in case - GFX->setGlobalAmbientColor(LinearColorF(0.0f, 0.0f, 0.0f, 1.0f)); - if ( light->getType() == LightInfo::Ambient ) - { - // Ambient light - GFX->setGlobalAmbientColor( light->getAmbient() ); - return; - } - - GFX->setLight(0, NULL); - GFX->setLight(1, NULL); - // This is a quick hack that lets us use FF lights - GFXLightMaterial lightMat; - lightMat.ambient = LinearColorF(1.0f, 1.0f, 1.0f, 1.0f); - lightMat.diffuse = LinearColorF(1.0f, 1.0f, 1.0f, 1.0f); - lightMat.emissive = LinearColorF(0.0f, 0.0f, 0.0f, 0.0f); - lightMat.specular = LinearColorF(0.0f, 0.0f, 0.0f, 0.0f); - lightMat.shininess = 128.0f; - GFX->setLightMaterial(lightMat); - - // set object transform - MatrixF objTrans = _objTrans; - objTrans.inverse(); - - // fill in primary light - //------------------------- - GFXLightInfo xlatedLight; - light->setGFXLight(&xlatedLight); - Point3F lightPos = light->getPosition(); - Point3F lightDir = light->getDirection(); - objTrans.mulP(lightPos); - objTrans.mulV(lightDir); - - xlatedLight.mPos = lightPos; - xlatedLight.mDirection = lightDir; - - GFX->setLight(0, &xlatedLight); -} - -void ProcessedFFMaterial::_setSecondaryLightInfo(const MatrixF &_objTrans, LightInfo* light) -{ - // set object transform - MatrixF objTrans = _objTrans; - objTrans.inverse(); - - // fill in secondary light - //------------------------- - GFXLightInfo xlatedLight; - light->setGFXLight(&xlatedLight); - - Point3F lightPos = light->getPosition(); - Point3F lightDir = light->getDirection(); - objTrans.mulP(lightPos); - objTrans.mulV(lightDir); - - xlatedLight.mPos = lightPos; - xlatedLight.mDirection = lightDir; - - GFX->setLight(1, &xlatedLight); -} - -bool ProcessedFFMaterial::init( const FeatureSet &features, - const GFXVertexFormat *vertexFormat, - const MatFeaturesDelegate &featuresDelegate ) -{ - TORQUE_UNUSED( vertexFormat ); - TORQUE_UNUSED( featuresDelegate ); - - _setStageData(); - - // Just create a simple pass - _createPasses(0, features); - _initRenderPassDataStateBlocks(); - mStateHint.init( this ); - - return true; -} - -void ProcessedFFMaterial::_addPass(U32 stageNum, FixedFuncFeatureData& featData) -{ - U32 numTex = 0; - - // Just creates a simple pass, but it can still glow! - RenderPassData rpd; - - // Base texture, texunit 0 - if(featData.features[FixedFuncFeatureData::DiffuseMap]) - { - rpd.mTexSlot[0].texObject = mStages[stageNum].getTex( MFT_DiffuseMap ); - rpd.mTexType[0] = Material::NoTexture; - numTex++; - } - - // lightmap, texunit 1 - if(featData.features[FixedFuncFeatureData::LightMap]) - { - rpd.mTexType[1] = Material::Lightmap; - numTex++; - } - - rpd.mNumTex = numTex; - rpd.mStageNum = stageNum; - rpd.mGlow = false; - - mPasses.push_back( new RenderPassData(rpd) ); -} - -void ProcessedFFMaterial::_setPassBlendOp() -{ - -} - -void ProcessedFFMaterial::_initPassStateBlock( RenderPassData *rpd, GFXStateBlockDesc &result ) -{ - Parent::_initPassStateBlock( rpd, result ); - - if ( mIsLightingMaterial ) - { - result.ffLighting = true; - result.blendDefined = true; - result.blendEnable = true; - result.blendSrc = GFXBlendOne; - result.blendDest = GFXBlendZero; - } - - // This is here for generic FF shader fallbacks. - CustomMaterial* custmat = dynamic_cast(mMaterial); - if (custmat && custmat->getStateBlockData() ) - result.addDesc(custmat->getStateBlockData()->getState()); -} diff --git a/Engine/source/materials/processedFFMaterial.h b/Engine/source/materials/processedFFMaterial.h deleted file mode 100644 index 9af49a29a..000000000 --- a/Engine/source/materials/processedFFMaterial.h +++ /dev/null @@ -1,127 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- -#ifndef _MATERIALS_PROCESSEDFFMATERIAL_H_ -#define _MATERIALS_PROCESSEDFFMATERIAL_H_ - -#ifndef _MATERIALS_PROCESSEDMATERIAL_H_ -#include "materials/processedMaterial.h" -#endif - -class LightInfo; -struct GFXShaderConstDesc; - - -/// Fixed function rendering. Does not load or use shaders. Does not rely on GFXMaterialFeatureData. -/// Tries very hard to not rely on anything possibly related to shaders. -/// -/// @note Does not always succeed. -class ProcessedFFMaterial : public ProcessedMaterial -{ - typedef ProcessedMaterial Parent; -public: - ProcessedFFMaterial(); - ProcessedFFMaterial(Material &mat, const bool isLightingMaterial = false); - ~ProcessedFFMaterial(); - /// @name Render state setting - /// - /// @{ - - /// Sets necessary textures and texture ops for rendering - virtual void setTextureStages(SceneRenderState *, const SceneData &sgData, U32 pass ); - - virtual MaterialParameters* allocMaterialParameters(); - virtual MaterialParameterHandle* getMaterialParameterHandle(const String& name); - virtual MaterialParameters* getDefaultMaterialParameters(); - - virtual void setTransforms(const MatrixSet &matrixSet, SceneRenderState *state, const U32 pass); - virtual void setNodeTransforms(const MatrixF *address, const U32 numTransforms, const U32 pass) {;} - virtual void setCustomShaderData(Vector &shaderData, const U32 pass) {;} - - virtual void setSceneInfo(SceneRenderState *, const SceneData& sgData, U32 pass); - - /// @} - - virtual bool init( const FeatureSet &features, - const GFXVertexFormat *vertexFormat, - const MatFeaturesDelegate &featuresDelegate ); - - /// Sets up the given pass - /// - /// @returns false if the pass could not be set up - virtual bool setupPass(SceneRenderState *, const SceneData& sgData, U32 pass); - - /// Returns the number of stages we're using (not to be confused with the number of passes) - virtual U32 getNumStages(); - -protected: - - MaterialParameterHandle* mDefaultHandle; - MaterialParameters* mDefaultParameters; - - struct FixedFuncFeatureData - { - enum - { - DiffuseMap, - LightMap, - ToneMap, - NumFeatures - }; - bool features[NumFeatures]; - }; - - bool mIsLightingMaterial; - - Vector mParamDesc; - - /// @name Internal functions - /// - /// @{ - - /// Adds a pass for the given stage - virtual void _addPass(U32 stageNum, FixedFuncFeatureData& featData); - - /// Chooses a blend op for the pass during pass creation - virtual void _setPassBlendOp(); - - /// Creates all necessary passes for the given stage - void _createPasses( U32 stageNum, const FeatureSet &features ); - - /// Determine what features we need - void _determineFeatures( U32 stageNum, - FixedFuncFeatureData &featData, - const FeatureSet &features); - - /// Sets light info for the first light - virtual void _setPrimaryLightInfo(const MatrixF &objTrans, LightInfo* light, U32 pass); - - /// Sets light info for the second light - virtual void _setSecondaryLightInfo(const MatrixF &objTrans, LightInfo* light); - - /// Does the base render state block setting, normally per pass - virtual void _initPassStateBlock( RenderPassData *rpd, GFXStateBlockDesc &result ); - /// @} - - void _construct(); -}; - -#endif diff --git a/Engine/source/materials/processedMaterial.cpp b/Engine/source/materials/processedMaterial.cpp index 05d3aac16..5a801a982 100644 --- a/Engine/source/materials/processedMaterial.cpp +++ b/Engine/source/materials/processedMaterial.cpp @@ -210,10 +210,6 @@ void ProcessedMaterial::_initStateBlockTemplates(GFXStateBlockDesc& stateTranslu stateTranslucent.alphaTestRef = mMaterial->mAlphaRef; stateTranslucent.alphaTestFunc = GFXCmpGreaterEqual; stateTranslucent.samplersDefined = true; - stateTranslucent.samplers[0].textureColorOp = GFXTOPModulate; - stateTranslucent.samplers[0].alphaOp = GFXTOPModulate; - stateTranslucent.samplers[0].alphaArg1 = GFXTATexture; - stateTranslucent.samplers[0].alphaArg2 = GFXTADiffuse; // Glow stateGlow.zDefined = true; @@ -268,7 +264,6 @@ void ProcessedMaterial::_initPassStateBlock( RenderPassData *rpd, GFXStateBlockD { default: { - result.samplers[i].textureColorOp = GFXTOPModulate; result.samplers[i].addressModeU = GFXAddressWrap; result.samplers[i].addressModeV = GFXAddressWrap; diff --git a/Engine/source/materials/processedShaderMaterial.cpp b/Engine/source/materials/processedShaderMaterial.cpp index a5c6c89a1..049cb0e87 100644 --- a/Engine/source/materials/processedShaderMaterial.cpp +++ b/Engine/source/materials/processedShaderMaterial.cpp @@ -109,7 +109,7 @@ void ShaderConstHandles::init( GFXShader *shader, CustomMaterial* mat /*=NULL*/) mImposterUVs = shader->getShaderConstHandle( "$imposterUVs" ); mImposterLimits = shader->getShaderConstHandle( "$imposterLimits" ); - for (S32 i = 0; i < TEXTURE_STAGE_COUNT; ++i) + for (S32 i = 0; i < GFX_TEXTURE_STAGE_COUNT; ++i) mRTParamsSC[i] = shader->getShaderConstHandle( String::ToString( "$rtParams%d", i ) ); // MFT_HardwareSkinning diff --git a/Engine/source/materials/processedShaderMaterial.h b/Engine/source/materials/processedShaderMaterial.h index dc63f4f25..cc50b0cfc 100644 --- a/Engine/source/materials/processedShaderMaterial.h +++ b/Engine/source/materials/processedShaderMaterial.h @@ -99,7 +99,7 @@ public: GFXShaderConstHandle* mMatInfoFlagsSC; GFXShaderConstHandle* mTexHandlesSC[Material::MAX_TEX_PER_PASS]; - GFXShaderConstHandle* mRTParamsSC[TEXTURE_STAGE_COUNT]; + GFXShaderConstHandle* mRTParamsSC[GFX_TEXTURE_STAGE_COUNT]; GFXShaderConstHandle* mNodeTransforms; diff --git a/Engine/source/renderInstance/renderParticleMgr.cpp b/Engine/source/renderInstance/renderParticleMgr.cpp index fb91c8a31..3f4779d34 100644 --- a/Engine/source/renderInstance/renderParticleMgr.cpp +++ b/Engine/source/renderInstance/renderParticleMgr.cpp @@ -664,9 +664,6 @@ GFXStateBlockRef RenderParticleMgr::_getOffscreenStateBlock(ParticleRenderInst * // Diffuse texture sampler d.samplers[0] = GFXSamplerStateDesc::getClampLinear(); - d.samplers[0].alphaOp = GFXTOPModulate; - d.samplers[0].alphaArg1 = GFXTATexture; - d.samplers[0].alphaArg2 = GFXTADiffuse; // Deferred sampler d.samplers[1] = GFXSamplerStateDesc::getClampPoint(); @@ -697,9 +694,6 @@ GFXStateBlockRef RenderParticleMgr::_getHighResStateBlock(ParticleRenderInst *ri // Diffuse texture sampler d.samplers[0] = GFXSamplerStateDesc::getClampLinear(); - d.samplers[0].alphaOp = GFXTOPModulate; - d.samplers[0].alphaArg1 = GFXTATexture; - d.samplers[0].alphaArg2 = GFXTADiffuse; // Deferred sampler d.samplers[1] = GFXSamplerStateDesc::getClampPoint(); @@ -769,9 +763,6 @@ GFXStateBlockRef RenderParticleMgr::_getMixedResStateBlock(ParticleRenderInst *r // Diffuse texture sampler d.samplers[0] = GFXSamplerStateDesc::getClampLinear(); - d.samplers[0].alphaOp = GFXTOPModulate; - d.samplers[0].alphaArg1 = GFXTATexture; - d.samplers[0].alphaArg2 = GFXTADiffuse; // Deferred sampler d.samplers[1] = GFXSamplerStateDesc::getClampPoint(); @@ -828,4 +819,4 @@ bool RenderParticleMgr::_handleGFXEvent( GFXDevice::GFXDeviceEventType event ) // Do nothing. This render manager uses its target chain as a pool of targets. return true; -} \ No newline at end of file +} diff --git a/Engine/source/renderInstance/renderTranslucentMgr.cpp b/Engine/source/renderInstance/renderTranslucentMgr.cpp index 94598262d..725cd3e7e 100644 --- a/Engine/source/renderInstance/renderTranslucentMgr.cpp +++ b/Engine/source/renderInstance/renderTranslucentMgr.cpp @@ -125,9 +125,6 @@ GFXStateBlockRef RenderTranslucentMgr::_getStateBlock( U8 transFlag ) d.zWriteEnable = false; d.samplersDefined = true; d.samplers[0] = GFXSamplerStateDesc::getClampLinear(); - d.samplers[0].alphaOp = GFXTOPModulate; - d.samplers[0].alphaArg1 = GFXTATexture; - d.samplers[0].alphaArg2 = GFXTADiffuse; mStateBlocks[transFlag] = GFX->createStateBlock(d); return mStateBlocks[transFlag];