mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
Removed old fixed function code from GFX.
This commit is contained in:
parent
58d2e30af7
commit
5a933c00d3
53 changed files with 98 additions and 1646 deletions
|
|
@ -1520,14 +1520,10 @@ void fxFoliageReplicator::renderObject(ObjectRenderInst *ri, SceneRenderState *s
|
||||||
|
|
||||||
// Debug SB
|
// Debug SB
|
||||||
desc.samplersDefined = true;
|
desc.samplersDefined = true;
|
||||||
desc.samplers[0].textureColorOp = GFXTOPDisable;
|
|
||||||
desc.samplers[1].textureColorOp = GFXTOPDisable;
|
|
||||||
|
|
||||||
mDebugSB = GFX->createStateBlock(desc);
|
mDebugSB = GFX->createStateBlock(desc);
|
||||||
|
|
||||||
// Render SB
|
// Render SB
|
||||||
desc.samplers[0].textureColorOp = GFXTOPModulate;
|
|
||||||
desc.samplers[1].textureColorOp = GFXTOPModulate;
|
|
||||||
desc.samplers[1].addressModeU = GFXAddressClamp;
|
desc.samplers[1].addressModeU = GFXAddressClamp;
|
||||||
desc.samplers[1].addressModeV = GFXAddressClamp;
|
desc.samplers[1].addressModeV = GFXAddressClamp;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1608,14 +1608,6 @@ void Precipitation::renderObject(ObjectRenderInst *ri, SceneRenderState *state,
|
||||||
mDefaultSB = GFX->createStateBlock(desc);
|
mDefaultSB = GFX->createStateBlock(desc);
|
||||||
|
|
||||||
desc.samplersDefined = true;
|
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);
|
mDistantSB = GFX->createStateBlock(desc);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,6 @@ void GuiSpeedometerHud::onRender(Point2I offset, const RectI &updateRect)
|
||||||
GFXStateBlockDesc desc;
|
GFXStateBlockDesc desc;
|
||||||
desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
|
desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
|
||||||
desc.samplersDefined = true;
|
desc.samplersDefined = true;
|
||||||
desc.samplers[0].textureColorOp = GFXTOPDisable;
|
|
||||||
mBlendSB = GFX->createStateBlock(desc);
|
mBlendSB = GFX->createStateBlock(desc);
|
||||||
}
|
}
|
||||||
GFX->setStateBlock(mBlendSB);
|
GFX->setStateBlock(mBlendSB);
|
||||||
|
|
|
||||||
|
|
@ -2799,5 +2799,5 @@ DefineEngineFunction( getMaxDynamicVerts, S32, (),,
|
||||||
"Get max number of allowable dynamic vertices in a single vertex buffer.\n\n"
|
"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 the max number of allowable dynamic vertices in a single vertex buffer" )
|
||||||
{
|
{
|
||||||
return MAX_DYNAMIC_VERTS / 2;
|
return GFX_MAX_DYNAMIC_VERTS / 2;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -960,7 +960,6 @@ bool VolumetricFog::setupRenderer()
|
||||||
descD.samplers[0].magFilter = GFXTextureFilterLinear;
|
descD.samplers[0].magFilter = GFXTextureFilterLinear;
|
||||||
descD.samplers[0].minFilter = GFXTextureFilterLinear;
|
descD.samplers[0].minFilter = GFXTextureFilterLinear;
|
||||||
descD.samplers[0].mipFilter = GFXTextureFilterLinear;
|
descD.samplers[0].mipFilter = GFXTextureFilterLinear;
|
||||||
descD.samplers[0].textureColorOp = GFXTOPDisable;
|
|
||||||
|
|
||||||
// DepthBuffer sampler
|
// DepthBuffer sampler
|
||||||
descD.samplers[1].addressModeU = GFXAddressClamp;
|
descD.samplers[1].addressModeU = GFXAddressClamp;
|
||||||
|
|
@ -969,7 +968,6 @@ bool VolumetricFog::setupRenderer()
|
||||||
descD.samplers[1].magFilter = GFXTextureFilterLinear;
|
descD.samplers[1].magFilter = GFXTextureFilterLinear;
|
||||||
descD.samplers[1].minFilter = GFXTextureFilterLinear;
|
descD.samplers[1].minFilter = GFXTextureFilterLinear;
|
||||||
descD.samplers[1].mipFilter = GFXTextureFilterLinear;
|
descD.samplers[1].mipFilter = GFXTextureFilterLinear;
|
||||||
descD.samplers[1].textureColorOp = GFXTOPModulate;
|
|
||||||
|
|
||||||
// FrontBuffer sampler
|
// FrontBuffer sampler
|
||||||
descD.samplers[2].addressModeU = GFXAddressClamp;
|
descD.samplers[2].addressModeU = GFXAddressClamp;
|
||||||
|
|
@ -978,7 +976,6 @@ bool VolumetricFog::setupRenderer()
|
||||||
descD.samplers[2].magFilter = GFXTextureFilterLinear;
|
descD.samplers[2].magFilter = GFXTextureFilterLinear;
|
||||||
descD.samplers[2].minFilter = GFXTextureFilterLinear;
|
descD.samplers[2].minFilter = GFXTextureFilterLinear;
|
||||||
descD.samplers[2].mipFilter = GFXTextureFilterLinear;
|
descD.samplers[2].mipFilter = GFXTextureFilterLinear;
|
||||||
descD.samplers[2].textureColorOp = GFXTOPModulate;
|
|
||||||
|
|
||||||
// animated density modifier map sampler
|
// animated density modifier map sampler
|
||||||
descD.samplers[3].addressModeU = GFXAddressWrap;
|
descD.samplers[3].addressModeU = GFXAddressWrap;
|
||||||
|
|
@ -987,7 +984,6 @@ bool VolumetricFog::setupRenderer()
|
||||||
descD.samplers[3].magFilter = GFXTextureFilterLinear;
|
descD.samplers[3].magFilter = GFXTextureFilterLinear;
|
||||||
descD.samplers[3].minFilter = GFXTextureFilterLinear;
|
descD.samplers[3].minFilter = GFXTextureFilterLinear;
|
||||||
descD.samplers[3].mipFilter = GFXTextureFilterLinear;
|
descD.samplers[3].mipFilter = GFXTextureFilterLinear;
|
||||||
descD.samplers[3].textureColorOp = GFXTOPModulate;
|
|
||||||
|
|
||||||
dMemcpy(&descF, &descD, sizeof(GFXStateBlockDesc));
|
dMemcpy(&descF, &descD, sizeof(GFXStateBlockDesc));
|
||||||
descF.setCullMode(GFXCullCCW);
|
descF.setCullMode(GFXCullCCW);
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,6 @@ bool BasicClouds::onAdd()
|
||||||
desc.samplers[0].magFilter = GFXTextureFilterLinear;
|
desc.samplers[0].magFilter = GFXTextureFilterLinear;
|
||||||
desc.samplers[0].minFilter = GFXTextureFilterLinear;
|
desc.samplers[0].minFilter = GFXTextureFilterLinear;
|
||||||
desc.samplers[0].mipFilter = GFXTextureFilterLinear;
|
desc.samplers[0].mipFilter = GFXTextureFilterLinear;
|
||||||
desc.samplers[0].textureColorOp = GFXTOPModulate;
|
|
||||||
|
|
||||||
mStateblock = GFX->createStateBlock( desc );
|
mStateblock = GFX->createStateBlock( desc );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,6 @@ bool CloudLayer::onAdd()
|
||||||
desc.samplers[0].magFilter = GFXTextureFilterLinear;
|
desc.samplers[0].magFilter = GFXTextureFilterLinear;
|
||||||
desc.samplers[0].minFilter = GFXTextureFilterLinear;
|
desc.samplers[0].minFilter = GFXTextureFilterLinear;
|
||||||
desc.samplers[0].mipFilter = GFXTextureFilterLinear;
|
desc.samplers[0].mipFilter = GFXTextureFilterLinear;
|
||||||
desc.samplers[0].textureColorOp = GFXTOPModulate;
|
|
||||||
|
|
||||||
mStateblock = GFX->createStateBlock( desc );
|
mStateblock = GFX->createStateBlock( desc );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
mVB_high = NULL;
|
||||||
mPB_high = NULL;
|
mPB_high = NULL;
|
||||||
|
|
|
||||||
|
|
@ -961,7 +961,7 @@ void GFXD3D11Device::reacquireDefaultPoolResources()
|
||||||
mDynamicPB = new GFXD3D11PrimitiveBuffer(this, 0, 0, GFXBufferTypeDynamic);
|
mDynamicPB = new GFXD3D11PrimitiveBuffer(this, 0, 0, GFXBufferTypeDynamic);
|
||||||
|
|
||||||
D3D11_BUFFER_DESC desc;
|
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.Usage = D3D11_USAGE_DYNAMIC;
|
||||||
desc.BindFlags = D3D11_BIND_INDEX_BUFFER;
|
desc.BindFlags = D3D11_BIND_INDEX_BUFFER;
|
||||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||||
|
|
@ -1019,7 +1019,7 @@ GFXD3D11VertexBuffer * GFXD3D11Device::createVBPool( const GFXVertexFormat *vert
|
||||||
vertexFormat->getDecl();
|
vertexFormat->getDecl();
|
||||||
|
|
||||||
D3D11_BUFFER_DESC desc;
|
D3D11_BUFFER_DESC desc;
|
||||||
desc.ByteWidth = vertSize * MAX_DYNAMIC_VERTS;
|
desc.ByteWidth = vertSize * GFX_MAX_DYNAMIC_VERTS;
|
||||||
desc.Usage = D3D11_USAGE_DYNAMIC;
|
desc.Usage = D3D11_USAGE_DYNAMIC;
|
||||||
desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||||
|
|
@ -1283,7 +1283,7 @@ GFXPrimitiveBuffer * GFXD3D11Device::allocPrimitiveBuffer(U32 numIndices, U32 nu
|
||||||
if(bufferType == GFXBufferTypeVolatile)
|
if(bufferType == GFXBufferTypeVolatile)
|
||||||
{
|
{
|
||||||
// Get it from the pool if it's a volatile...
|
// 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->ib = mDynamicPB->ib;
|
||||||
res->mVolatileBuffer = mDynamicPB;
|
res->mVolatileBuffer = mDynamicPB;
|
||||||
|
|
@ -1362,7 +1362,7 @@ GFXVertexBuffer * GFXD3D11Device::allocVertexBuffer(U32 numVerts, const GFXVerte
|
||||||
if(bufferType == GFXBufferTypeVolatile)
|
if(bufferType == GFXBufferTypeVolatile)
|
||||||
{
|
{
|
||||||
// NOTE: Volatile VBs are pooled and will be allocated at lock time.
|
// 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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -176,11 +176,6 @@ protected:
|
||||||
/// Called by base GFXDevice to actually set a const buffer
|
/// Called by base GFXDevice to actually set a const buffer
|
||||||
virtual void setShaderConstBufferInternal(GFXShaderConstBuffer* 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
|
// Index buffer management
|
||||||
|
|
@ -286,8 +281,8 @@ public:
|
||||||
virtual void setVertexStreamFrequency( U32 stream, U32 frequency );
|
virtual void setVertexStreamFrequency( U32 stream, U32 frequency );
|
||||||
// }
|
// }
|
||||||
|
|
||||||
virtual U32 getMaxDynamicVerts() { return MAX_DYNAMIC_VERTS; }
|
virtual U32 getMaxDynamicVerts() { return GFX_MAX_DYNAMIC_VERTS; }
|
||||||
virtual U32 getMaxDynamicIndices() { return MAX_DYNAMIC_INDICES; }
|
virtual U32 getMaxDynamicIndices() { return GFX_MAX_DYNAMIC_INDICES; }
|
||||||
|
|
||||||
inline U32 primCountToIndexCount(GFXPrimitiveType primType, U32 primitiveCount);
|
inline U32 primCountToIndexCount(GFXPrimitiveType primType, U32 primitiveCount);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,8 +87,6 @@ void GFXD3D11EnumTranslate::init()
|
||||||
GFXD3D11TextureFilter[GFXTextureFilterPoint] = D3D11_FILTER_MIN_MAG_MIP_POINT;
|
GFXD3D11TextureFilter[GFXTextureFilterPoint] = D3D11_FILTER_MIN_MAG_MIP_POINT;
|
||||||
GFXD3D11TextureFilter[GFXTextureFilterLinear] = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
GFXD3D11TextureFilter[GFXTextureFilterLinear] = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
||||||
GFXD3D11TextureFilter[GFXTextureFilterAnisotropic] = D3D11_FILTER_ANISOTROPIC;
|
GFXD3D11TextureFilter[GFXTextureFilterAnisotropic] = D3D11_FILTER_ANISOTROPIC;
|
||||||
GFXD3D11TextureFilter[GFXTextureFilterPyramidalQuad] = D3D11_FILTER_ANISOTROPIC;
|
|
||||||
GFXD3D11TextureFilter[GFXTextureFilterGaussianQuad] = D3D11_FILTER_ANISOTROPIC;
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
GFXD3D11Blend[GFXBlendZero] = D3D11_BLEND_ZERO;
|
GFXD3D11Blend[GFXBlendZero] = D3D11_BLEND_ZERO;
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ void GFXD3D11PrimitiveBuffer::lock(U32 indexStart, U32 indexEnd, void **indexPtr
|
||||||
case GFXBufferTypeVolatile:
|
case GFXBufferTypeVolatile:
|
||||||
// Get our range now...
|
// Get our range now...
|
||||||
AssertFatal(indexStart == 0, "Cannot get a subrange on a volatile buffer.");
|
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
|
// Get the primtive buffer
|
||||||
mVolatileBuffer = D3D11->mDynamicPB;
|
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!");
|
AssertFatal( mVolatileBuffer, "GFXD3D11PrimitiveBuffer::lock - No dynamic primitive buffer was available!");
|
||||||
|
|
||||||
// We created the pool when we requested this volatile buffer, so assume it exists...
|
// 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;
|
flags = D3D11_MAP_WRITE_DISCARD;
|
||||||
mVolatileStart = indexStart = 0;
|
mVolatileStart = indexStart = 0;
|
||||||
|
|
|
||||||
|
|
@ -63,12 +63,12 @@ private:
|
||||||
D3D11_BLEND_DESC mBlendDesc;
|
D3D11_BLEND_DESC mBlendDesc;
|
||||||
D3D11_RASTERIZER_DESC mRasterizerDesc;
|
D3D11_RASTERIZER_DESC mRasterizerDesc;
|
||||||
D3D11_DEPTH_STENCIL_DESC mDepthStencilDesc;
|
D3D11_DEPTH_STENCIL_DESC mDepthStencilDesc;
|
||||||
D3D11_SAMPLER_DESC mSamplerDesc[TEXTURE_STAGE_COUNT];
|
D3D11_SAMPLER_DESC mSamplerDesc[GFX_TEXTURE_STAGE_COUNT];
|
||||||
|
|
||||||
ID3D11BlendState* mBlendState;
|
ID3D11BlendState* mBlendState;
|
||||||
ID3D11DepthStencilState* mDepthStencilState;
|
ID3D11DepthStencilState* mDepthStencilState;
|
||||||
ID3D11RasterizerState* mRasterizerState;
|
ID3D11RasterizerState* mRasterizerState;
|
||||||
ID3D11SamplerState* mSamplerStates[TEXTURE_STAGE_COUNT];
|
ID3D11SamplerState* mSamplerStates[GFX_TEXTURE_STAGE_COUNT];
|
||||||
|
|
||||||
GFXStateBlockDesc mDesc;
|
GFXStateBlockDesc mDesc;
|
||||||
U32 mCachedHashValue;
|
U32 mCachedHashValue;
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ protected:
|
||||||
bool _freeTexture(GFXTextureObject *texture, bool zombify = false);
|
bool _freeTexture(GFXTextureObject *texture, bool zombify = false);
|
||||||
|
|
||||||
private:
|
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);
|
void _innerCreateTexture(GFXD3D11TextureObject *obj, U32 height, U32 width, U32 depth, GFXFormat format, GFXTextureProfile *profile, U32 numMipLevels, bool forceMips = false, S32 antialiasLevel = 0);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -62,11 +62,11 @@ void GFXD3D11VertexBuffer::lock(U32 vertexStart, U32 vertexEnd, void **vertexPtr
|
||||||
|
|
||||||
// Get our range now...
|
// Get our range now...
|
||||||
AssertFatal(vertexStart == 0, "Cannot get a subrange on a volatile buffer.");
|
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.");
|
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...
|
// 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;
|
flags = D3D11_MAP_WRITE_DISCARD;
|
||||||
mVolatileStart = vertexStart = 0;
|
mVolatileStart = vertexStart = 0;
|
||||||
|
|
|
||||||
|
|
@ -354,11 +354,6 @@ void GFXNullDevice::enumerateAdapters( Vector<GFXAdapter*> &adapterList )
|
||||||
adapterList.push_back(toAdd);
|
adapterList.push_back(toAdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GFXNullDevice::setLightInternal(U32 lightStage, const GFXLightInfo light, bool lightEnable)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void GFXNullDevice::init( const GFXVideoMode &mode, PlatformWindow *window )
|
void GFXNullDevice::init( const GFXVideoMode &mode, PlatformWindow *window )
|
||||||
{
|
{
|
||||||
mCardProfiler = new GFXNullCardProfiler();
|
mCardProfiler = new GFXNullCardProfiler();
|
||||||
|
|
|
||||||
|
|
@ -99,9 +99,6 @@ protected:
|
||||||
|
|
||||||
virtual void setTextureInternal(U32 textureUnit, const GFXTextureObject*texture) { };
|
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.
|
/// @name State Initalization.
|
||||||
/// @{
|
/// @{
|
||||||
|
|
@ -110,8 +107,6 @@ protected:
|
||||||
/// is created.
|
/// is created.
|
||||||
virtual void initStates() { };
|
virtual void initStates() { };
|
||||||
|
|
||||||
virtual void setMatrix( GFXMatrixType mtype, const MatrixF &mat ) { };
|
|
||||||
|
|
||||||
virtual GFXVertexBuffer *allocVertexBuffer( U32 numVerts,
|
virtual GFXVertexBuffer *allocVertexBuffer( U32 numVerts,
|
||||||
const GFXVertexFormat *vertexFormat,
|
const GFXVertexFormat *vertexFormat,
|
||||||
U32 vertSize,
|
U32 vertSize,
|
||||||
|
|
|
||||||
|
|
@ -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
|
// Check bitmapA format
|
||||||
switch( bitmapA->getFormat() )
|
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)
|
// Combine them (clamp values 0-U8_MAX)
|
||||||
switch( combineOp )
|
switch( combineOp )
|
||||||
{
|
{
|
||||||
case GFXTOPAdd:
|
case Add:
|
||||||
*destBits++ = getMin( U8( pxA + pxB ), U8_MAX );
|
*destBits++ = getMin( U8( pxA + pxB ), U8_MAX );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GFXTOPSubtract:
|
case Subtract:
|
||||||
*destBits++ = getMax( U8( pxA - pxB ), U8( 0 ) );
|
*destBits++ = getMax( U8( pxA - pxB ), U8( 0 ) );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,12 @@ public:
|
||||||
c_maxMipLevels = 13
|
c_maxMipLevels = 13
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum TextureOp
|
||||||
|
{
|
||||||
|
Add,
|
||||||
|
Subtract
|
||||||
|
};
|
||||||
|
|
||||||
struct Registration
|
struct Registration
|
||||||
{
|
{
|
||||||
/// The read function prototype.
|
/// The read function prototype.
|
||||||
|
|
@ -218,7 +224,7 @@ public:
|
||||||
///
|
///
|
||||||
/// @note There are some restrictions on ops and formats that will probably change
|
/// @note There are some restrictions on ops and formats that will probably change
|
||||||
/// based on how we use this function.
|
/// 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.
|
/// Fills the first mip level of the bitmap with the specified color.
|
||||||
void fill( const ColorI &rColor );
|
void fill( const ColorI &rColor );
|
||||||
|
|
|
||||||
|
|
@ -98,74 +98,9 @@ ImplementEnumType( GFXTextureFilterType,
|
||||||
{ GFXTextureFilterPoint, "GFXTextureFilterPoint" },
|
{ GFXTextureFilterPoint, "GFXTextureFilterPoint" },
|
||||||
{ GFXTextureFilterLinear, "GFXTextureFilterLinear" },
|
{ GFXTextureFilterLinear, "GFXTextureFilterLinear" },
|
||||||
{ GFXTextureFilterAnisotropic, "GFXTextureFilterAnisotropic" },
|
{ GFXTextureFilterAnisotropic, "GFXTextureFilterAnisotropic" },
|
||||||
{ GFXTextureFilterPyramidalQuad, "GFXTextureFilterPyramidalQuad" },
|
|
||||||
{ GFXTextureFilterGaussianQuad, "GFXTextureFilterGaussianQuad" }
|
|
||||||
|
|
||||||
EndImplementEnumType;
|
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,
|
ImplementEnumType( GFXFormat,
|
||||||
"The texture formats.\n"
|
"The texture formats.\n"
|
||||||
"@note Not all formats are supported on all platforms.\n"
|
"@note Not all formats are supported on all platforms.\n"
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,7 @@ DefineEnumType( GFXBlend );
|
||||||
DefineEnumType( GFXCmpFunc );
|
DefineEnumType( GFXCmpFunc );
|
||||||
DefineEnumType( GFXTextureAddressMode );
|
DefineEnumType( GFXTextureAddressMode );
|
||||||
DefineEnumType( GFXFormat );
|
DefineEnumType( GFXFormat );
|
||||||
DefineEnumType( GFXTextureTransformFlags );
|
|
||||||
DefineEnumType( GFXTextureFilterType );
|
DefineEnumType( GFXTextureFilterType );
|
||||||
DefineEnumType( GFXTextureOp );
|
|
||||||
DefineEnumType( GFXTextureArgument );
|
|
||||||
DefineEnumType( GFXCullMode );
|
DefineEnumType( GFXCullMode );
|
||||||
DefineEnumType( GFXStencilOp );
|
DefineEnumType( GFXStencilOp );
|
||||||
DefineEnumType( GFXBlendOp );
|
DefineEnumType( GFXBlendOp );
|
||||||
|
|
@ -56,10 +53,7 @@ DefineConsoleType( TypeGFXBlend, GFXBlend );
|
||||||
DefineConsoleType( TypeGFXCmpFunc, GFXCmpFunc );
|
DefineConsoleType( TypeGFXCmpFunc, GFXCmpFunc );
|
||||||
DefineConsoleType( TypeGFXTextureAddressMode, GFXTextureAddressMode );
|
DefineConsoleType( TypeGFXTextureAddressMode, GFXTextureAddressMode );
|
||||||
DefineConsoleType( TypeGFXFormat, GFXFormat );
|
DefineConsoleType( TypeGFXFormat, GFXFormat );
|
||||||
DefineConsoleType( TypeGFXTextureTransformFlags, GFXTextureTransformFlags );
|
|
||||||
DefineConsoleType( TypeGFXTextureFilterType, GFXTextureFilterType );
|
DefineConsoleType( TypeGFXTextureFilterType, GFXTextureFilterType );
|
||||||
DefineConsoleType( TypeGFXTextureOp, GFXTextureOp );
|
|
||||||
DefineConsoleType( TypeGFXTextureArgument, GFXTextureArgument );
|
|
||||||
DefineConsoleType( TypeGFXCullMode, GFXCullMode );
|
DefineConsoleType( TypeGFXCullMode, GFXCullMode );
|
||||||
DefineConsoleType( TypeGFXStencilOp, GFXStencilOp );
|
DefineConsoleType( TypeGFXStencilOp, GFXStencilOp );
|
||||||
DefineConsoleType( TypeGFXBlendOp, GFXBlendOp );
|
DefineConsoleType( TypeGFXBlendOp, GFXBlendOp );
|
||||||
|
|
|
||||||
|
|
@ -94,16 +94,12 @@ GFXDevice::GFXDevice()
|
||||||
VECTOR_SET_ASSOCIATION( mVideoModes );
|
VECTOR_SET_ASSOCIATION( mVideoModes );
|
||||||
VECTOR_SET_ASSOCIATION( mRTStack );
|
VECTOR_SET_ASSOCIATION( mRTStack );
|
||||||
|
|
||||||
mWorldMatrixDirty = false;
|
|
||||||
mWorldStackSize = 0;
|
mWorldStackSize = 0;
|
||||||
mProjectionMatrixDirty = false;
|
|
||||||
mViewMatrixDirty = false;
|
|
||||||
mTextureMatrixCheckDirty = false;
|
|
||||||
|
|
||||||
mViewMatrix.identity();
|
mViewMatrix.identity();
|
||||||
mProjectionMatrix.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();
|
mWorldMatrix[i].identity();
|
||||||
|
|
||||||
AssertFatal(smGFXDevice == NULL, "Already a GFXDevice created! Bad!");
|
AssertFatal(smGFXDevice == NULL, "Already a GFXDevice created! Bad!");
|
||||||
|
|
@ -123,8 +119,8 @@ GFXDevice::GFXDevice()
|
||||||
mPrimitiveBufferDirty = false;
|
mPrimitiveBufferDirty = false;
|
||||||
mTexturesDirty = false;
|
mTexturesDirty = false;
|
||||||
|
|
||||||
// Use of TEXTURE_STAGE_COUNT in initialization is okay [7/2/2007 Pat]
|
// Use of GFX_TEXTURE_STAGE_COUNT in initialization is okay [7/2/2007 Pat]
|
||||||
for(U32 i = 0; i < TEXTURE_STAGE_COUNT; i++)
|
for(U32 i = 0; i < GFX_TEXTURE_STAGE_COUNT; i++)
|
||||||
{
|
{
|
||||||
mTextureDirty[i] = false;
|
mTextureDirty[i] = false;
|
||||||
mCurrentTexture[i] = NULL;
|
mCurrentTexture[i] = NULL;
|
||||||
|
|
@ -136,24 +132,8 @@ GFXDevice::GFXDevice()
|
||||||
mCurrentTextureArray[i] = NULL;
|
mCurrentTextureArray[i] = NULL;
|
||||||
mNewCubemapArray[i] = NULL;
|
mNewCubemapArray[i] = NULL;
|
||||||
mTexType[i] = GFXTDT_Normal;
|
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
|
// State block
|
||||||
mStateBlockDirty = false;
|
mStateBlockDirty = false;
|
||||||
mCurrentStateBlock = NULL;
|
mCurrentStateBlock = NULL;
|
||||||
|
|
@ -173,8 +153,6 @@ GFXDevice::GFXDevice()
|
||||||
mViewport = RectI::Zero;
|
mViewport = RectI::Zero;
|
||||||
mViewportDirty = false;
|
mViewportDirty = false;
|
||||||
|
|
||||||
mCurrentFrontBufferIdx = 0;
|
|
||||||
|
|
||||||
mDeviceSwizzle32 = NULL;
|
mDeviceSwizzle32 = NULL;
|
||||||
mDeviceSwizzle24 = NULL;
|
mDeviceSwizzle24 = NULL;
|
||||||
|
|
||||||
|
|
@ -260,7 +238,7 @@ GFXDevice::~GFXDevice()
|
||||||
mCurrentVertexBuffer[i] = NULL;
|
mCurrentVertexBuffer[i] = NULL;
|
||||||
|
|
||||||
// Clear out our current texture references
|
// 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;
|
mCurrentTexture[i] = NULL;
|
||||||
mNewTexture[i] = NULL;
|
mNewTexture[i] = NULL;
|
||||||
|
|
@ -367,10 +345,6 @@ void GFXDevice::updateStates(bool forceSetAll /*=false*/)
|
||||||
rememberToEndScene = true;
|
rememberToEndScene = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
setMatrix( GFXMatrixProjection, mProjectionMatrix );
|
|
||||||
setMatrix( GFXMatrixWorld, mWorldMatrix[mWorldStackSize] );
|
|
||||||
setMatrix( GFXMatrixView, mViewMatrix );
|
|
||||||
|
|
||||||
setVertexDecl( mCurrVertexDecl );
|
setVertexDecl( mCurrVertexDecl );
|
||||||
|
|
||||||
for ( U32 i=0; i < VERTEX_STREAM_COUNT; i++ )
|
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();
|
_updateRenderTargets();
|
||||||
|
|
||||||
if(rememberToEndScene)
|
if(rememberToEndScene)
|
||||||
|
|
@ -453,42 +418,6 @@ void GFXDevice::updateStates(bool forceSetAll /*=false*/)
|
||||||
// Normal update logic begins here.
|
// Normal update logic begins here.
|
||||||
mStateDirty = false;
|
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.
|
// Update the vertex declaration.
|
||||||
if ( mVertexDeclDirty )
|
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();
|
_updateRenderTargets();
|
||||||
|
|
||||||
|
|
@ -762,43 +670,6 @@ Point2F GFXDevice::getWorldToScreenScale() const
|
||||||
return scale;
|
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
|
// Set texture
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -72,9 +72,7 @@ class GFXShaderConstBuffer;
|
||||||
class GFXTextureManager;
|
class GFXTextureManager;
|
||||||
|
|
||||||
// Global macro
|
// Global macro
|
||||||
#define GFX GFXDevice::get()
|
#define GFX GFXDevice::get()
|
||||||
|
|
||||||
#define MAX_MRT_TARGETS 4
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -185,10 +183,6 @@ private:
|
||||||
friend class GFXTextureObject;
|
friend class GFXTextureObject;
|
||||||
friend class GFXTexHandle;
|
friend class GFXTexHandle;
|
||||||
friend class GFXVertexFormat;
|
friend class GFXVertexFormat;
|
||||||
friend class GFXTestFullscreenToggle;
|
|
||||||
friend class TestGFXTextureCube;
|
|
||||||
friend class TestGFXRenderTargetCube;
|
|
||||||
friend class TestGFXRenderTargetStack;
|
|
||||||
friend class GFXResource;
|
friend class GFXResource;
|
||||||
friend class LightMatInstance; // For stencil interface
|
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)
|
/// The device has started rendering a frame's field (such as for side-by-side rendering)
|
||||||
deStartOfField,
|
deStartOfField,
|
||||||
|
|
||||||
/// left stereo frame has been rendered
|
/// left stereo frame has been rendered
|
||||||
deLeftStereoFrameRendered,
|
deLeftStereoFrameRendered,
|
||||||
|
|
||||||
/// right stereo frame has been rendered
|
/// right stereo frame has been rendered
|
||||||
deRightStereoFrameRendered,
|
deRightStereoFrameRendered,
|
||||||
|
|
||||||
/// The device is about to finish rendering a frame's field
|
/// The device is about to finish rendering a frame's field
|
||||||
deEndOfField,
|
deEndOfField,
|
||||||
|
|
@ -255,7 +249,7 @@ public:
|
||||||
{
|
{
|
||||||
RS_Standard = 0,
|
RS_Standard = 0,
|
||||||
RS_StereoSideBySide = (1<<0), // Render into current Render Target side-by-side
|
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
|
enum GFXDeviceLimits
|
||||||
|
|
@ -503,17 +497,17 @@ protected:
|
||||||
GFXTDT_TextureArray
|
GFXTDT_TextureArray
|
||||||
};
|
};
|
||||||
|
|
||||||
GFXTexHandle mCurrentTexture[TEXTURE_STAGE_COUNT];
|
GFXTexHandle mCurrentTexture[GFX_TEXTURE_STAGE_COUNT];
|
||||||
GFXTexHandle mNewTexture[TEXTURE_STAGE_COUNT];
|
GFXTexHandle mNewTexture[GFX_TEXTURE_STAGE_COUNT];
|
||||||
GFXCubemapHandle mCurrentCubemap[TEXTURE_STAGE_COUNT];
|
GFXCubemapHandle mCurrentCubemap[GFX_TEXTURE_STAGE_COUNT];
|
||||||
GFXCubemapHandle mNewCubemap[TEXTURE_STAGE_COUNT];
|
GFXCubemapHandle mNewCubemap[GFX_TEXTURE_STAGE_COUNT];
|
||||||
GFXCubemapArrayHandle mCurrentCubemapArray[TEXTURE_STAGE_COUNT];
|
GFXCubemapArrayHandle mCurrentCubemapArray[GFX_TEXTURE_STAGE_COUNT];
|
||||||
GFXCubemapArrayHandle mNewCubemapArray[TEXTURE_STAGE_COUNT];
|
GFXCubemapArrayHandle mNewCubemapArray[GFX_TEXTURE_STAGE_COUNT];
|
||||||
GFXTextureArrayHandle mCurrentTextureArray[TEXTURE_STAGE_COUNT];
|
GFXTextureArrayHandle mCurrentTextureArray[GFX_TEXTURE_STAGE_COUNT];
|
||||||
GFXTextureArrayHandle mNewTextureArray[TEXTURE_STAGE_COUNT];
|
GFXTextureArrayHandle mNewTextureArray[GFX_TEXTURE_STAGE_COUNT];
|
||||||
|
|
||||||
TexDirtyType mTexType[TEXTURE_STAGE_COUNT];
|
TexDirtyType mTexType[GFX_TEXTURE_STAGE_COUNT];
|
||||||
bool mTextureDirty[TEXTURE_STAGE_COUNT];
|
bool mTextureDirty[GFX_TEXTURE_STAGE_COUNT];
|
||||||
bool mTexturesDirty;
|
bool mTexturesDirty;
|
||||||
|
|
||||||
// This maps a GFXStateBlockDesc hash value to a GFXStateBlockRef
|
// 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
|
/// @see getDeviceSwizzle32
|
||||||
Swizzle<U8, 4> *mDeviceSwizzle32;
|
Swizzle<U8, 4> *mDeviceSwizzle32;
|
||||||
|
|
||||||
/// @see getDeviceSwizzle24
|
/// @see getDeviceSwizzle24
|
||||||
Swizzle<U8, 3> *mDeviceSwizzle24;
|
Swizzle<U8, 3> *mDeviceSwizzle24;
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
/// @name Matrix managing variables
|
/// @name Matrix managing variables
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
///
|
///
|
||||||
MatrixF mWorldMatrix[WORLD_STACK_MAX];
|
MatrixF mWorldMatrix[GFX_WORLD_STACK_MAX];
|
||||||
bool mWorldMatrixDirty;
|
|
||||||
S32 mWorldStackSize;
|
S32 mWorldStackSize;
|
||||||
|
|
||||||
MatrixF mProjectionMatrix;
|
MatrixF mProjectionMatrix;
|
||||||
bool mProjectionMatrixDirty;
|
|
||||||
|
|
||||||
MatrixF mViewMatrix;
|
MatrixF mViewMatrix;
|
||||||
bool mViewMatrixDirty;
|
|
||||||
|
|
||||||
MatrixF mTextureMatrix[TEXTURE_STAGE_COUNT];
|
|
||||||
bool mTextureMatrixDirty[TEXTURE_STAGE_COUNT];
|
|
||||||
bool mTextureMatrixCheckDirty;
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// @name Current frustum planes
|
/// @name Current frustum planes
|
||||||
|
|
@ -621,10 +581,6 @@ protected:
|
||||||
|
|
||||||
virtual void setTextureInternal(U32 textureUnit, const GFXTextureObject*texture) = 0;
|
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 bool beginSceneInternal() = 0;
|
||||||
virtual void endSceneInternal() = 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:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -711,14 +652,8 @@ protected:
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
//---------------------------------------
|
|
||||||
// SFX buffer
|
|
||||||
//---------------------------------------
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
GFXTexHandle mFrontBuffer[2];
|
|
||||||
U32 mCurrentFrontBufferIdx;
|
|
||||||
|
|
||||||
//---------------------------------------
|
//---------------------------------------
|
||||||
// Render target related
|
// Render target related
|
||||||
//---------------------------------------
|
//---------------------------------------
|
||||||
|
|
@ -850,8 +785,6 @@ public:
|
||||||
virtual void endField();
|
virtual void endField();
|
||||||
PlatformTimer *mFrameTime;
|
PlatformTimer *mFrameTime;
|
||||||
|
|
||||||
virtual GFXTexHandle & getFrontBuffer(){ return mFrontBuffer[mCurrentFrontBufferIdx]; }
|
|
||||||
|
|
||||||
void setPrimitiveBuffer( GFXPrimitiveBuffer *buffer );
|
void setPrimitiveBuffer( GFXPrimitiveBuffer *buffer );
|
||||||
|
|
||||||
/// Sets the vertex buffer.
|
/// Sets the vertex buffer.
|
||||||
|
|
@ -924,7 +857,6 @@ public:
|
||||||
void drawPrimitive( const GFXPrimitive &prim );
|
void drawPrimitive( const GFXPrimitive &prim );
|
||||||
void drawPrimitive( U32 primitiveIndex );
|
void drawPrimitive( U32 primitiveIndex );
|
||||||
void drawPrimitives();
|
void drawPrimitives();
|
||||||
void drawPrimitiveBuffer( GFXPrimitiveBuffer *buffer );
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -936,18 +868,8 @@ public:
|
||||||
|
|
||||||
/// Returns a hardware occlusion query object or NULL
|
/// Returns a hardware occlusion query object or NULL
|
||||||
/// if this device does not support them.
|
/// if this device does not support them.
|
||||||
virtual GFXOcclusionQuery* createOcclusionQuery() { return NULL; }
|
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);
|
|
||||||
|
|
||||||
/// @}
|
|
||||||
|
|
||||||
/// @name Texture State Settings
|
/// @name Texture State Settings
|
||||||
/// NONE of these should be overridden by API implementations
|
/// NONE of these should be overridden by API implementations
|
||||||
/// because of the state caching stuff.
|
/// because of the state caching stuff.
|
||||||
|
|
@ -1136,23 +1058,20 @@ public:
|
||||||
|
|
||||||
inline void GFXDevice::setWorldMatrix( const MatrixF &newWorld )
|
inline void GFXDevice::setWorldMatrix( const MatrixF &newWorld )
|
||||||
{
|
{
|
||||||
mWorldMatrixDirty = true;
|
|
||||||
mStateDirty = true;
|
mStateDirty = true;
|
||||||
mWorldMatrix[mWorldStackSize] = newWorld;
|
mWorldMatrix[mWorldStackSize] = newWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void GFXDevice::pushWorldMatrix()
|
inline void GFXDevice::pushWorldMatrix()
|
||||||
{
|
{
|
||||||
mWorldMatrixDirty = true;
|
|
||||||
mStateDirty = true;
|
mStateDirty = true;
|
||||||
mWorldStackSize++;
|
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];
|
mWorldMatrix[mWorldStackSize] = mWorldMatrix[mWorldStackSize - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void GFXDevice::popWorldMatrix()
|
inline void GFXDevice::popWorldMatrix()
|
||||||
{
|
{
|
||||||
mWorldMatrixDirty = true;
|
|
||||||
mStateDirty = true;
|
mStateDirty = true;
|
||||||
mWorldStackSize--;
|
mWorldStackSize--;
|
||||||
AssertFatal( mWorldStackSize >= 0, "GFX: Negative WorldStackSize!" );
|
AssertFatal( mWorldStackSize >= 0, "GFX: Negative WorldStackSize!" );
|
||||||
|
|
@ -1160,14 +1079,12 @@ inline void GFXDevice::popWorldMatrix()
|
||||||
|
|
||||||
inline void GFXDevice::multWorld( const MatrixF &mat )
|
inline void GFXDevice::multWorld( const MatrixF &mat )
|
||||||
{
|
{
|
||||||
mWorldMatrixDirty = true;
|
|
||||||
mStateDirty = true;
|
mStateDirty = true;
|
||||||
mWorldMatrix[mWorldStackSize].mul(mat);
|
mWorldMatrix[mWorldStackSize].mul(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void GFXDevice::setProjectionMatrix( const MatrixF &newProj )
|
inline void GFXDevice::setProjectionMatrix( const MatrixF &newProj )
|
||||||
{
|
{
|
||||||
mProjectionMatrixDirty = true;
|
|
||||||
mStateDirty = true;
|
mStateDirty = true;
|
||||||
mProjectionMatrix = newProj;
|
mProjectionMatrix = newProj;
|
||||||
}
|
}
|
||||||
|
|
@ -1175,19 +1092,9 @@ inline void GFXDevice::setProjectionMatrix( const MatrixF &newProj )
|
||||||
inline void GFXDevice::setViewMatrix( const MatrixF &newView )
|
inline void GFXDevice::setViewMatrix( const MatrixF &newView )
|
||||||
{
|
{
|
||||||
mStateDirty = true;
|
mStateDirty = true;
|
||||||
mViewMatrixDirty = true;
|
|
||||||
mViewMatrix = newView;
|
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
|
// Buffer management
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,31 +27,35 @@
|
||||||
|
|
||||||
// These are for the enum translation. It will help with porting to other platforms
|
// These are for the enum translation. It will help with porting to other platforms
|
||||||
// and API's.
|
// and API's.
|
||||||
#define GFX_UNSUPPORTED_VAL 0xDEADBEEF
|
#define GFX_UNSUPPORTED_VAL 0xDEADBEEFULL
|
||||||
#define GFX_UNINIT_VAL 0xDECAFBAD
|
#define GFX_UNINIT_VAL 0xDECAFBADULL
|
||||||
|
|
||||||
// Adjust these pools to your app's needs. Be aware dynamic vertices are much more
|
// 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
|
// expensive than static vertices. These are in gfxEnums because they should be
|
||||||
// consistant across all APIs/platforms so that the dynamic buffer performance
|
// consistant across all APIs/platforms so that the dynamic buffer performance
|
||||||
// and behavior is also consistant. -patw
|
// and behavior is also consistant. -patw
|
||||||
#define MAX_DYNAMIC_VERTS (8192*2)
|
#define GFX_MAX_DYNAMIC_VERTS (8192*2)
|
||||||
#define MAX_DYNAMIC_INDICES (8192*4)
|
#define GFX_MAX_DYNAMIC_INDICES (8192*4)
|
||||||
|
|
||||||
|
#define GFX_WORLD_STACK_MAX 24
|
||||||
|
|
||||||
|
#define GFX_TEXTURE_STAGE_COUNT 16
|
||||||
|
|
||||||
enum GFXBufferType
|
enum GFXBufferType
|
||||||
{
|
{
|
||||||
GFXBufferTypeStatic, ///< Static vertex buffers are created and rarely updated.
|
GFXBufferTypeStatic, ///< Static vertex buffers are created and rarely updated.
|
||||||
///< Updating might incur a performance penalty. Resizing a static vertex buffer is not
|
///< Updating might incur a performance penalty. Resizing a static vertex buffer is not
|
||||||
///< allowed.
|
///< allowed.
|
||||||
GFXBufferTypeDynamic, ///< Dynamic vertex buffers are meant for vertices that can be changed
|
GFXBufferTypeDynamic, ///< Dynamic vertex buffers are meant for vertices that can be changed
|
||||||
///< often. Vertices written into dynamic vertex buffers will remain valid
|
///< often. Vertices written into dynamic vertex buffers will remain valid
|
||||||
///< until the dynamic vertex buffer is released. Resizing a dynamic vertex buffer is not
|
///< until the dynamic vertex buffer is released. Resizing a dynamic vertex buffer is not
|
||||||
///< allowed.
|
///< allowed.
|
||||||
GFXBufferTypeVolatile, ///< Volatile vertex or index buffers are meant for vertices or indices that are essentially
|
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.
|
///< 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
|
enum GFXTexCallbackCode
|
||||||
|
|
@ -60,7 +64,6 @@ enum GFXTexCallbackCode
|
||||||
GFXResurrect,
|
GFXResurrect,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum GFXPrimitiveType
|
enum GFXPrimitiveType
|
||||||
{
|
{
|
||||||
GFXPT_FIRST = 0,
|
GFXPT_FIRST = 0,
|
||||||
|
|
@ -72,15 +75,6 @@ enum GFXPrimitiveType
|
||||||
GFXPT_COUNT
|
GFXPT_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GFXTextureType
|
|
||||||
{
|
|
||||||
GFXTextureType_Normal,
|
|
||||||
GFXTextureType_KeepBitmap,
|
|
||||||
GFXTextureType_Dynamic,
|
|
||||||
GFXTextureType_RenderTarget,
|
|
||||||
GFXTextureType_Count
|
|
||||||
};
|
|
||||||
|
|
||||||
enum GFXBitmapFlip
|
enum GFXBitmapFlip
|
||||||
{
|
{
|
||||||
GFXBitmapFlip_None = 0,
|
GFXBitmapFlip_None = 0,
|
||||||
|
|
@ -89,37 +83,6 @@ enum GFXBitmapFlip
|
||||||
GFXBitmapFlip_XY = GFXBitmapFlip_X | GFXBitmapFlip_Y
|
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
|
enum GFXTextureAddressMode
|
||||||
{
|
{
|
||||||
GFXAddress_FIRST = 0,
|
GFXAddress_FIRST = 0,
|
||||||
|
|
@ -138,8 +101,6 @@ enum GFXTextureFilterType
|
||||||
GFXTextureFilterPoint,
|
GFXTextureFilterPoint,
|
||||||
GFXTextureFilterLinear,
|
GFXTextureFilterLinear,
|
||||||
GFXTextureFilterAnisotropic,
|
GFXTextureFilterAnisotropic,
|
||||||
GFXTextureFilterPyramidalQuad,
|
|
||||||
GFXTextureFilterGaussianQuad,
|
|
||||||
GFXTextureFilter_COUNT
|
GFXTextureFilter_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -248,13 +209,6 @@ inline U32 GFXFormat_getByteSize( GFXFormat format )
|
||||||
return 16;
|
return 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum GFXShadeMode
|
|
||||||
{
|
|
||||||
GFXShadeFlat = 1,
|
|
||||||
GFXShadeGouraud,
|
|
||||||
GFXShadePhong,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum GFXClearFlags
|
enum GFXClearFlags
|
||||||
{
|
{
|
||||||
GFXClearTarget = 1 << 0,
|
GFXClearTarget = 1 << 0,
|
||||||
|
|
@ -328,13 +282,6 @@ enum GFXStencilOp
|
||||||
GFXStencilOp_COUNT
|
GFXStencilOp_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GFXMaterialColorSource
|
|
||||||
{
|
|
||||||
GFXMCSMaterial = 0,
|
|
||||||
GFXMCSColor1,
|
|
||||||
GFXMCSColor2,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum GFXBlendOp
|
enum GFXBlendOp
|
||||||
{
|
{
|
||||||
GFXBlendOp_FIRST = 0,
|
GFXBlendOp_FIRST = 0,
|
||||||
|
|
@ -346,195 +293,6 @@ enum GFXBlendOp
|
||||||
GFXBlendOp_COUNT
|
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
|
enum GFXMatrixType
|
||||||
{
|
{
|
||||||
GFXMatrixWorld = 256,
|
GFXMatrixWorld = 256,
|
||||||
|
|
@ -551,30 +309,6 @@ enum GFXMatrixType
|
||||||
GFXMatrixTexture7 = 23,
|
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
|
enum GFXShaderConstType
|
||||||
{
|
{
|
||||||
/// GFX"S"hader"C"onstant"T"ype
|
/// GFX"S"hader"C"onstant"T"ype
|
||||||
|
|
@ -603,7 +337,6 @@ enum GFXShaderConstType
|
||||||
GFXSCT_SamplerTextureArray
|
GFXSCT_SamplerTextureArray
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// Defines a vertex declaration type.
|
/// Defines a vertex declaration type.
|
||||||
/// @see GFXVertexElement
|
/// @see GFXVertexElement
|
||||||
/// @see GFXVertexFormat
|
/// @see GFXVertexFormat
|
||||||
|
|
|
||||||
|
|
@ -40,18 +40,10 @@ FontRenderBatcher::FontRenderBatcher() : mStorage(8096)
|
||||||
f.blendSrc = GFXBlendSrcAlpha;
|
f.blendSrc = GFXBlendSrcAlpha;
|
||||||
f.blendDest = GFXBlendInvSrcAlpha;
|
f.blendDest = GFXBlendInvSrcAlpha;
|
||||||
f.samplersDefined = true;
|
f.samplersDefined = true;
|
||||||
f.samplers[0].alphaOp = GFXTOPModulate;
|
|
||||||
f.samplers[0].magFilter = GFXTextureFilterPoint;
|
f.samplers[0].magFilter = GFXTextureFilterPoint;
|
||||||
f.samplers[0].minFilter = GFXTextureFilterPoint;
|
f.samplers[0].minFilter = GFXTextureFilterPoint;
|
||||||
f.samplers[0].addressModeU = GFXAddressClamp;
|
f.samplers[0].addressModeU = GFXAddressClamp;
|
||||||
f.samplers[0].addressModeV = 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
|
f.setColorWrites(true, true, true, false); // NOTE: comment this out if alpha write is needed
|
||||||
mFontSB = GFX->createStateBlock(f);
|
mFontSB = GFX->createStateBlock(f);
|
||||||
|
|
|
||||||
|
|
@ -88,9 +88,6 @@ GFXStateBlockDesc::GFXStateBlockDesc()
|
||||||
stencilMask = 0xFFFFFFFF;
|
stencilMask = 0xFFFFFFFF;
|
||||||
stencilWriteMask = 0xFFFFFFFF;
|
stencilWriteMask = 0xFFFFFFFF;
|
||||||
|
|
||||||
// FF lighting
|
|
||||||
ffLighting = false;
|
|
||||||
|
|
||||||
vertexColorEnable = false;
|
vertexColorEnable = false;
|
||||||
|
|
||||||
fillMode = GFXFillSolid;
|
fillMode = GFXFillSolid;
|
||||||
|
|
@ -183,7 +180,7 @@ void GFXStateBlockDesc::addDesc(const GFXStateBlockDesc& desc)
|
||||||
if (desc.samplersDefined)
|
if (desc.samplersDefined)
|
||||||
{
|
{
|
||||||
samplersDefined = true;
|
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];
|
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",
|
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],
|
stencilEnable, GFXStringCmpFunc[stencilFailOp], GFXStringCmpFunc[stencilZFailOp], GFXStringCmpFunc[stencilPassOp],
|
||||||
GFXStringCmpFunc[stencilFunc], stencilRef, stencilMask, stencilWriteMask);
|
GFXStringCmpFunc[stencilFunc], stencilRef, stencilMask, stencilWriteMask);
|
||||||
ret += String::ToString(" FF Lighting: %d, VertexColors: %d, fillMode: %s",
|
|
||||||
ffLighting, vertexColorEnable, GFXStringFillMode[fillMode]);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -274,7 +269,6 @@ void GFXStateBlockDesc::setColorWrites( bool red, bool green, bool blue, bool al
|
||||||
|
|
||||||
GFXSamplerStateDesc::GFXSamplerStateDesc()
|
GFXSamplerStateDesc::GFXSamplerStateDesc()
|
||||||
{
|
{
|
||||||
textureColorOp = GFXTOPDisable;
|
|
||||||
addressModeU = GFXAddressWrap;
|
addressModeU = GFXAddressWrap;
|
||||||
addressModeV = GFXAddressWrap;
|
addressModeV = GFXAddressWrap;
|
||||||
addressModeW = GFXAddressWrap;
|
addressModeW = GFXAddressWrap;
|
||||||
|
|
@ -283,15 +277,6 @@ GFXSamplerStateDesc::GFXSamplerStateDesc()
|
||||||
mipFilter = GFXTextureFilterLinear;
|
mipFilter = GFXTextureFilterLinear;
|
||||||
samplerFunc = GFXCmpNever;
|
samplerFunc = GFXCmpNever;
|
||||||
maxAnisotropy = 1;
|
maxAnisotropy = 1;
|
||||||
alphaArg1 = GFXTATexture;
|
|
||||||
alphaArg2 = GFXTADiffuse;
|
|
||||||
alphaArg3 = GFXTACurrent;
|
|
||||||
colorArg1 = GFXTACurrent;
|
|
||||||
colorArg2 = GFXTATexture;
|
|
||||||
colorArg3 = GFXTACurrent;
|
|
||||||
alphaOp = GFXTOPModulate;
|
|
||||||
textureTransform = GFXTTFFDisable;
|
|
||||||
resultArg = GFXTACurrent;
|
|
||||||
mipLODBias = 0.0f;
|
mipLODBias = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -299,14 +284,12 @@ GFXSamplerStateDesc GFXSamplerStateDesc::getWrapLinear()
|
||||||
{
|
{
|
||||||
// Linear with wrapping is already the default
|
// Linear with wrapping is already the default
|
||||||
GFXSamplerStateDesc ssd;
|
GFXSamplerStateDesc ssd;
|
||||||
ssd.textureColorOp = GFXTOPModulate;
|
|
||||||
return ssd;
|
return ssd;
|
||||||
}
|
}
|
||||||
|
|
||||||
GFXSamplerStateDesc GFXSamplerStateDesc::getWrapPoint()
|
GFXSamplerStateDesc GFXSamplerStateDesc::getWrapPoint()
|
||||||
{
|
{
|
||||||
GFXSamplerStateDesc ssd;
|
GFXSamplerStateDesc ssd;
|
||||||
ssd.textureColorOp = GFXTOPModulate;
|
|
||||||
ssd.magFilter = GFXTextureFilterPoint;
|
ssd.magFilter = GFXTextureFilterPoint;
|
||||||
ssd.minFilter = GFXTextureFilterPoint;
|
ssd.minFilter = GFXTextureFilterPoint;
|
||||||
ssd.mipFilter = GFXTextureFilterPoint;
|
ssd.mipFilter = GFXTextureFilterPoint;
|
||||||
|
|
@ -316,7 +299,6 @@ GFXSamplerStateDesc GFXSamplerStateDesc::getWrapPoint()
|
||||||
GFXSamplerStateDesc GFXSamplerStateDesc::getClampLinear()
|
GFXSamplerStateDesc GFXSamplerStateDesc::getClampLinear()
|
||||||
{
|
{
|
||||||
GFXSamplerStateDesc ssd;
|
GFXSamplerStateDesc ssd;
|
||||||
ssd.textureColorOp = GFXTOPModulate;
|
|
||||||
ssd.addressModeU = GFXAddressClamp;
|
ssd.addressModeU = GFXAddressClamp;
|
||||||
ssd.addressModeV = GFXAddressClamp;
|
ssd.addressModeV = GFXAddressClamp;
|
||||||
ssd.addressModeW = GFXAddressClamp;
|
ssd.addressModeW = GFXAddressClamp;
|
||||||
|
|
@ -326,7 +308,6 @@ GFXSamplerStateDesc GFXSamplerStateDesc::getClampLinear()
|
||||||
GFXSamplerStateDesc GFXSamplerStateDesc::getClampPoint()
|
GFXSamplerStateDesc GFXSamplerStateDesc::getClampPoint()
|
||||||
{
|
{
|
||||||
GFXSamplerStateDesc ssd;
|
GFXSamplerStateDesc ssd;
|
||||||
ssd.textureColorOp = GFXTOPModulate;
|
|
||||||
ssd.addressModeU = GFXAddressClamp;
|
ssd.addressModeU = GFXAddressClamp;
|
||||||
ssd.addressModeV = GFXAddressClamp;
|
ssd.addressModeV = GFXAddressClamp;
|
||||||
ssd.addressModeW = GFXAddressClamp;
|
ssd.addressModeW = GFXAddressClamp;
|
||||||
|
|
@ -334,4 +315,4 @@ GFXSamplerStateDesc GFXSamplerStateDesc::getClampPoint()
|
||||||
ssd.minFilter = GFXTextureFilterPoint;
|
ssd.minFilter = GFXTextureFilterPoint;
|
||||||
ssd.mipFilter = GFXTextureFilterPoint;
|
ssd.mipFilter = GFXTextureFilterPoint;
|
||||||
return ssd;
|
return ssd;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,21 +63,6 @@ struct GFXSamplerStateDesc
|
||||||
/// Defaults to zero.
|
/// Defaults to zero.
|
||||||
F32 mipLODBias;
|
F32 mipLODBias;
|
||||||
|
|
||||||
GFXTextureOp textureColorOp;
|
|
||||||
|
|
||||||
GFXTextureOp alphaOp;
|
|
||||||
GFXTextureArgument alphaArg1;
|
|
||||||
GFXTextureArgument alphaArg2;
|
|
||||||
GFXTextureArgument alphaArg3;
|
|
||||||
|
|
||||||
GFXTextureArgument colorArg1;
|
|
||||||
GFXTextureArgument colorArg2;
|
|
||||||
GFXTextureArgument colorArg3;
|
|
||||||
|
|
||||||
GFXTextureArgument resultArg;
|
|
||||||
|
|
||||||
GFXTextureTransformFlags textureTransform;
|
|
||||||
|
|
||||||
GFXSamplerStateDesc();
|
GFXSamplerStateDesc();
|
||||||
|
|
||||||
/// Returns an modulate, wrap, and linear sampled state.
|
/// Returns an modulate, wrap, and linear sampled state.
|
||||||
|
|
@ -153,16 +138,13 @@ struct GFXStateBlockDesc
|
||||||
U32 stencilMask;
|
U32 stencilMask;
|
||||||
U32 stencilWriteMask;
|
U32 stencilWriteMask;
|
||||||
|
|
||||||
// FF lighting
|
|
||||||
bool ffLighting;
|
|
||||||
|
|
||||||
bool vertexColorEnable;
|
bool vertexColorEnable;
|
||||||
|
|
||||||
GFXFillMode fillMode;
|
GFXFillMode fillMode;
|
||||||
|
|
||||||
// Sampler states
|
// Sampler states
|
||||||
bool samplersDefined;
|
bool samplersDefined;
|
||||||
GFXSamplerStateDesc samplers[TEXTURE_STAGE_COUNT];
|
GFXSamplerStateDesc samplers[GFX_TEXTURE_STAGE_COUNT];
|
||||||
ColorI textureFactor;
|
ColorI textureFactor;
|
||||||
|
|
||||||
GFXStateBlockDesc();
|
GFXStateBlockDesc();
|
||||||
|
|
|
||||||
|
|
@ -28,12 +28,9 @@
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
const char *GFXStringIndexFormat[GFXIndexFormat_COUNT];
|
|
||||||
const char *GFXStringSamplerState[GFXSAMP_COUNT];
|
|
||||||
const char *GFXStringTextureFormat[GFXFormat_COUNT];
|
const char *GFXStringTextureFormat[GFXFormat_COUNT];
|
||||||
const char *GFXStringTiledTextureFormat[GFXFormat_COUNT];
|
const char *GFXStringTiledTextureFormat[GFXFormat_COUNT];
|
||||||
const char *GFXStringRenderTargetFormat[GFXFormat_COUNT];
|
const char *GFXStringRenderTargetFormat[GFXFormat_COUNT];
|
||||||
const char *GFXStringRenderState[GFXRenderState_COUNT];
|
|
||||||
const char *GFXStringTextureFilter[GFXTextureFilter_COUNT];
|
const char *GFXStringTextureFilter[GFXTextureFilter_COUNT];
|
||||||
const char *GFXStringBlend[GFXBlend_COUNT];
|
const char *GFXStringBlend[GFXBlend_COUNT];
|
||||||
const char *GFXStringBlendOp[GFXBlendOp_COUNT];
|
const char *GFXStringBlendOp[GFXBlendOp_COUNT];
|
||||||
|
|
@ -41,15 +38,9 @@ const char *GFXStringStencilOp[GFXStencilOp_COUNT];
|
||||||
const char *GFXStringCmpFunc[GFXCmp_COUNT];
|
const char *GFXStringCmpFunc[GFXCmp_COUNT];
|
||||||
const char *GFXStringCullMode[GFXCull_COUNT];
|
const char *GFXStringCullMode[GFXCull_COUNT];
|
||||||
const char *GFXStringPrimType[GFXPT_COUNT];
|
const char *GFXStringPrimType[GFXPT_COUNT];
|
||||||
const char *GFXStringTextureStageState[GFXTSS_COUNT];
|
|
||||||
const char *GFXStringTextureAddress[GFXAddress_COUNT];
|
const char *GFXStringTextureAddress[GFXAddress_COUNT];
|
||||||
const char *GFXStringTextureOp[GFXTOP_COUNT];
|
|
||||||
const char *GFXStringFillMode[GFXFill_COUNT];
|
const char *GFXStringFillMode[GFXFill_COUNT];
|
||||||
|
|
||||||
StringValueLookupFn GFXStringRenderStateValueLookup[GFXRenderState_COUNT];
|
|
||||||
StringValueLookupFn GFXStringSamplerStateValueLookup[GFXSAMP_COUNT];
|
|
||||||
StringValueLookupFn GFXStringTextureStageStateValueLookup[GFXTSS_COUNT];
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
const char *defaultStringValueLookup( const U32 &value )
|
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(GFXStringTextureAddress);
|
||||||
_STRING_VALUE_LOOKUP_FXN(GFXStringTextureFilter);
|
_STRING_VALUE_LOOKUP_FXN(GFXStringTextureFilter);
|
||||||
_STRING_VALUE_LOOKUP_FXN(GFXStringBlend);
|
_STRING_VALUE_LOOKUP_FXN(GFXStringBlend);
|
||||||
_STRING_VALUE_LOOKUP_FXN(GFXStringTextureOp);
|
|
||||||
_STRING_VALUE_LOOKUP_FXN(GFXStringCmpFunc);
|
_STRING_VALUE_LOOKUP_FXN(GFXStringCmpFunc);
|
||||||
_STRING_VALUE_LOOKUP_FXN(GFXStringStencilOp);
|
_STRING_VALUE_LOOKUP_FXN(GFXStringStencilOp);
|
||||||
_STRING_VALUE_LOOKUP_FXN(GFXStringCullMode);
|
_STRING_VALUE_LOOKUP_FXN(GFXStringCullMode);
|
||||||
|
|
@ -106,29 +96,6 @@ void GFXStringEnumTranslate::init()
|
||||||
|
|
||||||
sInitCalled = true;
|
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 * );
|
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, GFXFormatBC2_SRGB );
|
||||||
GFX_STRING_ASSIGN_MACRO( GFXStringTextureFormat, GFXFormatBC3_SRGB );
|
GFX_STRING_ASSIGN_MACRO( GFXStringTextureFormat, GFXFormatBC3_SRGB );
|
||||||
VALIDATE_LOOKUPTABLE( GFXStringTextureFormat, GFXFormat);
|
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 * );
|
INIT_LOOKUPTABLE( GFXStringBlend, GFXBlend, const char * );
|
||||||
|
|
@ -356,29 +204,6 @@ void GFXStringEnumTranslate::init()
|
||||||
GFX_STRING_ASSIGN_MACRO( GFXStringPrimType, GFXTriangleStrip );
|
GFX_STRING_ASSIGN_MACRO( GFXStringPrimType, GFXTriangleStrip );
|
||||||
VALIDATE_LOOKUPTABLE( GFXStringPrimType, GFXPT );
|
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 * );
|
INIT_LOOKUPTABLE( GFXStringTextureAddress, GFXAddress, const char * );
|
||||||
GFX_STRING_ASSIGN_MACRO( GFXStringTextureAddress, GFXAddressWrap );
|
GFX_STRING_ASSIGN_MACRO( GFXStringTextureAddress, GFXAddressWrap );
|
||||||
|
|
@ -389,34 +214,6 @@ void GFXStringEnumTranslate::init()
|
||||||
VALIDATE_LOOKUPTABLE(GFXStringTextureAddress, GFXAddress );
|
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 * );
|
INIT_LOOKUPTABLE( GFXStringFillMode, GFXFill, const char * );
|
||||||
GFX_STRING_ASSIGN_MACRO( GFXStringFillMode, GFXFillPoint );
|
GFX_STRING_ASSIGN_MACRO( GFXStringFillMode, GFXFillPoint );
|
||||||
GFX_STRING_ASSIGN_MACRO( GFXStringFillMode, GFXFillWireframe );
|
GFX_STRING_ASSIGN_MACRO( GFXStringFillMode, GFXFillWireframe );
|
||||||
|
|
|
||||||
|
|
@ -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 *GFXStringTextureFormat[GFXFormat_COUNT];
|
||||||
extern const char *GFXStringRenderState[GFXRenderState_COUNT];
|
|
||||||
extern const char *GFXStringTextureFilter[GFXTextureFilter_COUNT];
|
extern const char *GFXStringTextureFilter[GFXTextureFilter_COUNT];
|
||||||
extern const char *GFXStringBlend[GFXBlend_COUNT];
|
extern const char *GFXStringBlend[GFXBlend_COUNT];
|
||||||
extern const char *GFXStringBlendOp[GFXBlendOp_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 *GFXStringCmpFunc[GFXCmp_COUNT];
|
||||||
extern const char *GFXStringCullMode[GFXCull_COUNT];
|
extern const char *GFXStringCullMode[GFXCull_COUNT];
|
||||||
extern const char *GFXStringPrimType[GFXPT_COUNT];
|
extern const char *GFXStringPrimType[GFXPT_COUNT];
|
||||||
extern const char *GFXStringTextureStageState[GFXTSS_COUNT];
|
|
||||||
extern const char *GFXStringTextureAddress[GFXAddress_COUNT];
|
extern const char *GFXStringTextureAddress[GFXAddress_COUNT];
|
||||||
extern const char *GFXStringTextureOp[GFXTOP_COUNT];
|
|
||||||
extern const char *GFXStringFillMode[GFXFill_COUNT];
|
extern const char *GFXStringFillMode[GFXFill_COUNT];
|
||||||
|
|
||||||
typedef const char *(*StringValueLookupFn)( const U32 &value );
|
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 ) \
|
#define GFXREVERSE_LOOKUP( tablearray, enumprefix, val ) \
|
||||||
for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
|
for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
|
||||||
if( (S32)tablearray##[i] == val ) \
|
if( (S32)tablearray##[i] == val ) \
|
||||||
|
|
@ -86,4 +77,4 @@ extern EnumTable gTextureArgumentEnumTable_M;
|
||||||
//extern EnumTable::Enums srcBlendFactorLookup[9];
|
//extern EnumTable::Enums srcBlendFactorLookup[9];
|
||||||
//extern EnumTable::Enums dstBlendFactorLookup[9];
|
//extern EnumTable::Enums dstBlendFactorLookup[9];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -48,53 +48,6 @@
|
||||||
#include "gfx/gfxVertexTypes.h"
|
#include "gfx/gfxVertexTypes.h"
|
||||||
#endif
|
#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
|
struct GFXVideoMode
|
||||||
|
|
@ -144,7 +97,6 @@ struct GFXVideoMode
|
||||||
const String toString() const;
|
const String toString() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
struct GFXPrimitive
|
struct GFXPrimitive
|
||||||
|
|
@ -195,5 +147,4 @@ struct GFXShaderMacro
|
||||||
static void stringize( const Vector<GFXShaderMacro> ¯os, String *outString );
|
static void stringize( const Vector<GFXShaderMacro> ¯os, String *outString );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _GFXSTRUCTS_H_
|
#endif // _GFXSTRUCTS_H_
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ GFXGLDevice::GFXGLDevice(U32 adapterIndex) :
|
||||||
mTextureManager = new GFXGLTextureManager();
|
mTextureManager = new GFXGLTextureManager();
|
||||||
gScreenShot = new ScreenShotGL();
|
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;
|
mActiveTextureType[i] = GL_ZERO;
|
||||||
|
|
||||||
mNumVertexStream = 2;
|
mNumVertexStream = 2;
|
||||||
|
|
@ -260,7 +260,7 @@ GFXGLDevice::~GFXGLDevice()
|
||||||
mVolatilePBs[i] = NULL;
|
mVolatilePBs[i] = NULL;
|
||||||
|
|
||||||
// Clear out our current texture references
|
// 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;
|
mCurrentTexture[i] = NULL;
|
||||||
mNewTexture[i] = NULL;
|
mNewTexture[i] = NULL;
|
||||||
|
|
@ -711,21 +711,6 @@ void GFXGLDevice::setPB(GFXGLPrimitiveBuffer* pb)
|
||||||
mCurrentPB = 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)
|
void GFXGLDevice::setTextureInternal(U32 textureUnit, const GFXTextureObject*texture)
|
||||||
{
|
{
|
||||||
GFXGLTextureObject *tex = static_cast<GFXGLTextureObject*>(const_cast<GFXTextureObject*>(texture));
|
GFXGLTextureObject *tex = static_cast<GFXGLTextureObject*>(const_cast<GFXTextureObject*>(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 )
|
void GFXGLDevice::setClipRect( const RectI &inRect )
|
||||||
{
|
{
|
||||||
AssertFatal(mCurrentRT.isValid(), "GFXGLDevice::setClipRect - must have a render target set to do any rendering operations!");
|
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;
|
mProjectionMatrix *= translate;
|
||||||
|
|
||||||
setMatrix(GFXMatrixProjection, mProjectionMatrix);
|
|
||||||
|
|
||||||
MatrixF mTempMatrix(true);
|
MatrixF mTempMatrix(true);
|
||||||
setViewMatrix( mTempMatrix );
|
setViewMatrix( mTempMatrix );
|
||||||
setWorldMatrix( mTempMatrix );
|
setWorldMatrix( mTempMatrix );
|
||||||
|
|
@ -985,7 +963,7 @@ void GFXGLDevice::setShaderConstBufferInternal(GFXShaderConstBuffer* buffer)
|
||||||
|
|
||||||
U32 GFXGLDevice::getNumSamplers() const
|
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
|
GFXTextureObject* GFXGLDevice::getDefaultDepthTex() const
|
||||||
|
|
|
||||||
|
|
@ -140,8 +140,8 @@ public:
|
||||||
|
|
||||||
virtual void preDestroy() { Parent::preDestroy(); }
|
virtual void preDestroy() { Parent::preDestroy(); }
|
||||||
|
|
||||||
virtual U32 getMaxDynamicVerts() { return MAX_DYNAMIC_VERTS; }
|
virtual U32 getMaxDynamicVerts() { return GFX_MAX_DYNAMIC_VERTS; }
|
||||||
virtual U32 getMaxDynamicIndices() { return MAX_DYNAMIC_INDICES; }
|
virtual U32 getMaxDynamicIndices() { return GFX_MAX_DYNAMIC_INDICES; }
|
||||||
|
|
||||||
GFXFence *createFence();
|
GFXFence *createFence();
|
||||||
|
|
||||||
|
|
@ -177,10 +177,6 @@ protected:
|
||||||
virtual void setCubemapArrayInternal(U32 textureUnit, const GFXGLCubemapArray* texture);
|
virtual void setCubemapArrayInternal(U32 textureUnit, const GFXGLCubemapArray* texture);
|
||||||
virtual void setTextureArrayInternal(U32 textureUnit, const GFXGLTextureArray* 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.
|
/// @name State Initalization.
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -188,8 +184,6 @@ protected:
|
||||||
/// is created.
|
/// is created.
|
||||||
virtual void initStates() { }
|
virtual void initStates() { }
|
||||||
|
|
||||||
virtual void setMatrix( GFXMatrixType mtype, const MatrixF &mat );
|
|
||||||
|
|
||||||
virtual GFXVertexBuffer *allocVertexBuffer( U32 numVerts,
|
virtual GFXVertexBuffer *allocVertexBuffer( U32 numVerts,
|
||||||
const GFXVertexFormat *vertexFormat,
|
const GFXVertexFormat *vertexFormat,
|
||||||
U32 vertSize,
|
U32 vertSize,
|
||||||
|
|
@ -255,7 +249,7 @@ private:
|
||||||
|
|
||||||
GFXGLStateBlockRef mCurrentGLStateBlock;
|
GFXGLStateBlockRef mCurrentGLStateBlock;
|
||||||
|
|
||||||
GLenum mActiveTextureType[TEXTURE_STAGE_COUNT];
|
GLenum mActiveTextureType[GFX_TEXTURE_STAGE_COUNT];
|
||||||
|
|
||||||
Vector< StrongRefPtr<GFXGLVertexBuffer> > mVolatileVBs; ///< Pool of existing volatile VBs so we can reuse previously created ones
|
Vector< StrongRefPtr<GFXGLVertexBuffer> > mVolatileVBs; ///< Pool of existing volatile VBs so we can reuse previously created ones
|
||||||
Vector< StrongRefPtr<GFXGLPrimitiveBuffer> > mVolatilePBs; ///< Pool of existing volatile PBs so we can reuse previously created ones
|
Vector< StrongRefPtr<GFXGLPrimitiveBuffer> > mVolatilePBs; ///< Pool of existing volatile PBs so we can reuse previously created ones
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
GLenum GFXGLPrimType[GFXPT_COUNT];
|
GLenum GFXGLPrimType[GFXPT_COUNT];
|
||||||
GLenum GFXGLBlend[GFXBlend_COUNT];
|
GLenum GFXGLBlend[GFXBlend_COUNT];
|
||||||
GLenum GFXGLBlendOp[GFXBlendOp_COUNT];
|
GLenum GFXGLBlendOp[GFXBlendOp_COUNT];
|
||||||
GLenum GFXGLSamplerState[GFXSAMP_COUNT];
|
|
||||||
GLenum GFXGLTextureFilter[GFXTextureFilter_COUNT];
|
GLenum GFXGLTextureFilter[GFXTextureFilter_COUNT];
|
||||||
GLenum GFXGLTextureAddress[GFXAddress_COUNT];
|
GLenum GFXGLTextureAddress[GFXAddress_COUNT];
|
||||||
GLenum GFXGLCmpFunc[GFXCmp_COUNT];
|
GLenum GFXGLCmpFunc[GFXCmp_COUNT];
|
||||||
|
|
@ -75,14 +74,7 @@ void GFXGLEnumTranslate::init()
|
||||||
GFXGLBlendOp[GFXBlendOpMin] = GL_MIN;
|
GFXGLBlendOp[GFXBlendOpMin] = GL_MIN;
|
||||||
GFXGLBlendOp[GFXBlendOpMax] = GL_MAX;
|
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
|
// Comparison
|
||||||
GFXGLCmpFunc[GFXCmpNever] = GL_NEVER;
|
GFXGLCmpFunc[GFXCmpNever] = GL_NEVER;
|
||||||
GFXGLCmpFunc[GFXCmpLess] = GL_LESS;
|
GFXGLCmpFunc[GFXCmpLess] = GL_LESS;
|
||||||
|
|
@ -96,10 +88,7 @@ void GFXGLEnumTranslate::init()
|
||||||
GFXGLTextureFilter[GFXTextureFilterNone] = GL_NEAREST;
|
GFXGLTextureFilter[GFXTextureFilterNone] = GL_NEAREST;
|
||||||
GFXGLTextureFilter[GFXTextureFilterPoint] = GL_NEAREST;
|
GFXGLTextureFilter[GFXTextureFilterPoint] = GL_NEAREST;
|
||||||
GFXGLTextureFilter[GFXTextureFilterLinear] = GL_LINEAR;
|
GFXGLTextureFilter[GFXTextureFilterLinear] = GL_LINEAR;
|
||||||
|
|
||||||
GFXGLTextureFilter[GFXTextureFilterAnisotropic] = GL_LINEAR;
|
GFXGLTextureFilter[GFXTextureFilterAnisotropic] = GL_LINEAR;
|
||||||
GFXGLTextureFilter[GFXTextureFilterPyramidalQuad] = GL_LINEAR;
|
|
||||||
GFXGLTextureFilter[GFXTextureFilterGaussianQuad] = GL_LINEAR;
|
|
||||||
|
|
||||||
GFXGLTextureAddress[GFXAddressWrap] = GL_REPEAT;
|
GFXGLTextureAddress[GFXAddressWrap] = GL_REPEAT;
|
||||||
GFXGLTextureAddress[GFXAddressMirror] = GL_REPEAT;
|
GFXGLTextureAddress[GFXAddressMirror] = GL_REPEAT;
|
||||||
|
|
@ -116,8 +105,7 @@ void GFXGLEnumTranslate::init()
|
||||||
GFXGLStencilOp[GFXStencilOpInvert] = GL_INVERT;
|
GFXGLStencilOp[GFXStencilOpInvert] = GL_INVERT;
|
||||||
|
|
||||||
GFXGLStencilOp[GFXStencilOpIncr] = GL_INCR_WRAP;
|
GFXGLStencilOp[GFXStencilOpIncr] = GL_INCR_WRAP;
|
||||||
GFXGLStencilOp[GFXStencilOpDecr] = GL_DECR_WRAP;
|
GFXGLStencilOp[GFXStencilOpDecr] = GL_DECR_WRAP;
|
||||||
|
|
||||||
|
|
||||||
// Texture formats
|
// Texture formats
|
||||||
for(int i = 0; i < GFXFormat_COUNT; ++i)
|
for(int i = 0; i < GFXFormat_COUNT; ++i)
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ namespace GFXGLEnumTranslate
|
||||||
extern GLenum GFXGLPrimType[GFXPT_COUNT];
|
extern GLenum GFXGLPrimType[GFXPT_COUNT];
|
||||||
extern GLenum GFXGLBlend[GFXBlend_COUNT];
|
extern GLenum GFXGLBlend[GFXBlend_COUNT];
|
||||||
extern GLenum GFXGLBlendOp[GFXBlendOp_COUNT];
|
extern GLenum GFXGLBlendOp[GFXBlendOp_COUNT];
|
||||||
extern GLenum GFXGLSamplerState[GFXSAMP_COUNT];
|
|
||||||
extern GLenum GFXGLTextureFilter[GFXTextureFilter_COUNT];
|
extern GLenum GFXGLTextureFilter[GFXTextureFilter_COUNT];
|
||||||
extern GLenum GFXGLTextureAddress[GFXAddress_COUNT];
|
extern GLenum GFXGLTextureAddress[GFXAddress_COUNT];
|
||||||
extern GLenum GFXGLCmpFunc[GFXCmp_COUNT];
|
extern GLenum GFXGLCmpFunc[GFXCmp_COUNT];
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ GFXGLStateBlock::GFXGLStateBlock(const GFXStateBlockDesc& desc) :
|
||||||
{
|
{
|
||||||
static Map<GFXSamplerStateDesc, U32> mSamplersMap;
|
static Map<GFXSamplerStateDesc, U32> mSamplersMap;
|
||||||
|
|
||||||
for(int i = 0; i < TEXTURE_STAGE_COUNT; ++i)
|
for(int i = 0; i < GFX_TEXTURE_STAGE_COUNT; ++i)
|
||||||
{
|
{
|
||||||
GLuint &id = mSamplerObjects[i];
|
GLuint &id = mSamplerObjects[i];
|
||||||
GFXSamplerStateDesc &ssd = mDesc.samplers[i];
|
GFXSamplerStateDesc &ssd = mDesc.samplers[i];
|
||||||
|
|
@ -172,7 +172,7 @@ void GFXGLStateBlock::activate(const GFXGLStateBlock* oldState)
|
||||||
#undef CHECK_TOGGLE_STATE
|
#undef CHECK_TOGGLE_STATE
|
||||||
|
|
||||||
//sampler objects
|
//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])
|
if(!oldState || oldState->mSamplerObjects[i] != mSamplerObjects[i])
|
||||||
glBindSampler(i, mSamplerObjects[i] );
|
glBindSampler(i, mSamplerObjects[i] );
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ public:
|
||||||
private:
|
private:
|
||||||
GFXStateBlockDesc mDesc;
|
GFXStateBlockDesc mDesc;
|
||||||
U32 mCachedHashValue;
|
U32 mCachedHashValue;
|
||||||
U32 mSamplerObjects[TEXTURE_STAGE_COUNT];
|
U32 mSamplerObjects[GFX_TEXTURE_STAGE_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef StrongRefPtr<GFXGLStateBlock> GFXGLStateBlockRef;
|
typedef StrongRefPtr<GFXGLStateBlock> GFXGLStateBlockRef;
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GLuint mActiveTexture, mBindedVBO, mBindedIBO, mBindedFBO_W, mBindedFBO_R;
|
GLuint mActiveTexture, mBindedVBO, mBindedIBO, mBindedFBO_W, mBindedFBO_R;
|
||||||
TextureUnit mTextureUnits[TEXTURE_STAGE_COUNT];
|
TextureUnit mTextureUnits[GFX_TEXTURE_STAGE_COUNT];
|
||||||
U32 mVertexAttribActive;
|
U32 mVertexAttribActive;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -199,9 +199,9 @@ void end( bool useGenericShaders )
|
||||||
|
|
||||||
if ( stripStart > 0 )
|
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 );
|
mVertBuff.set( GFX, copyVerts, GFXBufferTypeVolatile );
|
||||||
|
|
||||||
GFXVertexPCT *verts = mVertBuff.lock();
|
GFXVertexPCT *verts = mVertBuff.lock();
|
||||||
|
|
@ -216,7 +216,7 @@ void end( bool useGenericShaders )
|
||||||
{
|
{
|
||||||
while ( numVerts > 0 )
|
while ( numVerts > 0 )
|
||||||
{
|
{
|
||||||
U32 copyVerts = getMin( (U32)MAX_DYNAMIC_VERTS, numVerts );
|
U32 copyVerts = getMin( (U32)GFX_MAX_DYNAMIC_VERTS, numVerts );
|
||||||
copyVerts -= copyVerts % vertStride;
|
copyVerts -= copyVerts % vertStride;
|
||||||
|
|
||||||
mVertBuff.set( GFX, copyVerts, GFXBufferTypeVolatile );
|
mVertBuff.set( GFX, copyVerts, GFXBufferTypeVolatile );
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ ConsoleDocClass( GFXStateBlockData,
|
||||||
|
|
||||||
GFXStateBlockData::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;
|
mSamplerStates[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -210,9 +210,6 @@ void GFXStateBlockData::initPersistFields()
|
||||||
|
|
||||||
addGroup( "Fixed Function" );
|
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),
|
addField( "vertexColorEnable", TypeBool, Offset(mState.vertexColorEnable, GFXStateBlockData),
|
||||||
"Enables fixed function vertex coloring when rendering without a shader. The default is false." );
|
"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),
|
addField( "samplersDefined", TypeBool, Offset(mState.samplersDefined, GFXStateBlockData),
|
||||||
"Set to true if the sampler states are not all defaults." );
|
"Set to true if the sampler states are not all defaults." );
|
||||||
|
|
||||||
addField( "samplerStates", TYPEID<GFXSamplerStateData>(), Offset(mSamplerStates, GFXStateBlockData), TEXTURE_STAGE_COUNT,
|
addField( "samplerStates", TYPEID<GFXSamplerStateData>(), Offset(mSamplerStates, GFXStateBlockData), GFX_TEXTURE_STAGE_COUNT,
|
||||||
"The array of texture sampler states.\n"
|
"The array of texture sampler states.\n"
|
||||||
"@note Not all graphics devices support 16 samplers. In general "
|
"@note Not all graphics devices support 16 samplers. In general "
|
||||||
"all systems support 4 samplers with most modern cards doing 8." );
|
"all systems support 4 samplers with most modern cards doing 8." );
|
||||||
|
|
@ -243,7 +240,7 @@ bool GFXStateBlockData::onAdd()
|
||||||
if (!Parent::onAdd())
|
if (!Parent::onAdd())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (U32 i = 0; i < TEXTURE_STAGE_COUNT; i++)
|
for (U32 i = 0; i < GFX_TEXTURE_STAGE_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (mSamplerStates[i])
|
if (mSamplerStates[i])
|
||||||
mSamplerStates[i]->setSamplerState(mState.samplers[i]);
|
mSamplerStates[i]->setSamplerState(mState.samplers[i]);
|
||||||
|
|
@ -284,38 +281,6 @@ void GFXSamplerStateData::initPersistFields()
|
||||||
{
|
{
|
||||||
Parent::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" );
|
addGroup( "Address Mode" );
|
||||||
|
|
||||||
addField("addressModeU", TypeGFXTextureAddressMode, Offset(mState.addressModeU, GFXSamplerStateData),
|
addField("addressModeU", TypeGFXTextureAddressMode, Offset(mState.addressModeU, GFXSamplerStateData),
|
||||||
|
|
@ -348,12 +313,6 @@ void GFXSamplerStateData::initPersistFields()
|
||||||
|
|
||||||
endGroup( "Filter State" );
|
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),
|
addField("samplerFunc", TypeGFXCmpFunc, Offset(mState.samplerFunc, GFXSamplerStateData),
|
||||||
"Compares sampled data against existing sampled data. The default is GFXCmpNever.");
|
"Compares sampled data against existing sampled data. The default is GFXCmpNever.");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class GFXStateBlockData : public SimObject
|
||||||
typedef SimObject Parent;
|
typedef SimObject Parent;
|
||||||
|
|
||||||
GFXStateBlockDesc mState;
|
GFXStateBlockDesc mState;
|
||||||
GFXSamplerStateData* mSamplerStates[TEXTURE_STAGE_COUNT];
|
GFXSamplerStateData* mSamplerStates[GFX_TEXTURE_STAGE_COUNT];
|
||||||
public:
|
public:
|
||||||
GFXStateBlockData();
|
GFXStateBlockData();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,14 +68,11 @@ bool GuiTerrPreviewCtrl::onAdd()
|
||||||
desc.samplersDefined = true;
|
desc.samplersDefined = true;
|
||||||
desc.samplers[0].addressModeU = GFXAddressWrap;
|
desc.samplers[0].addressModeU = GFXAddressWrap;
|
||||||
desc.samplers[0].addressModeV = GFXAddressWrap;
|
desc.samplers[0].addressModeV = GFXAddressWrap;
|
||||||
desc.samplers[0].textureColorOp = GFXTOPSelectARG1;
|
|
||||||
desc.samplers[0].colorArg1 = GFXTATexture;
|
|
||||||
desc.setCullMode(GFXCullNone);
|
desc.setCullMode(GFXCullNone);
|
||||||
desc.setZReadWrite(false);
|
desc.setZReadWrite(false);
|
||||||
|
|
||||||
mTerrainBitmapStateBlock = GFX->createStateBlock(desc);
|
mTerrainBitmapStateBlock = GFX->createStateBlock(desc);
|
||||||
|
|
||||||
desc.samplers[0].textureColorOp = GFXTOPDisable;
|
|
||||||
|
|
||||||
mControlsStateBlock = GFX->createStateBlock(desc);
|
mControlsStateBlock = GFX->createStateBlock(desc);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1339,7 +1339,7 @@ void TerrainEditor::renderPoints( const Vector<GFXVertexPCT> &pointList )
|
||||||
|
|
||||||
while ( vertsLeft > 0 )
|
while ( vertsLeft > 0 )
|
||||||
{
|
{
|
||||||
U32 vertsThisDrawCall = getMin( (U32)vertsLeft, (U32)MAX_DYNAMIC_VERTS );
|
U32 vertsThisDrawCall = getMin( (U32)vertsLeft, (U32)GFX_MAX_DYNAMIC_VERTS );
|
||||||
vertsLeft -= vertsThisDrawCall;
|
vertsLeft -= vertsThisDrawCall;
|
||||||
|
|
||||||
GFXVertexBufferHandle<GFXVertexPCT> vbuff( GFX, vertsThisDrawCall, GFXBufferTypeVolatile );
|
GFXVertexBufferHandle<GFXVertexPCT> vbuff( GFX, vertsThisDrawCall, GFXBufferTypeVolatile );
|
||||||
|
|
|
||||||
|
|
@ -1500,7 +1500,6 @@ void WorldEditor::renderSplinePath(SimPath::Path *path)
|
||||||
desc.setCullMode( GFXCullNone );
|
desc.setCullMode( GFXCullNone );
|
||||||
desc.setBlend( true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
|
desc.setBlend( true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
|
||||||
desc.samplersDefined = true;
|
desc.samplersDefined = true;
|
||||||
desc.samplers[0].textureColorOp = GFXTOPDisable;
|
|
||||||
|
|
||||||
mSplineSB = GFX->createStateBlock( desc );
|
mSplineSB = GFX->createStateBlock( desc );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 )
|
void LightInfo::setDirection( const VectorF &dir )
|
||||||
{
|
{
|
||||||
MathUtils::getMatrixFromForwardVector( mNormalize( dir ), &mTransform );
|
MathUtils::getMatrixFromForwardVector( mNormalize( dir ), &mTransform );
|
||||||
|
|
|
||||||
|
|
@ -159,9 +159,6 @@ public:
|
||||||
// Copies data passed in from light
|
// Copies data passed in from light
|
||||||
void set( const LightInfo *light );
|
void set( const LightInfo *light );
|
||||||
|
|
||||||
// Sets a fixed function GFXLight with our properties
|
|
||||||
void setGFXLight( GFXLightInfo *light );
|
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
Type getType() const { return mType; }
|
Type getType() const { return mType; }
|
||||||
void setType( Type val ) { mType = val; }
|
void setType( Type val ) { mType = val; }
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
#include "materials/materialManager.h"
|
#include "materials/materialManager.h"
|
||||||
#include "materials/customMaterialDefinition.h"
|
#include "materials/customMaterialDefinition.h"
|
||||||
#include "materials/processedMaterial.h"
|
#include "materials/processedMaterial.h"
|
||||||
#include "materials/processedFFMaterial.h"
|
|
||||||
#include "materials/processedShaderMaterial.h"
|
#include "materials/processedShaderMaterial.h"
|
||||||
#include "materials/processedCustomMaterial.h"
|
#include "materials/processedCustomMaterial.h"
|
||||||
#include "materials/materialFeatureTypes.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",
|
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()));
|
String(mMaterial->getName()).isEmpty() ? "Unknown" : mMaterial->getName(), custMat->mMapTo.c_str()));
|
||||||
mProcessedMaterial = new ProcessedFFMaterial(*mMaterial);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mProcessedMaterial = new ProcessedCustomMaterial(*mMaterial);
|
mProcessedMaterial = new ProcessedCustomMaterial(*mMaterial);
|
||||||
}
|
}
|
||||||
else if(GFX->getPixelShaderVersion() > 0.001)
|
|
||||||
mProcessedMaterial = getShaderMaterial();
|
|
||||||
else
|
else
|
||||||
mProcessedMaterial = new ProcessedFFMaterial(*mMaterial);
|
mProcessedMaterial = getShaderMaterial();
|
||||||
|
|
||||||
|
|
||||||
if (mProcessedMaterial)
|
if (mProcessedMaterial)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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; i<Material::MAX_STAGES; i++ )
|
|
||||||
{
|
|
||||||
// Assume stage is inactive
|
|
||||||
bool stageActive = false;
|
|
||||||
|
|
||||||
// Cubemaps only on first stage
|
|
||||||
if( i == 0 )
|
|
||||||
{
|
|
||||||
// If we have a cubemap the stage is active
|
|
||||||
if( mMaterial->mCubemapData || 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( pass<mPasses.size(), "Pass out of bounds" );
|
|
||||||
#endif
|
|
||||||
RenderPassData *rpd = mPasses[pass];
|
|
||||||
for( U32 i=0; i<rpd->mNumTex; 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<CustomMaterial*>(mMaterial);
|
|
||||||
if (custmat && custmat->getStateBlockData() )
|
|
||||||
result.addDesc(custmat->getStateBlockData()->getState());
|
|
||||||
}
|
|
||||||
|
|
@ -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<CustomShaderBindingData> &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<GFXShaderConstDesc> 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
|
|
||||||
|
|
@ -210,10 +210,6 @@ void ProcessedMaterial::_initStateBlockTemplates(GFXStateBlockDesc& stateTranslu
|
||||||
stateTranslucent.alphaTestRef = mMaterial->mAlphaRef;
|
stateTranslucent.alphaTestRef = mMaterial->mAlphaRef;
|
||||||
stateTranslucent.alphaTestFunc = GFXCmpGreaterEqual;
|
stateTranslucent.alphaTestFunc = GFXCmpGreaterEqual;
|
||||||
stateTranslucent.samplersDefined = true;
|
stateTranslucent.samplersDefined = true;
|
||||||
stateTranslucent.samplers[0].textureColorOp = GFXTOPModulate;
|
|
||||||
stateTranslucent.samplers[0].alphaOp = GFXTOPModulate;
|
|
||||||
stateTranslucent.samplers[0].alphaArg1 = GFXTATexture;
|
|
||||||
stateTranslucent.samplers[0].alphaArg2 = GFXTADiffuse;
|
|
||||||
|
|
||||||
// Glow
|
// Glow
|
||||||
stateGlow.zDefined = true;
|
stateGlow.zDefined = true;
|
||||||
|
|
@ -268,7 +264,6 @@ void ProcessedMaterial::_initPassStateBlock( RenderPassData *rpd, GFXStateBlockD
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
result.samplers[i].textureColorOp = GFXTOPModulate;
|
|
||||||
result.samplers[i].addressModeU = GFXAddressWrap;
|
result.samplers[i].addressModeU = GFXAddressWrap;
|
||||||
result.samplers[i].addressModeV = GFXAddressWrap;
|
result.samplers[i].addressModeV = GFXAddressWrap;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ void ShaderConstHandles::init( GFXShader *shader, CustomMaterial* mat /*=NULL*/)
|
||||||
mImposterUVs = shader->getShaderConstHandle( "$imposterUVs" );
|
mImposterUVs = shader->getShaderConstHandle( "$imposterUVs" );
|
||||||
mImposterLimits = shader->getShaderConstHandle( "$imposterLimits" );
|
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 ) );
|
mRTParamsSC[i] = shader->getShaderConstHandle( String::ToString( "$rtParams%d", i ) );
|
||||||
|
|
||||||
// MFT_HardwareSkinning
|
// MFT_HardwareSkinning
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ public:
|
||||||
GFXShaderConstHandle* mMatInfoFlagsSC;
|
GFXShaderConstHandle* mMatInfoFlagsSC;
|
||||||
|
|
||||||
GFXShaderConstHandle* mTexHandlesSC[Material::MAX_TEX_PER_PASS];
|
GFXShaderConstHandle* mTexHandlesSC[Material::MAX_TEX_PER_PASS];
|
||||||
GFXShaderConstHandle* mRTParamsSC[TEXTURE_STAGE_COUNT];
|
GFXShaderConstHandle* mRTParamsSC[GFX_TEXTURE_STAGE_COUNT];
|
||||||
|
|
||||||
GFXShaderConstHandle* mNodeTransforms;
|
GFXShaderConstHandle* mNodeTransforms;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -664,9 +664,6 @@ GFXStateBlockRef RenderParticleMgr::_getOffscreenStateBlock(ParticleRenderInst *
|
||||||
|
|
||||||
// Diffuse texture sampler
|
// Diffuse texture sampler
|
||||||
d.samplers[0] = GFXSamplerStateDesc::getClampLinear();
|
d.samplers[0] = GFXSamplerStateDesc::getClampLinear();
|
||||||
d.samplers[0].alphaOp = GFXTOPModulate;
|
|
||||||
d.samplers[0].alphaArg1 = GFXTATexture;
|
|
||||||
d.samplers[0].alphaArg2 = GFXTADiffuse;
|
|
||||||
|
|
||||||
// Deferred sampler
|
// Deferred sampler
|
||||||
d.samplers[1] = GFXSamplerStateDesc::getClampPoint();
|
d.samplers[1] = GFXSamplerStateDesc::getClampPoint();
|
||||||
|
|
@ -697,9 +694,6 @@ GFXStateBlockRef RenderParticleMgr::_getHighResStateBlock(ParticleRenderInst *ri
|
||||||
|
|
||||||
// Diffuse texture sampler
|
// Diffuse texture sampler
|
||||||
d.samplers[0] = GFXSamplerStateDesc::getClampLinear();
|
d.samplers[0] = GFXSamplerStateDesc::getClampLinear();
|
||||||
d.samplers[0].alphaOp = GFXTOPModulate;
|
|
||||||
d.samplers[0].alphaArg1 = GFXTATexture;
|
|
||||||
d.samplers[0].alphaArg2 = GFXTADiffuse;
|
|
||||||
|
|
||||||
// Deferred sampler
|
// Deferred sampler
|
||||||
d.samplers[1] = GFXSamplerStateDesc::getClampPoint();
|
d.samplers[1] = GFXSamplerStateDesc::getClampPoint();
|
||||||
|
|
@ -769,9 +763,6 @@ GFXStateBlockRef RenderParticleMgr::_getMixedResStateBlock(ParticleRenderInst *r
|
||||||
|
|
||||||
// Diffuse texture sampler
|
// Diffuse texture sampler
|
||||||
d.samplers[0] = GFXSamplerStateDesc::getClampLinear();
|
d.samplers[0] = GFXSamplerStateDesc::getClampLinear();
|
||||||
d.samplers[0].alphaOp = GFXTOPModulate;
|
|
||||||
d.samplers[0].alphaArg1 = GFXTATexture;
|
|
||||||
d.samplers[0].alphaArg2 = GFXTADiffuse;
|
|
||||||
|
|
||||||
// Deferred sampler
|
// Deferred sampler
|
||||||
d.samplers[1] = GFXSamplerStateDesc::getClampPoint();
|
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.
|
// Do nothing. This render manager uses its target chain as a pool of targets.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -125,9 +125,6 @@ GFXStateBlockRef RenderTranslucentMgr::_getStateBlock( U8 transFlag )
|
||||||
d.zWriteEnable = false;
|
d.zWriteEnable = false;
|
||||||
d.samplersDefined = true;
|
d.samplersDefined = true;
|
||||||
d.samplers[0] = GFXSamplerStateDesc::getClampLinear();
|
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);
|
mStateBlocks[transFlag] = GFX->createStateBlock(d);
|
||||||
return mStateBlocks[transFlag];
|
return mStateBlocks[transFlag];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue