mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Direct3D11 Engine/source changes
This commit is contained in:
parent
3a9b50f702
commit
41e5caf22b
|
|
@ -188,7 +188,7 @@ void CameraSpline::renderTimeMap()
|
|||
gBuilding = true;
|
||||
|
||||
// Build vertex buffer
|
||||
GFXVertexBufferHandle<GFXVertexPC> vb;
|
||||
GFXVertexBufferHandle<GFXVertexPCT> vb;
|
||||
vb.set(GFX, mTimeMap.size(), GFXBufferTypeVolatile);
|
||||
void *ptr = vb.lock();
|
||||
if(!ptr) return;
|
||||
|
|
|
|||
|
|
@ -1557,7 +1557,7 @@ void Precipitation::renderObject(ObjectRenderInst *ri, SceneRenderState *state,
|
|||
Point3F pos;
|
||||
VectorF orthoDir, velocity, right, up, rightUp(0.0f, 0.0f, 0.0f), leftUp(0.0f, 0.0f, 0.0f);
|
||||
F32 distance = 0;
|
||||
GFXVertexPT* vertPtr = NULL;
|
||||
GFXVertexPCT* vertPtr = NULL;
|
||||
const Point2F *tc;
|
||||
|
||||
// Do this here and we won't have to in the loop!
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ class Precipitation : public GameBase
|
|||
void destroySplash(Raindrop *drop); ///< Removes a drop from the splash list
|
||||
|
||||
GFXPrimitiveBufferHandle mRainIB;
|
||||
GFXVertexBufferHandle<GFXVertexPT> mRainVB;
|
||||
GFXVertexBufferHandle<GFXVertexPCT> mRainVB;
|
||||
|
||||
bool onAdd();
|
||||
void onRemove();
|
||||
|
|
|
|||
|
|
@ -317,8 +317,7 @@ void VolumetricFog::handleResize(VolumetricFogRTManager *RTM, bool resize)
|
|||
{
|
||||
F32 width = (F32)mPlatformWindow->getClientExtent().x;
|
||||
F32 height = (F32)mPlatformWindow->getClientExtent().y;
|
||||
if (!mPlatformWindow->isFullscreen())
|
||||
height -= 20;//subtract caption bar from rendertarget size.
|
||||
|
||||
mTexScale.x = 2.0f - ((F32)mTexture.getWidth() / width);
|
||||
mTexScale.y = 2.0f - ((F32)mTexture.getHeight() / height);
|
||||
}
|
||||
|
|
@ -1075,7 +1074,6 @@ void VolumetricFog::render(ObjectRenderInst *ri, SceneRenderState *state, BaseMa
|
|||
|
||||
mPPShaderConsts->setSafe(mPPModelViewProjSC, xform);
|
||||
|
||||
LightInfo *lightinfo = LIGHTMGR->getSpecialLight(LightManager::slSunLightType);
|
||||
const ColorF &sunlight = state->getAmbientLightColor();
|
||||
|
||||
Point3F ambientColor(sunlight.red, sunlight.green, sunlight.blue);
|
||||
|
|
@ -1160,6 +1158,11 @@ void VolumetricFog::render(ObjectRenderInst *ri, SceneRenderState *state, BaseMa
|
|||
GFX->setStateBlock(mStateblockF);
|
||||
|
||||
GFX->drawPrimitive(0);
|
||||
|
||||
// Ensure these two textures are bound to the pixel shader input on the second run as they are used as pixel shader outputs (render targets).
|
||||
GFX->setTexture(1, NULL); //mDepthBuffer
|
||||
GFX->setTexture(2, NULL); //mFrontBuffer
|
||||
GFX->updateStates(); //update the dirty texture state we set above
|
||||
}
|
||||
|
||||
void VolumetricFog::reflect_render(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat)
|
||||
|
|
@ -1210,9 +1213,6 @@ void VolumetricFog::InitTexture()
|
|||
F32 width = (F32)mPlatformWindow->getClientExtent().x;
|
||||
F32 height = (F32)mPlatformWindow->getClientExtent().y;
|
||||
|
||||
if (!mPlatformWindow->isFullscreen())
|
||||
height -= 20;//subtract caption bar from rendertarget size.
|
||||
|
||||
mTexScale.x = 2.0f - ((F32)mTexture.getWidth() / width);
|
||||
mTexScale.y = 2.0f - ((F32)mTexture.getHeight() / height);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include "windowManager/platformWindowMgr.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "gui/core/guiCanvas.h"
|
||||
#include "gfx/gfxDevice.h"
|
||||
|
||||
MODULE_BEGIN(VolumetricFogRTManager)
|
||||
|
||||
|
|
@ -127,10 +128,10 @@ void VolumetricFogRTManager::consoleInit()
|
|||
bool VolumetricFogRTManager::Init()
|
||||
{
|
||||
if (mIsInitialized)
|
||||
{
|
||||
{
|
||||
Con::errorf("VolumetricFogRTManager allready initialized!!");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
GuiCanvas* cv = dynamic_cast<GuiCanvas*>(Sim::findObject("Canvas"));
|
||||
if (cv == NULL)
|
||||
|
|
@ -142,15 +143,11 @@ bool VolumetricFogRTManager::Init()
|
|||
mPlatformWindow = cv->getPlatformWindow();
|
||||
mPlatformWindow->getScreenResChangeSignal().notify(this,&VolumetricFogRTManager::ResizeRT);
|
||||
|
||||
if (mTargetScale < 1)
|
||||
if (mTargetScale < 1 || GFX->getAdapterType() == Direct3D11)
|
||||
mTargetScale = 1;
|
||||
|
||||
mWidth = mFloor(mPlatformWindow->getClientExtent().x / mTargetScale);
|
||||
mHeight = mPlatformWindow->getClientExtent().y;
|
||||
mFullScreen = mPlatformWindow->isFullscreen();
|
||||
if (!mFullScreen)
|
||||
mHeight -= 20;//subtract caption bar from rendertarget size.
|
||||
mHeight = mFloor(mHeight / mTargetScale);
|
||||
mHeight = mFloor(mPlatformWindow->getClientExtent().y / mTargetScale);
|
||||
|
||||
mDepthBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F,
|
||||
&GFXDefaultRenderTargetProfile, avar("%s() - mDepthBuffer (line %d)", __FUNCTION__, __LINE__));
|
||||
|
|
@ -221,14 +218,11 @@ void VolumetricFogRTManager::FogAnswered()
|
|||
|
||||
bool VolumetricFogRTManager::Resize()
|
||||
{
|
||||
if (mTargetScale < 1)
|
||||
if (mTargetScale < 1 || GFX->getAdapterType() == Direct3D11)
|
||||
mTargetScale = 1;
|
||||
|
||||
mWidth = mFloor(mPlatformWindow->getClientExtent().x / mTargetScale);
|
||||
mHeight = mPlatformWindow->getClientExtent().y;
|
||||
|
||||
if (!mPlatformWindow->isFullscreen())
|
||||
mHeight -= 20;//subtract caption bar from rendertarget size.
|
||||
mHeight = mFloor(mHeight / mTargetScale);
|
||||
mHeight = mFloor(mPlatformWindow->getClientExtent().y / mTargetScale);
|
||||
|
||||
if (mWidth < 16 || mHeight < 16)
|
||||
return false;
|
||||
|
|
@ -248,19 +242,19 @@ bool VolumetricFogRTManager::Resize()
|
|||
mFrontBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F,
|
||||
&GFXDefaultRenderTargetProfile, avar("%s() - mFrontBuffer (line %d)", __FUNCTION__, __LINE__));
|
||||
if (!mFrontBuffer.isValid())
|
||||
{
|
||||
{
|
||||
Con::errorf("VolumetricFogRTManager::Resize() Fatal Error: Unable to create front buffer");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
mFrontTarget.setTexture(mFrontBuffer);
|
||||
|
||||
mDepthBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F,
|
||||
&GFXDefaultRenderTargetProfile, avar("%s() - mDepthBuffer (line %d)", __FUNCTION__, __LINE__));
|
||||
if (!mDepthBuffer.isValid())
|
||||
{
|
||||
Con::errorf("VolumetricFogRTManager::Resize() Fatal Error: Unable to create Depthbuffer");
|
||||
return false;
|
||||
}
|
||||
{
|
||||
Con::errorf("VolumetricFogRTManager::Resize() Fatal Error: Unable to create Depthbuffer");
|
||||
return false;
|
||||
}
|
||||
mDepthTarget.setTexture(mDepthBuffer);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ class VolumetricFogRTManager : public SceneObject
|
|||
U32 mFogHasAnswered;
|
||||
U32 mWidth;
|
||||
U32 mHeight;
|
||||
bool mFullScreen;
|
||||
|
||||
void onRemove();
|
||||
void onSceneRemove();
|
||||
|
|
|
|||
|
|
@ -1067,17 +1067,17 @@ void ScatterSky::_renderMoon( ObjectRenderInst *ri, SceneRenderState *state, Bas
|
|||
|
||||
// Initialize points with basic info
|
||||
Point3F points[4];
|
||||
points[0] = Point3F(-BBRadius, 0.0, -BBRadius);
|
||||
points[0] = Point3F( -BBRadius, 0.0, -BBRadius);
|
||||
points[1] = Point3F( -BBRadius, 0.0, BBRadius);
|
||||
points[2] = Point3F( BBRadius, 0.0, BBRadius);
|
||||
points[3] = Point3F( BBRadius, 0.0, -BBRadius);
|
||||
points[2] = Point3F( BBRadius, 0.0, -BBRadius);
|
||||
points[3] = Point3F( BBRadius, 0.0, BBRadius);
|
||||
|
||||
static const Point2F sCoords[4] =
|
||||
{
|
||||
Point2F( 0.0f, 0.0f ),
|
||||
Point2F( 0.0f, 1.0f ),
|
||||
Point2F( 1.0f, 1.0f ),
|
||||
Point2F( 1.0f, 0.0f )
|
||||
Point2F( 1.0f, 0.0f ),
|
||||
Point2F( 1.0f, 1.0f )
|
||||
};
|
||||
|
||||
// Get info we need to adjust points
|
||||
|
|
@ -1126,7 +1126,7 @@ void ScatterSky::_renderMoon( ObjectRenderInst *ri, SceneRenderState *state, Bas
|
|||
mMoonMatInst->setSceneInfo( state, sgData );
|
||||
|
||||
GFX->setVertexBuffer( vb );
|
||||
GFX->drawPrimitive( GFXTriangleFan, 0, 2 );
|
||||
GFX->drawPrimitive( GFXTriangleStrip, 0, 2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -467,15 +467,15 @@ void Sun::_renderCorona( ObjectRenderInst *ri, SceneRenderState *state, BaseMatI
|
|||
Point3F points[4];
|
||||
points[0] = Point3F(-BBRadius, 0.0, -BBRadius);
|
||||
points[1] = Point3F( -BBRadius, 0.0, BBRadius);
|
||||
points[2] = Point3F( BBRadius, 0.0, BBRadius);
|
||||
points[3] = Point3F( BBRadius, 0.0, -BBRadius);
|
||||
points[2] = Point3F( BBRadius, 0.0, -BBRadius);
|
||||
points[3] = Point3F(BBRadius, 0.0, BBRadius);
|
||||
|
||||
static const Point2F sCoords[4] =
|
||||
{
|
||||
Point2F( 0.0f, 0.0f ),
|
||||
Point2F( 0.0f, 1.0f ),
|
||||
Point2F( 1.0f, 1.0f ),
|
||||
Point2F( 1.0f, 0.0f )
|
||||
Point2F( 1.0f, 0.0f ),
|
||||
Point2F(1.0f, 1.0f)
|
||||
};
|
||||
|
||||
// Get info we need to adjust points
|
||||
|
|
@ -525,7 +525,7 @@ void Sun::_renderCorona( ObjectRenderInst *ri, SceneRenderState *state, BaseMatI
|
|||
mCoronaMatInst->setSceneInfo( state, sgData );
|
||||
|
||||
GFX->setVertexBuffer( vb );
|
||||
GFX->drawPrimitive( GFXTriangleFan, 0, 2 );
|
||||
GFX->drawPrimitive( GFXTriangleStrip, 0, 2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -826,25 +826,25 @@ void WaterObject::drawUnderwaterFilter( SceneRenderState *state )
|
|||
// draw quad
|
||||
|
||||
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts( GFX, 4, GFXBufferTypeVolatile );
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts( GFX, 4, GFXBufferTypeVolatile );
|
||||
verts.lock();
|
||||
|
||||
verts[0].point.set( -1.0 - copyOffsetX, -1.0 + copyOffsetY, 0.0 );
|
||||
verts[0].point.set(1.0 - copyOffsetX, -1.0 + copyOffsetY, 0.0);
|
||||
verts[0].color = mUnderwaterColor;
|
||||
|
||||
verts[1].point.set( -1.0 - copyOffsetX, 1.0 + copyOffsetY, 0.0 );
|
||||
verts[1].point.set(1.0 - copyOffsetX, 1.0 + copyOffsetY, 0.0);
|
||||
verts[1].color = mUnderwaterColor;
|
||||
|
||||
verts[2].point.set( 1.0 - copyOffsetX, 1.0 + copyOffsetY, 0.0 );
|
||||
verts[2].point.set(-1.0 - copyOffsetX, -1.0 + copyOffsetY, 0.0);
|
||||
verts[2].color = mUnderwaterColor;
|
||||
|
||||
verts[3].point.set( 1.0 - copyOffsetX, -1.0 + copyOffsetY, 0.0 );
|
||||
verts[3].point.set(-1.0 - copyOffsetX, 1.0 + copyOffsetY, 0.0);
|
||||
verts[3].color = mUnderwaterColor;
|
||||
|
||||
verts.unlock();
|
||||
|
||||
GFX->setVertexBuffer( verts );
|
||||
GFX->drawPrimitive( GFXTriangleFan, 0, 2 );
|
||||
GFX->drawPrimitive( GFXTriangleStrip, 0, 2 );
|
||||
|
||||
// reset states / transforms
|
||||
GFX->setProjectionMatrix( proj );
|
||||
|
|
@ -1141,7 +1141,7 @@ bool WaterObject::initMaterial( S32 idx )
|
|||
else
|
||||
mat = MATMGR->createMatInstance( mSurfMatName[idx] );
|
||||
|
||||
const GFXVertexFormat *flags = getGFXVertexFormat<GFXVertexPC>();
|
||||
const GFXVertexFormat *flags = getGFXVertexFormat<GFXVertexPCT>();
|
||||
|
||||
if ( mat && mat->init( MATMGR->getDefaultFeatures(), flags ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -826,6 +826,7 @@ GFXVertexBuffer * GFXD3D9Device::allocVertexBuffer( U32 numVerts,
|
|||
|
||||
switch(bufferType)
|
||||
{
|
||||
case GFXBufferTypeImmutable:
|
||||
case GFXBufferTypeStatic:
|
||||
pool = isD3D9Ex() ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1307,10 +1307,15 @@ void GFXD3D9Shader::_buildSamplerShaderConstantHandles( Vector<GFXShaderConstDes
|
|||
|
||||
void GFXD3D9Shader::_buildInstancingShaderConstantHandles()
|
||||
{
|
||||
// If we have no instancing than just return
|
||||
if (!mInstancingFormat)
|
||||
return;
|
||||
|
||||
U32 offset = 0;
|
||||
for ( U32 i=0; i < mInstancingFormat.getElementCount(); i++ )
|
||||
|
||||
for ( U32 i=0; i < mInstancingFormat->getElementCount(); i++ )
|
||||
{
|
||||
const GFXVertexElement &element = mInstancingFormat.getElement( i );
|
||||
const GFXVertexElement &element = mInstancingFormat->getElement( i );
|
||||
|
||||
String constName = String::ToString( "$%s", element.getSemantic().c_str() );
|
||||
|
||||
|
|
@ -1347,9 +1352,9 @@ void GFXD3D9Shader::_buildInstancingShaderConstantHandles()
|
|||
|
||||
// If this is a matrix we will have 2 or 3 more of these
|
||||
// semantics with the same name after it.
|
||||
for ( ; i < mInstancingFormat.getElementCount(); i++ )
|
||||
for ( ; i < mInstancingFormat->getElementCount(); i++ )
|
||||
{
|
||||
const GFXVertexElement &nextElement = mInstancingFormat.getElement( i );
|
||||
const GFXVertexElement &nextElement = mInstancingFormat->getElement( i );
|
||||
if ( nextElement.getSemantic() != element.getSemantic() )
|
||||
{
|
||||
i--;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ void GFXD3D9VertexBuffer::lock(U32 vertexStart, U32 vertexEnd, void **vertexPtr)
|
|||
|
||||
switch( mBufferType )
|
||||
{
|
||||
case GFXBufferTypeImmutable:
|
||||
case GFXBufferTypeStatic:
|
||||
break;
|
||||
|
||||
|
|
@ -203,7 +204,7 @@ void GFXD3D9VertexBuffer::zombify()
|
|||
{
|
||||
AssertFatal(lockedVertexStart == 0 && lockedVertexEnd == 0, "GFXD3D9VertexBuffer::zombify - Cannot zombify a locked buffer!");
|
||||
// Static buffers are managed by D3D9 so we don't deal with them.
|
||||
if(mBufferType == GFXBufferTypeDynamic)
|
||||
if(mBufferType == GFXBufferTypeDynamic || mBufferType == GFXBufferTypeImmutable)
|
||||
{
|
||||
SAFE_RELEASE(vb);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -302,7 +302,6 @@ void GFXD3D9EnumTranslate::init()
|
|||
GFXD3D9PrimType[GFXLineStrip] = D3DPT_LINESTRIP;
|
||||
GFXD3D9PrimType[GFXTriangleList] = D3DPT_TRIANGLELIST;
|
||||
GFXD3D9PrimType[GFXTriangleStrip] = D3DPT_TRIANGLESTRIP;
|
||||
GFXD3D9PrimType[GFXTriangleFan] = D3DPT_TRIANGLEFAN;
|
||||
VALIDATE_LOOKUPTABLE( GFXD3D9PrimType, GFXPT );
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -514,7 +514,7 @@ void GFXPCD3D9Device::init( const GFXVideoMode &mode, PlatformWindow *window /*
|
|||
mCardProfiler = new GFXD3D9CardProfiler(mAdapterIndex);
|
||||
mCardProfiler->init();
|
||||
|
||||
gScreenShot = new ScreenShotD3D;
|
||||
gScreenShot = new ScreenShotD3D9;
|
||||
|
||||
// Set the video capture frame grabber.
|
||||
mVideoFrameGrabber = new VideoFrameGrabberD3D9();
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include <d3dx9tex.h>
|
||||
|
||||
|
||||
GBitmap* ScreenShotD3D::_captureBackBuffer()
|
||||
GBitmap* ScreenShotD3D9::_captureBackBuffer()
|
||||
{
|
||||
#ifdef TORQUE_OS_XENON
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -19,15 +19,15 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _SCREENSHOTD3D_H_
|
||||
#define _SCREENSHOTD3D_H_
|
||||
#ifndef _SCREENSHOTD3D9_H_
|
||||
#define _SCREENSHOTD3D9_H_
|
||||
|
||||
#include "gfx/screenshot.h"
|
||||
|
||||
//**************************************************************************
|
||||
// D3D implementation of screenshot
|
||||
//**************************************************************************
|
||||
class ScreenShotD3D : public ScreenShot
|
||||
class ScreenShotD3D9 : public ScreenShot
|
||||
{
|
||||
protected:
|
||||
|
||||
|
|
@ -36,4 +36,4 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
#endif // _SCREENSHOTD3D_H_
|
||||
#endif // _SCREENSHOTD3D9_H_
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ public:
|
|||
virtual ~GenericConstBufferLayout() {}
|
||||
|
||||
/// Add a parameter to the buffer
|
||||
void addParameter(const String& name, const GFXShaderConstType constType, const U32 offset, const U32 size, const U32 arraySize, const U32 alignValue);
|
||||
virtual void addParameter(const String& name, const GFXShaderConstType constType, const U32 offset, const U32 size, const U32 arraySize, const U32 alignValue);
|
||||
|
||||
/// Get the size of the buffer
|
||||
inline U32 getBufferSize() const { return mBufferSize; }
|
||||
|
|
@ -210,6 +210,9 @@ public:
|
|||
/// state at the same time.
|
||||
inline const U8* getDirtyBuffer( U32 *start, U32 *size );
|
||||
|
||||
/// Gets the entire buffer ignoring dirty range
|
||||
inline const U8* getEntireBuffer();
|
||||
|
||||
/// Sets the entire buffer as dirty or clears the dirty state.
|
||||
inline void setDirty( bool dirty );
|
||||
|
||||
|
|
@ -348,6 +351,13 @@ inline const U8* GenericConstBuffer::getDirtyBuffer( U32 *start, U32 *size )
|
|||
return buffer;
|
||||
}
|
||||
|
||||
inline const U8* GenericConstBuffer::getEntireBuffer()
|
||||
{
|
||||
AssertFatal(mBuffer, "GenericConstBuffer::getDirtyBuffer() - Buffer is empty!");
|
||||
|
||||
return mBuffer;
|
||||
}
|
||||
|
||||
inline bool GenericConstBuffer::isEqual( const GenericConstBuffer *buffer ) const
|
||||
{
|
||||
U32 bsize = mLayout->getBufferSize();
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ ImplementEnumType( GFXAdapterType,
|
|||
"Back-end graphics API used by the GFX subsystem.\n\n"
|
||||
"@ingroup GFX" )
|
||||
{ OpenGL, "OpenGL", "OpenGL." },
|
||||
{ Direct3D8, "D3D8", "Direct3D 8." },
|
||||
{ Direct3D11, "D3D11", "Direct3D 11." },
|
||||
{ Direct3D9, "D3D9", "Direct3D 9." },
|
||||
{ NullDevice, "NullDevice", "Null device for dedicated servers." },
|
||||
{ Direct3D9_360, "Xenon", "Direct3D 9 on Xbox 360." }
|
||||
|
|
|
|||
|
|
@ -514,6 +514,8 @@ void GFXDevice::updateStates(bool forceSetAll /*=false*/)
|
|||
mStateBlockDirty = false;
|
||||
}
|
||||
|
||||
_updateRenderTargets();
|
||||
|
||||
if( mTexturesDirty )
|
||||
{
|
||||
mTexturesDirty = false;
|
||||
|
|
|
|||
|
|
@ -458,7 +458,7 @@ void GFXDrawUtil::drawRect( const Point2F &upperLeft, const Point2F &lowerRight,
|
|||
Point2F nw(-0.5f,-0.5f); /* \ */
|
||||
Point2F ne(0.5f,-0.5f); /* / */
|
||||
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts (mDevice, 10, GFXBufferTypeVolatile );
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts (mDevice, 10, GFXBufferTypeVolatile );
|
||||
verts.lock();
|
||||
|
||||
F32 ulOffset = 0.5f - mDevice->getFillConventionOffset();
|
||||
|
|
@ -521,12 +521,12 @@ void GFXDrawUtil::drawRectFill( const Point2F &upperLeft, const Point2F &lowerRi
|
|||
Point2F nw(-0.5,-0.5); /* \ */
|
||||
Point2F ne(0.5,-0.5); /* / */
|
||||
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(mDevice, 4, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(mDevice, 4, GFXBufferTypeVolatile);
|
||||
verts.lock();
|
||||
|
||||
F32 ulOffset = 0.5f - mDevice->getFillConventionOffset();
|
||||
|
||||
verts[0].point.set( upperLeft.x + nw.x + ulOffset, upperLeft.y + nw.y + ulOffset, 0.0f);
|
||||
verts[0].point.set( upperLeft.x+nw.x + ulOffset, upperLeft.y+nw.y + ulOffset, 0.0f );
|
||||
verts[1].point.set( lowerRight.x + ne.x + ulOffset, upperLeft.y + ne.y + ulOffset, 0.0f);
|
||||
verts[2].point.set( upperLeft.x - ne.x + ulOffset, lowerRight.y - ne.y + ulOffset, 0.0f);
|
||||
verts[3].point.set( lowerRight.x - nw.x + ulOffset, lowerRight.y - nw.y + ulOffset, 0.0f);
|
||||
|
|
@ -548,7 +548,7 @@ void GFXDrawUtil::draw2DSquare( const Point2F &screenPoint, F32 width, F32 spinA
|
|||
|
||||
Point3F offset( screenPoint.x, screenPoint.y, 0.0 );
|
||||
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts( mDevice, 4, GFXBufferTypeVolatile );
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts( mDevice, 4, GFXBufferTypeVolatile );
|
||||
verts.lock();
|
||||
|
||||
verts[0].point.set( -width, -width, 0.0f );
|
||||
|
|
@ -608,7 +608,7 @@ void GFXDrawUtil::drawLine( F32 x1, F32 y1, F32 x2, F32 y2, const ColorI &color
|
|||
|
||||
void GFXDrawUtil::drawLine( F32 x1, F32 y1, F32 z1, F32 x2, F32 y2, F32 z2, const ColorI &color )
|
||||
{
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts( mDevice, 2, GFXBufferTypeVolatile );
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts( mDevice, 2, GFXBufferTypeVolatile );
|
||||
verts.lock();
|
||||
|
||||
verts[0].point.set( x1, y1, z1 );
|
||||
|
|
@ -647,7 +647,7 @@ void GFXDrawUtil::drawSphere( const GFXStateBlockDesc &desc, F32 radius, const P
|
|||
const SphereMesh::TriangleMesh * sphereMesh = gSphere.getMesh(2);
|
||||
S32 numPoly = sphereMesh->numPoly;
|
||||
S32 totalPoly = 0;
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(mDevice, numPoly*3, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(mDevice, numPoly*3, GFXBufferTypeVolatile);
|
||||
verts.lock();
|
||||
S32 vertexIndex = 0;
|
||||
for (S32 i=0; i<numPoly; i++)
|
||||
|
|
@ -712,7 +712,7 @@ void GFXDrawUtil::drawTriangle( const GFXStateBlockDesc &desc, const Point3F &p0
|
|||
|
||||
void GFXDrawUtil::_drawWireTriangle( const GFXStateBlockDesc &desc, const Point3F &p0, const Point3F &p1, const Point3F &p2, const ColorI &color, const MatrixF *xfm )
|
||||
{
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(mDevice, 4, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(mDevice, 4, GFXBufferTypeVolatile);
|
||||
verts.lock();
|
||||
|
||||
// Set up the line strip
|
||||
|
|
@ -745,7 +745,7 @@ void GFXDrawUtil::_drawWireTriangle( const GFXStateBlockDesc &desc, const Point3
|
|||
|
||||
void GFXDrawUtil::_drawSolidTriangle( const GFXStateBlockDesc &desc, const Point3F &p0, const Point3F &p1, const Point3F &p2, const ColorI &color, const MatrixF *xfm )
|
||||
{
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(mDevice, 3, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(mDevice, 3, GFXBufferTypeVolatile);
|
||||
verts.lock();
|
||||
|
||||
// Set up the line strip
|
||||
|
|
@ -778,7 +778,7 @@ void GFXDrawUtil::drawPolygon( const GFXStateBlockDesc& desc, const Point3F* poi
|
|||
{
|
||||
const bool isWireframe = ( desc.fillMode == GFXFillWireframe );
|
||||
const U32 numVerts = isWireframe ? numPoints + 1 : numPoints;
|
||||
GFXVertexBufferHandle< GFXVertexPC > verts( mDevice, numVerts, GFXBufferTypeVolatile );
|
||||
GFXVertexBufferHandle< GFXVertexPCT > verts( mDevice, numVerts, GFXBufferTypeVolatile );
|
||||
|
||||
verts.lock();
|
||||
for( U32 i = 0; i < numPoints; ++ i )
|
||||
|
|
@ -809,7 +809,7 @@ void GFXDrawUtil::drawPolygon( const GFXStateBlockDesc& desc, const Point3F* poi
|
|||
if( desc.fillMode == GFXFillWireframe )
|
||||
mDevice->drawPrimitive( GFXLineStrip, 0, numPoints );
|
||||
else
|
||||
mDevice->drawPrimitive( GFXTriangleFan, 0, numPoints - 2 );
|
||||
mDevice->drawPrimitive( GFXTriangleStrip, 0, numPoints - 2 );
|
||||
}
|
||||
|
||||
void GFXDrawUtil::drawCube( const GFXStateBlockDesc &desc, const Box3F &box, const ColorI &color, const MatrixF *xfm )
|
||||
|
|
@ -827,7 +827,7 @@ void GFXDrawUtil::drawCube( const GFXStateBlockDesc &desc, const Point3F &size,
|
|||
|
||||
void GFXDrawUtil::_drawWireCube( const GFXStateBlockDesc &desc, const Point3F &size, const Point3F &pos, const ColorI &color, const MatrixF *xfm )
|
||||
{
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(mDevice, 30, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(mDevice, 30, GFXBufferTypeVolatile);
|
||||
verts.lock();
|
||||
|
||||
Point3F halfSize = size * 0.5f;
|
||||
|
|
@ -870,7 +870,7 @@ void GFXDrawUtil::_drawWireCube( const GFXStateBlockDesc &desc, const Point3F &s
|
|||
|
||||
void GFXDrawUtil::_drawSolidCube( const GFXStateBlockDesc &desc, const Point3F &size, const Point3F &pos, const ColorI &color, const MatrixF *xfm )
|
||||
{
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(mDevice, 36, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(mDevice, 36, GFXBufferTypeVolatile);
|
||||
verts.lock();
|
||||
|
||||
Point3F halfSize = size * 0.5f;
|
||||
|
|
@ -950,7 +950,7 @@ void GFXDrawUtil::_drawWirePolyhedron( const GFXStateBlockDesc &desc, const AnyP
|
|||
|
||||
// Allocate a temporary vertex buffer.
|
||||
|
||||
GFXVertexBufferHandle< GFXVertexPC > verts( mDevice, numEdges * 2, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle< GFXVertexPCT > verts( mDevice, numEdges * 2, GFXBufferTypeVolatile);
|
||||
|
||||
// Fill it with the vertices for the edges.
|
||||
|
||||
|
|
@ -997,7 +997,7 @@ void GFXDrawUtil::_drawSolidPolyhedron( const GFXStateBlockDesc &desc, const Any
|
|||
// Create a temp buffer for the vertices and
|
||||
// put all the polyhedron's points in there.
|
||||
|
||||
GFXVertexBufferHandle< GFXVertexPC > verts( mDevice, numPoints, GFXBufferTypeVolatile );
|
||||
GFXVertexBufferHandle< GFXVertexPCT > verts( mDevice, numPoints, GFXBufferTypeVolatile );
|
||||
|
||||
verts.lock();
|
||||
for( U32 i = 0; i < numPoints; ++ i )
|
||||
|
|
@ -1071,7 +1071,7 @@ void GFXDrawUtil::_drawSolidPolyhedron( const GFXStateBlockDesc &desc, const Any
|
|||
for( U32 i = 0; i < numPolys; ++ i )
|
||||
{
|
||||
U32 numVerts = numIndicesForPoly[ i ];
|
||||
mDevice->drawIndexedPrimitive( GFXTriangleFan, 0, 0, numPoints, startIndex, numVerts - 2 );
|
||||
mDevice->drawIndexedPrimitive( GFXTriangleStrip, 0, 0, numPoints, startIndex, numVerts - 2 );
|
||||
startIndex += numVerts;
|
||||
}
|
||||
}
|
||||
|
|
@ -1119,7 +1119,7 @@ void GFXDrawUtil::drawObjectBox( const GFXStateBlockDesc &desc, const Point3F &s
|
|||
PrimBuild::end();
|
||||
}
|
||||
|
||||
static const Point2F circlePoints[] =
|
||||
static const Point2F circlePoints[] =
|
||||
{
|
||||
Point2F(0.707107f, 0.707107f),
|
||||
Point2F(0.923880f, 0.382683f),
|
||||
|
|
@ -1156,7 +1156,7 @@ void GFXDrawUtil::_drawSolidCapsule( const GFXStateBlockDesc &desc, const Point3
|
|||
mat = MatrixF::Identity;
|
||||
|
||||
S32 numPoints = sizeof(circlePoints)/sizeof(Point2F);
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(mDevice, numPoints * 2 + 2, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(mDevice, numPoints * 2 + 2, GFXBufferTypeVolatile);
|
||||
verts.lock();
|
||||
|
||||
for (S32 i=0; i<numPoints + 1; i++)
|
||||
|
|
@ -1222,7 +1222,7 @@ void GFXDrawUtil::_drawWireCapsule( const GFXStateBlockDesc &desc, const Point3F
|
|||
mDevice->multWorld(mat);
|
||||
|
||||
S32 numPoints = sizeof(circlePoints)/sizeof(Point2F);
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(mDevice, numPoints, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(mDevice, numPoints, GFXBufferTypeVolatile);
|
||||
verts.lock();
|
||||
for (S32 i=0; i< numPoints; i++)
|
||||
{
|
||||
|
|
@ -1268,27 +1268,57 @@ void GFXDrawUtil::drawCone( const GFXStateBlockDesc &desc, const Point3F &basePn
|
|||
mDevice->multWorld(mat);
|
||||
|
||||
S32 numPoints = sizeof(circlePoints)/sizeof(Point2F);
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(mDevice, numPoints + 2, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(mDevice, numPoints * 3 + 2, GFXBufferTypeVolatile);
|
||||
verts.lock();
|
||||
verts[0].point = Point3F(0.0f,0.0f,1.0f);
|
||||
verts[0].color = color;
|
||||
for (S32 i=0; i<numPoints + 1; i++)
|
||||
|
||||
F32 sign = -1.f;
|
||||
S32 indexDown = 0; //counting down from numPoints
|
||||
S32 indexUp = 0; //counting up from 0
|
||||
S32 index = 0; //circlePoints index for cap
|
||||
|
||||
for (S32 i = 0; i < numPoints + 1; i++)
|
||||
{
|
||||
//Top cap
|
||||
if (i != numPoints)
|
||||
{
|
||||
if (sign < 0)
|
||||
index = indexDown;
|
||||
else
|
||||
index = indexUp;
|
||||
|
||||
verts[i].point = Point3F(circlePoints[index].x, circlePoints[index].y, 0);
|
||||
verts[i].color = color;
|
||||
|
||||
if (sign < 0)
|
||||
indexUp += 1;
|
||||
else
|
||||
indexDown = numPoints - indexUp;
|
||||
|
||||
// invert sign
|
||||
sign *= -1.0f;
|
||||
}
|
||||
|
||||
//cone
|
||||
S32 imod = i % numPoints;
|
||||
verts[i + 1].point = Point3F(circlePoints[imod].x,circlePoints[imod].y, 0.0f);
|
||||
verts[i + 1].color = color;
|
||||
S32 vertindex = 2 * i + numPoints;
|
||||
verts[vertindex].point = Point3F(circlePoints[imod].x, circlePoints[imod].y, 0);
|
||||
verts[vertindex].color = color;
|
||||
verts[vertindex + 1].point = Point3F(0.0f, 0.0f, 1.0f);
|
||||
verts[vertindex + 1].color = color;
|
||||
}
|
||||
|
||||
verts.unlock();
|
||||
|
||||
mDevice->setStateBlockByDesc( desc );
|
||||
|
||||
mDevice->setVertexBuffer( verts );
|
||||
mDevice->setupGenericShaders( GFXDevice::GSModColorTexture );
|
||||
mDevice->setupGenericShaders();
|
||||
|
||||
mDevice->drawPrimitive( GFXTriangleFan, 0, numPoints );
|
||||
mDevice->drawPrimitive( GFXTriangleFan, 1, numPoints-1 );
|
||||
mDevice->drawPrimitive(GFXTriangleStrip, 0, numPoints - 2);
|
||||
mDevice->drawPrimitive(GFXTriangleStrip, numPoints, numPoints * 2);
|
||||
|
||||
mDevice->popWorldMatrix();
|
||||
|
||||
}
|
||||
|
||||
void GFXDrawUtil::drawCylinder( const GFXStateBlockDesc &desc, const Point3F &basePnt, const Point3F &tipPnt, F32 radius, const ColorI &color )
|
||||
|
|
@ -1307,32 +1337,59 @@ void GFXDrawUtil::drawCylinder( const GFXStateBlockDesc &desc, const Point3F &ba
|
|||
mDevice->pushWorldMatrix();
|
||||
mDevice->multWorld(mat);
|
||||
|
||||
S32 numPoints = sizeof(circlePoints)/sizeof(Point2F);
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(mDevice, numPoints * 4 + 4, GFXBufferTypeVolatile);
|
||||
S32 numPoints = sizeof(circlePoints) / sizeof(Point2F);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(mDevice, numPoints *4 + 2, GFXBufferTypeVolatile);
|
||||
verts.lock();
|
||||
for (S32 i=0; i<numPoints + 1; i++)
|
||||
{
|
||||
S32 imod = i % numPoints;
|
||||
verts[i].point = Point3F(circlePoints[imod].x,circlePoints[imod].y, 0.5f);
|
||||
verts[i].color = color;
|
||||
verts[i + numPoints + 1].point = Point3F(circlePoints[imod].x,circlePoints[imod].y, 0);
|
||||
verts[i + numPoints + 1].color = color;
|
||||
|
||||
verts[2*numPoints + 2 + 2 * i].point = Point3F(circlePoints[imod].x,circlePoints[imod].y, 0.5f);
|
||||
verts[2*numPoints + 2 + 2 * i].color = color;
|
||||
verts[2*numPoints + 2 + 2 * i + 1].point = Point3F(circlePoints[imod].x,circlePoints[imod].y, 0);
|
||||
verts[2*numPoints + 2 + 2 * i + 1].color = color;
|
||||
F32 sign = -1.f;
|
||||
S32 indexDown = 0; //counting down from numPoints
|
||||
S32 indexUp = 0; //counting up from 0
|
||||
S32 index = 0; //circlePoints index for caps
|
||||
|
||||
for (S32 i = 0; i < numPoints + 1; i++)
|
||||
{
|
||||
//Top/Bottom cap
|
||||
if (i != numPoints)
|
||||
{
|
||||
if (sign < 0)
|
||||
index = indexDown;
|
||||
else
|
||||
index = indexUp;
|
||||
|
||||
verts[i].point = Point3F(circlePoints[index].x, circlePoints[index].y, 0);
|
||||
verts[i].color = color;
|
||||
verts[i + numPoints].point = Point3F(circlePoints[index].x, circlePoints[index].y, 0.5f);
|
||||
verts[i + numPoints].color = color;
|
||||
|
||||
if (sign < 0)
|
||||
indexUp += 1;
|
||||
else
|
||||
indexDown = numPoints - indexUp;
|
||||
|
||||
// invert sign
|
||||
sign *= -1.0f;
|
||||
}
|
||||
|
||||
//cylinder
|
||||
S32 imod = i % numPoints;
|
||||
S32 vertindex = 2 * i + (numPoints * 2);
|
||||
verts[vertindex].point = Point3F(circlePoints[imod].x, circlePoints[imod].y, 0);
|
||||
verts[vertindex].color = color;
|
||||
verts[vertindex + 1].point = Point3F(circlePoints[imod].x, circlePoints[imod].y, 0.5f);
|
||||
verts[vertindex + 1].color = color;
|
||||
}
|
||||
|
||||
|
||||
verts.unlock();
|
||||
|
||||
mDevice->setStateBlockByDesc( desc );
|
||||
|
||||
mDevice->setVertexBuffer( verts );
|
||||
mDevice->setupGenericShaders( GFXDevice::GSModColorTexture );
|
||||
mDevice->setupGenericShaders();
|
||||
|
||||
mDevice->drawPrimitive( GFXTriangleFan, 0, numPoints );
|
||||
mDevice->drawPrimitive( GFXTriangleFan, numPoints + 1, numPoints );
|
||||
mDevice->drawPrimitive( GFXTriangleStrip, 2 * numPoints + 2, 2 * numPoints);
|
||||
mDevice->drawPrimitive( GFXTriangleStrip, 0, numPoints-2 );
|
||||
mDevice->drawPrimitive( GFXTriangleStrip, numPoints, numPoints - 2);
|
||||
mDevice->drawPrimitive( GFXTriangleStrip, numPoints*2, numPoints * 2);
|
||||
|
||||
mDevice->popWorldMatrix();
|
||||
}
|
||||
|
|
@ -1393,7 +1450,7 @@ void GFXDrawUtil::drawFrustum( const Frustum &f, const ColorI &color )
|
|||
|
||||
void GFXDrawUtil::drawSolidPlane( const GFXStateBlockDesc &desc, const Point3F &pos, const Point2F &size, const ColorI &color )
|
||||
{
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(mDevice, 4, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(mDevice, 4, GFXBufferTypeVolatile);
|
||||
verts.lock();
|
||||
|
||||
verts[0].point = pos + Point3F( -size.x / 2.0f, -size.y / 2.0f, 0 );
|
||||
|
|
@ -1412,7 +1469,7 @@ void GFXDrawUtil::drawSolidPlane( const GFXStateBlockDesc &desc, const Point3F &
|
|||
mDevice->setVertexBuffer( verts );
|
||||
mDevice->setupGenericShaders();
|
||||
|
||||
mDevice->drawPrimitive( GFXTriangleFan, 0, 2 );
|
||||
mDevice->drawPrimitive( GFXTriangleStrip, 0, 2 );
|
||||
}
|
||||
|
||||
void GFXDrawUtil::drawPlaneGrid( const GFXStateBlockDesc &desc, const Point3F &pos, const Point2F &size, const Point2F &step, const ColorI &color, Plane plane )
|
||||
|
|
@ -1449,7 +1506,7 @@ void GFXDrawUtil::drawPlaneGrid( const GFXStateBlockDesc &desc, const Point3F &p
|
|||
break;
|
||||
}
|
||||
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts( mDevice, numVertices, GFXBufferTypeVolatile );
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts( mDevice, numVertices, GFXBufferTypeVolatile );
|
||||
verts.lock();
|
||||
|
||||
U32 vertCount = 0;
|
||||
|
|
@ -1541,7 +1598,7 @@ void GFXDrawUtil::drawTransform( const GFXStateBlockDesc &desc, const MatrixF &m
|
|||
|
||||
GFX->multWorld( mat );
|
||||
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts( mDevice, 6, GFXBufferTypeVolatile );
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts( mDevice, 6, GFXBufferTypeVolatile );
|
||||
verts.lock();
|
||||
|
||||
const static ColorI defColors[3] =
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ enum GFXPrimitiveType
|
|||
GFXLineStrip,
|
||||
GFXTriangleList,
|
||||
GFXTriangleStrip,
|
||||
GFXTriangleFan,
|
||||
GFXPT_COUNT
|
||||
};
|
||||
|
||||
|
|
@ -277,8 +276,8 @@ enum GFXBlend
|
|||
enum GFXAdapterType
|
||||
{
|
||||
OpenGL = 0,
|
||||
Direct3D11,
|
||||
Direct3D9,
|
||||
Direct3D8,
|
||||
NullDevice,
|
||||
Direct3D9_360,
|
||||
GFXAdapterType_Count
|
||||
|
|
|
|||
|
|
@ -77,8 +77,8 @@ inline static void _GFXInitReportAdapters(Vector<GFXAdapter*> &adapters)
|
|||
case NullDevice:
|
||||
Con::printf(" Null device found");
|
||||
break;
|
||||
case Direct3D8:
|
||||
Con::printf(" Direct 3D (version 8.1) device found");
|
||||
case Direct3D11:
|
||||
Con::printf(" Direct 3D (version 11.x) device found");
|
||||
break;
|
||||
default :
|
||||
Con::printf(" Unknown device found");
|
||||
|
|
@ -221,7 +221,8 @@ GFXAdapter* GFXInit::chooseAdapter( GFXAdapterType type, const char* outputDevic
|
|||
|
||||
const char* GFXInit::getAdapterNameFromType(GFXAdapterType type)
|
||||
{
|
||||
static const char* _names[] = { "OpenGL", "D3D9", "D3D8", "NullDevice", "Xenon" };
|
||||
// must match GFXAdapterType order
|
||||
static const char* _names[] = { "OpenGL", "D3D11", "D3D9", "NullDevice", "Xenon" };
|
||||
|
||||
if( type < 0 || type >= GFXAdapterType_Count )
|
||||
{
|
||||
|
|
@ -268,51 +269,53 @@ GFXAdapter *GFXInit::getBestAdapterChoice()
|
|||
//
|
||||
// If D3D is unavailable, we're not on windows, so GL is de facto the
|
||||
// best choice!
|
||||
F32 highestSM9 = 0.f, highestSMGL = 0.f;
|
||||
GFXAdapter *foundAdapter8 = NULL, *foundAdapter9 = NULL,
|
||||
*foundAdapterGL = NULL;
|
||||
F32 highestSMDX = 0.f, highestSMGL = 0.f;
|
||||
GFXAdapter *foundAdapter9 = NULL, *foundAdapterGL = NULL, *foundAdapter11 = NULL;
|
||||
|
||||
for(S32 i=0; i<smAdapters.size(); i++)
|
||||
for (S32 i = 0; i<smAdapters.size(); i++)
|
||||
{
|
||||
GFXAdapter *currAdapter = smAdapters[i];
|
||||
switch(currAdapter->mType)
|
||||
switch (currAdapter->mType)
|
||||
{
|
||||
case Direct3D9:
|
||||
if(currAdapter->mShaderModel > highestSM9)
|
||||
case Direct3D11:
|
||||
if (currAdapter->mShaderModel > highestSMDX)
|
||||
{
|
||||
highestSM9 = currAdapter->mShaderModel;
|
||||
highestSMDX = currAdapter->mShaderModel;
|
||||
foundAdapter11 = currAdapter;
|
||||
}
|
||||
break;
|
||||
|
||||
case Direct3D9:
|
||||
if (currAdapter->mShaderModel > highestSMDX)
|
||||
{
|
||||
highestSMDX = currAdapter->mShaderModel;
|
||||
foundAdapter9 = currAdapter;
|
||||
}
|
||||
break;
|
||||
|
||||
case OpenGL:
|
||||
if(currAdapter->mShaderModel > highestSMGL)
|
||||
if (currAdapter->mShaderModel > highestSMGL)
|
||||
{
|
||||
highestSMGL = currAdapter->mShaderModel;
|
||||
foundAdapterGL = currAdapter;
|
||||
}
|
||||
break;
|
||||
|
||||
case Direct3D8:
|
||||
if(!foundAdapter8)
|
||||
foundAdapter8 = currAdapter;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Return best found in order DX9, GL, DX8.
|
||||
if(foundAdapter9)
|
||||
// Return best found in order DX11,DX9, GL
|
||||
if (foundAdapter11)
|
||||
return foundAdapter11;
|
||||
|
||||
if (foundAdapter9)
|
||||
return foundAdapter9;
|
||||
|
||||
if(foundAdapterGL)
|
||||
if (foundAdapterGL)
|
||||
return foundAdapterGL;
|
||||
|
||||
if(foundAdapter8)
|
||||
return foundAdapter8;
|
||||
|
||||
// Uh oh - we didn't find anything. Grab whatever we can that's not Null...
|
||||
for(S32 i=0; i<smAdapters.size(); i++)
|
||||
if(smAdapters[i]->mType != NullDevice)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ bool GFXShader::smLogWarnings = true;
|
|||
|
||||
GFXShader::GFXShader()
|
||||
: mPixVersion( 0.0f ),
|
||||
mReloadKey( 0 )
|
||||
mReloadKey( 0 ),
|
||||
mInstancingFormat( NULL )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -43,6 +44,8 @@ GFXShader::~GFXShader()
|
|||
{
|
||||
Torque::FS::RemoveChangeNotification( mVertexFile, this, &GFXShader::_onFileChanged );
|
||||
Torque::FS::RemoveChangeNotification( mPixelFile, this, &GFXShader::_onFileChanged );
|
||||
|
||||
SAFE_DELETE(mInstancingFormat);
|
||||
}
|
||||
|
||||
#ifndef TORQUE_OPENGL
|
||||
|
|
@ -60,8 +63,16 @@ bool GFXShader::init( const Torque::Path &vertFile,
|
|||
const Torque::Path &pixFile,
|
||||
F32 pixVersion,
|
||||
const Vector<GFXShaderMacro> ¯os,
|
||||
const Vector<String> &samplerNames)
|
||||
const Vector<String> &samplerNames,
|
||||
GFXVertexFormat *instanceFormat)
|
||||
{
|
||||
// Take care of instancing
|
||||
if (instanceFormat)
|
||||
{
|
||||
mInstancingFormat = new GFXVertexFormat;
|
||||
mInstancingFormat->copy(*instanceFormat);
|
||||
}
|
||||
|
||||
// Store the inputs for use in reloading.
|
||||
mVertexFile = vertFile;
|
||||
mPixelFile = pixFile;
|
||||
|
|
|
|||
|
|
@ -262,13 +262,12 @@ protected:
|
|||
/// their destructor.
|
||||
Vector<GFXShaderConstBuffer*> mActiveBuffers;
|
||||
|
||||
GFXVertexFormat *mInstancingFormat;
|
||||
|
||||
/// A protected constructor so it cannot be instantiated.
|
||||
GFXShader();
|
||||
|
||||
public:
|
||||
|
||||
// TODO: Add this into init().
|
||||
GFXVertexFormat mInstancingFormat;
|
||||
public:
|
||||
|
||||
/// Adds a global shader macro which will be merged with
|
||||
/// the script defined macros on every shader reload.
|
||||
|
|
@ -312,7 +311,8 @@ public:
|
|||
const Torque::Path &pixFile,
|
||||
F32 pixVersion,
|
||||
const Vector<GFXShaderMacro> ¯os,
|
||||
const Vector<String> &samplerNames);
|
||||
const Vector<String> &samplerNames,
|
||||
GFXVertexFormat *instanceFormat = NULL );
|
||||
|
||||
/// Reloads the shader from disk.
|
||||
bool reload();
|
||||
|
|
@ -358,6 +358,9 @@ public:
|
|||
// GFXResource
|
||||
const String describeSelf() const { return mDescription; }
|
||||
|
||||
// Get instancing vertex format
|
||||
GFXVertexFormat *getInstancingFormat() { return mInstancingFormat; }
|
||||
|
||||
protected:
|
||||
|
||||
/// Called when the shader files change on disk.
|
||||
|
|
|
|||
|
|
@ -347,7 +347,6 @@ void GFXStringEnumTranslate::init()
|
|||
GFX_STRING_ASSIGN_MACRO( GFXStringPrimType, GFXLineStrip );
|
||||
GFX_STRING_ASSIGN_MACRO( GFXStringPrimType, GFXTriangleList );
|
||||
GFX_STRING_ASSIGN_MACRO( GFXStringPrimType, GFXTriangleStrip );
|
||||
GFX_STRING_ASSIGN_MACRO( GFXStringPrimType, GFXTriangleFan );
|
||||
VALIDATE_LOOKUPTABLE( GFXStringPrimType, GFXPT );
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ GFXVertexFormat::GFXVertexFormat()
|
|||
mHasColor( false ),
|
||||
mHasNormal( false ),
|
||||
mHasTangent( false ),
|
||||
mHasInstancing( false ),
|
||||
mTexCoordCount( 0 ),
|
||||
mSizeInBytes( 0 ),
|
||||
mDecl( NULL )
|
||||
|
|
@ -83,6 +84,7 @@ void GFXVertexFormat::copy( const GFXVertexFormat &format )
|
|||
mHasNormal = format.mHasNormal;
|
||||
mHasTangent = format.mHasTangent;
|
||||
mHasColor = format.mHasColor;
|
||||
mHasInstancing = format.mHasInstancing;
|
||||
mTexCoordCount = format.mTexCoordCount;
|
||||
mSizeInBytes = format.mSizeInBytes;
|
||||
mDescription = format.mDescription;
|
||||
|
|
@ -161,6 +163,14 @@ bool GFXVertexFormat::hasColor() const
|
|||
return mHasColor;
|
||||
}
|
||||
|
||||
bool GFXVertexFormat::hasInstancing() const
|
||||
{
|
||||
if (mDirty)
|
||||
const_cast<GFXVertexFormat*>(this)->_updateDirty();
|
||||
|
||||
return mHasInstancing;
|
||||
}
|
||||
|
||||
U32 GFXVertexFormat::getTexCoordCount() const
|
||||
{
|
||||
if ( mDirty )
|
||||
|
|
@ -177,6 +187,11 @@ U32 GFXVertexFormat::getSizeInBytes() const
|
|||
return mSizeInBytes;
|
||||
}
|
||||
|
||||
void GFXVertexFormat::enableInstancing()
|
||||
{
|
||||
mHasInstancing = true;
|
||||
}
|
||||
|
||||
void GFXVertexFormat::_updateDirty()
|
||||
{
|
||||
PROFILE_SCOPE( GFXVertexFormat_updateDirty );
|
||||
|
|
|
|||
|
|
@ -153,6 +153,9 @@ public:
|
|||
/// The copy constructor.
|
||||
GFXVertexFormat( const GFXVertexFormat &format ) { copy( format ); }
|
||||
|
||||
/// Tell this format it has instancing
|
||||
void enableInstancing();
|
||||
|
||||
/// Copy the other vertex format.
|
||||
void copy( const GFXVertexFormat &format );
|
||||
|
||||
|
|
@ -163,7 +166,7 @@ public:
|
|||
const String& getDescription() const;
|
||||
|
||||
/// Clears all the vertex elements.
|
||||
void clear();
|
||||
void clear();
|
||||
|
||||
/// Adds a vertex element to the format.
|
||||
///
|
||||
|
|
@ -182,6 +185,9 @@ public:
|
|||
/// Returns true if there is a COLOR semantic in this vertex format.
|
||||
bool hasColor() const;
|
||||
|
||||
/// Return true if instancing is used with this vertex format.
|
||||
bool hasInstancing() const;
|
||||
|
||||
/// Returns the texture coordinate count by
|
||||
/// counting the number of TEXCOORD semantics.
|
||||
U32 getTexCoordCount() const;
|
||||
|
|
@ -225,6 +231,9 @@ protected:
|
|||
/// Is true if there is a COLOR semantic in this vertex format.
|
||||
bool mHasColor;
|
||||
|
||||
/// Is instaning used with this vertex format.
|
||||
bool mHasInstancing;
|
||||
|
||||
/// The texture coordinate count by counting the
|
||||
/// number of "TEXCOORD" semantics.
|
||||
U32 mTexCoordCount;
|
||||
|
|
|
|||
|
|
@ -513,9 +513,6 @@ inline GLsizei GFXGLDevice::primCountToIndexCount(GFXPrimitiveType primType, U32
|
|||
case GFXTriangleStrip :
|
||||
return 2 + primitiveCount;
|
||||
break;
|
||||
case GFXTriangleFan :
|
||||
return 2 + primitiveCount;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(false, "GFXGLDevice::primCountToIndexCount - unrecognized prim type");
|
||||
break;
|
||||
|
|
@ -789,7 +786,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
|
|||
shaderData->registerObject();
|
||||
mGenericShader[GSColor] = shaderData->getShader();
|
||||
mGenericShaderBuffer[GSColor] = mGenericShader[GSColor]->allocConstBuffer();
|
||||
mModelViewProjSC[GSColor] = mGenericShader[GSColor]->getShaderConstHandle( "$modelView" );
|
||||
mModelViewProjSC[GSColor] = mGenericShader[GSColor]->getShaderConstHandle( "$modelView" );
|
||||
Sim::getRootGroup()->addObject(shaderData);
|
||||
|
||||
shaderData = new ShaderData();
|
||||
shaderData->setField("OGLVertexShaderFile", "shaders/common/fixedFunction/gl/modColorTextureV.glsl");
|
||||
|
|
@ -799,7 +797,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
|
|||
shaderData->registerObject();
|
||||
mGenericShader[GSModColorTexture] = shaderData->getShader();
|
||||
mGenericShaderBuffer[GSModColorTexture] = mGenericShader[GSModColorTexture]->allocConstBuffer();
|
||||
mModelViewProjSC[GSModColorTexture] = mGenericShader[GSModColorTexture]->getShaderConstHandle( "$modelView" );
|
||||
mModelViewProjSC[GSModColorTexture] = mGenericShader[GSModColorTexture]->getShaderConstHandle( "$modelView" );
|
||||
Sim::getRootGroup()->addObject(shaderData);
|
||||
|
||||
shaderData = new ShaderData();
|
||||
shaderData->setField("OGLVertexShaderFile", "shaders/common/fixedFunction/gl/addColorTextureV.glsl");
|
||||
|
|
@ -809,7 +808,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
|
|||
shaderData->registerObject();
|
||||
mGenericShader[GSAddColorTexture] = shaderData->getShader();
|
||||
mGenericShaderBuffer[GSAddColorTexture] = mGenericShader[GSAddColorTexture]->allocConstBuffer();
|
||||
mModelViewProjSC[GSAddColorTexture] = mGenericShader[GSAddColorTexture]->getShaderConstHandle( "$modelView" );
|
||||
mModelViewProjSC[GSAddColorTexture] = mGenericShader[GSAddColorTexture]->getShaderConstHandle( "$modelView" );
|
||||
Sim::getRootGroup()->addObject(shaderData);
|
||||
|
||||
shaderData = new ShaderData();
|
||||
shaderData->setField("OGLVertexShaderFile", "shaders/common/fixedFunction/gl/textureV.glsl");
|
||||
|
|
@ -820,6 +820,7 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
|
|||
mGenericShader[GSTexture] = shaderData->getShader();
|
||||
mGenericShaderBuffer[GSTexture] = mGenericShader[GSTexture]->allocConstBuffer();
|
||||
mModelViewProjSC[GSTexture] = mGenericShader[GSTexture]->getShaderConstHandle( "$modelView" );
|
||||
Sim::getRootGroup()->addObject(shaderData);
|
||||
}
|
||||
|
||||
MatrixF tempMatrix = mProjectionMatrix * mViewMatrix * mWorldMatrix[mWorldStackSize];
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ void GFXGLEnumTranslate::init()
|
|||
GFXGLPrimType[GFXLineStrip] = GL_LINE_STRIP;
|
||||
GFXGLPrimType[GFXTriangleList] = GL_TRIANGLES;
|
||||
GFXGLPrimType[GFXTriangleStrip] = GL_TRIANGLE_STRIP;
|
||||
GFXGLPrimType[GFXTriangleFan] = GL_TRIANGLE_FAN;
|
||||
|
||||
// Blend
|
||||
GFXGLBlend[GFXBlendZero] = GL_ZERO;
|
||||
|
|
|
|||
|
|
@ -664,10 +664,14 @@ void GFXGLShader::initHandles()
|
|||
glUseProgram(0);
|
||||
|
||||
//instancing
|
||||
if (!mInstancingFormat)
|
||||
return;
|
||||
|
||||
U32 offset = 0;
|
||||
for ( U32 i=0; i < mInstancingFormat.getElementCount(); i++ )
|
||||
|
||||
for ( U32 i=0; i < mInstancingFormat->getElementCount(); i++ )
|
||||
{
|
||||
const GFXVertexElement &element = mInstancingFormat.getElement( i );
|
||||
const GFXVertexElement &element = mInstancingFormat->getElement( i );
|
||||
|
||||
String constName = String::ToString( "$%s", element.getSemantic().c_str() );
|
||||
|
||||
|
|
@ -702,9 +706,9 @@ void GFXGLShader::initHandles()
|
|||
|
||||
// If this is a matrix we will have 2 or 3 more of these
|
||||
// semantics with the same name after it.
|
||||
for ( ; i < mInstancingFormat.getElementCount(); i++ )
|
||||
for ( ; i < mInstancingFormat->getElementCount(); i++ )
|
||||
{
|
||||
const GFXVertexElement &nextElement = mInstancingFormat.getElement( i );
|
||||
const GFXVertexElement &nextElement = mInstancingFormat->getElement( i );
|
||||
if ( nextElement.getSemantic() != element.getSemantic() )
|
||||
{
|
||||
i--;
|
||||
|
|
|
|||
|
|
@ -117,7 +117,6 @@ GFXVertexBuffer * endToBuffer( U32 &numPrims )
|
|||
}
|
||||
|
||||
case GFXTriangleStrip:
|
||||
case GFXTriangleFan:
|
||||
{
|
||||
numPrims = mCurVertIndex - 2;
|
||||
break;
|
||||
|
|
@ -171,7 +170,6 @@ void end( bool useGenericShaders )
|
|||
}
|
||||
|
||||
case GFXTriangleStrip:
|
||||
case GFXTriangleFan:
|
||||
{
|
||||
stripStart = 2;
|
||||
vertStride = 1;
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ namespace
|
|||
start -= lineVec;
|
||||
end += lineVec;
|
||||
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(GFX, 4, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(GFX, 4, GFXBufferTypeVolatile);
|
||||
verts.lock();
|
||||
|
||||
verts[0].point.set( start.x+perp.x, start.y+perp.y, z1 );
|
||||
|
|
|
|||
|
|
@ -319,81 +319,79 @@ void GuiGradientCtrl::renderColorBox(RectI &bounds)
|
|||
void GuiGradientCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, Vector<ColorRange> colorRange)
|
||||
{
|
||||
GFX->setStateBlock(mStateBlock);
|
||||
|
||||
// Create new global dimensions
|
||||
|
||||
// Create new global dimensions
|
||||
S32 l = bounds.point.x + mSwatchFactor, r = bounds.point.x + bounds.extent.x - mSwatchFactor;
|
||||
S32 t = bounds.point.y, b = bounds.point.y + bounds.extent.y - mSwatchFactor;
|
||||
|
||||
// Draw border using new global dimensions
|
||||
if (mProfile->mBorder)
|
||||
GFX->getDrawUtil()->drawRect( RectI( Point2I(l,t),Point2I(r,b) ), mProfile->mBorderColor);
|
||||
|
||||
// Update local dimensions
|
||||
mBlendRangeBox.point = globalToLocalCoord(Point2I(l, t));
|
||||
mBlendRangeBox.extent = globalToLocalCoord(Point2I(r, b));
|
||||
|
||||
ColorRange& firstColorRange = colorRange.first();
|
||||
|
||||
if(colorRange.size() == 1) // Only one color to draw
|
||||
{
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
// Draw border using new global dimensions
|
||||
if (mProfile->mBorder)
|
||||
GFX->getDrawUtil()->drawRect(RectI(Point2I(l, t), Point2I(r, b)), mProfile->mBorderColor);
|
||||
|
||||
PrimBuild::color(firstColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i( l, t );
|
||||
PrimBuild::vertex2i( l, b );
|
||||
// Update local dimensions
|
||||
mBlendRangeBox.point = globalToLocalCoord(Point2I(l, t));
|
||||
mBlendRangeBox.extent = globalToLocalCoord(Point2I(r, b));
|
||||
|
||||
PrimBuild::color(firstColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i( r, b );
|
||||
PrimBuild::vertex2i( r, t );
|
||||
if (colorRange.size() == 1) // Only one color to draw
|
||||
{
|
||||
PrimBuild::begin(GFXTriangleStrip, 4);
|
||||
|
||||
PrimBuild::end();
|
||||
}
|
||||
else
|
||||
{
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
PrimBuild::color(colorRange.first().swatch->getColor());
|
||||
PrimBuild::vertex2i(l, t);
|
||||
PrimBuild::vertex2i(r, t);
|
||||
|
||||
PrimBuild::color(firstColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i( l, t );
|
||||
PrimBuild::vertex2i( l, b );
|
||||
PrimBuild::color(colorRange.first().swatch->getColor());
|
||||
PrimBuild::vertex2i(l, b);
|
||||
PrimBuild::vertex2i(r, b);
|
||||
|
||||
PrimBuild::color(firstColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i(l + firstColorRange.swatch->getPosition().x, b);
|
||||
PrimBuild::vertex2i(l + firstColorRange.swatch->getPosition().x, t);
|
||||
PrimBuild::end();
|
||||
}
|
||||
else
|
||||
{
|
||||
PrimBuild::begin(GFXTriangleStrip, 4);
|
||||
|
||||
PrimBuild::end();
|
||||
PrimBuild::color(colorRange.first().swatch->getColor());
|
||||
PrimBuild::vertex2i(l, t);
|
||||
PrimBuild::vertex2i(l + colorRange.first().swatch->getPosition().x, t);
|
||||
|
||||
for( U16 i = 0;i < colorRange.size() - 1; i++ )
|
||||
{
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
if (!vertical) // Horizontal (+x)
|
||||
{
|
||||
// First color
|
||||
PrimBuild::color( colorRange[i].swatch->getColor() );
|
||||
PrimBuild::vertex2i( l + colorRange[i].swatch->getPosition().x, t );
|
||||
PrimBuild::vertex2i( l + colorRange[i].swatch->getPosition().x, b );
|
||||
|
||||
// First color
|
||||
PrimBuild::color( colorRange[i+1].swatch->getColor() );
|
||||
PrimBuild::vertex2i( l + colorRange[i+1].swatch->getPosition().x, b );
|
||||
PrimBuild::vertex2i( l + colorRange[i+1].swatch->getPosition().x, t );
|
||||
}
|
||||
PrimBuild::end();
|
||||
}
|
||||
PrimBuild::color(colorRange.first().swatch->getColor());
|
||||
PrimBuild::vertex2i(l, b);
|
||||
PrimBuild::vertex2i(l + colorRange.first().swatch->getPosition().x, b);
|
||||
|
||||
ColorRange& lastColorRange = colorRange.last();
|
||||
PrimBuild::end();
|
||||
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
for (U16 i = 0; i < colorRange.size() - 1; i++)
|
||||
{
|
||||
PrimBuild::begin(GFXTriangleStrip, 4);
|
||||
if (!vertical) // Horizontal (+x)
|
||||
{
|
||||
// First color
|
||||
PrimBuild::color(colorRange[i].swatch->getColor());
|
||||
PrimBuild::vertex2i(l + colorRange[i].swatch->getPosition().x, t);
|
||||
PrimBuild::color(colorRange[i + 1].swatch->getColor());
|
||||
PrimBuild::vertex2i(l + colorRange[i + 1].swatch->getPosition().x, t);
|
||||
|
||||
PrimBuild::color(lastColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i(l + lastColorRange.swatch->getPosition().x, t);
|
||||
PrimBuild::vertex2i(l + lastColorRange.swatch->getPosition().x, b);
|
||||
|
||||
PrimBuild::color(lastColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i( r, b );
|
||||
PrimBuild::vertex2i( r, t );
|
||||
// First color
|
||||
PrimBuild::color(colorRange[i].swatch->getColor());
|
||||
PrimBuild::vertex2i(l + colorRange[i].swatch->getPosition().x, b);
|
||||
PrimBuild::color(colorRange[i + 1].swatch->getColor());
|
||||
PrimBuild::vertex2i(l + colorRange[i + 1].swatch->getPosition().x, b);
|
||||
}
|
||||
PrimBuild::end();
|
||||
}
|
||||
|
||||
PrimBuild::end();
|
||||
}
|
||||
PrimBuild::begin(GFXTriangleStrip, 4);
|
||||
|
||||
PrimBuild::color(colorRange.last().swatch->getColor());
|
||||
PrimBuild::vertex2i(l + colorRange.last().swatch->getPosition().x, t);
|
||||
PrimBuild::vertex2i(r, t);
|
||||
|
||||
PrimBuild::color(colorRange.last().swatch->getColor());
|
||||
PrimBuild::vertex2i(l + colorRange.last().swatch->getPosition().x, b);
|
||||
PrimBuild::vertex2i(r, b);
|
||||
|
||||
PrimBuild::end();
|
||||
}
|
||||
}
|
||||
|
||||
void GuiGradientCtrl::onMouseDown(const GuiEvent &event)
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ void GuiTextEditSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
Point2I(start.x+14,midPoint.y),
|
||||
mProfile->mFontColor);
|
||||
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(GFX, 6, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(GFX, 6, GFXBufferTypeVolatile);
|
||||
verts.lock();
|
||||
|
||||
verts[0].color.set( 0, 0, 0 );
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ class GuiEditCtrl : public GuiControl
|
|||
SimSet* mSelectedSet;
|
||||
|
||||
// grid drawing
|
||||
GFXVertexBufferHandle<GFXVertexPC> mDots;
|
||||
GFXVertexBufferHandle<GFXVertexPCT> mDots;
|
||||
GFXStateBlockRef mDotSB;
|
||||
|
||||
mouseModes mMouseDownMode;
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ void GuiFilterCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
}
|
||||
|
||||
// draw the curv
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(GFX, ext.x, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(GFX, ext.x, GFXBufferTypeVolatile);
|
||||
|
||||
verts.lock();
|
||||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
for( S32 sample = 0; sample < numSamples; ++ sample )
|
||||
{
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
PrimBuild::begin( GFXTriangleStrip, 4 );
|
||||
PrimBuild::color( mGraphColor[ k ] );
|
||||
|
||||
F32 offset = F32( getExtent().x ) / F32( MaxDataPoints ) * F32( sample + 1 );
|
||||
|
|
|
|||
|
|
@ -1315,7 +1315,7 @@ DefineEngineMethod( EditTSCtrl, renderCircle, void, ( Point3F pos, Point3F norma
|
|||
{
|
||||
PrimBuild::color( object->mConsoleFillColor );
|
||||
|
||||
PrimBuild::begin( GFXTriangleFan, points.size() + 2 );
|
||||
PrimBuild::begin( GFXTriangleStrip, points.size() + 2 );
|
||||
|
||||
// Center point
|
||||
PrimBuild::vertex3fv( pos );
|
||||
|
|
|
|||
|
|
@ -1403,7 +1403,7 @@ void Gizmo::renderGizmo(const MatrixF &cameraTransform, F32 cameraFOV )
|
|||
|
||||
for(U32 j = 0; j < 6; j++)
|
||||
{
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
PrimBuild::begin( GFXTriangleStrip, 4 );
|
||||
|
||||
PrimBuild::vertex3fv( sgCenterBoxPnts[sgBoxVerts[j][0]] * tipScale);
|
||||
PrimBuild::vertex3fv( sgCenterBoxPnts[sgBoxVerts[j][1]] * tipScale);
|
||||
|
|
@ -1599,7 +1599,7 @@ void Gizmo::_renderAxisBoxes()
|
|||
|
||||
for(U32 j = 0; j < 6; j++)
|
||||
{
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
PrimBuild::begin( GFXTriangleStrip, 4 );
|
||||
|
||||
PrimBuild::vertex3fv( sgCenterBoxPnts[sgBoxVerts[j][0]] * tipScale + sgAxisVectors[axisIdx] * pos );
|
||||
PrimBuild::vertex3fv( sgCenterBoxPnts[sgBoxVerts[j][1]] * tipScale + sgAxisVectors[axisIdx] * pos );
|
||||
|
|
@ -1663,7 +1663,7 @@ void Gizmo::_renderAxisCircles()
|
|||
ColorI color = mProfile->inActiveColor;
|
||||
color.alpha = 100;
|
||||
PrimBuild::color( color );
|
||||
PrimBuild::begin( GFXTriangleFan, segments+2 );
|
||||
PrimBuild::begin( GFXTriangleStrip, segments+2 );
|
||||
|
||||
PrimBuild::vertex3fv( Point3F(0,0,0) );
|
||||
|
||||
|
|
|
|||
|
|
@ -265,18 +265,18 @@ void GuiTerrPreviewCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
// the texture if flipped horz to reflect how the terrain is really drawn
|
||||
PrimBuild::color3f(1.0f, 1.0f, 1.0f);
|
||||
PrimBuild::begin(GFXTriangleFan, 4);
|
||||
PrimBuild::texCoord2f(textureP1.x, textureP2.y);
|
||||
PrimBuild::vertex2f(screenP1.x, screenP2.y); // left bottom
|
||||
PrimBuild::begin(GFXTriangleStrip, 4);
|
||||
PrimBuild::texCoord2f(textureP1.x, textureP1.y);
|
||||
PrimBuild::vertex2f(screenP1.x, screenP1.y); // left top
|
||||
|
||||
|
||||
PrimBuild::texCoord2f(textureP2.x, textureP2.y);
|
||||
PrimBuild::vertex2f(screenP2.x, screenP2.y); // right bottom
|
||||
PrimBuild::texCoord2f(textureP2.x, textureP1.y);
|
||||
PrimBuild::vertex2f(screenP2.x, screenP1.y); // right top
|
||||
PrimBuild::texCoord2f(textureP2.x, textureP1.y);
|
||||
PrimBuild::vertex2f(screenP2.x, screenP1.y); // right top
|
||||
|
||||
PrimBuild::texCoord2f(textureP1.x, textureP1.y);
|
||||
PrimBuild::vertex2f(screenP1.x, screenP1.y); // left top
|
||||
PrimBuild::texCoord2f(textureP1.x, textureP2.y);
|
||||
PrimBuild::vertex2f(screenP1.x, screenP2.y); // left bottom
|
||||
|
||||
PrimBuild::texCoord2f(textureP2.x, textureP2.y);
|
||||
PrimBuild::vertex2f(screenP2.x, screenP2.y); // right bottom
|
||||
PrimBuild::end();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -658,7 +658,7 @@ void SelectionBrush::rebuild()
|
|||
//... move the selection
|
||||
}
|
||||
|
||||
void SelectionBrush::render(Vector<GFXVertexPC> & vertexBuffer, S32 & verts, S32 & elems, S32 & prims, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone) const
|
||||
void SelectionBrush::render(Vector<GFXVertexPCT> & vertexBuffer, S32 & verts, S32 & elems, S32 & prims, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone) const
|
||||
{
|
||||
//... render the selection
|
||||
}
|
||||
|
|
@ -1342,8 +1342,8 @@ void TerrainEditor::renderPoints( const Vector<GFXVertexPCT> &pointList )
|
|||
U32 vertsThisDrawCall = getMin( (U32)vertsLeft, (U32)MAX_DYNAMIC_VERTS );
|
||||
vertsLeft -= vertsThisDrawCall;
|
||||
|
||||
GFXVertexBufferHandle<GFXVertexPC> vbuff( GFX, vertsThisDrawCall, GFXBufferTypeVolatile );
|
||||
GFXVertexPC *vert = vbuff.lock();
|
||||
GFXVertexBufferHandle<GFXVertexPCT> vbuff( GFX, vertsThisDrawCall, GFXBufferTypeVolatile );
|
||||
GFXVertexPCT *vert = vbuff.lock();
|
||||
|
||||
const U32 loops = vertsThisDrawCall / 6;
|
||||
|
||||
|
|
@ -1394,7 +1394,7 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
|
|||
if(sel.size() == 0)
|
||||
return;
|
||||
|
||||
Vector<GFXVertexPC> vertexBuffer;
|
||||
Vector<GFXVertexPCT> vertexBuffer;
|
||||
ColorF color;
|
||||
ColorI iColor;
|
||||
|
||||
|
|
@ -1430,15 +1430,15 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
|
|||
//
|
||||
iColor = color;
|
||||
|
||||
GFXVertexPC *verts = &(vertexBuffer[i * 5]);
|
||||
GFXVertexPCT *verts = &(vertexBuffer[i * 5]);
|
||||
|
||||
verts[0].point = wPos + Point3F(-squareSize, -squareSize, 0);
|
||||
verts[0].point = wPos + Point3F(-squareSize, squareSize, 0);
|
||||
verts[0].color = iColor;
|
||||
verts[1].point = wPos + Point3F( squareSize, -squareSize, 0);
|
||||
verts[1].point = wPos + Point3F( squareSize, squareSize, 0);
|
||||
verts[1].color = iColor;
|
||||
verts[2].point = wPos + Point3F( squareSize, squareSize, 0);
|
||||
verts[2].point = wPos + Point3F( -squareSize, -squareSize, 0);
|
||||
verts[2].color = iColor;
|
||||
verts[3].point = wPos + Point3F(-squareSize, squareSize, 0);
|
||||
verts[3].point = wPos + Point3F( squareSize, -squareSize, 0);
|
||||
verts[3].color = iColor;
|
||||
verts[4].point = verts[0].point;
|
||||
verts[4].color = iColor;
|
||||
|
|
@ -1452,7 +1452,7 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
|
|||
GridPoint selectedGridPoint = sel[i].mGridPoint;
|
||||
Point2I gPos = selectedGridPoint.gridPos;
|
||||
|
||||
GFXVertexPC *verts = &(vertexBuffer[i * 5]);
|
||||
GFXVertexPCT *verts = &(vertexBuffer[i * 5]);
|
||||
|
||||
bool center = gridToWorld(selectedGridPoint, verts[0].point);
|
||||
gridToWorld(Point2I(gPos.x + 1, gPos.y), verts[1].point, selectedGridPoint.terrainBlock);
|
||||
|
|
@ -1503,12 +1503,12 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
|
|||
|
||||
// Render this bad boy, by stuffing everything into a volatile buffer
|
||||
// and rendering...
|
||||
GFXVertexBufferHandle<GFXVertexPC> selectionVB(GFX, vertexBuffer.size(), GFXBufferTypeStatic);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> selectionVB(GFX, vertexBuffer.size(), GFXBufferTypeStatic);
|
||||
|
||||
selectionVB.lock(0, vertexBuffer.size());
|
||||
|
||||
// Copy stuff
|
||||
dMemcpy((void*)&selectionVB[0], (void*)&vertexBuffer[0], sizeof(GFXVertexPC) * vertexBuffer.size());
|
||||
dMemcpy((void*)&selectionVB[0], (void*)&vertexBuffer[0], sizeof(GFXVertexPCT) * vertexBuffer.size());
|
||||
|
||||
selectionVB.unlock();
|
||||
|
||||
|
|
@ -1518,7 +1518,7 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
|
|||
|
||||
if(renderFill)
|
||||
for(U32 i=0; i < sel.size(); i++)
|
||||
GFX->drawPrimitive( GFXTriangleFan, i*5, 4);
|
||||
GFX->drawPrimitive( GFXTriangleStrip, i*5, 4);
|
||||
|
||||
if(renderFrame)
|
||||
for(U32 i=0; i < sel.size(); i++)
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ public:
|
|||
|
||||
const char *getType() const { return "selection"; }
|
||||
void rebuild();
|
||||
void render(Vector<GFXVertexPC> & vertexBuffer, S32 & verts, S32 & elems, S32 & prims, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone) const;
|
||||
void render(Vector<GFXVertexPCT> & vertexBuffer, S32 & verts, S32 & elems, S32 & prims, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone) const;
|
||||
void setSize(const Point2I &){}
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -1303,7 +1303,7 @@ void WorldEditor::renderObjectFace(SceneObject * obj, const VectorF & normal, co
|
|||
|
||||
PrimBuild::color( col );
|
||||
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
PrimBuild::begin( GFXTriangleStrip, 4 );
|
||||
for(U32 k = 0; k < 4; k++)
|
||||
{
|
||||
PrimBuild::vertex3f(projPnts[k].x, projPnts[k].y, projPnts[k].z);
|
||||
|
|
@ -1503,7 +1503,7 @@ void WorldEditor::renderSplinePath(SimPath::Path *path)
|
|||
if(vCount > 4000)
|
||||
batchSize = 4000;
|
||||
|
||||
GFXVertexBufferHandle<GFXVertexPC> vb;
|
||||
GFXVertexBufferHandle<GFXVertexPCT> vb;
|
||||
vb.set(GFX, 3*batchSize, GFXBufferTypeVolatile);
|
||||
void *lockPtr = vb.lock();
|
||||
if(!lockPtr) return;
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ void AdvancedLightBinManager::render( SceneRenderState *state )
|
|||
{
|
||||
vectorMatInfo->matInstance->setSceneInfo( state, sgData );
|
||||
vectorMatInfo->matInstance->setTransforms( matrixSet, state );
|
||||
GFX->drawPrimitive( GFXTriangleFan, 0, 2 );
|
||||
GFX->drawPrimitive( GFXTriangleStrip, 0, 2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -482,24 +482,24 @@ void AdvancedLightBinManager::_setupPerFrameParameters( const SceneRenderState *
|
|||
// passes.... this is a volatile VB and updates every frame.
|
||||
FarFrustumQuadVert verts[4];
|
||||
{
|
||||
verts[0].point.set( wsFrustumPoints[Frustum::FarBottomLeft] - cameraPos );
|
||||
invCam.mulP( wsFrustumPoints[Frustum::FarBottomLeft], &verts[0].normal );
|
||||
verts[0].texCoord.set( -1.0, -1.0 );
|
||||
verts[0].tangent.set(wsFrustumPoints[Frustum::FarBottomLeft] - cameraOffsetPos);
|
||||
verts[0].point.set(wsFrustumPoints[Frustum::FarTopLeft] - cameraPos);
|
||||
invCam.mulP(wsFrustumPoints[Frustum::FarTopLeft], &verts[0].normal);
|
||||
verts[0].texCoord.set(-1.0, 1.0);
|
||||
verts[0].tangent.set(wsFrustumPoints[Frustum::FarTopLeft] - cameraOffsetPos);
|
||||
|
||||
verts[1].point.set( wsFrustumPoints[Frustum::FarTopLeft] - cameraPos );
|
||||
invCam.mulP( wsFrustumPoints[Frustum::FarTopLeft], &verts[1].normal );
|
||||
verts[1].texCoord.set( -1.0, 1.0 );
|
||||
verts[1].tangent.set(wsFrustumPoints[Frustum::FarTopLeft] - cameraOffsetPos);
|
||||
verts[1].point.set(wsFrustumPoints[Frustum::FarTopRight] - cameraPos);
|
||||
invCam.mulP(wsFrustumPoints[Frustum::FarTopRight], &verts[1].normal);
|
||||
verts[1].texCoord.set(1.0, 1.0);
|
||||
verts[1].tangent.set(wsFrustumPoints[Frustum::FarTopRight] - cameraOffsetPos);
|
||||
|
||||
verts[2].point.set( wsFrustumPoints[Frustum::FarTopRight] - cameraPos );
|
||||
invCam.mulP( wsFrustumPoints[Frustum::FarTopRight], &verts[2].normal );
|
||||
verts[2].texCoord.set( 1.0, 1.0 );
|
||||
verts[2].tangent.set(wsFrustumPoints[Frustum::FarTopRight] - cameraOffsetPos);
|
||||
verts[2].point.set(wsFrustumPoints[Frustum::FarBottomLeft] - cameraPos);
|
||||
invCam.mulP(wsFrustumPoints[Frustum::FarBottomLeft], &verts[2].normal);
|
||||
verts[2].texCoord.set(-1.0, -1.0);
|
||||
verts[2].tangent.set(wsFrustumPoints[Frustum::FarBottomLeft] - cameraOffsetPos);
|
||||
|
||||
verts[3].point.set( wsFrustumPoints[Frustum::FarBottomRight] - cameraPos );
|
||||
invCam.mulP( wsFrustumPoints[Frustum::FarBottomRight], &verts[3].normal );
|
||||
verts[3].texCoord.set( 1.0, -1.0 );
|
||||
verts[3].point.set(wsFrustumPoints[Frustum::FarBottomRight] - cameraPos);
|
||||
invCam.mulP(wsFrustumPoints[Frustum::FarBottomRight], &verts[3].normal);
|
||||
verts[3].texCoord.set(1.0, -1.0);
|
||||
verts[3].tangent.set(wsFrustumPoints[Frustum::FarBottomRight] - cameraOffsetPos);
|
||||
}
|
||||
mFarFrustumQuadVerts.set( GFX, 4 );
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ void DeferredSpecMapGLSL::processPix( Vector<ShaderComponent*> &componentList, c
|
|||
specularMap->uniform = true;
|
||||
specularMap->sampler = true;
|
||||
specularMap->constNum = Var::getTexUnitNum();
|
||||
LangElement *texOp = new GenOp( "tex2D(@, @)", specularMap, texCoord );
|
||||
//matinfo.g slot reserved for AO later
|
||||
meta->addStatement(new GenOp(" @.g = 1.0;\r\n", material));
|
||||
meta->addStatement(new GenOp(" @.b = dot(tex2D(@, @).rgb, vec3(0.3, 0.59, 0.11));\r\n", material, specularMap, texCoord));
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ void GBufferConditionerGLSL::processVert( Vector<ShaderComponent*> &componentLis
|
|||
// TODO: Total hack because Conditioner is directly derived
|
||||
// from ShaderFeature and not from ShaderFeatureGLSL.
|
||||
NamedFeatureGLSL dummy( String::EmptyString );
|
||||
dummy.mInstancingFormat = mInstancingFormat;
|
||||
dummy.setInstancingFormat( mInstancingFormat );
|
||||
Var *worldViewOnly = dummy.getWorldView( componentList, fd.features[MFT_UseInstancing], meta );
|
||||
|
||||
meta->addStatement( new GenOp(" @ = tMul(@, float4( normalize(@), 0.0 ) ).xyz;\r\n",
|
||||
|
|
|
|||
|
|
@ -126,6 +126,18 @@ void DeferredRTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &component
|
|||
lightInfoBuffer->sampler = true;
|
||||
lightInfoBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var* lightBufferTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
lightInfoBuffer->setType("SamplerState");
|
||||
lightBufferTex = new Var;
|
||||
lightBufferTex->setName("lightInfoBufferTex");
|
||||
lightBufferTex->setType("Texture2D");
|
||||
lightBufferTex->uniform = true;
|
||||
lightBufferTex->texture = true;
|
||||
lightBufferTex->constNum = lightInfoBuffer->constNum;
|
||||
}
|
||||
|
||||
// Declare the RTLighting variables in this feature, they will either be assigned
|
||||
// in this feature, or in the tonemap/lightmap feature
|
||||
Var *d_lightcolor = new Var( "d_lightcolor", "float3" );
|
||||
|
|
@ -140,8 +152,12 @@ void DeferredRTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &component
|
|||
|
||||
// Perform the uncondition here.
|
||||
String unconditionLightInfo = String::ToLower( AdvancedLightBinManager::smBufferName ) + "Uncondition";
|
||||
meta->addStatement( new GenOp( avar( " %s(tex2D(@, @), @, @, @);\r\n",
|
||||
unconditionLightInfo.c_str() ), lightInfoBuffer, uvScene, d_lightcolor, d_NL_Att, d_specular ) );
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(avar(" %s(@.Sample(@, @), @, @, @);\r\n",
|
||||
unconditionLightInfo.c_str()), lightBufferTex, lightInfoBuffer, uvScene, d_lightcolor, d_NL_Att, d_specular));
|
||||
else
|
||||
meta->addStatement(new GenOp(avar(" %s(tex2D(@, @), @, @, @);\r\n",
|
||||
unconditionLightInfo.c_str()), lightInfoBuffer, uvScene, d_lightcolor, d_NL_Att, d_specular));
|
||||
|
||||
// If this has an interlaced pre-pass, do averaging here
|
||||
if( fd.features[MFT_InterlacedPrePass] )
|
||||
|
|
@ -157,8 +173,12 @@ void DeferredRTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &component
|
|||
}
|
||||
|
||||
meta->addStatement( new GenOp( " float id_NL_Att, id_specular;\r\n float3 id_lightcolor;\r\n" ) );
|
||||
meta->addStatement( new GenOp( avar( " %s(tex2D(@, @ + float2(0.0, @.y)), id_lightcolor, id_NL_Att, id_specular);\r\n",
|
||||
unconditionLightInfo.c_str() ), lightInfoBuffer, uvScene, oneOverTargetSize ) );
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(avar(" %s(@.Sample(@, @ + float2(0.0, @.y)), id_lightcolor, id_NL_Att, id_specular);\r\n",
|
||||
unconditionLightInfo.c_str()), lightBufferTex, lightInfoBuffer, uvScene, oneOverTargetSize));
|
||||
else
|
||||
meta->addStatement(new GenOp(avar(" %s(tex2D(@, @ + float2(0.0, @.y)), id_lightcolor, id_NL_Att, id_specular);\r\n",
|
||||
unconditionLightInfo.c_str()), lightInfoBuffer, uvScene, oneOverTargetSize));
|
||||
|
||||
meta->addStatement( new GenOp(" @ = lerp(@, id_lightcolor, 0.5);\r\n", d_lightcolor, d_lightcolor ) );
|
||||
meta->addStatement( new GenOp(" @ = lerp(@, id_NL_Att, 0.5);\r\n", d_NL_Att, d_NL_Att ) );
|
||||
|
|
@ -272,8 +292,17 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
// create texture var
|
||||
Var *bumpMap = getNormalMapTex();
|
||||
Var *texCoord = getInTexCoord( "texCoord", "float2", true, componentList );
|
||||
LangElement *texOp = new GenOp( "tex2D(@, @)", bumpMap, texCoord );
|
||||
Var *texCoord = getInTexCoord("texCoord", "float2", true, componentList);
|
||||
|
||||
LangElement *texOp = NULL;
|
||||
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
Var *bumpMapTex = (Var*)LangElement::find("bumpMapTex");
|
||||
texOp = new GenOp("@.Sample(@, @)", bumpMapTex, bumpMap, texCoord);
|
||||
}
|
||||
else
|
||||
texOp = new GenOp("tex2D(@, @)", bumpMap, texCoord);
|
||||
|
||||
// create bump normal
|
||||
Var *bumpNorm = new Var;
|
||||
|
|
@ -295,8 +324,25 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
bumpMap->sampler = true;
|
||||
bumpMap->constNum = Var::getTexUnitNum();
|
||||
|
||||
texCoord = getInTexCoord( "detCoord", "float2", true, componentList );
|
||||
texOp = new GenOp( "tex2D(@, @)", bumpMap, texCoord );
|
||||
Var* detailNormalTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
bumpMap->setType("SamplerState");
|
||||
detailNormalTex = new Var;
|
||||
detailNormalTex->setName("detailBumpMapTex");
|
||||
detailNormalTex->setType("Texture2D");
|
||||
detailNormalTex->uniform = true;
|
||||
detailNormalTex->texture = true;
|
||||
detailNormalTex->constNum = bumpMap->constNum;
|
||||
}
|
||||
|
||||
|
||||
texCoord = getInTexCoord("detCoord", "float2", true, componentList);
|
||||
|
||||
if (mIsDirect3D11)
|
||||
texOp = new GenOp("@.Sample(@, @)", detailNormalTex, bumpMap, texCoord);
|
||||
else
|
||||
texOp = new GenOp("tex2D(@, @)", bumpMap, texCoord);
|
||||
|
||||
Var *detailBump = new Var;
|
||||
detailBump->setName( "detailBump" );
|
||||
|
|
@ -333,25 +379,32 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
else if (fd.features[MFT_AccuMap])
|
||||
{
|
||||
Var *bumpSample = (Var *)LangElement::find( "bumpSample" );
|
||||
if( bumpSample == NULL )
|
||||
if (bumpSample == NULL)
|
||||
{
|
||||
MultiLine *meta = new MultiLine;
|
||||
|
||||
Var *texCoord = getInTexCoord( "texCoord", "float2", true, componentList );
|
||||
Var *texCoord = getInTexCoord("texCoord", "float2", true, componentList);
|
||||
|
||||
Var *bumpMap = getNormalMapTex();
|
||||
|
||||
bumpSample = new Var;
|
||||
bumpSample->setType( "float4" );
|
||||
bumpSample->setName( "bumpSample" );
|
||||
LangElement *bumpSampleDecl = new DecOp( bumpSample );
|
||||
bumpSample->setType("float4");
|
||||
bumpSample->setName("bumpSample");
|
||||
LangElement *bumpSampleDecl = new DecOp(bumpSample);
|
||||
|
||||
meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n", bumpSampleDecl, bumpMap, texCoord ) );
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
Var *bumpMapTex = (Var *)LangElement::find("bumpMapTex");
|
||||
output = new GenOp(" @ = @.Sample(@, @);\r\n", bumpSampleDecl, bumpMapTex, bumpMap, texCoord);
|
||||
}
|
||||
else
|
||||
output = new GenOp(" @ = tex2D(@, @);\r\n", bumpSampleDecl, bumpMap, texCoord);
|
||||
|
||||
if ( fd.features.hasFeature( MFT_DetailNormalMap ) )
|
||||
{
|
||||
Var *bumpMap = (Var*)LangElement::find( "detailBumpMap" );
|
||||
if ( !bumpMap ) {
|
||||
if ( !bumpMap )
|
||||
{
|
||||
bumpMap = new Var;
|
||||
bumpMap->setType( "sampler2D" );
|
||||
bumpMap->setName( "detailBumpMap" );
|
||||
|
|
@ -360,8 +413,24 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
bumpMap->constNum = Var::getTexUnitNum();
|
||||
}
|
||||
|
||||
Var* bumpMapTex = (Var*)LangElement::find("detailBumpMap");
|
||||
if (mIsDirect3D11 && !bumpMapTex)
|
||||
{
|
||||
bumpMap->setType("SamplerState");
|
||||
bumpMapTex = new Var;
|
||||
bumpMapTex->setName("detailBumpMapTex");
|
||||
bumpMapTex->setType("Texture2D");
|
||||
bumpMapTex->uniform = true;
|
||||
bumpMapTex->texture = true;
|
||||
bumpMapTex->constNum = bumpMap->constNum;
|
||||
}
|
||||
|
||||
texCoord = getInTexCoord( "detCoord", "float2", true, componentList );
|
||||
LangElement *texOp = new GenOp( "tex2D(@, @)", bumpMap, texCoord );
|
||||
LangElement *texOp = NULL;
|
||||
if (mIsDirect3D11)
|
||||
texOp = new GenOp("@.Sample(@, @)", bumpMap, bumpMapTex, texCoord);
|
||||
else
|
||||
texOp = new GenOp( "tex2D(@, @)", bumpMap, texCoord );
|
||||
|
||||
Var *detailBump = new Var;
|
||||
detailBump->setName( "detailBump" );
|
||||
|
|
@ -402,7 +471,14 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
bumpSample->setName( "bumpSample" );
|
||||
LangElement *bumpSampleDecl = new DecOp( bumpSample );
|
||||
|
||||
output = new GenOp( " @ = tex2D(@, @);\r\n", bumpSampleDecl, bumpMap, texCoord );
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
Var *bumpMapTex = (Var *)LangElement::find("bumpMapTex");
|
||||
output = new GenOp(" @ = @.Sample(@, @);\r\n", bumpSampleDecl, bumpMapTex, bumpMap, texCoord);
|
||||
}
|
||||
else
|
||||
output = new GenOp(" @ = tex2D(@, @);\r\n", bumpSampleDecl, bumpMap, texCoord);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -547,7 +623,8 @@ void DeferredPixelSpecularHLSL::processPix( Vector<ShaderComponent*> &component
|
|||
AssertFatal( lightInfoSamp && d_specular && d_NL_Att,
|
||||
"DeferredPixelSpecularHLSL::processPix - Something hosed the deferred features!" );
|
||||
|
||||
if (fd.features[ MFT_AccuMap ]) {
|
||||
if (fd.features[ MFT_AccuMap ])
|
||||
{
|
||||
// change specularity where the accu texture is applied
|
||||
Var *accuPlc = (Var*) LangElement::find( "plc" );
|
||||
Var *accuSpecular = (Var*)LangElement::find( "accuSpecular" );
|
||||
|
|
@ -671,6 +748,18 @@ void DeferredMinnaertHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
prepassBuffer->sampler = true;
|
||||
prepassBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var* prePassTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
prepassBuffer->setType("SamplerState");
|
||||
prePassTex = new Var;
|
||||
prePassTex->setName("prePassTex");
|
||||
prePassTex->setType("Texture2D");
|
||||
prePassTex->uniform = true;
|
||||
prePassTex->texture = true;
|
||||
prePassTex->constNum = prepassBuffer->constNum;
|
||||
}
|
||||
|
||||
// Texture coord
|
||||
Var *uvScene = (Var*) LangElement::find( "uvScene" );
|
||||
AssertFatal(uvScene != NULL, "Unable to find UVScene, no RTLighting feature?");
|
||||
|
|
@ -684,7 +773,11 @@ void DeferredMinnaertHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
Var *d_NL_Att = (Var*)LangElement::find( "d_NL_Att" );
|
||||
|
||||
meta->addStatement( new GenOp( avar( " float4 normalDepth = %s(@, @);\r\n", unconditionPrePassMethod.c_str() ), prepassBuffer, uvScene ) );
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, ,@, @);\r\n", unconditionPrePassMethod.c_str()), prepassBuffer, prePassTex, uvScene));
|
||||
else
|
||||
meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, @);\r\n", unconditionPrePassMethod.c_str()), prepassBuffer, uvScene));
|
||||
|
||||
meta->addStatement( new GenOp( " float vDotN = dot(normalDepth.xyz, @);\r\n", wsViewVec ) );
|
||||
meta->addStatement( new GenOp( " float Minnaert = pow( @, @) * pow(vDotN, 1.0 - @);\r\n", d_NL_Att, minnaertConstant, minnaertConstant ) );
|
||||
meta->addStatement( new GenOp( " @;\r\n", assignColor( new GenOp( "float4(Minnaert, Minnaert, Minnaert, 1.0)" ), Material::Mul ) ) );
|
||||
|
|
|
|||
|
|
@ -62,12 +62,35 @@ void DeferredSpecMapHLSL::processPix( Vector<ShaderComponent*> &componentList, c
|
|||
specularMap->uniform = true;
|
||||
specularMap->sampler = true;
|
||||
specularMap->constNum = Var::getTexUnitNum();
|
||||
LangElement *texOp = new GenOp( "tex2D(@, @)", specularMap, texCoord );
|
||||
|
||||
Var* specularMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
specularMap->setType("SamplerState");
|
||||
specularMapTex = new Var;
|
||||
specularMapTex->setName("specularMapTex");
|
||||
specularMapTex->setType("Texture2D");
|
||||
specularMapTex->uniform = true;
|
||||
specularMapTex->texture = true;
|
||||
specularMapTex->constNum = specularMap->constNum;
|
||||
}
|
||||
|
||||
//matinfo.g slot reserved for AO later
|
||||
Var* specColor = new Var;
|
||||
specColor->setName("specColor");
|
||||
specColor->setType("float4");
|
||||
LangElement *specColorElem = new DecOp(specColor);
|
||||
|
||||
meta->addStatement(new GenOp(" @.g = 1.0;\r\n", material));
|
||||
meta->addStatement(new GenOp(" @.b = dot(tex2D(@, @).rgb, float3(0.3, 0.59, 0.11));\r\n", material, specularMap, texCoord));
|
||||
meta->addStatement(new GenOp(" @.a = tex2D(@, @).a;\r\n", material, specularMap, texCoord));
|
||||
//sample specular map
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(" @ = @.Sample(@, @);\r\n", specColorElem, specularMapTex, specularMap, texCoord));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = tex2D(@, @);\r\n", specColorElem, specularMap, texCoord));
|
||||
|
||||
meta->addStatement(new GenOp(" @.b = dot(@.rgb, float3(0.3, 0.59, 0.11));\r\n", material, specColor));
|
||||
meta->addStatement(new GenOp(" @.a = @.a;\r\n", material, specColor));
|
||||
|
||||
output = meta;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "materials/materialFeatureTypes.h"
|
||||
#include "materials/materialFeatureData.h"
|
||||
#include "shaderGen/hlsl/shaderFeatureHLSL.h"
|
||||
|
||||
#include "gfx/gfxDevice.h"
|
||||
|
||||
GBufferConditionerHLSL::GBufferConditionerHLSL( const GFXFormat bufferFormat, const NormalSpace nrmSpace ) :
|
||||
Parent( bufferFormat )
|
||||
|
|
@ -114,7 +114,7 @@ void GBufferConditionerHLSL::processVert( Vector<ShaderComponent*> &componentLis
|
|||
// TODO: Total hack because Conditioner is directly derived
|
||||
// from ShaderFeature and not from ShaderFeatureHLSL.
|
||||
NamedFeatureHLSL dummy( String::EmptyString );
|
||||
dummy.mInstancingFormat = mInstancingFormat;
|
||||
dummy.setInstancingFormat( mInstancingFormat );
|
||||
Var *worldViewOnly = dummy.getWorldView( componentList, fd.features[MFT_UseInstancing], meta );
|
||||
|
||||
meta->addStatement( new GenOp(" @ = mul(@, float4( normalize(@), 0.0 ) ).xyz;\r\n",
|
||||
|
|
@ -222,6 +222,7 @@ Var* GBufferConditionerHLSL::printMethodHeader( MethodType methodType, const Str
|
|||
retVal = Parent::printMethodHeader( methodType, methodName, stream, meta );
|
||||
else
|
||||
{
|
||||
const bool isDirect3D11 = GFX->getAdapterType() == Direct3D11;
|
||||
Var *methodVar = new Var;
|
||||
methodVar->setName(methodName);
|
||||
methodVar->setType("inline float4");
|
||||
|
|
@ -237,12 +238,28 @@ Var* GBufferConditionerHLSL::printMethodHeader( MethodType methodType, const Str
|
|||
screenUV->setType("float2");
|
||||
DecOp *screenUVDecl = new DecOp(screenUV);
|
||||
|
||||
Var *prepassTex = NULL;
|
||||
DecOp *prepassTexDecl = NULL;
|
||||
if (isDirect3D11)
|
||||
{
|
||||
prepassSampler->setType("SamplerState");
|
||||
prepassTex = new Var;
|
||||
prepassTex->setName("prepassTexVar");
|
||||
prepassTex->setType("Texture2D");
|
||||
prepassTex->texture = true;
|
||||
prepassTex->constNum = prepassSampler->constNum;
|
||||
prepassTexDecl = new DecOp(prepassTex);
|
||||
}
|
||||
|
||||
Var *bufferSample = new Var;
|
||||
bufferSample->setName("bufferSample");
|
||||
bufferSample->setType("float4");
|
||||
DecOp *bufferSampleDecl = new DecOp(bufferSample);
|
||||
|
||||
meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, prepassSamplerDecl, screenUVDecl ) );
|
||||
if (isDirect3D11)
|
||||
meta->addStatement(new GenOp("@(@, @, @)\r\n", methodDecl, prepassSamplerDecl, prepassTexDecl, screenUVDecl));
|
||||
else
|
||||
meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, prepassSamplerDecl, screenUVDecl ) );
|
||||
|
||||
meta->addStatement( new GenOp( "{\r\n" ) );
|
||||
|
||||
|
|
@ -255,10 +272,14 @@ Var* GBufferConditionerHLSL::printMethodHeader( MethodType methodType, const Str
|
|||
// The gbuffer has no mipmaps, so use tex2dlod when
|
||||
// possible so that the shader compiler can optimize.
|
||||
meta->addStatement( new GenOp( " #if TORQUE_SM >= 30\r\n" ) );
|
||||
meta->addStatement( new GenOp( " @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, prepassSampler, screenUV ) );
|
||||
meta->addStatement( new GenOp( " #else\r\n" ) );
|
||||
meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n", bufferSampleDecl, prepassSampler, screenUV ) );
|
||||
meta->addStatement( new GenOp( " #endif\r\n\r\n" ) );
|
||||
if (isDirect3D11)
|
||||
meta->addStatement(new GenOp(" @ = @.SampleLevel(@, @,0);\r\n", bufferSampleDecl, prepassTex, prepassSampler, screenUV));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, prepassSampler, screenUV));
|
||||
|
||||
meta->addStatement(new GenOp(" #else\r\n"));
|
||||
meta->addStatement(new GenOp(" @ = tex2D(@, @);\r\n", bufferSampleDecl, prepassSampler, screenUV));
|
||||
meta->addStatement(new GenOp(" #endif\r\n\r\n"));
|
||||
#endif
|
||||
|
||||
// We don't use this way of passing var's around, so this should cause a crash
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ void BlobShadow::render( F32 camDist, const TSRenderState &rdata )
|
|||
GFX->setVertexBuffer(mShadowBuffer);
|
||||
|
||||
for(U32 p=0; p<mPartition.size(); p++)
|
||||
GFX->drawPrimitive(GFXTriangleFan, mPartition[p].vertexStart, (mPartition[p].vertexCount - 2));
|
||||
GFX->drawPrimitive(GFXTriangleStrip, mPartition[p].vertexStart, (mPartition[p].vertexCount - 2));
|
||||
|
||||
// This is a bad nasty hack which forces the shadow to reconstruct itself every frame.
|
||||
mPartition.clear();
|
||||
|
|
|
|||
|
|
@ -22,10 +22,6 @@
|
|||
#ifndef _MISCSHDRDAT_H_
|
||||
#define _MISCSHDRDAT_H_
|
||||
|
||||
#ifndef _PLATFORM_H_
|
||||
#include "platform/platform.h"
|
||||
#endif
|
||||
|
||||
//**************************************************************************
|
||||
// This file is an attempt to keep certain classes from having to know about
|
||||
// the ShaderGen class
|
||||
|
|
@ -45,6 +41,7 @@ enum RegisterType
|
|||
RT_COLOR,
|
||||
RT_TEXCOORD,
|
||||
RT_VPOS,
|
||||
RT_SVPOSITION
|
||||
};
|
||||
|
||||
enum Components
|
||||
|
|
@ -52,7 +49,7 @@ enum Components
|
|||
C_VERT_STRUCT = 0,
|
||||
C_CONNECTOR,
|
||||
C_VERT_MAIN,
|
||||
C_PIX_MAIN,
|
||||
C_PIX_MAIN
|
||||
};
|
||||
|
||||
#endif // _MISCSHDRDAT_H_
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ bool ProcessedShaderMaterial::init( const FeatureSet &features,
|
|||
if ( mFeatures.hasFeature( MFT_UseInstancing ) )
|
||||
{
|
||||
mInstancingState = new InstancingState();
|
||||
mInstancingState->setFormat( &_getRPD( 0 )->shader->mInstancingFormat, mVertexFormat );
|
||||
mInstancingState->setFormat( _getRPD( 0 )->shader->getInstancingFormat(), mVertexFormat );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,6 +167,8 @@ protected:
|
|||
mInstFormat = instFormat;
|
||||
mDeclFormat.copy( *vertexFormat );
|
||||
mDeclFormat.append( *mInstFormat, 1 );
|
||||
// Let the declaration know we have instancing.
|
||||
mDeclFormat.enableInstancing();
|
||||
mDeclFormat.getDecl();
|
||||
|
||||
delete [] mBuffer;
|
||||
|
|
|
|||
|
|
@ -236,6 +236,7 @@ GFXShader* ShaderData::_createShader( const Vector<GFXShaderMacro> ¯os )
|
|||
{
|
||||
case Direct3D9_360:
|
||||
case Direct3D9:
|
||||
case Direct3D11:
|
||||
{
|
||||
success = shader->init( mDXVertexShaderName,
|
||||
mDXPixelShaderName,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
//#include <comdef.h>
|
||||
#include <wbemidl.h>
|
||||
//#include <atlconv.h>
|
||||
#include <DXGI.h>
|
||||
#pragma comment(lib, "comsuppw.lib")
|
||||
#pragma comment(lib, "wbemuuid.lib")
|
||||
|
||||
|
|
@ -53,58 +54,6 @@ struct MYGUID : public GUID
|
|||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// DXGI decls for retrieving device info on Vista. We manually declare that
|
||||
// stuff here, so we don't depend on headers and compile on any setup. At
|
||||
// run-time, it depends on whether we can successfully load the DXGI DLL; if
|
||||
// not, nothing of this here will be used.
|
||||
|
||||
struct IDXGIObject;
|
||||
struct IDXGIFactory;
|
||||
struct IDXGIAdapter;
|
||||
struct IDXGIOutput;
|
||||
|
||||
struct DXGI_SWAP_CHAIN_DESC;
|
||||
struct DXGI_ADAPTER_DESC;
|
||||
|
||||
struct IDXGIObject : public IUnknown
|
||||
{
|
||||
virtual HRESULT STDMETHODCALLTYPE SetPrivateData( REFGUID, UINT, const void* ) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( REFGUID, const IUnknown* ) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE GetPrivateData( REFGUID, UINT*, void* ) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE GetParent( REFIID, void** ) = 0;
|
||||
};
|
||||
|
||||
struct IDXGIFactory : public IDXGIObject
|
||||
{
|
||||
virtual HRESULT STDMETHODCALLTYPE EnumAdapters( UINT, IDXGIAdapter** ) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE MakeWindowAssociation( HWND, UINT ) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE GetWindowAssociation( HWND ) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE CreateSwapChain( IUnknown*, DXGI_SWAP_CHAIN_DESC* ) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter( HMODULE, IDXGIAdapter** ) = 0;
|
||||
};
|
||||
|
||||
struct IDXGIAdapter : public IDXGIObject
|
||||
{
|
||||
virtual HRESULT STDMETHODCALLTYPE EnumOutputs( UINT, IDXGIOutput** ) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE GetDesc( DXGI_ADAPTER_DESC* ) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE CheckInterfaceSupport( REFGUID, LARGE_INTEGER* ) = 0;
|
||||
};
|
||||
|
||||
struct DXGI_ADAPTER_DESC
|
||||
{
|
||||
WCHAR Description[ 128 ];
|
||||
UINT VendorId;
|
||||
UINT DeviceId;
|
||||
UINT SubSysId;
|
||||
UINT Revision;
|
||||
SIZE_T DedicatedVideoMemory;
|
||||
SIZE_T DedicatedSystemMemory;
|
||||
SIZE_T SharedSystemMemory;
|
||||
LUID AdapterLuid;
|
||||
};
|
||||
|
||||
static MYGUID IID_IDXGIFactory( 0x7b7166ec, 0x21c7, 0x44ae, 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69 );
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// DXDIAG declarations.
|
||||
|
|
@ -184,6 +133,26 @@ WMIVideoInfo::~WMIVideoInfo()
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
String WMIVideoInfo::_lookUpVendorId(U32 vendorId)
|
||||
{
|
||||
String vendor;
|
||||
switch (vendorId)
|
||||
{
|
||||
case 0x10DE:
|
||||
vendor = "NVIDIA";
|
||||
break;
|
||||
case 0x1002:
|
||||
vendor = "AMD";
|
||||
break;
|
||||
case 0x8086:
|
||||
vendor = "INTEL";
|
||||
break;
|
||||
}
|
||||
return vendor;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
bool WMIVideoInfo::_initialize()
|
||||
{
|
||||
// Init COM
|
||||
|
|
@ -282,16 +251,15 @@ bool WMIVideoInfo::_initializeWMI()
|
|||
|
||||
bool WMIVideoInfo::_initializeDXGI()
|
||||
{
|
||||
// Try going for DXGI. Will only succeed on Vista.
|
||||
#if 0
|
||||
// Try using for DXGI 1.1, will only succeed on Windows 7+.
|
||||
mDXGIModule = ( HMODULE ) LoadLibrary( L"dxgi.dll" );
|
||||
if( mDXGIModule != 0 )
|
||||
{
|
||||
typedef HRESULT (* CreateDXGIFactoryFuncType )( REFIID, void** );
|
||||
typedef HRESULT (WINAPI* CreateDXGIFactoryFuncType )( REFIID, void** );
|
||||
CreateDXGIFactoryFuncType factoryFunction =
|
||||
( CreateDXGIFactoryFuncType ) GetProcAddress( ( HMODULE ) mDXGIModule, "CreateDXGIFactory" );
|
||||
( CreateDXGIFactoryFuncType ) GetProcAddress( ( HMODULE ) mDXGIModule, "CreateDXGIFactory1" );
|
||||
|
||||
if( factoryFunction && factoryFunction( IID_IDXGIFactory, ( void** ) &mDXGIFactory ) == S_OK )
|
||||
if( factoryFunction && factoryFunction( IID_IDXGIFactory1, ( void** ) &mDXGIFactory ) == S_OK )
|
||||
return true;
|
||||
else
|
||||
{
|
||||
|
|
@ -299,7 +267,7 @@ bool WMIVideoInfo::_initializeDXGI()
|
|||
mDXGIModule = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -483,20 +451,36 @@ bool WMIVideoInfo::_queryPropertyDxDiag( const PVIQueryType queryType, const U32
|
|||
|
||||
bool WMIVideoInfo::_queryPropertyDXGI( const PVIQueryType queryType, const U32 adapterId, String *outValue )
|
||||
{
|
||||
#if 0
|
||||
|
||||
if( mDXGIFactory )
|
||||
{
|
||||
IDXGIAdapter* adapter;
|
||||
if( mDXGIFactory->EnumAdapters( adapterId, &adapter ) != S_OK )
|
||||
// Special case to deal with PVI_NumAdapters
|
||||
if (queryType == PVI_NumAdapters)
|
||||
{
|
||||
U32 count = 0;
|
||||
IDXGIAdapter1 *adapter;
|
||||
while (mDXGIFactory->EnumAdapters1(count, &adapter) != DXGI_ERROR_NOT_FOUND)
|
||||
{
|
||||
++count;
|
||||
adapter->Release();
|
||||
}
|
||||
|
||||
String value = String::ToString("%d", count);
|
||||
*outValue = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
IDXGIAdapter1* adapter;
|
||||
if( mDXGIFactory->EnumAdapters1( adapterId, &adapter ) != S_OK )
|
||||
return false;
|
||||
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
if( adapter->GetDesc( &desc ) != S_OK )
|
||||
DXGI_ADAPTER_DESC1 desc;
|
||||
if( adapter->GetDesc1( &desc ) != S_OK )
|
||||
{
|
||||
adapter->Release();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
String value;
|
||||
switch( queryType )
|
||||
{
|
||||
|
|
@ -511,15 +495,17 @@ bool WMIVideoInfo::_queryPropertyDXGI( const PVIQueryType queryType, const U32 a
|
|||
case PVI_VRAM:
|
||||
value = String( avar( "%i", desc.DedicatedVideoMemory / 1048576 ) );
|
||||
break;
|
||||
|
||||
//RDTODO
|
||||
case PVI_ChipSet:
|
||||
value = _lookUpVendorId(desc.VendorId);
|
||||
break;
|
||||
//TODO PVI_DriverVersion
|
||||
}
|
||||
|
||||
adapter->Release();
|
||||
*outValue = value;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
struct IWbemLocator;
|
||||
struct IWbemServices;
|
||||
|
||||
struct IDXGIFactory;
|
||||
struct IDXGIFactory1;
|
||||
struct IDxDiagProvider;
|
||||
|
||||
class WMIVideoInfo : public PlatformVideoInfo
|
||||
|
|
@ -39,7 +39,7 @@ private:
|
|||
bool mComInitialized;
|
||||
|
||||
void* mDXGIModule;
|
||||
IDXGIFactory* mDXGIFactory;
|
||||
IDXGIFactory1* mDXGIFactory;
|
||||
IDxDiagProvider* mDxDiagProvider;
|
||||
|
||||
bool _initializeDXGI();
|
||||
|
|
@ -54,6 +54,7 @@ protected:
|
|||
static WCHAR *smPVIQueryTypeToWMIString [];
|
||||
bool _queryProperty( const PVIQueryType queryType, const U32 adapterId, String *outValue );
|
||||
bool _initialize();
|
||||
String _lookUpVendorId(U32 vendorId);
|
||||
|
||||
public:
|
||||
WMIVideoInfo();
|
||||
|
|
|
|||
|
|
@ -510,23 +510,23 @@ void PostEffect::_updateScreenGeometry( const Frustum &frustum,
|
|||
|
||||
PFXVertex *vert = outVB->lock();
|
||||
|
||||
vert->point.set( -1.0, -1.0, 0.0 );
|
||||
vert->texCoord.set( 0.0f, 1.0f );
|
||||
vert->wsEyeRay = frustumPoints[Frustum::FarBottomLeft] - cameraOffsetPos;
|
||||
vert++;
|
||||
|
||||
vert->point.set( -1.0, 1.0, 0.0 );
|
||||
vert->texCoord.set( 0.0f, 0.0f );
|
||||
vert->point.set(-1.0, 1.0, 0.0);
|
||||
vert->texCoord.set(0.0f, 0.0f);
|
||||
vert->wsEyeRay = frustumPoints[Frustum::FarTopLeft] - cameraOffsetPos;
|
||||
vert++;
|
||||
|
||||
vert->point.set( 1.0, 1.0, 0.0 );
|
||||
vert->texCoord.set( 1.0f, 0.0f );
|
||||
vert->point.set(1.0, 1.0, 0.0);
|
||||
vert->texCoord.set(1.0f, 0.0f);
|
||||
vert->wsEyeRay = frustumPoints[Frustum::FarTopRight] - cameraOffsetPos;
|
||||
vert++;
|
||||
|
||||
vert->point.set( 1.0, -1.0, 0.0 );
|
||||
vert->texCoord.set( 1.0f, 1.0f );
|
||||
vert->point.set(-1.0, -1.0, 0.0);
|
||||
vert->texCoord.set(0.0f, 1.0f);
|
||||
vert->wsEyeRay = frustumPoints[Frustum::FarBottomLeft] - cameraOffsetPos;
|
||||
vert++;
|
||||
|
||||
vert->point.set(1.0, -1.0, 0.0);
|
||||
vert->texCoord.set(1.0f, 1.0f);
|
||||
vert->wsEyeRay = frustumPoints[Frustum::FarBottomRight] - cameraOffsetPos;
|
||||
vert++;
|
||||
|
||||
|
|
@ -1275,7 +1275,7 @@ void PostEffect::process( const SceneRenderState *state,
|
|||
|
||||
// Draw it.
|
||||
GFX->setVertexBuffer( vb );
|
||||
GFX->drawPrimitive( GFXTriangleFan, 0, 2 );
|
||||
GFX->drawPrimitive( GFXTriangleStrip, 0, 2 );
|
||||
|
||||
// Allow PostEffecVis to hook in.
|
||||
PFXVIS->onPFXProcessed( this );
|
||||
|
|
|
|||
|
|
@ -385,7 +385,6 @@ void RenderPrePassMgr::render( SceneRenderState *state )
|
|||
GFXTextureObject *lastLM = NULL;
|
||||
GFXCubemap *lastCubemap = NULL;
|
||||
GFXTextureObject *lastReflectTex = NULL;
|
||||
GFXTextureObject *lastMiscTex = NULL;
|
||||
GFXTextureObject *lastAccuTex = NULL;
|
||||
|
||||
// Next render all the meshes.
|
||||
|
|
|
|||
|
|
@ -248,8 +248,18 @@ GFXTextureObject* ReflectionManager::getRefractTex( bool forceUpdate )
|
|||
const U32 desWidth = targetSize.x;
|
||||
const U32 desHeight = targetSize.y;
|
||||
#else
|
||||
const U32 desWidth = mFloor( (F32)targetSize.x * smRefractTexScale );
|
||||
const U32 desHeight = mFloor( ( F32)targetSize.y * smRefractTexScale );
|
||||
U32 desWidth, desHeight;
|
||||
// D3D11 needs to be the same size as the active target
|
||||
if (GFX->getAdapterType() == Direct3D11)
|
||||
{
|
||||
desWidth = targetSize.x;
|
||||
desHeight = targetSize.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
desWidth = mFloor((F32)targetSize.x * smRefractTexScale);
|
||||
desHeight = mFloor((F32)targetSize.y * smRefractTexScale);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( mRefractTex.isNull() ||
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ DefineEngineMethod( Path, getPathId, S32, (),,
|
|||
//--------------------------------------------------------------------------
|
||||
|
||||
GFXStateBlockRef Marker::smStateBlock;
|
||||
GFXVertexBufferHandle<GFXVertexPC> Marker::smVertexBuffer;
|
||||
GFXVertexBufferHandle<GFXVertexPCT> Marker::smVertexBuffer;
|
||||
GFXPrimitiveBufferHandle Marker::smPrimitiveBuffer;
|
||||
|
||||
static Point3F wedgePoints[4] = {
|
||||
|
|
@ -295,7 +295,7 @@ void Marker::initGFXResources()
|
|||
smStateBlock = GFX->createStateBlock(d);
|
||||
|
||||
smVertexBuffer.set(GFX, 4, GFXBufferTypeStatic);
|
||||
GFXVertexPC* verts = smVertexBuffer.lock();
|
||||
GFXVertexPCT* verts = smVertexBuffer.lock();
|
||||
verts[0].point = wedgePoints[0] * 0.25f;
|
||||
verts[1].point = wedgePoints[1] * 0.25f;
|
||||
verts[2].point = wedgePoints[2] * 0.25f;
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ class Marker : public SceneObject
|
|||
static void initGFXResources();
|
||||
|
||||
static GFXStateBlockRef smStateBlock;
|
||||
static GFXVertexBufferHandle<GFXVertexPC> smVertexBuffer;
|
||||
static GFXVertexBufferHandle<GFXVertexPCT> smVertexBuffer;
|
||||
static GFXPrimitiveBufferHandle smPrimitiveBuffer;
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -85,7 +85,8 @@ void AccuTexFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
// accu constants
|
||||
Var *accuScale = (Var*)LangElement::find( "accuScale" );
|
||||
if ( !accuScale ) {
|
||||
if ( !accuScale )
|
||||
{
|
||||
accuScale = new Var;
|
||||
accuScale->setType( "float" );
|
||||
accuScale->setName( "accuScale" );
|
||||
|
|
@ -94,7 +95,8 @@ void AccuTexFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
accuScale->constSortPos = cspPotentialPrimitive;
|
||||
}
|
||||
Var *accuDirection = (Var*)LangElement::find( "accuDirection" );
|
||||
if ( !accuDirection ) {
|
||||
if ( !accuDirection )
|
||||
{
|
||||
accuDirection = new Var;
|
||||
accuDirection->setType( "float" );
|
||||
accuDirection->setName( "accuDirection" );
|
||||
|
|
@ -103,7 +105,8 @@ void AccuTexFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
accuDirection->constSortPos = cspPotentialPrimitive;
|
||||
}
|
||||
Var *accuStrength = (Var*)LangElement::find( "accuStrength" );
|
||||
if ( !accuStrength ) {
|
||||
if ( !accuStrength )
|
||||
{
|
||||
accuStrength = new Var;
|
||||
accuStrength->setType( "float" );
|
||||
accuStrength->setName( "accuStrength" );
|
||||
|
|
@ -112,7 +115,8 @@ void AccuTexFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
accuStrength->constSortPos = cspPotentialPrimitive;
|
||||
}
|
||||
Var *accuCoverage = (Var*)LangElement::find( "accuCoverage" );
|
||||
if ( !accuCoverage ) {
|
||||
if ( !accuCoverage )
|
||||
{
|
||||
accuCoverage = new Var;
|
||||
accuCoverage->setType( "float" );
|
||||
accuCoverage->setName( "accuCoverage" );
|
||||
|
|
@ -121,7 +125,8 @@ void AccuTexFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
accuCoverage->constSortPos = cspPotentialPrimitive;
|
||||
}
|
||||
Var *accuSpecular = (Var*)LangElement::find( "accuSpecular" );
|
||||
if ( !accuSpecular ) {
|
||||
if ( !accuSpecular )
|
||||
{
|
||||
accuSpecular = new Var;
|
||||
accuSpecular->setType( "float" );
|
||||
accuSpecular->setName( "accuSpecular" );
|
||||
|
|
@ -133,14 +138,26 @@ void AccuTexFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
Var *inTex = getInTexCoord( "texCoord", "float2", true, componentList );
|
||||
Var *accuVec = getInTexCoord( "accuVec", "float3", true, componentList );
|
||||
Var *bumpNorm = (Var *)LangElement::find( "bumpSample" );
|
||||
if( bumpNorm == NULL ) {
|
||||
if( bumpNorm == NULL )
|
||||
{
|
||||
bumpNorm = (Var *)LangElement::find( "bumpNormal" );
|
||||
if (!bumpNorm)
|
||||
return;
|
||||
}
|
||||
|
||||
// get the accu pixel color
|
||||
meta->addStatement( new GenOp( " @ = tex2D(@, @ * @);\r\n", colorAccuDecl, accuMap, inTex, accuScale ) );
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
Var *accuMapTex = new Var;
|
||||
accuMapTex->setType("Texture2D");
|
||||
accuMapTex->setName("accuMapTex");
|
||||
accuMapTex->uniform = true;
|
||||
accuMapTex->texture = true;
|
||||
accuMapTex->constNum = accuMap->constNum;
|
||||
meta->addStatement(new GenOp(" @ = @.Sample(@, @ * @);\r\n", colorAccuDecl, accuMapTex, accuMap, inTex, accuScale));
|
||||
}
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = tex2D(@, @ * @);\r\n", colorAccuDecl, accuMap, inTex, accuScale));
|
||||
|
||||
// scale up normals
|
||||
meta->addStatement( new GenOp( " @.xyz = @.xyz * 2.0 - 0.5;\r\n", bumpNorm, bumpNorm ) );
|
||||
|
|
|
|||
|
|
@ -70,6 +70,13 @@ void BumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
Var *bumpMap = getNormalMapTex();
|
||||
LangElement *texOp = NULL;
|
||||
|
||||
//if it's D3D11 let's create the texture object
|
||||
Var* bumpMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
bumpMapTex = (Var*)LangElement::find("bumpMapTex");
|
||||
}
|
||||
|
||||
// Handle atlased textures
|
||||
// http://www.infinity-universe.com/Infinity/index.php?option=com_content&task=view&id=65&Itemid=47
|
||||
if(fd.features[MFT_NormalMapAtlas])
|
||||
|
|
@ -127,18 +134,25 @@ void BumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
// Add a newline
|
||||
meta->addStatement( new GenOp( "\r\n" ) );
|
||||
|
||||
if(is_sm3)
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
texOp = new GenOp( "tex2Dlod(@, float4(@, 0.0, mipLod_bump))", bumpMap, texCoord );
|
||||
texOp = new GenOp("@.SampleLevel(@, @, mipLod_bump)", bumpMapTex, bumpMap, texCoord);
|
||||
}
|
||||
else if (is_sm3)
|
||||
{
|
||||
texOp = new GenOp("tex2Dlod(@, float4(@, 0.0, mipLod_bump))", bumpMap, texCoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
texOp = new GenOp( "tex2D(@, @)", bumpMap, texCoord );
|
||||
texOp = new GenOp("tex2D(@, @)", bumpMap, texCoord);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
texOp = new GenOp( "tex2D(@, @)", bumpMap, texCoord );
|
||||
if (mIsDirect3D11)
|
||||
texOp = new GenOp("@.Sample(@, @)", bumpMapTex, bumpMap, texCoord);
|
||||
else
|
||||
texOp = new GenOp("tex2D(@, @)", bumpMap, texCoord);
|
||||
}
|
||||
|
||||
Var *bumpNorm = new Var( "bumpNormal", "float4" );
|
||||
|
|
@ -156,8 +170,26 @@ void BumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
bumpMap->sampler = true;
|
||||
bumpMap->constNum = Var::getTexUnitNum();
|
||||
|
||||
Var* detailBumpTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
bumpMap->setType("SamplerState");
|
||||
detailBumpTex = new Var;
|
||||
detailBumpTex->setName("detailBumpTex");
|
||||
detailBumpTex->setType("Texture2D");
|
||||
detailBumpTex->uniform = true;
|
||||
detailBumpTex->texture = true;
|
||||
detailBumpTex->constNum = bumpMap->constNum;
|
||||
}
|
||||
else
|
||||
bumpMap->setType("sampler2D");
|
||||
|
||||
texCoord = getInTexCoord( "detCoord", "float2", true, componentList );
|
||||
texOp = new GenOp( "tex2D(@, @)", bumpMap, texCoord );
|
||||
|
||||
if (mIsDirect3D11)
|
||||
texOp = new GenOp("@.Sample(@, @)", detailBumpTex, bumpMap, texCoord);
|
||||
else
|
||||
texOp = new GenOp("tex2D(@, @)", bumpMap, texCoord);
|
||||
|
||||
Var *detailBump = new Var;
|
||||
detailBump->setName( "detailBump" );
|
||||
|
|
@ -345,17 +377,26 @@ void ParallaxFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
// Get the rest of our inputs.
|
||||
Var *parallaxInfo = _getUniformVar( "parallaxInfo", "float", cspPotentialPrimitive );
|
||||
Var *normalMap = getNormalMapTex();
|
||||
Var *bumpMapTexture = (Var*)LangElement::find("bumpMapTex");
|
||||
|
||||
// Call the library function to do the rest.
|
||||
if(fd.features.hasFeature( MFT_IsDXTnm, getProcessIndex() ))
|
||||
if (fd.features.hasFeature(MFT_IsDXTnm, getProcessIndex()))
|
||||
{
|
||||
meta->addStatement( new GenOp( " @.xy += parallaxOffsetDxtnm( @, @.xy, @, @ );\r\n",
|
||||
texCoord, normalMap, texCoord, negViewTS, parallaxInfo ) );
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffsetDxtnm( @, @, @.xy, @, @ );\r\n",
|
||||
texCoord, bumpMapTexture, normalMap, texCoord, negViewTS, parallaxInfo));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffsetDxtnm( @, @.xy, @, @ );\r\n",
|
||||
texCoord, normalMap, texCoord, negViewTS, parallaxInfo));
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement( new GenOp( " @.xy += parallaxOffset( @, @.xy, @, @ );\r\n",
|
||||
texCoord, normalMap, texCoord, negViewTS, parallaxInfo ) );
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffset( @, @, @.xy, @, @ );\r\n",
|
||||
texCoord, bumpMapTexture, normalMap, texCoord, negViewTS, parallaxInfo));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffset( @, @.xy, @, @ );\r\n",
|
||||
texCoord, normalMap, texCoord, negViewTS, parallaxInfo));
|
||||
}
|
||||
|
||||
// TODO: Fix second UV maybe?
|
||||
|
|
|
|||
|
|
@ -46,9 +46,13 @@ void ParaboloidVertTransformHLSL::processVert( Vector<ShaderComponent*> &compon
|
|||
ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
|
||||
|
||||
// Grab connector out position.
|
||||
Var *outPosition = connectComp->getElement( RT_POSITION );
|
||||
outPosition->setName( "hpos" );
|
||||
outPosition->setStructName( "OUT" );
|
||||
RegisterType type = RT_POSITION;
|
||||
if (mIsDirect3D11)
|
||||
type = RT_SVPOSITION;
|
||||
|
||||
Var *outPosition = connectComp->getElement(type);
|
||||
outPosition->setName("hpos");
|
||||
outPosition->setStructName("OUT");
|
||||
|
||||
// Get the atlas scale.
|
||||
Var *atlasScale = new Var;
|
||||
|
|
|
|||
|
|
@ -77,8 +77,12 @@ void PixelSpecularHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
{
|
||||
LangElement * lightMap = LangElement::find( "lightMap" );
|
||||
LangElement * lmCoord = LangElement::find( "texCoord2" );
|
||||
LangElement * lightMapTex = LangElement::find("lightMapTex"); //used only DX11 shaders
|
||||
|
||||
lmColor = new GenOp( "tex2D(@, @)", lightMap, lmCoord );
|
||||
if (lightMapTex)
|
||||
lmColor = new GenOp("@.Sample(@, @)", lightMapTex, lightMap, lmCoord);
|
||||
else
|
||||
lmColor = new GenOp("tex2D(@, @)", lightMap, lmCoord);
|
||||
}
|
||||
|
||||
final = new GenOp( "@ * float4(@.rgb,0)", specMul, lmColor );
|
||||
|
|
@ -138,11 +142,33 @@ void SpecularMapHLSL::processPix( Vector<ShaderComponent*> &componentList, const
|
|||
specularMap->uniform = true;
|
||||
specularMap->sampler = true;
|
||||
specularMap->constNum = Var::getTexUnitNum();
|
||||
LangElement *texOp = new GenOp( "tex2D(@, @)", specularMap, texCoord );
|
||||
Var *specularMapTex = NULL;
|
||||
|
||||
Var *specularColor = new Var( "specularColor", "float4" );
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
specularMap->setType("SamplerState");
|
||||
specularMapTex = new Var;
|
||||
specularMapTex->setName("specularMapTex");
|
||||
specularMapTex->setType("Texture2D");
|
||||
specularMapTex->uniform = true;
|
||||
specularMapTex->texture = true;
|
||||
specularMapTex->constNum = specularMap->constNum;
|
||||
}
|
||||
else
|
||||
{
|
||||
specularMap->setType("sampler2D");
|
||||
}
|
||||
|
||||
output = new GenOp( " @ = @;\r\n", new DecOp( specularColor ), texOp );
|
||||
LangElement *texOp = NULL;
|
||||
|
||||
if (specularMapTex)
|
||||
texOp = new GenOp("@.Sample(@, @)", specularMapTex, specularMap, texCoord);
|
||||
else
|
||||
texOp = new GenOp("tex2D(@, @)", specularMap, texCoord);
|
||||
|
||||
Var *specularColor = new Var("specularColor", "float4");
|
||||
|
||||
output = new GenOp(" @ = @;\r\n", new DecOp(specularColor), texOp);
|
||||
}
|
||||
|
||||
ShaderFeature::Resources SpecularMapHLSL::getResources( const MaterialFeatureData &fd )
|
||||
|
|
|
|||
|
|
@ -55,6 +55,25 @@ Var * ShaderConnectorHLSL::getIndexedElement( U32 index, RegisterType type, U32
|
|||
Var *newVar = new Var;
|
||||
mElementList.push_back( newVar );
|
||||
newVar->setConnectName( "POSITION" );
|
||||
newVar->rank = 0;
|
||||
return newVar;
|
||||
}
|
||||
|
||||
case RT_VPOS:
|
||||
{
|
||||
Var *newVar = new Var;
|
||||
mElementList.push_back(newVar);
|
||||
newVar->setConnectName("VPOS");
|
||||
newVar->rank = 0;
|
||||
return newVar;
|
||||
}
|
||||
|
||||
case RT_SVPOSITION:
|
||||
{
|
||||
Var *newVar = new Var;
|
||||
mElementList.push_back(newVar);
|
||||
newVar->setConnectName("SV_Position");
|
||||
newVar->rank = 0;
|
||||
return newVar;
|
||||
}
|
||||
|
||||
|
|
@ -63,6 +82,7 @@ Var * ShaderConnectorHLSL::getIndexedElement( U32 index, RegisterType type, U32
|
|||
Var *newVar = new Var;
|
||||
mElementList.push_back( newVar );
|
||||
newVar->setConnectName( "NORMAL" );
|
||||
newVar->rank = 1;
|
||||
return newVar;
|
||||
}
|
||||
|
||||
|
|
@ -71,6 +91,7 @@ Var * ShaderConnectorHLSL::getIndexedElement( U32 index, RegisterType type, U32
|
|||
Var *newVar = new Var;
|
||||
mElementList.push_back( newVar );
|
||||
newVar->setConnectName( "BINORMAL" );
|
||||
newVar->rank = 2;
|
||||
return newVar;
|
||||
}
|
||||
|
||||
|
|
@ -79,6 +100,7 @@ Var * ShaderConnectorHLSL::getIndexedElement( U32 index, RegisterType type, U32
|
|||
Var *newVar = new Var;
|
||||
mElementList.push_back( newVar );
|
||||
newVar->setConnectName( "TANGENT" );
|
||||
newVar->rank = 3;
|
||||
return newVar;
|
||||
}
|
||||
|
||||
|
|
@ -87,14 +109,7 @@ Var * ShaderConnectorHLSL::getIndexedElement( U32 index, RegisterType type, U32
|
|||
Var *newVar = new Var;
|
||||
mElementList.push_back( newVar );
|
||||
newVar->setConnectName( "COLOR" );
|
||||
return newVar;
|
||||
}
|
||||
|
||||
case RT_VPOS:
|
||||
{
|
||||
Var *newVar = new Var;
|
||||
mElementList.push_back( newVar );
|
||||
newVar->setConnectName( "VPOS" );
|
||||
newVar->rank = 4;
|
||||
return newVar;
|
||||
}
|
||||
|
||||
|
|
@ -113,6 +128,7 @@ Var * ShaderConnectorHLSL::getIndexedElement( U32 index, RegisterType type, U32
|
|||
newVar->setConnectName( out );
|
||||
newVar->constNum = index;
|
||||
newVar->arraySize = numElements;
|
||||
newVar->rank = 5 + index;
|
||||
|
||||
return newVar;
|
||||
}
|
||||
|
|
@ -124,67 +140,27 @@ Var * ShaderConnectorHLSL::getIndexedElement( U32 index, RegisterType type, U32
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
S32 QSORT_CALLBACK ShaderConnectorHLSL::_hlsl4VarSort(const void* e1, const void* e2)
|
||||
{
|
||||
Var* a = *((Var **)e1);
|
||||
Var* b = *((Var **)e2);
|
||||
|
||||
return a->rank - b->rank;
|
||||
}
|
||||
|
||||
void ShaderConnectorHLSL::sortVars()
|
||||
{
|
||||
if ( GFX->getPixelShaderVersion() >= 2.0 )
|
||||
|
||||
// If shader model 4+ than we gotta sort the vars to make sure the order is consistent
|
||||
if (GFX->getPixelShaderVersion() >= 4.f)
|
||||
{
|
||||
dQsort((void *)&mElementList[0], mElementList.size(), sizeof(Var *), _hlsl4VarSort);
|
||||
return;
|
||||
|
||||
// Sort connector variables - They must be sorted on hardware that is running
|
||||
// ps 1.4 and below. The reason is that texture coordinate registers MUST
|
||||
// map exactly to their respective texture stage. Ie. if you have fog
|
||||
// coordinates being passed into a pixel shader in texture coordinate register
|
||||
// number 4, the fog texture MUST reside in texture stage 4 for it to work.
|
||||
// The problem is solved by pushing non-texture coordinate data to the end
|
||||
// of the structure so that the texture coodinates are all at the "top" of the
|
||||
// structure in the order that the features are processed.
|
||||
|
||||
// create list of just the texCoords, sorting by 'mapsToSampler'
|
||||
Vector< Var * > texCoordList;
|
||||
|
||||
// - first pass is just coords mapped to a sampler
|
||||
for( U32 i=0; i<mElementList.size(); i++ )
|
||||
{
|
||||
Var *var = mElementList[i];
|
||||
if( var->mapsToSampler )
|
||||
{
|
||||
texCoordList.push_back( var );
|
||||
}
|
||||
}
|
||||
|
||||
// - next pass is for the others
|
||||
for( U32 i=0; i<mElementList.size(); i++ )
|
||||
{
|
||||
Var *var = mElementList[i];
|
||||
if( dStrstr( (const char *)var->connectName, "TEX" ) &&
|
||||
!var->mapsToSampler )
|
||||
{
|
||||
texCoordList.push_back( var );
|
||||
}
|
||||
}
|
||||
|
||||
// rename the connectNames
|
||||
for( U32 i=0; i<texCoordList.size(); i++ )
|
||||
{
|
||||
char out[32];
|
||||
dSprintf( (char*)out, sizeof(out), "TEXCOORD%d", i );
|
||||
texCoordList[i]->setConnectName( out );
|
||||
}
|
||||
|
||||
// write new, sorted list over old one
|
||||
if( texCoordList.size() )
|
||||
{
|
||||
U32 index = 0;
|
||||
|
||||
for( U32 i=0; i<mElementList.size(); i++ )
|
||||
{
|
||||
Var *var = mElementList[i];
|
||||
if( dStrstr( (const char *)var->connectName, "TEX" ) )
|
||||
{
|
||||
mElementList[i] = texCoordList[index];
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void ShaderConnectorHLSL::setName( char *newName )
|
||||
|
|
@ -246,7 +222,7 @@ void ParamsDefHLSL::assignConstantNumbers()
|
|||
Var *var = dynamic_cast<Var*>(LangElement::elementList[i]);
|
||||
if( var )
|
||||
{
|
||||
bool shaderConst = var->uniform && !var->sampler;
|
||||
bool shaderConst = var->uniform && !var->sampler && !var->texture;
|
||||
AssertFatal((!shaderConst) || var->constSortPos != cspUninit, "Const sort position has not been set, variable will not receive a constant number!!");
|
||||
if( shaderConst && var->constSortPos == bin)
|
||||
{
|
||||
|
|
@ -328,6 +304,10 @@ void PixelParamsDefHLSL::print( Stream &stream, bool isVerterShader )
|
|||
{
|
||||
dSprintf( (char*)varNum, sizeof(varNum), ": register(S%d)", var->constNum );
|
||||
}
|
||||
else if (var->texture)
|
||||
{
|
||||
dSprintf((char*)varNum, sizeof(varNum), ": register(T%d)", var->constNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
dSprintf( (char*)varNum, sizeof(varNum), ": register(C%d)", var->constNum );
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
class ShaderConnectorHLSL : public ShaderConnector
|
||||
{
|
||||
private:
|
||||
static S32 QSORT_CALLBACK _hlsl4VarSort(const void* e1, const void* e2);
|
||||
public:
|
||||
|
||||
// ShaderConnector
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ LangElement *ShaderFeatureHLSL::expandNormalMap( LangElement *sampleNormalOp,
|
|||
ShaderFeatureHLSL::ShaderFeatureHLSL()
|
||||
{
|
||||
output = NULL;
|
||||
mIsDirect3D11 = GFX->getAdapterType() == Direct3D11;
|
||||
}
|
||||
|
||||
Var * ShaderFeatureHLSL::getVertTexCoord( const String &name )
|
||||
|
|
@ -354,7 +355,7 @@ Var* ShaderFeatureHLSL::getOutTexCoord( const char *name,
|
|||
|
||||
if ( useTexAnim )
|
||||
{
|
||||
inTex->setType( "float4" );
|
||||
inTex->setType( "float2" );
|
||||
|
||||
// create texture mat var
|
||||
Var *texMat = new Var;
|
||||
|
|
@ -365,7 +366,7 @@ Var* ShaderFeatureHLSL::getOutTexCoord( const char *name,
|
|||
|
||||
// Statement allows for casting of different types which
|
||||
// eliminates vector truncation problems.
|
||||
String statement = String::ToString( " @ = (%s)mul(@, @).xy;\r\n", type );
|
||||
String statement = String::ToString(" @ = (%s)mul(@, float4(@,1,1));\r\n", type);
|
||||
meta->addStatement( new GenOp( statement, texCoord, texMat, inTex ) );
|
||||
}
|
||||
else
|
||||
|
|
@ -464,7 +465,17 @@ Var* ShaderFeatureHLSL::getInVpos( MultiLine *meta,
|
|||
|
||||
ShaderConnector *connectComp = dynamic_cast<ShaderConnector*>( componentList[C_CONNECTOR] );
|
||||
|
||||
if ( GFX->getPixelShaderVersion() >= 3.0f )
|
||||
F32 pixelShaderVer = GFX->getPixelShaderVersion();
|
||||
|
||||
if ( pixelShaderVer >= 4.0f )
|
||||
{
|
||||
inVpos = connectComp->getElement( RT_SVPOSITION );
|
||||
inVpos->setName( "vpos" );
|
||||
inVpos->setStructName( "IN" );
|
||||
inVpos->setType( "float4" );
|
||||
return inVpos;
|
||||
}
|
||||
else if ( pixelShaderVer >= 3.0f )
|
||||
{
|
||||
inVpos = connectComp->getElement( RT_VPOS );
|
||||
inVpos->setName( "vpos" );
|
||||
|
|
@ -516,15 +527,30 @@ Var* ShaderFeatureHLSL::getInViewToTangent( Vector<ShaderComponent*> &componentL
|
|||
|
||||
Var* ShaderFeatureHLSL::getNormalMapTex()
|
||||
{
|
||||
Var *normalMap = (Var*)LangElement::find( "bumpMap" );
|
||||
if ( !normalMap )
|
||||
Var *normalMap = (Var*)LangElement::find("bumpMap");
|
||||
if (!normalMap)
|
||||
{
|
||||
normalMap = new Var;
|
||||
normalMap->setType( "sampler2D" );
|
||||
normalMap->setName( "bumpMap" );
|
||||
normalMap->setType("sampler2D");
|
||||
normalMap->setName("bumpMap");
|
||||
normalMap->uniform = true;
|
||||
normalMap->sampler = true;
|
||||
normalMap->constNum = Var::getTexUnitNum();
|
||||
|
||||
// D3D11
|
||||
Var* normalMapTex = NULL;
|
||||
if (GFX->getAdapterType() == Direct3D11)
|
||||
{
|
||||
normalMap->setType("SamplerState");
|
||||
normalMapTex = new Var;
|
||||
normalMapTex->setName("bumpMapTex");
|
||||
normalMapTex->setType("Texture2D");
|
||||
normalMapTex->uniform = true;
|
||||
normalMapTex->texture = true;
|
||||
normalMapTex->constNum = normalMap->constNum;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return normalMap;
|
||||
|
|
@ -780,6 +806,7 @@ Var* ShaderFeatureHLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &compon
|
|||
|
||||
// Grab incoming texture coords.
|
||||
Var *inTex = getVertTexCoord( "texCoord" );
|
||||
inTex->setType("float2");
|
||||
|
||||
// create detail variable
|
||||
Var *detScale = new Var;
|
||||
|
|
@ -798,8 +825,6 @@ Var* ShaderFeatureHLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &compon
|
|||
|
||||
if ( useTexAnim )
|
||||
{
|
||||
inTex->setType( "float4" );
|
||||
|
||||
// Find or create the texture matrix.
|
||||
Var *texMat = (Var*)LangElement::find( "texMat" );
|
||||
if ( !texMat )
|
||||
|
|
@ -811,7 +836,7 @@ Var* ShaderFeatureHLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &compon
|
|||
texMat->constSortPos = cspPass;
|
||||
}
|
||||
|
||||
meta->addStatement( new GenOp( " @ = mul(@, @).xy * @;\r\n", outTex, texMat, inTex, detScale ) );
|
||||
meta->addStatement(new GenOp(" @ = mul(@, float4(@,1,1)).xy * @;\r\n", outTex, texMat, inTex, detScale));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -869,6 +894,19 @@ void DiffuseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
diffuseMap->sampler = true;
|
||||
diffuseMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var* diffuseMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
diffuseMap->setType("SamplerState");
|
||||
|
||||
diffuseMapTex = new Var;
|
||||
diffuseMapTex->setName("diffuseMapTex");
|
||||
diffuseMapTex->setType("Texture2D");
|
||||
diffuseMapTex->uniform = true;
|
||||
diffuseMapTex->texture = true;
|
||||
diffuseMapTex->constNum = diffuseMap->constNum;
|
||||
}
|
||||
|
||||
// create sample color
|
||||
Var *diffColor = new Var;
|
||||
diffColor->setType("float4");
|
||||
|
|
@ -880,13 +918,14 @@ void DiffuseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
if ( fd.features[MFT_CubeMap] )
|
||||
{
|
||||
meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n",
|
||||
colorDecl,
|
||||
diffuseMap,
|
||||
inTex ) );
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(" @ = @.Sample(@, @);\r\n", colorDecl, diffuseMapTex, diffuseMap, inTex));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = tex2D(@, @);\r\n", colorDecl, diffuseMap, inTex));
|
||||
|
||||
if (!fd.features[MFT_Imposter])
|
||||
meta->addStatement(new GenOp(" @ = toLinear(@);\r\n", diffColor, diffColor));
|
||||
|
||||
|
||||
meta->addStatement(new GenOp(" @;\r\n", assignColor(diffColor, Material::Mul, NULL, targ)));
|
||||
}
|
||||
else if(fd.features[MFT_DiffuseMapAtlas])
|
||||
|
|
@ -958,15 +997,19 @@ void DiffuseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(is_sm3)
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
meta->addStatement(new GenOp(" @ = @.SampleLevel(@,@,mipLod);\r\n",
|
||||
new DecOp(diffColor), diffuseMapTex, diffuseMap, inTex));
|
||||
}
|
||||
else if(is_sm3)
|
||||
{
|
||||
meta->addStatement(new GenOp( " @ = tex2Dlod(@, float4(@, 0.0, mipLod));\r\n",
|
||||
new DecOp(diffColor), diffuseMap, inTex));
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement(new GenOp( " @ = tex2D(@, @);\r\n",
|
||||
meta->addStatement(new GenOp( " @ = tex2D(@, @);\r\n",
|
||||
new DecOp(diffColor), diffuseMap, inTex));
|
||||
}
|
||||
if (!fd.features[MFT_Imposter])
|
||||
|
|
@ -976,7 +1019,11 @@ void DiffuseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement(new GenOp("@ = tex2D(@, @);\r\n", colorDecl, diffuseMap, inTex));
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp("@ = @.Sample(@, @);\r\n", colorDecl, diffuseMapTex, diffuseMap, inTex));
|
||||
else
|
||||
meta->addStatement(new GenOp("@ = tex2D(@, @);\r\n", colorDecl, diffuseMap, inTex));
|
||||
|
||||
if (!fd.features[MFT_Imposter])
|
||||
meta->addStatement(new GenOp(" @ = toLinear(@);\r\n", diffColor, diffColor));
|
||||
meta->addStatement(new GenOp(" @;\r\n", assignColor(diffColor, Material::Mul, NULL, targ)));
|
||||
|
|
@ -1067,7 +1114,24 @@ void OverlayTexFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
diffuseMap->sampler = true;
|
||||
diffuseMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
LangElement *statement = new GenOp( "tex2D(@, @)", diffuseMap, inTex );
|
||||
Var* diffuseMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
diffuseMap->setType("SamplerState");
|
||||
diffuseMapTex = new Var;
|
||||
diffuseMapTex->setName("overlayMapTex");
|
||||
diffuseMapTex->setType("Texture2D");
|
||||
diffuseMapTex->uniform = true;
|
||||
diffuseMapTex->texture = true;
|
||||
diffuseMapTex->constNum = diffuseMap->constNum;
|
||||
}
|
||||
|
||||
LangElement *statement = NULL;
|
||||
if (mIsDirect3D11)
|
||||
statement = new GenOp("@.Sample(@, @)", diffuseMapTex, diffuseMap, inTex);
|
||||
else
|
||||
statement = new GenOp("tex2D(@, @)", diffuseMap, inTex);
|
||||
|
||||
output = new GenOp( " @;\r\n", assignColor( statement, Material::LerpAlpha ) );
|
||||
}
|
||||
|
||||
|
|
@ -1240,6 +1304,17 @@ void LightmapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
lightMap->sampler = true;
|
||||
lightMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var *lightMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
lightMap->setType("SamplerState");
|
||||
lightMapTex->setName("lightMapTex");
|
||||
lightMapTex->setType("Texture2D");
|
||||
lightMapTex->uniform = true;
|
||||
lightMapTex->texture = true;
|
||||
lightMapTex->constNum = lightMap->constNum;
|
||||
}
|
||||
|
||||
|
||||
// argh, pixel specular should prob use this too
|
||||
if( fd.features[MFT_NormalMap] )
|
||||
|
|
@ -1249,7 +1324,10 @@ void LightmapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
lmColor->setType( "float4" );
|
||||
LangElement *lmColorDecl = new DecOp( lmColor );
|
||||
|
||||
output = new GenOp( " @ = tex2D(@, @);\r\n", lmColorDecl, lightMap, inTex );
|
||||
if (mIsDirect3D11)
|
||||
output = new GenOp(" @ = @.Sample(@, @);\r\n", lmColorDecl, lightMapTex, lightMap, inTex);
|
||||
else
|
||||
output = new GenOp(" @ = tex2D(@, @);\r\n", lmColorDecl, lightMap, inTex);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1269,16 +1347,26 @@ void LightmapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
// Lightmap has already been included in the advanced light bin, so
|
||||
// no need to do any sampling or anything
|
||||
if(bPreProcessedLighting)
|
||||
statement = new GenOp( "float4(@, 1.0)", inColor );
|
||||
if (bPreProcessedLighting)
|
||||
statement = new GenOp("float4(@, 1.0)", inColor);
|
||||
else
|
||||
statement = new GenOp( "tex2D(@, @) + float4(@.rgb, 0.0)", lightMap, inTex, inColor );
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
statement = new GenOp("@.Sample(@, @) + float4(@.rgb, 0.0)", lightMapTex, lightMap, inTex, inColor);
|
||||
else
|
||||
statement = new GenOp("tex2D(@, @) + float4(@.rgb, 0.0)", lightMap, inTex, inColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we still don't have it... then just sample the lightmap.
|
||||
if ( !statement )
|
||||
statement = new GenOp( "tex2D(@, @)", lightMap, inTex );
|
||||
if (!statement)
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
statement = new GenOp("@.Sample(@, @)", lightMapTex, lightMap, inTex);
|
||||
else
|
||||
statement = new GenOp("tex2D(@, @)", lightMap, inTex);
|
||||
}
|
||||
|
||||
// Assign to proper render target
|
||||
MultiLine *meta = new MultiLine;
|
||||
|
|
@ -1365,6 +1453,18 @@ void TonemapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
toneMap->sampler = true;
|
||||
toneMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var *toneMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
toneMap->setType("SamplerState");
|
||||
toneMapTex = new Var;
|
||||
toneMapTex->setName("toneMapTex");
|
||||
toneMapTex->setType("Texture2D");
|
||||
toneMapTex->uniform = true;
|
||||
toneMapTex->texture = true;
|
||||
toneMapTex->constNum = toneMap->constNum;
|
||||
}
|
||||
|
||||
MultiLine * meta = new MultiLine;
|
||||
|
||||
// First get the toneMap color
|
||||
|
|
@ -1373,7 +1473,10 @@ void TonemapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
toneMapColor->setName( "toneMapColor" );
|
||||
LangElement *toneMapColorDecl = new DecOp( toneMapColor );
|
||||
|
||||
meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n", toneMapColorDecl, toneMap, inTex2 ) );
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(" @ = @.Sample(@, @);\r\n", toneMapColorDecl, toneMapTex, toneMap, inTex2));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = tex2D(@, @);\r\n", toneMapColorDecl, toneMap, inTex2));
|
||||
|
||||
// We do a different calculation if there is a diffuse map or not
|
||||
Material::BlendOp blendOp = Material::Mul;
|
||||
|
|
@ -1602,6 +1705,18 @@ void DetailFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
detailMap->sampler = true;
|
||||
detailMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var* detailMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
detailMap->setType("SamplerState");
|
||||
detailMapTex = new Var;
|
||||
detailMapTex->setName("detailMapTex");
|
||||
detailMapTex->setType("Texture2D");
|
||||
detailMapTex->uniform = true;
|
||||
detailMapTex->texture = true;
|
||||
detailMapTex->constNum = detailMap->constNum;
|
||||
}
|
||||
|
||||
// We're doing the standard greyscale detail map
|
||||
// technique which can darken and lighten the
|
||||
// diffuse texture.
|
||||
|
|
@ -1609,7 +1724,12 @@ void DetailFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
// TODO: We could add a feature to toggle between this
|
||||
// and a simple multiplication with the detail map.
|
||||
|
||||
LangElement *statement = new GenOp( "( tex2D(@, @) * 2.0 ) - 1.0", detailMap, inTex );
|
||||
LangElement *statement = NULL;
|
||||
if (mIsDirect3D11)
|
||||
statement = new GenOp("( @.Sample(@, @) * 2.0 ) - 1.0", detailMapTex, detailMap, inTex);
|
||||
else
|
||||
statement = new GenOp("( tex2D(@, @) * 2.0 ) - 1.0", detailMap, inTex);
|
||||
|
||||
if ( fd.features[MFT_isDeferred])
|
||||
output = new GenOp( " @;\r\n", assignColor( statement, Material::Add, NULL, ShaderFeature::RenderTarget1 ) );
|
||||
else
|
||||
|
|
@ -1665,7 +1785,12 @@ void VertPositionHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
// grab connector position
|
||||
ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
|
||||
Var *outPosition = connectComp->getElement( RT_POSITION );
|
||||
Var *outPosition = NULL;
|
||||
if (mIsDirect3D11)
|
||||
outPosition = connectComp->getElement(RT_SVPOSITION);
|
||||
else
|
||||
outPosition = connectComp->getElement(RT_POSITION);
|
||||
|
||||
outPosition->setName( "hpos" );
|
||||
outPosition->setStructName( "OUT" );
|
||||
|
||||
|
|
@ -1679,6 +1804,19 @@ void VertPositionHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
output = meta;
|
||||
}
|
||||
|
||||
void VertPositionHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd)
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
// grab connector position
|
||||
ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>(componentList[C_CONNECTOR]);
|
||||
Var *outPosition = connectComp->getElement(RT_SVPOSITION);
|
||||
outPosition->setName("vpos");
|
||||
outPosition->setStructName("IN");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************
|
||||
// Reflect Cubemap
|
||||
|
|
@ -1738,8 +1876,11 @@ void ReflectCubeFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
cubeNormal->setType( "float3" );
|
||||
LangElement *cubeNormDecl = new DecOp( cubeNormal );
|
||||
|
||||
meta->addStatement( new GenOp( " @ = normalize( mul(@, float4(normalize(@),0.0)).xyz );\r\n",
|
||||
cubeNormDecl, cubeTrans, inNormal ) );
|
||||
meta->addStatement(new GenOp(" @ = ( mul( (@), float4(@, 0) ) ).xyz;\r\n",
|
||||
cubeNormDecl, cubeTrans, inNormal));
|
||||
|
||||
meta->addStatement(new GenOp(" @ = bool(length(@)) ? normalize(@) : @;\r\n",
|
||||
cubeNormal, cubeNormal, cubeNormal, cubeNormal));
|
||||
|
||||
// grab the eye position
|
||||
Var *eyePos = (Var*)LangElement::find( "eyePosWorld" );
|
||||
|
|
@ -1782,10 +1923,10 @@ void ReflectCubeFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
// current pass - we need to add one to the current pass to use
|
||||
// its alpha channel as a gloss map.
|
||||
if( !fd.features[MFT_DiffuseMap] &&
|
||||
!fd.features[MFT_NormalMap] )
|
||||
!fd.features[MFT_NormalMap])
|
||||
{
|
||||
if( fd.materialFeatures[MFT_DiffuseMap] ||
|
||||
fd.materialFeatures[MFT_NormalMap] )
|
||||
fd.materialFeatures[MFT_NormalMap])
|
||||
{
|
||||
// grab connector texcoord register
|
||||
Var *inTex = getInTexCoord( "texCoord", "float2", true, componentList );
|
||||
|
|
@ -1797,6 +1938,19 @@ void ReflectCubeFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
newMap->uniform = true;
|
||||
newMap->sampler = true;
|
||||
newMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var* glowMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
newMap->setType("SamplerState");
|
||||
|
||||
glowMapTex = new Var;
|
||||
glowMapTex->setName("glowMapTex");
|
||||
glowMapTex->setType("Texture2D");
|
||||
glowMapTex->uniform = true;
|
||||
glowMapTex->texture = true;
|
||||
glowMapTex->constNum = newMap->constNum;
|
||||
}
|
||||
|
||||
// create sample color
|
||||
Var *color = new Var;
|
||||
|
|
@ -1806,7 +1960,10 @@ void ReflectCubeFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
glossColor = color;
|
||||
|
||||
meta->addStatement( new GenOp( " @ = tex2D( @, @ );\r\n", colorDecl, newMap, inTex ) );
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(" @ = @.Sample( @, @ );\r\n", colorDecl, glowMapTex, newMap, inTex));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = tex2D( @, @ );\r\n", colorDecl, newMap, inTex));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1837,6 +1994,18 @@ void ReflectCubeFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
cubeMap->sampler = true;
|
||||
cubeMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var* cubeMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
cubeMap->setType("SamplerState");
|
||||
cubeMapTex = new Var;
|
||||
cubeMapTex->setName("cubeMapTex");
|
||||
cubeMapTex->setType("TextureCube"); // cubeMapTex->setType("TextureCube");
|
||||
cubeMapTex->uniform = true;
|
||||
cubeMapTex->texture = true;
|
||||
cubeMapTex->constNum = cubeMap->constNum;
|
||||
}
|
||||
|
||||
// TODO: Restore the lighting attenuation here!
|
||||
Var *attn = NULL;
|
||||
//if ( fd.materialFeatures[MFT_DynamicLight] )
|
||||
|
|
@ -1855,15 +2024,37 @@ void ReflectCubeFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
//LangElement *texCube = new GenOp( "texCUBElod( @, float4(@, min((1.0 - (@ / 128.0)) * 11.0 + 1.0, 8.0)) )", cubeMap, reflectVec, specPower );
|
||||
|
||||
if (fd.features[MFT_DeferredSpecMap])
|
||||
texCube = new GenOp("texCUBElod( @, float4(@, (@.a*5)) )", cubeMap, reflectVec, matinfo);
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
texCube = new GenOp("@.SampleLevel( @, @, @.a*5)", cubeMapTex, cubeMap, reflectVec, matinfo);
|
||||
else
|
||||
texCube = new GenOp("texCUBElod( @, float4(@, (@.a*5)) )", cubeMap, reflectVec, matinfo);
|
||||
}
|
||||
else
|
||||
texCube = new GenOp("texCUBElod( @, float4(@, ((1.0-@.a)*6)) )", cubeMap, reflectVec, matinfo);
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
texCube = new GenOp("@.SampleLevel( @, @, (1.0-@.a)*6 )", cubeMapTex, cubeMap, reflectVec, matinfo);
|
||||
else
|
||||
texCube = new GenOp("texCUBElod( @, float4(@, ((1.0-@.a)*6)) )", cubeMap, reflectVec, matinfo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (glossColor) //failing that, rtry and find color data
|
||||
texCube = new GenOp("texCUBElod( @, float4(@, @.a*5))", cubeMap, reflectVec, glossColor);
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
texCube = new GenOp("@.SampleLevel( @, @, @.a*5)", cubeMapTex, cubeMap, reflectVec, glossColor);
|
||||
else
|
||||
texCube = new GenOp("texCUBElod( @, float4(@, @.a*5))", cubeMap, reflectVec, glossColor);
|
||||
}
|
||||
else //failing *that*, just draw the cubemap
|
||||
texCube = new GenOp("texCUBE( @, @)", cubeMap, reflectVec);
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
texCube = new GenOp("@.Sample( @, @ )", cubeMapTex, cubeMap, reflectVec);
|
||||
else
|
||||
texCube = new GenOp("texCUBE( @, @ )", cubeMap, reflectVec);
|
||||
}
|
||||
}
|
||||
|
||||
LangElement *lerpVal = NULL;
|
||||
Material::BlendOp blendOp = Material::LerpAlpha;
|
||||
|
|
@ -1898,7 +2089,7 @@ void ReflectCubeFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
if (fd.features[MFT_DeferredSpecMap])
|
||||
meta->addStatement(new GenOp(" @.rgb = lerp( @.rgb, (@).rgb, (@.b));\r\n", targ, targ, texCube, lerpVal));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @.rgb = lerp( @.rgb, (@).rgb, (@.b));\r\n", targ, targ, texCube, lerpVal));
|
||||
meta->addStatement(new GenOp(" @.rgb = lerp( @.rgb, (@).rgb, (@.b*128/5));\r\n", targ, targ, texCube, lerpVal));
|
||||
}
|
||||
else
|
||||
meta->addStatement( new GenOp( " @;\r\n", assignColor( texCube, blendOp, lerpVal ) ) );
|
||||
|
|
@ -1951,7 +2142,7 @@ void ReflectCubeFeatHLSL::setTexData( Material::StageData &stageDat,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( stageDat.getCubemap() )
|
||||
{
|
||||
passData.mCubeMap = stageDat.getCubemap();
|
||||
|
|
@ -2397,7 +2588,8 @@ void VisibilityFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
// Everything else does a fizzle.
|
||||
Var *vPos = getInVpos( meta, componentList );
|
||||
meta->addStatement( new GenOp( " fizzle( @, @ );\r\n", vPos, visibility ) );
|
||||
// vpos is a float4 in d3d11
|
||||
meta->addStatement( new GenOp( " fizzle( @.xy, @ );\r\n", vPos, visibility ) );
|
||||
}
|
||||
|
||||
ShaderFeature::Resources VisibilityFeatHLSL::getResources( const MaterialFeatureData &fd )
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ struct RenderPassData;
|
|||
|
||||
class ShaderFeatureHLSL : public ShaderFeature
|
||||
{
|
||||
protected:
|
||||
bool mIsDirect3D11;
|
||||
public:
|
||||
ShaderFeatureHLSL();
|
||||
|
||||
|
|
@ -188,6 +190,9 @@ class VertPositionHLSL : public ShaderFeatureHLSL
|
|||
public:
|
||||
virtual void processVert( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd );
|
||||
|
||||
virtual void processPix( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd);
|
||||
|
||||
virtual String getName()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -63,21 +63,33 @@ void ShaderGenPrinterHLSL::printPixelShaderOutputStruct(Stream& stream, const Ma
|
|||
for( U32 i = 0; i < FEATUREMGR->getFeatureCount(); i++ )
|
||||
{
|
||||
const FeatureInfo &info = FEATUREMGR->getAt( i );
|
||||
if( featureData.features.hasFeature( *info.type ) )
|
||||
if ( featureData.features.hasFeature( *info.type ) )
|
||||
numMRTs |= info.feature->getOutputTargets( featureData );
|
||||
}
|
||||
|
||||
WRITESTR( "struct Fragout\r\n" );
|
||||
WRITESTR( "{\r\n" );
|
||||
WRITESTR( " float4 col : COLOR0;\r\n" );
|
||||
for( U32 i = 1; i < 4; i++ )
|
||||
WRITESTR("struct Fragout\r\n");
|
||||
WRITESTR("{\r\n");
|
||||
if (GFX->getAdapterType() == Direct3D11)
|
||||
{
|
||||
if( numMRTs & 1 << i )
|
||||
WRITESTR( avar( " float4 col%d : COLOR%d;\r\n", i, i ) );
|
||||
WRITESTR(" float4 col : SV_Target0;\r\n");
|
||||
for (U32 i = 1; i < 4; i++)
|
||||
{
|
||||
if (numMRTs & 1 << i)
|
||||
WRITESTR(avar(" float4 col%d : SV_Target%d;\r\n", i, i));
|
||||
}
|
||||
}
|
||||
WRITESTR( "};\r\n" );
|
||||
WRITESTR( "\r\n" );
|
||||
WRITESTR( "\r\n" );
|
||||
else
|
||||
{
|
||||
WRITESTR(" float4 col : COLOR0;\r\n");
|
||||
for (U32 i = 1; i < 4; i++)
|
||||
{
|
||||
if (numMRTs & 1 << i)
|
||||
WRITESTR(avar(" float4 col%d : COLOR%d;\r\n", i, i));
|
||||
}
|
||||
}
|
||||
WRITESTR("};\r\n");
|
||||
WRITESTR("\r\n");
|
||||
WRITESTR("\r\n");
|
||||
}
|
||||
|
||||
void ShaderGenPrinterHLSL::printPixelShaderCloser(Stream& stream)
|
||||
|
|
@ -141,8 +153,8 @@ ShaderComponent* ShaderGenComponentFactoryHLSL::createVertexInputConnector( cons
|
|||
}
|
||||
else if ( element.isSemantic( GFXSemantic::TANGENTW ) )
|
||||
{
|
||||
var = vertComp->getIndexedElement( element.getSemanticIndex(), RT_TEXCOORD );
|
||||
var->setName( "tangentW" );
|
||||
var = vertComp->getIndexedElement(element.getSemanticIndex(), RT_TEXCOORD);
|
||||
var->setName("tangentW");
|
||||
}
|
||||
else if ( element.isSemantic( GFXSemantic::BINORMAL ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ MODULE_BEGIN( ShaderGenHLSL )
|
|||
sInitDelegate.bind(_initShaderGenHLSL);
|
||||
SHADERGEN->registerInitDelegate(Direct3D9, sInitDelegate);
|
||||
SHADERGEN->registerInitDelegate(Direct3D9_360, sInitDelegate);
|
||||
SHADERGEN->registerInitDelegate(Direct3D11, sInitDelegate);
|
||||
}
|
||||
|
||||
MODULE_END;
|
||||
|
|
|
|||
|
|
@ -99,6 +99,8 @@ Var::Var()
|
|||
sampler = false;
|
||||
mapsToSampler = false;
|
||||
arraySize = 1;
|
||||
texture = false;
|
||||
rank = 0;
|
||||
}
|
||||
|
||||
Var::Var( const char *inName, const char *inType )
|
||||
|
|
@ -113,6 +115,8 @@ Var::Var( const char *inName, const char *inType )
|
|||
texCoordNum = 0;
|
||||
constSortPos = cspUninit;
|
||||
arraySize = 1;
|
||||
texture = false;
|
||||
rank = 0;
|
||||
|
||||
setName( inName );
|
||||
setType( inType );
|
||||
|
|
|
|||
|
|
@ -120,8 +120,10 @@ struct Var : public LangElement
|
|||
bool vertData; // argument coming from vertex data
|
||||
bool connector; // variable that will be passed to pixel shader
|
||||
bool sampler; // texture
|
||||
bool texture; //for D3D11 texture variables
|
||||
bool mapsToSampler; // for ps 1.x shaders - texcoords must be mapped to same sampler stage
|
||||
U32 arraySize; // 1 = no array, > 1 array of "type"
|
||||
U32 rank; // optional rank system to assist in sorting vars if needed
|
||||
|
||||
static U32 texUnitCount;
|
||||
static U32 getTexUnitNum(U32 numElements = 1);
|
||||
|
|
|
|||
|
|
@ -84,4 +84,9 @@ Var* ShaderFeature::findOrCreateLocal( const char *name,
|
|||
}
|
||||
|
||||
return outVar;
|
||||
}
|
||||
|
||||
void ShaderFeature::setInstancingFormat(GFXVertexFormat *format)
|
||||
{
|
||||
mInstancingFormat = format;
|
||||
}
|
||||
|
|
@ -99,11 +99,10 @@ protected:
|
|||
///
|
||||
S32 mProcessIndex;
|
||||
|
||||
public:
|
||||
|
||||
// TODO: Make this protected and give it a proper API.
|
||||
GFXVertexFormat *mInstancingFormat;
|
||||
|
||||
public:
|
||||
|
||||
//**************************************************************************
|
||||
/*!
|
||||
The Resources structure is used by ShaderFeature to indicate how many
|
||||
|
|
@ -293,6 +292,8 @@ public:
|
|||
static Var* findOrCreateLocal( const char *name,
|
||||
const char *type,
|
||||
MultiLine *multi );
|
||||
// Set the instancing format
|
||||
void setInstancingFormat(GFXVertexFormat *format);
|
||||
};
|
||||
|
||||
#endif // _SHADERFEATURE_H_
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ void ShaderGen::_processVertFeatures( Vector<GFXShaderMacro> ¯os, bool macro
|
|||
if ( macrosOnly )
|
||||
continue;
|
||||
|
||||
feature->mInstancingFormat = &mInstancingFormat;
|
||||
feature->setInstancingFormat( &mInstancingFormat );
|
||||
feature->processVert( mComponents, mFeatureData );
|
||||
|
||||
String line;
|
||||
|
|
@ -304,7 +304,7 @@ void ShaderGen::_processPixFeatures( Vector<GFXShaderMacro> ¯os, bool macros
|
|||
if ( macrosOnly )
|
||||
continue;
|
||||
|
||||
feature->mInstancingFormat = &mInstancingFormat;
|
||||
feature->setInstancingFormat( &mInstancingFormat );
|
||||
feature->processPix( mComponents, mFeatureData );
|
||||
|
||||
String line;
|
||||
|
|
@ -488,8 +488,7 @@ GFXShader* ShaderGen::getShader( const MaterialFeatureData &featureData, const G
|
|||
generateShader( featureData, vertFile, pixFile, &pixVersion, vertexFormat, cacheKey, shaderMacros );
|
||||
|
||||
GFXShader *shader = GFX->createShader();
|
||||
shader->mInstancingFormat.copy( mInstancingFormat ); // TODO: Move to init() below!
|
||||
if ( !shader->init( vertFile, pixFile, pixVersion, shaderMacros, samplers ) )
|
||||
if (!shader->init(vertFile, pixFile, pixVersion, shaderMacros, samplers, &mInstancingFormat))
|
||||
{
|
||||
delete shader;
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -396,9 +396,6 @@ void TerrainDetailMapFeatGLSL::processPix( Vector<ShaderComponent*> &component
|
|||
const S32 detailIndex = getProcessIndex();
|
||||
Var *inTex = getVertTexCoord( "texCoord" );
|
||||
|
||||
// new terrain
|
||||
bool hasNormal = fd.features.hasFeature(MFT_TerrainNormalMap, detailIndex);
|
||||
|
||||
MultiLine *meta = new MultiLine;
|
||||
|
||||
// We need the negative tangent space view vector
|
||||
|
|
@ -490,7 +487,6 @@ void TerrainDetailMapFeatGLSL::processPix( Vector<ShaderComponent*> &component
|
|||
blendDepth->constSortPos = cspPrimitive;
|
||||
}
|
||||
|
||||
Var *baseColor = (Var*)LangElement::find("baseColor");
|
||||
ShaderFeature::OutputTarget target = ShaderFeature::DefaultTarget;
|
||||
|
||||
if(fd.features.hasFeature( MFT_DeferredTerrainDetailMap ))
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace
|
|||
{
|
||||
void register_hlsl_shader_features_for_terrain(GFXAdapterType type)
|
||||
{
|
||||
if(type != Direct3D9 && type != Direct3D9_360)
|
||||
if (type != Direct3D9 && type != Direct3D9_360 && type != Direct3D11)
|
||||
return;
|
||||
|
||||
FEATUREMGR->registerFeature( MFT_TerrainBaseMap, new TerrainBaseMapFeatHLSL );
|
||||
|
|
@ -70,9 +70,9 @@ MODULE_END;
|
|||
|
||||
TerrainFeatHLSL::TerrainFeatHLSL()
|
||||
: mTorqueDep( "shaders/common/torque.hlsl" )
|
||||
{
|
||||
{
|
||||
addDependency( &mTorqueDep );
|
||||
}
|
||||
}
|
||||
|
||||
Var* TerrainFeatHLSL::_getUniformVar( const char *name, const char *type, ConstantSortPosition csp )
|
||||
{
|
||||
|
|
@ -129,14 +129,18 @@ Var* TerrainFeatHLSL::_getInMacroCoord( Vector<ShaderComponent*> &componentList
|
|||
|
||||
Var* TerrainFeatHLSL::_getNormalMapTex()
|
||||
{
|
||||
String name( String::ToString( "normalMap%d", getProcessIndex() ) );
|
||||
Var *normalMap = (Var*)LangElement::find( name );
|
||||
String name(String::ToString("normalMap%d", getProcessIndex()));
|
||||
Var *normalMap = (Var*)LangElement::find(name);
|
||||
|
||||
if ( !normalMap )
|
||||
if (!normalMap)
|
||||
{
|
||||
normalMap = new Var;
|
||||
normalMap->setType( "sampler2D" );
|
||||
normalMap->setName( name );
|
||||
if (mIsDirect3D11)
|
||||
normalMap->setType("SamplerState");
|
||||
else
|
||||
normalMap->setType("sampler2D");
|
||||
|
||||
normalMap->setName(name);
|
||||
normalMap->uniform = true;
|
||||
normalMap->sampler = true;
|
||||
normalMap->constNum = Var::getTexUnitNum();
|
||||
|
|
@ -267,12 +271,27 @@ void TerrainBaseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentLis
|
|||
Var *baseColor = new Var;
|
||||
baseColor->setType( "float4" );
|
||||
baseColor->setName( "baseColor" );
|
||||
meta->addStatement( new GenOp( " @ = tex2D( @, @.xy );\r\n", new DecOp( baseColor ), diffuseMap, texCoord ) );
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
diffuseMap->setType("SamplerState");
|
||||
Var *diffuseTex = new Var;
|
||||
diffuseTex->setType("Texture2D");
|
||||
diffuseTex->setName("baseTexture");
|
||||
diffuseTex->uniform = true;
|
||||
diffuseTex->texture = true;
|
||||
diffuseTex->constNum = diffuseMap->constNum;
|
||||
meta->addStatement(new GenOp(" @ = @.Sample( @, @.xy );\r\n", new DecOp(baseColor), diffuseTex, diffuseMap, texCoord));
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement(new GenOp(" @ = tex2D( @, @.xy );\r\n", new DecOp(baseColor), diffuseMap, texCoord));
|
||||
}
|
||||
|
||||
meta->addStatement(new GenOp(" @ = toLinear(@);\r\n", baseColor, baseColor));
|
||||
|
||||
ShaderFeature::OutputTarget target = ShaderFeature::DefaultTarget;
|
||||
ShaderFeature::OutputTarget target = ShaderFeature::DefaultTarget;
|
||||
|
||||
if (fd.features.hasFeature(MFT_isDeferred))
|
||||
if (fd.features.hasFeature(MFT_isDeferred))
|
||||
{
|
||||
target= ShaderFeature::RenderTarget1;
|
||||
}
|
||||
|
|
@ -433,9 +452,25 @@ void TerrainDetailMapFeatHLSL::processPix( Vector<ShaderComponent*> &component
|
|||
layerTex->sampler = true;
|
||||
layerTex->constNum = Var::getTexUnitNum();
|
||||
|
||||
// Read the layer texture to get the samples.
|
||||
meta->addStatement( new GenOp( " @ = round( tex2D( @, @.xy ) * 255.0f );\r\n",
|
||||
new DecOp( layerSample ), layerTex, inTex ) );
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
layerTex->setType("SamplerState");
|
||||
Var* layerTexObj = new Var;
|
||||
layerTexObj->setName("layerTexObj");
|
||||
layerTexObj->setType("Texture2D");
|
||||
layerTexObj->uniform = true;
|
||||
layerTexObj->texture = true;
|
||||
layerTexObj->constNum = layerTex->constNum;
|
||||
// Read the layer texture to get the samples.
|
||||
meta->addStatement(new GenOp(" @ = round( @.Sample( @, @.xy ) * 255.0f );\r\n",
|
||||
new DecOp(layerSample), layerTexObj, layerTex, inTex));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read the layer texture to get the samples.
|
||||
meta->addStatement(new GenOp(" @ = round( tex2D( @, @.xy ) * 255.0f );\r\n",
|
||||
new DecOp(layerSample), layerTex, inTex));
|
||||
}
|
||||
}
|
||||
|
||||
Var *layerSize = (Var*)LangElement::find( "layerSize" );
|
||||
|
|
@ -478,21 +513,52 @@ void TerrainDetailMapFeatHLSL::processPix( Vector<ShaderComponent*> &component
|
|||
|
||||
// If we had a parallax feature... then factor in the parallax
|
||||
// amount so that it fades out with the layer blending.
|
||||
if ( fd.features.hasFeature( MFT_TerrainParallaxMap, detailIndex ) )
|
||||
if (fd.features.hasFeature(MFT_TerrainParallaxMap, detailIndex))
|
||||
{
|
||||
// Get the rest of our inputs.
|
||||
Var *normalMap = _getNormalMapTex();
|
||||
|
||||
// Call the library function to do the rest.
|
||||
if(fd.features.hasFeature( MFT_IsDXTnm, detailIndex ) )
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
meta->addStatement( new GenOp( " @.xy += parallaxOffsetDxtnm( @, @.xy, @, @.z * @ );\r\n",
|
||||
inDet, normalMap, inDet, negViewTS, detailInfo, detailBlend ) );
|
||||
String name(String::ToString("normalMapTex%d", getProcessIndex()));
|
||||
Var *normalMapTex = (Var*)LangElement::find(name);
|
||||
|
||||
if (!normalMapTex)
|
||||
{
|
||||
normalMapTex = new Var;
|
||||
normalMapTex->setName(String::ToString("normalMapTex%d", getProcessIndex()));
|
||||
normalMapTex->setType("Texture2D");
|
||||
normalMapTex->uniform = true;
|
||||
normalMapTex->texture = true;
|
||||
normalMapTex->constNum = normalMap->constNum;
|
||||
}
|
||||
|
||||
// Call the library function to do the rest.
|
||||
if (fd.features.hasFeature(MFT_IsDXTnm, detailIndex))
|
||||
{
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffsetDxtnm( @, @, @.xy, @, @.z * @ );\r\n",
|
||||
inDet, normalMapTex, normalMap, inDet, negViewTS, detailInfo, detailBlend));
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffset( @, @, @.xy, @, @.z * @ );\r\n",
|
||||
inDet, normalMapTex, normalMap, inDet, negViewTS, detailInfo, detailBlend));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement( new GenOp( " @.xy += parallaxOffset( @, @.xy, @, @.z * @ );\r\n",
|
||||
inDet, normalMap, inDet, negViewTS, detailInfo, detailBlend ) );
|
||||
// Call the library function to do the rest.
|
||||
if (fd.features.hasFeature(MFT_IsDXTnm, detailIndex))
|
||||
{
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffsetDxtnm( @, @.xy, @, @.z * @ );\r\n",
|
||||
inDet, normalMap, inDet, negViewTS, detailInfo, detailBlend));
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffset( @, @.xy, @, @.z * @ );\r\n",
|
||||
inDet, normalMap, inDet, negViewTS, detailInfo, detailBlend));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -531,27 +597,46 @@ void TerrainDetailMapFeatHLSL::processPix( Vector<ShaderComponent*> &component
|
|||
//
|
||||
|
||||
//Sampled detail texture that is not expanded
|
||||
Var *detailTex = new Var;
|
||||
detailTex->setType("float4");
|
||||
detailTex->setName("detailTex");
|
||||
meta->addStatement( new GenOp( " @;\r\n", new DecOp( detailTex ) ) );
|
||||
|
||||
if ( fd.features.hasFeature( MFT_TerrainSideProject, detailIndex ) )
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
meta->addStatement( new GenOp(" @ = lerp( tex2D( @, @.yz ), tex2D( @, @.xz ), @.z);\r\n",detailTex,detailMap,inDet,detailMap,inDet,inTex));
|
||||
meta->addStatement( new GenOp( " @ = ( @ * 2.0 ) - 1.0;\r\n", detailColor, detailTex) );
|
||||
detailMap->setType("SamplerState");
|
||||
Var* detailTex = new Var;
|
||||
detailTex->setName(String::ToString("detailTex%d", detailIndex));
|
||||
detailTex->setType("Texture2D");
|
||||
detailTex->uniform = true;
|
||||
detailTex->texture = true;
|
||||
detailTex->constNum = detailMap->constNum;
|
||||
|
||||
if (fd.features.hasFeature(MFT_TerrainSideProject, detailIndex))
|
||||
{
|
||||
|
||||
meta->addStatement(new GenOp(" @ = ( lerp( @.Sample( @, @.yz ), @.Sample( @, @.xz ), @.z ) * 2.0 ) - 1.0;\r\n",
|
||||
detailColor, detailTex, detailMap, inDet, detailTex, detailMap, inDet, inTex));
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement(new GenOp(" @ = ( @.Sample( @, @.xy ) * 2.0 ) - 1.0;\r\n",
|
||||
detailColor, detailTex, detailMap, inDet));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement( new GenOp(" @ = tex2D(@,@.xy);\r\n",detailTex,detailMap,inDet));
|
||||
meta->addStatement( new GenOp( " @ = ( @ * 2.0 ) - 1.0;\r\n",
|
||||
detailColor, detailTex) );
|
||||
if (fd.features.hasFeature(MFT_TerrainSideProject, detailIndex))
|
||||
{
|
||||
|
||||
meta->addStatement(new GenOp(" @ = ( lerp( tex2D( @, @.yz ), tex2D( @, @.xz ), @.z ) * 2.0 ) - 1.0;\r\n",
|
||||
detailColor, detailMap, inDet, detailMap, inDet, inTex));
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement(new GenOp(" @ = ( tex2D( @, @.xy ) * 2.0 ) - 1.0;\r\n",
|
||||
detailColor, detailMap, inDet));
|
||||
}
|
||||
}
|
||||
|
||||
meta->addStatement( new GenOp( " @ *= @.y * @.w;\r\n",
|
||||
detailColor, detailInfo, inDet ) );
|
||||
|
||||
Var *baseColor = (Var*)LangElement::find( "baseColor" );
|
||||
ShaderFeature::OutputTarget target = ShaderFeature::DefaultTarget;
|
||||
|
||||
if(fd.features.hasFeature( MFT_DeferredTerrainDetailMap ))
|
||||
|
|
@ -718,8 +803,21 @@ void TerrainMacroMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentL
|
|||
layerTex->constNum = Var::getTexUnitNum();
|
||||
|
||||
// Read the layer texture to get the samples.
|
||||
meta->addStatement( new GenOp( " @ = round( tex2D( @, @.xy ) * 255.0f );\r\n",
|
||||
new DecOp( layerSample ), layerTex, inTex ) );
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
layerTex->setType("SamplerState");
|
||||
Var *layerTexObj = new Var;
|
||||
layerTexObj->setType("Texture2D");
|
||||
layerTexObj->setName("macroLayerTexObj");
|
||||
layerTexObj->uniform = true;
|
||||
layerTexObj->texture = true;
|
||||
layerTexObj->constNum = layerTex->constNum;
|
||||
meta->addStatement(new GenOp(" @ = round( @.Sample( @, @.xy ) * 255.0f );\r\n",
|
||||
new DecOp(layerSample), layerTexObj, layerTex, inTex));
|
||||
}
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = round( tex2D( @, @.xy ) * 255.0f );\r\n",
|
||||
new DecOp(layerSample), layerTex, inTex));
|
||||
}
|
||||
|
||||
Var *layerSize = (Var*)LangElement::find( "layerSize" );
|
||||
|
|
@ -752,7 +850,6 @@ void TerrainMacroMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentL
|
|||
if ( !blendTotal )
|
||||
{
|
||||
blendTotal = new Var;
|
||||
//blendTotal->setName( "blendTotal" );
|
||||
blendTotal->setName( "blendTotal" );
|
||||
blendTotal->setType( "float" );
|
||||
meta->addStatement( new GenOp( " @ = 0;\r\n", new DecOp( blendTotal ) ) );
|
||||
|
|
@ -778,6 +875,20 @@ void TerrainMacroMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentL
|
|||
detailMap->sampler = true;
|
||||
detailMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
//Create texture object for directx 11
|
||||
Var *detailTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
detailMap->setType("SamplerState");
|
||||
detailTex = new Var;
|
||||
detailTex->setName(String::ToString("macroMapTex%d", detailIndex));
|
||||
detailTex->setType("Texture2D");
|
||||
detailTex->uniform = true;
|
||||
detailTex->texture = true;
|
||||
detailTex->constNum = detailMap->constNum;
|
||||
|
||||
}
|
||||
|
||||
// If we're using SM 3.0 then take advantage of
|
||||
// dynamic branching to skip layers per-pixel.
|
||||
if ( GFX->getPixelShaderVersion() >= 3.0f )
|
||||
|
|
@ -792,22 +903,30 @@ void TerrainMacroMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentL
|
|||
// We take two color samples and lerp between them for
|
||||
// side projection layers... else a single sample.
|
||||
//
|
||||
if ( fd.features.hasFeature( MFT_TerrainSideProject, detailIndex ) )
|
||||
if (fd.features.hasFeature(MFT_TerrainSideProject, detailIndex))
|
||||
{
|
||||
meta->addStatement( new GenOp( " @ = ( lerp( tex2D( @, @.yz ), tex2D( @, @.xz ), @.z ) * 2.0 ) - 1.0;\r\n",
|
||||
detailColor, detailMap, inDet, detailMap, inDet, inTex ) );
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
meta->addStatement(new GenOp(" @ = ( lerp( @.Sample( @, @.yz ), @.Sample( @, @.xz ), @.z ) * 2.0 ) - 1.0;\r\n",
|
||||
detailColor, detailTex, detailMap, inDet, detailTex, detailMap, inDet, inTex));
|
||||
}
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = ( lerp( tex2D( @, @.yz ), tex2D( @, @.xz ), @.z ) * 2.0 ) - 1.0;\r\n",
|
||||
detailColor, detailMap, inDet, detailMap, inDet, inTex));
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement( new GenOp( " @ = ( tex2D( @, @.xy ) * 2.0 ) - 1.0;\r\n",
|
||||
detailColor, detailMap, inDet ) );
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(" @ = ( @.Sample( @, @.xy ) * 2.0 ) - 1.0;\r\n",
|
||||
detailColor, detailTex, detailMap, inDet));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = ( tex2D( @, @.xy ) * 2.0 ) - 1.0;\r\n",
|
||||
detailColor, detailMap, inDet));
|
||||
}
|
||||
|
||||
meta->addStatement( new GenOp( " @ *= @.y * @.w;\r\n",
|
||||
detailColor, detailInfo, inDet ) );
|
||||
|
||||
Var *baseColor = (Var*)LangElement::find( "baseColor" );
|
||||
|
||||
ShaderFeature::OutputTarget target = ShaderFeature::DefaultTarget;
|
||||
|
||||
if(fd.features.hasFeature(MFT_DeferredTerrainMacroMap))
|
||||
|
|
@ -907,13 +1026,39 @@ void TerrainNormalMapFeatHLSL::processPix( Vector<ShaderComponent*> &component
|
|||
// We take two normal samples and lerp between them for
|
||||
// side projection layers... else a single sample.
|
||||
LangElement *texOp;
|
||||
if ( fd.features.hasFeature( MFT_TerrainSideProject, normalIndex ) )
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
texOp = new GenOp( "lerp( tex2D( @, @.yz ), tex2D( @, @.xz ), @.z )",
|
||||
normalMap, inDet, normalMap, inDet, inTex );
|
||||
String name(String::ToString("normalMapTex%d", getProcessIndex()));
|
||||
Var *normalMapTex = (Var*)LangElement::find(name);
|
||||
if (!normalMapTex)
|
||||
{
|
||||
normalMapTex = new Var;
|
||||
normalMapTex->setName(String::ToString("normalMapTex%d", getProcessIndex()));
|
||||
normalMapTex->setType("Texture2D");
|
||||
normalMapTex->uniform = true;
|
||||
normalMapTex->texture = true;
|
||||
normalMapTex->constNum = normalMap->constNum;
|
||||
}
|
||||
if (fd.features.hasFeature(MFT_TerrainSideProject, normalIndex))
|
||||
{
|
||||
texOp = new GenOp("lerp( @.Sample( @, @.yz ), @.Sample( @, @.xz ), @.z )",
|
||||
normalMapTex, normalMap, inDet, normalMapTex, normalMap, inDet, inTex);
|
||||
}
|
||||
else
|
||||
texOp = new GenOp("@.Sample(@, @.xy)", normalMapTex, normalMap, inDet);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
texOp = new GenOp( "tex2D(@, @.xy)", normalMap, inDet );
|
||||
{
|
||||
if (fd.features.hasFeature(MFT_TerrainSideProject, normalIndex))
|
||||
{
|
||||
texOp = new GenOp("lerp( tex2D( @, @.yz ), tex2D( @, @.xz ), @.z )",
|
||||
normalMap, inDet, normalMap, inDet, inTex);
|
||||
}
|
||||
else
|
||||
texOp = new GenOp("tex2D(@, @.xy)", normalMap, inDet);
|
||||
}
|
||||
|
||||
// create bump normal
|
||||
Var *bumpNorm = new Var;
|
||||
|
|
@ -991,7 +1136,20 @@ void TerrainLightMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentLis
|
|||
meta->addStatement( new GenOp( " @ = 1;\r\n", new DecOp( lightMask ) ) );
|
||||
}
|
||||
|
||||
meta->addStatement( new GenOp( " @[0] = tex2D( @, @.xy ).r;\r\n", lightMask, lightMap, inTex ) );
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
lightMap->setType("SamplerState");
|
||||
Var* lightMapTex = new Var;
|
||||
lightMapTex->setName("lightMapTexObj");
|
||||
lightMapTex->setType("Texture2D");
|
||||
lightMapTex->uniform = true;
|
||||
lightMapTex->texture = true;
|
||||
lightMapTex->constNum = lightMap->constNum;
|
||||
meta->addStatement(new GenOp(" @[0] = @.Sample( @, @.xy ).r;\r\n", lightMask, lightMapTex, lightMap, inTex));
|
||||
}
|
||||
else
|
||||
meta->addStatement(new GenOp(" @[0] = tex2D( @, @.xy ).r;\r\n", lightMask, lightMap, inTex));
|
||||
|
||||
output = meta;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -208,14 +208,14 @@ void TerrainBlock::_updateBaseTexture(bool writeToCache)
|
|||
F32 copyOffsetY = 2.0f * GFX->getFillConventionOffset() / (F32)destSize.y;
|
||||
|
||||
GFXVertexPT points[4];
|
||||
points[0].point = Point3F( -1.0 - copyOffsetX, -1.0 + copyOffsetY, 0.0 );
|
||||
points[0].texCoord = Point2F( 0.0, 1.0f );
|
||||
points[1].point = Point3F( -1.0 - copyOffsetX, 1.0 + copyOffsetY, 0.0 );
|
||||
points[1].texCoord = Point2F( 0.0, 0.0f );
|
||||
points[2].point = Point3F( 1.0 - copyOffsetX, 1.0 + copyOffsetY, 0.0 );
|
||||
points[2].texCoord = Point2F( 1.0, 0.0f );
|
||||
points[3].point = Point3F( 1.0 - copyOffsetX, -1.0 + copyOffsetY, 0.0 );
|
||||
points[3].texCoord = Point2F( 1.0, 1.0f );
|
||||
points[0].point = Point3F(1.0 - copyOffsetX, -1.0 + copyOffsetY, 0.0);
|
||||
points[0].texCoord = Point2F(1.0, 1.0f);
|
||||
points[1].point = Point3F(1.0 - copyOffsetX, 1.0 + copyOffsetY, 0.0);
|
||||
points[1].texCoord = Point2F(1.0, 0.0f);
|
||||
points[2].point = Point3F(-1.0 - copyOffsetX, -1.0 + copyOffsetY, 0.0);
|
||||
points[2].texCoord = Point2F(0.0, 1.0f);
|
||||
points[3].point = Point3F(-1.0 - copyOffsetX, 1.0 + copyOffsetY, 0.0);
|
||||
points[3].texCoord = Point2F(0.0, 0.0f);
|
||||
|
||||
vb.set( GFX, 4, GFXBufferTypeVolatile );
|
||||
GFXVertexPT *ptr = vb.lock();
|
||||
|
|
@ -274,7 +274,7 @@ void TerrainBlock::_updateBaseTexture(bool writeToCache)
|
|||
mBaseShaderConsts->setSafe( mBaseTexScaleConst, Point2F( scale, -scale ) );
|
||||
mBaseShaderConsts->setSafe( mBaseTexIdConst, (F32)i );
|
||||
|
||||
GFX->drawPrimitive( GFXTriangleFan, 0, 2 );
|
||||
GFX->drawPrimitive( GFXTriangleStrip, 0, 2 );
|
||||
}
|
||||
|
||||
mBaseTarget->resolve();
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
# include "platformXbox/platformXbox.h"
|
||||
#endif
|
||||
|
||||
GFXPrimitiveType drawTypes[] = { GFXTriangleList, GFXTriangleStrip, GFXTriangleFan };
|
||||
GFXPrimitiveType drawTypes[] = { GFXTriangleList, GFXTriangleStrip };
|
||||
#define getDrawType(a) (drawTypes[a])
|
||||
|
||||
|
||||
|
|
@ -2442,7 +2442,6 @@ void TSMesh::_createVBIB( TSVertexBufferHandle &vb, GFXPrimitiveBufferHandle &pb
|
|||
break;
|
||||
|
||||
case GFXTriangleStrip:
|
||||
case GFXTriangleFan:
|
||||
pInfo.type = drawType;
|
||||
pInfo.numPrimitives = draw.numElements - 2;
|
||||
pInfo.startIndex = draw.start;
|
||||
|
|
@ -3006,17 +3005,6 @@ void TSMesh::createTangents(const Vector<Point3F> &_verts, const Vector<Point3F>
|
|||
}
|
||||
break;
|
||||
}
|
||||
case GFXTriangleFan:
|
||||
{
|
||||
p1Index = baseIdx[0];
|
||||
p2Index = baseIdx[1];
|
||||
for( U32 j = 2; j < numElements; j++ )
|
||||
{
|
||||
findTangent( p1Index, p2Index, baseIdx[j], tan0.address(), tan1, _verts );
|
||||
p2Index = baseIdx[j];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
AssertFatal( false, "TSMesh::createTangents: unknown primitive type!" );
|
||||
|
|
|
|||
|
|
@ -805,6 +805,8 @@ LRESULT PASCAL Win32Window::WindowProc( HWND hWnd, UINT message, WPARAM wParam,
|
|||
Con::warnf("Win32Window::WindowProc - resetting device due to window size change.");
|
||||
window->getGFXTarget()->resetMode();
|
||||
}
|
||||
|
||||
window->getScreenResChangeSignal().trigger(window, true);
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue