mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
Merge branch 'development' into navMess2
Conflicts: Engine/source/navigation/navMesh.cpp
This commit is contained in:
commit
554a871df9
151 changed files with 5453 additions and 394 deletions
|
|
@ -39,7 +39,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _TSSHAPE_H_
|
#ifndef _TSSHAPE_H_
|
||||||
#include "ts/TSShape.h"
|
#include "ts/tsShape.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef __RESOURCE_H__
|
#ifndef __RESOURCE_H__
|
||||||
#include "core/resource.h"
|
#include "core/resource.h"
|
||||||
|
|
|
||||||
|
|
@ -284,6 +284,7 @@ void DecalData::unpackData( BitStream *stream )
|
||||||
Parent::unpackData( stream );
|
Parent::unpackData( stream );
|
||||||
|
|
||||||
stream->read( &lookupName );
|
stream->read( &lookupName );
|
||||||
|
assignName(lookupName);
|
||||||
stream->read( &size );
|
stream->read( &size );
|
||||||
stream->read( &materialName );
|
stream->read( &materialName );
|
||||||
_updateMaterial();
|
_updateMaterial();
|
||||||
|
|
|
||||||
|
|
@ -4659,9 +4659,9 @@ Point3F Player::_move( const F32 travelTime, Collision *outCol )
|
||||||
}
|
}
|
||||||
Point3F distance = end - start;
|
Point3F distance = end - start;
|
||||||
|
|
||||||
if (mFabs(distance.x) < mObjBox.len_x() &&
|
if (mFabs(distance.x) < mScaledBox.len_x() &&
|
||||||
mFabs(distance.y) < mObjBox.len_y() &&
|
mFabs(distance.y) < mScaledBox.len_y() &&
|
||||||
mFabs(distance.z) < mObjBox.len_z())
|
mFabs(distance.z) < mScaledBox.len_z())
|
||||||
{
|
{
|
||||||
// We can potentially early out of this. If there are no polys in the clipped polylist at our
|
// We can potentially early out of this. If there are no polys in the clipped polylist at our
|
||||||
// end position, then we can bail, and just set start = end;
|
// end position, then we can bail, and just set start = end;
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,9 @@ ConsoleDocClass( TSStatic,
|
||||||
);
|
);
|
||||||
|
|
||||||
TSStatic::TSStatic()
|
TSStatic::TSStatic()
|
||||||
|
:
|
||||||
|
cubeDescId( 0 ),
|
||||||
|
reflectorDesc( NULL )
|
||||||
{
|
{
|
||||||
mNetFlags.set(Ghostable | ScopeAlways);
|
mNetFlags.set(Ghostable | ScopeAlways);
|
||||||
|
|
||||||
|
|
@ -186,6 +189,11 @@ void TSStatic::initPersistFields()
|
||||||
|
|
||||||
endGroup("Rendering");
|
endGroup("Rendering");
|
||||||
|
|
||||||
|
addGroup( "Reflection" );
|
||||||
|
addField( "cubeReflectorDesc", TypeRealString, Offset( cubeDescName, TSStatic ),
|
||||||
|
"References a ReflectorDesc datablock that defines performance and quality properties for dynamic reflections.\n");
|
||||||
|
endGroup( "Reflection" );
|
||||||
|
|
||||||
addGroup("Collision");
|
addGroup("Collision");
|
||||||
|
|
||||||
addField( "collisionType", TypeTSMeshType, Offset( mCollisionType, TSStatic ),
|
addField( "collisionType", TypeTSMeshType, Offset( mCollisionType, TSStatic ),
|
||||||
|
|
@ -292,6 +300,14 @@ bool TSStatic::onAdd()
|
||||||
|
|
||||||
addToScene();
|
addToScene();
|
||||||
|
|
||||||
|
if ( isClientObject() )
|
||||||
|
{
|
||||||
|
mCubeReflector.unregisterReflector();
|
||||||
|
|
||||||
|
if ( reflectorDesc )
|
||||||
|
mCubeReflector.registerReflector( this, reflectorDesc );
|
||||||
|
}
|
||||||
|
|
||||||
_updateShouldTick();
|
_updateShouldTick();
|
||||||
|
|
||||||
// Accumulation
|
// Accumulation
|
||||||
|
|
@ -357,6 +373,16 @@ bool TSStatic::_createShape()
|
||||||
if ( mAmbientThread )
|
if ( mAmbientThread )
|
||||||
mShapeInstance->setSequence( mAmbientThread, ambientSeq, 0);
|
mShapeInstance->setSequence( mAmbientThread, ambientSeq, 0);
|
||||||
|
|
||||||
|
// Resolve CubeReflectorDesc.
|
||||||
|
if ( cubeDescName.isNotEmpty() )
|
||||||
|
{
|
||||||
|
Sim::findObject( cubeDescName, reflectorDesc );
|
||||||
|
}
|
||||||
|
else if( cubeDescId > 0 )
|
||||||
|
{
|
||||||
|
Sim::findObject( cubeDescId, reflectorDesc );
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -429,6 +455,8 @@ void TSStatic::onRemove()
|
||||||
mShapeInstance = NULL;
|
mShapeInstance = NULL;
|
||||||
|
|
||||||
mAmbientThread = NULL;
|
mAmbientThread = NULL;
|
||||||
|
if ( isClientObject() )
|
||||||
|
mCubeReflector.unregisterReflector();
|
||||||
|
|
||||||
Parent::onRemove();
|
Parent::onRemove();
|
||||||
}
|
}
|
||||||
|
|
@ -561,6 +589,12 @@ void TSStatic::prepRenderImage( SceneRenderState* state )
|
||||||
|
|
||||||
F32 invScale = (1.0f/getMax(getMax(mObjScale.x,mObjScale.y),mObjScale.z));
|
F32 invScale = (1.0f/getMax(getMax(mObjScale.x,mObjScale.y),mObjScale.z));
|
||||||
|
|
||||||
|
// If we're currently rendering our own reflection we
|
||||||
|
// don't want to render ourselves into it.
|
||||||
|
if ( mCubeReflector.isRendering() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
if ( mForceDetail == -1 )
|
if ( mForceDetail == -1 )
|
||||||
mShapeInstance->setDetailFromDistance( state, dist * invScale );
|
mShapeInstance->setDetailFromDistance( state, dist * invScale );
|
||||||
else
|
else
|
||||||
|
|
@ -577,6 +611,9 @@ void TSStatic::prepRenderImage( SceneRenderState* state )
|
||||||
rdata.setFadeOverride( 1.0f );
|
rdata.setFadeOverride( 1.0f );
|
||||||
rdata.setOriginSort( mUseOriginSort );
|
rdata.setOriginSort( mUseOriginSort );
|
||||||
|
|
||||||
|
if ( mCubeReflector.isEnabled() )
|
||||||
|
rdata.setCubemap( mCubeReflector.getCubemap() );
|
||||||
|
|
||||||
// Acculumation
|
// Acculumation
|
||||||
rdata.setAccuTex(mAccuTex);
|
rdata.setAccuTex(mAccuTex);
|
||||||
|
|
||||||
|
|
@ -604,6 +641,20 @@ void TSStatic::prepRenderImage( SceneRenderState* state )
|
||||||
mat.scale( mObjScale );
|
mat.scale( mObjScale );
|
||||||
GFX->setWorldMatrix( mat );
|
GFX->setWorldMatrix( mat );
|
||||||
|
|
||||||
|
if ( state->isDiffusePass() && mCubeReflector.isEnabled() && mCubeReflector.getOcclusionQuery() )
|
||||||
|
{
|
||||||
|
RenderPassManager *pass = state->getRenderPass();
|
||||||
|
OccluderRenderInst *ri = pass->allocInst<OccluderRenderInst>();
|
||||||
|
|
||||||
|
ri->type = RenderPassManager::RIT_Occluder;
|
||||||
|
ri->query = mCubeReflector.getOcclusionQuery();
|
||||||
|
mObjToWorld.mulP( mObjBox.getCenter(), &ri->position );
|
||||||
|
ri->scale.set( mObjBox.getExtents() );
|
||||||
|
ri->orientation = pass->allocUniqueXform( mObjToWorld );
|
||||||
|
ri->isSphere = false;
|
||||||
|
state->getRenderPass()->addInst( ri );
|
||||||
|
}
|
||||||
|
|
||||||
mShapeInstance->animate();
|
mShapeInstance->animate();
|
||||||
if(mShapeInstance)
|
if(mShapeInstance)
|
||||||
{
|
{
|
||||||
|
|
@ -715,6 +766,10 @@ U32 TSStatic::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
||||||
if ( mLightPlugin )
|
if ( mLightPlugin )
|
||||||
retMask |= mLightPlugin->packUpdate(this, AdvancedStaticOptionsMask, con, mask, stream);
|
retMask |= mLightPlugin->packUpdate(this, AdvancedStaticOptionsMask, con, mask, stream);
|
||||||
|
|
||||||
|
if( stream->writeFlag( reflectorDesc != NULL ) )
|
||||||
|
{
|
||||||
|
stream->writeRangedU32( reflectorDesc->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast );
|
||||||
|
}
|
||||||
return retMask;
|
return retMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -782,6 +837,11 @@ void TSStatic::unpackUpdate(NetConnection *con, BitStream *stream)
|
||||||
mLightPlugin->unpackUpdate(this, con, stream);
|
mLightPlugin->unpackUpdate(this, con, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( stream->readFlag() )
|
||||||
|
{
|
||||||
|
cubeDescId = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );
|
||||||
|
}
|
||||||
|
|
||||||
if ( isProperlyAdded() )
|
if ( isProperlyAdded() )
|
||||||
_updateShouldTick();
|
_updateShouldTick();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,10 @@
|
||||||
#include "ts/tsShape.h"
|
#include "ts/tsShape.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _REFLECTOR_H_
|
||||||
|
#include "scene/reflector.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class TSShapeInstance;
|
class TSShapeInstance;
|
||||||
class TSThread;
|
class TSThread;
|
||||||
class TSStatic;
|
class TSStatic;
|
||||||
|
|
@ -147,6 +151,11 @@ protected:
|
||||||
/// Start or stop processing ticks depending on our state.
|
/// Start or stop processing ticks depending on our state.
|
||||||
void _updateShouldTick();
|
void _updateShouldTick();
|
||||||
|
|
||||||
|
String cubeDescName;
|
||||||
|
U32 cubeDescId;
|
||||||
|
ReflectorDesc *reflectorDesc;
|
||||||
|
CubeReflector mCubeReflector;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Convex *mConvexList;
|
Convex *mConvexList;
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
#include "console/simObjectRef.h"
|
#include "console/simObjectRef.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef TINYXML_INCLUDED
|
#ifndef TINYXML_INCLUDED
|
||||||
#include "tinyXML/tinyxml.h"
|
#include "tinyxml.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// @file
|
/// @file
|
||||||
|
|
@ -434,10 +434,6 @@ public:
|
||||||
/// This is a function pointer typedef to support optional writing for fields.
|
/// This is a function pointer typedef to support optional writing for fields.
|
||||||
typedef bool(*WriteDataNotify)(void* obj, StringTableEntry pFieldName);
|
typedef bool(*WriteDataNotify)(void* obj, StringTableEntry pFieldName);
|
||||||
|
|
||||||
/// Allows the writing of a custom TAML schema.
|
|
||||||
typedef void(*WriteCustomTamlSchema)(const AbstractClassRep* pClassRep, TiXmlElement* pParentElement);
|
|
||||||
|
|
||||||
|
|
||||||
/// These are special field type values used to mark
|
/// These are special field type values used to mark
|
||||||
/// groups and arrays in the field list.
|
/// groups and arrays in the field list.
|
||||||
/// @see Field::type
|
/// @see Field::type
|
||||||
|
|
|
||||||
|
|
@ -503,6 +503,7 @@ inline ColorI& ColorI::operator*=(const S32 in_mul)
|
||||||
|
|
||||||
inline ColorI& ColorI::operator/=(const S32 in_mul)
|
inline ColorI& ColorI::operator/=(const S32 in_mul)
|
||||||
{
|
{
|
||||||
|
AssertFatal(in_mul != 0.0f, "Error, div by zero...");
|
||||||
red = red / in_mul;
|
red = red / in_mul;
|
||||||
green = green / in_mul;
|
green = green / in_mul;
|
||||||
blue = blue / in_mul;
|
blue = blue / in_mul;
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ bool Stream::writeFormattedBuffer(const char *format, ...)
|
||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
const S32 length = vsprintf(buffer, format, args);
|
const S32 length = dVsprintf(buffer, sizeof(buffer), format, args);
|
||||||
|
|
||||||
// Sanity!
|
// Sanity!
|
||||||
AssertFatal(length <= sizeof(buffer), "writeFormattedBuffer - String format exceeded buffer size. This will cause corruption.");
|
AssertFatal(length <= sizeof(buffer), "writeFormattedBuffer - String format exceeded buffer size. This will cause corruption.");
|
||||||
|
|
|
||||||
1319
Engine/source/environment/VolumetricFog.cpp
Normal file
1319
Engine/source/environment/VolumetricFog.cpp
Normal file
File diff suppressed because it is too large
Load diff
243
Engine/source/environment/VolumetricFog.h
Normal file
243
Engine/source/environment/VolumetricFog.h
Normal file
|
|
@ -0,0 +1,243 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef _VolumetricFog_H_
|
||||||
|
#define _VolumetricFog_H_
|
||||||
|
|
||||||
|
#ifndef _SCENEOBJECT_H_
|
||||||
|
#include "scene/sceneObject.h"
|
||||||
|
#endif
|
||||||
|
#ifndef _MATTEXTURETARGET_H_
|
||||||
|
#include "materials/matTextureTarget.h"
|
||||||
|
#endif
|
||||||
|
#ifndef _GFXSHADER_H_
|
||||||
|
#include "gfx/gfxShader.h"
|
||||||
|
#endif
|
||||||
|
#ifndef _GFXTARGET_H_
|
||||||
|
#include "gfx/gfxTarget.h"
|
||||||
|
#endif
|
||||||
|
#ifndef _GFXVERTEXBUFFER_H_
|
||||||
|
#include "gfx/gfxVertexBuffer.h"
|
||||||
|
#endif
|
||||||
|
#ifndef _TSSHAPE_H_
|
||||||
|
#include "ts/tsShape.h"
|
||||||
|
#endif
|
||||||
|
#ifndef _POST_EFFECT_H_
|
||||||
|
#include "postFx/postEffect.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gui/core/guiCanvas.h"
|
||||||
|
|
||||||
|
class VolumetricFogRTManager;
|
||||||
|
|
||||||
|
class VolumetricFog : public SceneObject
|
||||||
|
{
|
||||||
|
typedef SceneObject Parent;
|
||||||
|
|
||||||
|
// Maskbits for updating
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
VolumetricFogMask = Parent::NextFreeMask,
|
||||||
|
FogColorMask = Parent::NextFreeMask << 1,
|
||||||
|
FogDensityMask = Parent::NextFreeMask << 2,
|
||||||
|
FogModulationMask = Parent::NextFreeMask << 3,
|
||||||
|
FogPostFXMask = Parent::NextFreeMask << 4,
|
||||||
|
FogShapeMask = Parent::NextFreeMask << 5,
|
||||||
|
NextFreeMask = Parent::NextFreeMask << 6
|
||||||
|
};
|
||||||
|
|
||||||
|
// Struct which holds the shape details
|
||||||
|
struct meshes
|
||||||
|
{
|
||||||
|
F32 det_size;
|
||||||
|
S32 sub_shape;
|
||||||
|
S32 obj_det;
|
||||||
|
U32 num_verts;
|
||||||
|
GFXVertexPNTT *verts;
|
||||||
|
Vector <GFXPrimitive> *piArray;
|
||||||
|
Vector <U32> *indices;
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Rendertargets;
|
||||||
|
GFXTextureTargetRef z_buf;
|
||||||
|
NamedTexTargetRef mPrepassTarget;
|
||||||
|
NamedTexTargetRef mDepthBufferTarget;
|
||||||
|
NamedTexTargetRef mFrontBufferTarget;
|
||||||
|
|
||||||
|
// Fog Modulation texture
|
||||||
|
GFXTexHandle mTexture;
|
||||||
|
|
||||||
|
// Shaders
|
||||||
|
GFXShaderRef mShader;
|
||||||
|
GFXShaderRef mPrePassShader;
|
||||||
|
GFXShaderRef mReflectionShader;
|
||||||
|
|
||||||
|
// Stateblocks
|
||||||
|
GFXStateBlockDesc descD;
|
||||||
|
GFXStateBlockDesc descF;
|
||||||
|
GFXStateBlockDesc desc_preD;
|
||||||
|
GFXStateBlockDesc desc_preF;
|
||||||
|
GFXStateBlockDesc desc_refl;
|
||||||
|
|
||||||
|
GFXStateBlockRef mStateblockD;
|
||||||
|
GFXStateBlockRef mStateblockF;
|
||||||
|
GFXStateBlockRef mStateblock_preD;
|
||||||
|
GFXStateBlockRef mStateblock_preF;
|
||||||
|
GFXStateBlockRef mStateblock_refl;
|
||||||
|
|
||||||
|
// Shaderconstants
|
||||||
|
GFXShaderConstBufferRef mShaderConsts;
|
||||||
|
GFXShaderConstHandle *mModelViewProjSC;
|
||||||
|
GFXShaderConstHandle *mFadeSizeSC;
|
||||||
|
GFXShaderConstHandle *mFogColorSC;
|
||||||
|
GFXShaderConstHandle *mFogDensitySC;
|
||||||
|
GFXShaderConstHandle *mPreBias;
|
||||||
|
GFXShaderConstHandle *mAccumTime;
|
||||||
|
GFXShaderConstHandle *mIsTexturedSC;
|
||||||
|
GFXShaderConstHandle *mModSpeedSC;
|
||||||
|
GFXShaderConstHandle *mModStrengthSC;
|
||||||
|
GFXShaderConstHandle *mViewPointSC;
|
||||||
|
GFXShaderConstHandle *mTexScaleSC;
|
||||||
|
GFXShaderConstHandle *mTexTilesSC;
|
||||||
|
|
||||||
|
GFXShaderConstBufferRef mPPShaderConsts;
|
||||||
|
GFXShaderConstHandle *mPPModelViewProjSC;
|
||||||
|
|
||||||
|
GFXShaderConstHandle *mAmbientColorSC;
|
||||||
|
|
||||||
|
GFXShaderConstBufferRef mReflShaderConsts;
|
||||||
|
GFXShaderConstHandle *mReflModelViewProjSC;
|
||||||
|
GFXShaderConstHandle *mReflFogColorSC;
|
||||||
|
GFXShaderConstHandle *mReflFogDensitySC;
|
||||||
|
GFXShaderConstHandle *mReflFogStrengthSC;
|
||||||
|
|
||||||
|
// Vertex and Prim. Buffer
|
||||||
|
GFXVertexBufferHandle<GFXVertexPNTT> mVB;
|
||||||
|
GFXPrimitiveBufferHandle mPB;
|
||||||
|
|
||||||
|
// Fog volume data;
|
||||||
|
StringTableEntry mShapeName;
|
||||||
|
ColorI mFogColor;
|
||||||
|
F32 mFogDensity;
|
||||||
|
bool mIgnoreWater;
|
||||||
|
bool mReflect;
|
||||||
|
Vector<meshes> det_size;
|
||||||
|
bool mShapeLoaded;
|
||||||
|
F32 mPixelSize;
|
||||||
|
F32 mFadeSize;
|
||||||
|
U32 mCurDetailLevel;
|
||||||
|
U32 mNumDetailLevels;
|
||||||
|
F32 mObjSize;
|
||||||
|
F32 mRadius;
|
||||||
|
OrientedBox3F ColBox;
|
||||||
|
VectorF mObjScale;
|
||||||
|
F32 mMinDisplaySize;
|
||||||
|
F32 mInvScale;
|
||||||
|
|
||||||
|
// Fog Modulation data
|
||||||
|
String mTextureName;
|
||||||
|
bool mIsTextured;
|
||||||
|
F32 mTexTiles;
|
||||||
|
F32 mStrength;
|
||||||
|
Point2F mSpeed1;
|
||||||
|
Point2F mSpeed2;
|
||||||
|
Point4F mSpeed;
|
||||||
|
Point2F mTexScale;
|
||||||
|
|
||||||
|
// Fog Rendering data
|
||||||
|
Point3F camPos;
|
||||||
|
Point2F mViewPoint;
|
||||||
|
F32 mFOV;
|
||||||
|
F32 viewDist;
|
||||||
|
bool mIsVBDirty;
|
||||||
|
bool mIsPBDirty;
|
||||||
|
bool mCamInFog;
|
||||||
|
bool mResizing;
|
||||||
|
PlatformWindow *mPlatformWindow;
|
||||||
|
|
||||||
|
// Reflections
|
||||||
|
F32 mFogReflStrength;
|
||||||
|
|
||||||
|
// PostFX
|
||||||
|
PostEffect *glowFX;
|
||||||
|
bool mUseGlow;
|
||||||
|
F32 mGlowStrength;
|
||||||
|
U8 mGlowing;
|
||||||
|
F32 mCurGlow;
|
||||||
|
|
||||||
|
bool mModifLightRays;
|
||||||
|
F32 mLightRayMod;
|
||||||
|
F32 mOldLightRayStrength;
|
||||||
|
|
||||||
|
GameConnection* conn;
|
||||||
|
U32 mCounter;
|
||||||
|
|
||||||
|
void ResizeRT(PlatformWindow *win, bool resize);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Protected methods
|
||||||
|
bool onAdd();
|
||||||
|
void onRemove();
|
||||||
|
void handleResize(VolumetricFogRTManager *RTM, bool resize);
|
||||||
|
void handleCanvasResize(GuiCanvas* canvas);
|
||||||
|
|
||||||
|
bool LoadShape();
|
||||||
|
bool setupRenderer();
|
||||||
|
void InitTexture();
|
||||||
|
bool UpdateBuffers(U32 dl,bool force=true);
|
||||||
|
|
||||||
|
void processTick(const Move *move);
|
||||||
|
void _enterFog(ShapeBase *control);
|
||||||
|
void _leaveFog(ShapeBase *control);
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Public methods
|
||||||
|
VolumetricFog();
|
||||||
|
~VolumetricFog();
|
||||||
|
|
||||||
|
static void initPersistFields();
|
||||||
|
virtual void inspectPostApply();
|
||||||
|
|
||||||
|
U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream);
|
||||||
|
void unpackUpdate(NetConnection *conn, BitStream *stream);
|
||||||
|
|
||||||
|
void prepRenderImage(SceneRenderState* state);
|
||||||
|
void render(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat);
|
||||||
|
void reflect_render(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat);
|
||||||
|
|
||||||
|
// Methods for modifying & networking various fog elements
|
||||||
|
// Used in script
|
||||||
|
void setFogColor(ColorF color);
|
||||||
|
void setFogColor(ColorI color);
|
||||||
|
void setFogDensity(F32 density);
|
||||||
|
void setFogModulation(F32 strength, Point2F speed1, Point2F speed2);
|
||||||
|
void setFogGlow(bool on_off, F32 strength);
|
||||||
|
void setFogLightray(bool on_off, F32 strength);
|
||||||
|
bool isInsideFog();
|
||||||
|
|
||||||
|
DECLARE_CONOBJECT(VolumetricFog);
|
||||||
|
|
||||||
|
DECLARE_CALLBACK(void, onEnterFog, (SimObjectId obj));
|
||||||
|
DECLARE_CALLBACK(void, onLeaveFog, (SimObjectId obj));
|
||||||
|
};
|
||||||
|
#endif
|
||||||
299
Engine/source/environment/VolumetricFogRTManager.cpp
Normal file
299
Engine/source/environment/VolumetricFogRTManager.cpp
Normal file
|
|
@ -0,0 +1,299 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Volumetric Fog Rendertarget Manager
|
||||||
|
//
|
||||||
|
// Creates and maintains one set of rendertargets to be used by every
|
||||||
|
// VolumetricFog object in the scene.
|
||||||
|
//
|
||||||
|
// Will be loaded at startup end removed when ending game.
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "VolumetricFogRTManager.h"
|
||||||
|
#include "core/module.h"
|
||||||
|
#include "scene/sceneManager.h"
|
||||||
|
#include "windowManager/platformWindowMgr.h"
|
||||||
|
#include "console/engineAPI.h"
|
||||||
|
#include "gui/core/guiCanvas.h"
|
||||||
|
|
||||||
|
MODULE_BEGIN(VolumetricFogRTManager)
|
||||||
|
|
||||||
|
MODULE_INIT_AFTER(Scene)
|
||||||
|
MODULE_SHUTDOWN_BEFORE(Scene)
|
||||||
|
|
||||||
|
MODULE_INIT
|
||||||
|
{
|
||||||
|
gVolumetricFogRTManager = new VolumetricFogRTManager;
|
||||||
|
gClientSceneGraph->addObjectToScene(gVolumetricFogRTManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
MODULE_SHUTDOWN
|
||||||
|
{
|
||||||
|
gClientSceneGraph->removeObjectFromScene(gVolumetricFogRTManager);
|
||||||
|
SAFE_DELETE(gVolumetricFogRTManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
MODULE_END;
|
||||||
|
|
||||||
|
ConsoleDocClass( VolumetricFogRTManager,
|
||||||
|
"@brief Creates and maintains one set of rendertargets to be used by every\n"
|
||||||
|
"VolumetricFog object in the scene.\n\n"
|
||||||
|
"Will be loaded at startup end removed when ending game.\n\n"
|
||||||
|
"Methods:\n"
|
||||||
|
" get() returns the currently loaded VolumetricFogRTManager, also accessible\n"
|
||||||
|
" through VFRTM define.\n"
|
||||||
|
" Init() Initializes the rendertargets, called when a VolumetricFog object is\n"
|
||||||
|
" added to the scene.\n"
|
||||||
|
" isInitialed() returns true if Rendertargets are present, false if not, then\n"
|
||||||
|
" Init() should be called to create the rendertargets.\n"
|
||||||
|
" setQuality(U32 Quality) Normally a rendertarget has the same size as the view,\n"
|
||||||
|
" with this method you can scale down the size of it.\n"
|
||||||
|
" Be aware that scaling down will introduce renderartefacts.\n"
|
||||||
|
"@ingroup Atmosphere"
|
||||||
|
);
|
||||||
|
|
||||||
|
VolumetricFogRTMResizeSignal VolumetricFogRTManager::smVolumetricFogRTMResizeSignal;
|
||||||
|
|
||||||
|
VolumetricFogRTManager *gVolumetricFogRTManager = NULL;
|
||||||
|
|
||||||
|
S32 VolumetricFogRTManager::mTargetScale = 1;
|
||||||
|
|
||||||
|
IMPLEMENT_CONOBJECT(VolumetricFogRTManager);
|
||||||
|
|
||||||
|
VolumetricFogRTManager::VolumetricFogRTManager()
|
||||||
|
{
|
||||||
|
setGlobalBounds();
|
||||||
|
mTypeMask |= EnvironmentObjectType;
|
||||||
|
mNetFlags.set(IsGhost);
|
||||||
|
mIsInitialized = false;
|
||||||
|
mNumFogObjects = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
VolumetricFogRTManager::~VolumetricFogRTManager()
|
||||||
|
{
|
||||||
|
if (mFrontTarget.isRegistered())
|
||||||
|
mFrontTarget.unregister();
|
||||||
|
|
||||||
|
if (mDepthTarget.isRegistered())
|
||||||
|
mDepthTarget.unregister();
|
||||||
|
|
||||||
|
if (mDepthBuffer.isValid())
|
||||||
|
mDepthBuffer->kill();
|
||||||
|
|
||||||
|
if (mFrontBuffer.isValid())
|
||||||
|
mFrontBuffer->kill();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VolumetricFogRTManager::onSceneRemove()
|
||||||
|
{
|
||||||
|
if (mIsInitialized)
|
||||||
|
mPlatformWindow->getScreenResChangeSignal().remove(this, &VolumetricFogRTManager::ResizeRT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VolumetricFogRTManager::onRemove()
|
||||||
|
{
|
||||||
|
removeFromScene();
|
||||||
|
Parent::onRemove();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VolumetricFogRTManager::consoleInit()
|
||||||
|
{
|
||||||
|
Con::addVariable("$pref::VolumetricFog::Quality", TypeS32, &mTargetScale,
|
||||||
|
"The scale of the rendertargets.\n"
|
||||||
|
"@ingroup Rendering\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VolumetricFogRTManager::Init()
|
||||||
|
{
|
||||||
|
if (mIsInitialized)
|
||||||
|
{
|
||||||
|
Con::errorf("VolumetricFogRTManager allready initialized!!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
GuiCanvas* cv = dynamic_cast<GuiCanvas*>(Sim::findObject("Canvas"));
|
||||||
|
if (cv == NULL)
|
||||||
|
{
|
||||||
|
Con::errorf("VolumetricFogRTManager::Init() - Canvas not found!!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
mPlatformWindow = cv->getPlatformWindow();
|
||||||
|
mPlatformWindow->getScreenResChangeSignal().notify(this,&VolumetricFogRTManager::ResizeRT);
|
||||||
|
|
||||||
|
if (mTargetScale < 1)
|
||||||
|
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);
|
||||||
|
|
||||||
|
mDepthBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F,
|
||||||
|
&GFXDefaultRenderTargetProfile, avar("%s() - mDepthBuffer (line %d)", __FUNCTION__, __LINE__));
|
||||||
|
if (!mDepthBuffer.isValid())
|
||||||
|
{
|
||||||
|
Con::errorf("VolumetricFogRTManager Fatal Error: Unable to create Depthbuffer");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!mDepthTarget.registerWithName("volfogdepth"))
|
||||||
|
{
|
||||||
|
Con::errorf("VolumetricFogRTManager Fatal Error : Unable to register Depthbuffer");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
mDepthTarget.setTexture(mDepthBuffer);
|
||||||
|
|
||||||
|
mFrontBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F,
|
||||||
|
&GFXDefaultRenderTargetProfile, avar("%s() - mFrontBuffer (line %d)", __FUNCTION__, __LINE__));
|
||||||
|
if (!mFrontBuffer.isValid())
|
||||||
|
{
|
||||||
|
Con::errorf("VolumetricFogRTManager Fatal Error: Unable to create front buffer");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!mFrontTarget.registerWithName("volfogfront"))
|
||||||
|
{
|
||||||
|
Con::errorf("VolumetricFogRTManager Fatal Error : Unable to register Frontbuffer");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
mFrontTarget.setTexture(mFrontBuffer);
|
||||||
|
|
||||||
|
Con::setVariable("$VolumetricFog::density", "0.0");
|
||||||
|
|
||||||
|
mIsInitialized = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 VolumetricFogRTManager::IncFogObjects()
|
||||||
|
{
|
||||||
|
mNumFogObjects++;
|
||||||
|
return mNumFogObjects;
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 VolumetricFogRTManager::DecFogObjects()
|
||||||
|
{
|
||||||
|
if (mNumFogObjects > 0)
|
||||||
|
mNumFogObjects--;
|
||||||
|
return mNumFogObjects;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VolumetricFogRTManager::ResizeRT(PlatformWindow* win,bool resize)
|
||||||
|
{
|
||||||
|
mFogHasAnswered = 0;
|
||||||
|
smVolumetricFogRTMResizeSignal.trigger(this, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VolumetricFogRTManager::FogAnswered()
|
||||||
|
{
|
||||||
|
mFogHasAnswered++;
|
||||||
|
if (mFogHasAnswered == mNumFogObjects)
|
||||||
|
{
|
||||||
|
if (Resize())
|
||||||
|
smVolumetricFogRTMResizeSignal.trigger(this, false);
|
||||||
|
else
|
||||||
|
Con::errorf("VolumetricFogRTManager::FogAnswered - Error resizing rendertargets!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VolumetricFogRTManager::Resize()
|
||||||
|
{
|
||||||
|
if (mTargetScale < 1)
|
||||||
|
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);
|
||||||
|
|
||||||
|
if (mWidth < 16 || mHeight < 16)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (mFrontTarget.isRegistered())
|
||||||
|
mFrontTarget.setTexture(NULL);
|
||||||
|
|
||||||
|
if (mDepthTarget.isRegistered())
|
||||||
|
mDepthTarget.setTexture(NULL);
|
||||||
|
|
||||||
|
if (mDepthBuffer.isValid())
|
||||||
|
mDepthBuffer->kill();
|
||||||
|
|
||||||
|
if (mFrontBuffer.isValid())
|
||||||
|
mFrontBuffer->kill();
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
mDepthTarget.setTexture(mDepthBuffer);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
S32 VolumetricFogRTManager::setQuality(U32 Quality)
|
||||||
|
{
|
||||||
|
if (!mIsInitialized)
|
||||||
|
return (mTargetScale = Quality);
|
||||||
|
|
||||||
|
if (Quality < 1)
|
||||||
|
Quality = 1;
|
||||||
|
|
||||||
|
if (Quality == mTargetScale)
|
||||||
|
return mTargetScale;
|
||||||
|
|
||||||
|
mTargetScale = Quality;
|
||||||
|
|
||||||
|
mFogHasAnswered = 0;
|
||||||
|
smVolumetricFogRTMResizeSignal.trigger(this, true);
|
||||||
|
|
||||||
|
return mTargetScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
VolumetricFogRTManager* VolumetricFogRTManager::get()
|
||||||
|
{
|
||||||
|
return gVolumetricFogRTManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
DefineConsoleFunction(SetFogVolumeQuality, S32, (U32 new_quality), ,
|
||||||
|
"@brief Resizes the rendertargets of the Volumetric Fog object.\n"
|
||||||
|
"@params new_quality new quality for the rendertargets 1 = full size, 2 = halfsize, 3 = 1/3, 4 = 1/4 ...")
|
||||||
|
{
|
||||||
|
if (VFRTM == NULL)
|
||||||
|
return -1;
|
||||||
|
return VFRTM->setQuality(new_quality);
|
||||||
|
}
|
||||||
92
Engine/source/environment/VolumetricFogRTManager.h
Normal file
92
Engine/source/environment/VolumetricFogRTManager.h
Normal file
|
|
@ -0,0 +1,92 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef _VolumetricFogRTManager_H_
|
||||||
|
#define _VolumetricFogRTManager_H_
|
||||||
|
|
||||||
|
#ifndef _SCENEOBJECT_H_
|
||||||
|
#include "scene/sceneObject.h"
|
||||||
|
#endif
|
||||||
|
#ifndef _MATTEXTURETARGET_H_
|
||||||
|
#include "materials/matTextureTarget.h"
|
||||||
|
#endif
|
||||||
|
#ifndef _GFXTARGET_H_
|
||||||
|
#include "gfx/gfxTarget.h"
|
||||||
|
#endif
|
||||||
|
#ifndef _SIGNAL_H_
|
||||||
|
#include "core/util/tSignal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class VolumetricFogRTManager;
|
||||||
|
|
||||||
|
typedef Signal<void(VolumetricFogRTManager *VolumetricFogRTManager, bool resize)> VolumetricFogRTMResizeSignal;
|
||||||
|
|
||||||
|
#define VFRTM VolumetricFogRTManager::get()
|
||||||
|
|
||||||
|
class VolumetricFogRTManager : public SceneObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef SceneObject Parent;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
GFXTexHandle mDepthBuffer;
|
||||||
|
GFXTexHandle mFrontBuffer;
|
||||||
|
|
||||||
|
NamedTexTarget mDepthTarget;
|
||||||
|
NamedTexTarget mFrontTarget;
|
||||||
|
|
||||||
|
PlatformWindow* mPlatformWindow;
|
||||||
|
|
||||||
|
static S32 mTargetScale;
|
||||||
|
bool mIsInitialized;
|
||||||
|
U32 mNumFogObjects;
|
||||||
|
U32 mFogHasAnswered;
|
||||||
|
U32 mWidth;
|
||||||
|
U32 mHeight;
|
||||||
|
bool mFullScreen;
|
||||||
|
|
||||||
|
void onRemove();
|
||||||
|
void onSceneRemove();
|
||||||
|
void ResizeRT(PlatformWindow *win, bool resize);
|
||||||
|
|
||||||
|
static VolumetricFogRTMResizeSignal smVolumetricFogRTMResizeSignal;
|
||||||
|
|
||||||
|
public:
|
||||||
|
VolumetricFogRTManager();
|
||||||
|
~VolumetricFogRTManager();
|
||||||
|
static VolumetricFogRTManager *get();
|
||||||
|
bool Init();
|
||||||
|
bool IsInitialized() { return mIsInitialized; }
|
||||||
|
static void consoleInit();
|
||||||
|
static VolumetricFogRTMResizeSignal& getVolumetricFogRTMResizeSignal() { return smVolumetricFogRTMResizeSignal; }
|
||||||
|
void FogAnswered();
|
||||||
|
S32 setQuality(U32 Quality);
|
||||||
|
bool Resize();
|
||||||
|
U32 IncFogObjects();
|
||||||
|
U32 DecFogObjects();
|
||||||
|
|
||||||
|
DECLARE_CONOBJECT(VolumetricFogRTManager);
|
||||||
|
};
|
||||||
|
|
||||||
|
extern VolumetricFogRTManager* gVolumetricFogRTManager;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -326,7 +326,7 @@ void GBitmap::allocateBitmap(const U32 in_width, const U32 in_height, const bool
|
||||||
|
|
||||||
mNumMipLevels++;
|
mNumMipLevels++;
|
||||||
allocPixels += currWidth * currHeight * mBytesPerPixel;
|
allocPixels += currWidth * currHeight * mBytesPerPixel;
|
||||||
} while (currWidth != 1 || currHeight != 1);
|
} while (currWidth != 1 && currHeight != 1);
|
||||||
}
|
}
|
||||||
AssertFatal(mNumMipLevels <= c_maxMipLevels, "GBitmap::allocateBitmap: too many miplevels");
|
AssertFatal(mNumMipLevels <= c_maxMipLevels, "GBitmap::allocateBitmap: too many miplevels");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ GFXDevice::GFXDevice()
|
||||||
mGlobalAmbientColor = ColorF(0.0f, 0.0f, 0.0f, 1.0f);
|
mGlobalAmbientColor = ColorF(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
mLightMaterialDirty = false;
|
mLightMaterialDirty = false;
|
||||||
dMemset(&mCurrentLightMaterial, NULL, sizeof(GFXLightMaterial));
|
dMemset(&mCurrentLightMaterial, 0, sizeof(GFXLightMaterial));
|
||||||
|
|
||||||
// State block
|
// State block
|
||||||
mStateBlockDirty = false;
|
mStateBlockDirty = false;
|
||||||
|
|
|
||||||
|
|
@ -526,10 +526,10 @@ void GFXDrawUtil::drawRectFill( const Point2F &upperLeft, const Point2F &lowerRi
|
||||||
|
|
||||||
F32 ulOffset = 0.5f - mDevice->getFillConventionOffset();
|
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, upperLeft.y+ne.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, 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, lowerRight.y-nw.y, 0.0f );
|
verts[3].point.set( lowerRight.x - nw.x + ulOffset, lowerRight.y - nw.y + ulOffset, 0.0f);
|
||||||
|
|
||||||
for (S32 i=0; i<4; i++)
|
for (S32 i=0; i<4; i++)
|
||||||
verts[i].color = color;
|
verts[i].color = color;
|
||||||
|
|
|
||||||
|
|
@ -1099,7 +1099,7 @@ void GFXTextureManager::_validateTexParams( const U32 width, const U32 height,
|
||||||
currHeight = 1;
|
currHeight = 1;
|
||||||
|
|
||||||
inOutNumMips++;
|
inOutNumMips++;
|
||||||
} while ( currWidth != 1 || currHeight != 1 );
|
} while ( currWidth != 1 && currHeight != 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,11 @@ public:
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~GLCircularVolatileBuffer()
|
||||||
|
{
|
||||||
|
glDeleteBuffers(1, &mBufferName);
|
||||||
|
}
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
glGenBuffers(1, &mBufferName);
|
glGenBuffers(1, &mBufferName);
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,10 @@ GFXGLTextureTarget::GFXGLTextureTarget() : mCopyFboSrc(0), mCopyFboDst(0)
|
||||||
|
|
||||||
GFXGLTextureTarget::~GFXGLTextureTarget()
|
GFXGLTextureTarget::~GFXGLTextureTarget()
|
||||||
{
|
{
|
||||||
GFXTextureManager::removeEventDelegate( this, &GFXGLTextureTarget::_onTextureEvent );
|
GFXTextureManager::removeEventDelegate(this, &GFXGLTextureTarget::_onTextureEvent);
|
||||||
|
|
||||||
|
glDeleteFramebuffers(1, &mCopyFboSrc);
|
||||||
|
glDeleteFramebuffers(1, &mCopyFboDst);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Point2I GFXGLTextureTarget::getSize()
|
const Point2I GFXGLTextureTarget::getSize()
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,14 @@ GFXGLWindowTarget::GFXGLWindowTarget(PlatformWindow *win, GFXDevice *d)
|
||||||
win->appEvent.notify(this, &GFXGLWindowTarget::_onAppSignal);
|
win->appEvent.notify(this, &GFXGLWindowTarget::_onAppSignal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GFXGLWindowTarget::~GFXGLWindowTarget()
|
||||||
|
{
|
||||||
|
if(glIsFramebuffer(mCopyFBO))
|
||||||
|
{
|
||||||
|
glDeleteFramebuffers(1, &mCopyFBO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GFXGLWindowTarget::resetMode()
|
void GFXGLWindowTarget::resetMode()
|
||||||
{
|
{
|
||||||
if(mWindow->getVideoMode().fullScreen != mWindow->isFullscreen())
|
if(mWindow->getVideoMode().fullScreen != mWindow->isFullscreen())
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ class GFXGLWindowTarget : public GFXWindowTarget
|
||||||
public:
|
public:
|
||||||
|
|
||||||
GFXGLWindowTarget(PlatformWindow *win, GFXDevice *d);
|
GFXGLWindowTarget(PlatformWindow *win, GFXDevice *d);
|
||||||
|
~GFXGLWindowTarget();
|
||||||
|
|
||||||
const Point2I getSize()
|
const Point2I getSize()
|
||||||
{
|
{
|
||||||
return mWindow->getClientExtent();
|
return mWindow->getClientExtent();
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,10 @@ void GFXGLDevice::enumerateAdapters( Vector<GFXAdapter*> &adapterList )
|
||||||
);
|
);
|
||||||
|
|
||||||
SDL_ClearError();
|
SDL_ClearError();
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||||
|
|
||||||
SDL_GLContext tempContext = SDL_GL_CreateContext( tempWindow );
|
SDL_GLContext tempContext = SDL_GL_CreateContext( tempWindow );
|
||||||
if( !tempContext )
|
if( !tempContext )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ namespace GL
|
||||||
{
|
{
|
||||||
void gglPerformBinds()
|
void gglPerformBinds()
|
||||||
{
|
{
|
||||||
|
glewExperimental = GL_TRUE;
|
||||||
GLenum err = glewInit();
|
GLenum err = glewInit();
|
||||||
AssertFatal(GLEW_OK == err, avar("Error: %s\n", glewGetErrorString(err)) );
|
AssertFatal(GLEW_OK == err, avar("Error: %s\n", glewGetErrorString(err)) );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,13 @@
|
||||||
#define T_GL_H
|
#define T_GL_H
|
||||||
#include "GL/glew.h"
|
#include "GL/glew.h"
|
||||||
|
|
||||||
|
#if defined (TORQUE_OS_WIN)
|
||||||
|
// This doesn't work on Mesa drivers.
|
||||||
#define gglHasExtension(EXTENSION) GLEW_##EXTENSION
|
#define gglHasExtension(EXTENSION) GLEW_##EXTENSION
|
||||||
|
#else
|
||||||
|
// Slower but reliably detects extensions on Mesa.
|
||||||
|
#define gglHasExtension(EXTENSION) glewGetExtension("GL_" # EXTENSION)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,11 @@ void DebugDrawer::setupStateBlocks()
|
||||||
|
|
||||||
d.setZReadWrite(false);
|
d.setZReadWrite(false);
|
||||||
mRenderZOffSB = GFX->createStateBlock(d);
|
mRenderZOffSB = GFX->createStateBlock(d);
|
||||||
|
|
||||||
|
d.setCullMode(GFXCullCCW);
|
||||||
|
d.setZReadWrite(true, false);
|
||||||
|
d.setBlend(true);
|
||||||
|
mRenderAlpha = GFX->createStateBlock(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugDrawer::render()
|
void DebugDrawer::render()
|
||||||
|
|
@ -158,10 +163,13 @@ void DebugDrawer::render()
|
||||||
|
|
||||||
// Set up the state block...
|
// Set up the state block...
|
||||||
GFXStateBlockRef currSB;
|
GFXStateBlockRef currSB;
|
||||||
if(p->useZ)
|
if(p->type==DebugPrim::Capsule){
|
||||||
|
currSB = mRenderAlpha;
|
||||||
|
}else if(p->useZ){
|
||||||
currSB = mRenderZOnSB;
|
currSB = mRenderZOnSB;
|
||||||
else
|
}else{
|
||||||
currSB = mRenderZOffSB;
|
currSB = mRenderZOffSB;
|
||||||
|
}
|
||||||
GFX->setStateBlock( currSB );
|
GFX->setStateBlock( currSB );
|
||||||
|
|
||||||
Point3F d;
|
Point3F d;
|
||||||
|
|
@ -180,6 +188,47 @@ void DebugDrawer::render()
|
||||||
|
|
||||||
PrimBuild::end();
|
PrimBuild::end();
|
||||||
break;
|
break;
|
||||||
|
case DebugPrim::DirectionLine:
|
||||||
|
{
|
||||||
|
const static F32 ARROW_LENGTH = 0.2f, ARROW_RADIUS = 0.035f, CYLINDER_RADIUS = 0.008f;
|
||||||
|
Point3F &start = p->a, &end = p->b;
|
||||||
|
Point3F direction = end - start;
|
||||||
|
F32 length = direction.len();
|
||||||
|
if( length>ARROW_LENGTH ){
|
||||||
|
//cylinder with arrow on end
|
||||||
|
direction *= (1.0f/length);
|
||||||
|
Point3F baseArrow = end - (direction*ARROW_LENGTH);
|
||||||
|
GFX->getDrawUtil()->drawCone(currSB->getDesc(), baseArrow, end, ARROW_RADIUS, p->color);
|
||||||
|
GFX->getDrawUtil()->drawCylinder(currSB->getDesc(), start, baseArrow, CYLINDER_RADIUS, p->color);
|
||||||
|
}else if( length>0 ){
|
||||||
|
//short, so just draw arrow
|
||||||
|
GFX->getDrawUtil()->drawCone(currSB->getDesc(), start, end, ARROW_RADIUS, p->color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DebugPrim::Capsule:
|
||||||
|
GFX->getDrawUtil()->drawCapsule(currSB->getDesc(), p->a, p->b.x, p->b.y, p->color);
|
||||||
|
break;
|
||||||
|
case DebugPrim::OutlinedText:
|
||||||
|
{
|
||||||
|
GFXTransformSaver saver;
|
||||||
|
Point3F result;
|
||||||
|
if (MathUtils::mProjectWorldToScreen(p->a, &result, GFX->getViewport(), GFX->getWorldMatrix(), GFX->getProjectionMatrix()))
|
||||||
|
{
|
||||||
|
GFX->setClipRect(GFX->getViewport());
|
||||||
|
Point2I where = Point2I(result.x, result.y);
|
||||||
|
|
||||||
|
GFX->getDrawUtil()->setBitmapModulation(p->color2);
|
||||||
|
GFX->getDrawUtil()->drawText(mFont, Point2I(where.x-1, where.y), p->mText);
|
||||||
|
GFX->getDrawUtil()->drawText(mFont, Point2I(where.x+1, where.y), p->mText);
|
||||||
|
GFX->getDrawUtil()->drawText(mFont, Point2I(where.x, where.y-1), p->mText);
|
||||||
|
GFX->getDrawUtil()->drawText(mFont, Point2I(where.x, where.y+1), p->mText);
|
||||||
|
|
||||||
|
GFX->getDrawUtil()->setBitmapModulation(p->color);
|
||||||
|
GFX->getDrawUtil()->drawText(mFont, where, p->mText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case DebugPrim::Box:
|
case DebugPrim::Box:
|
||||||
d = p->a - p->b;
|
d = p->a - p->b;
|
||||||
GFX->getDrawUtil()->drawCube(currSB->getDesc(), d * 0.5, (p->a + p->b) * 0.5, p->color);
|
GFX->getDrawUtil()->drawCube(currSB->getDesc(), d * 0.5, (p->a + p->b) * 0.5, p->color);
|
||||||
|
|
@ -262,6 +311,63 @@ void DebugDrawer::drawLine(const Point3F &a, const Point3F &b, const ColorF &col
|
||||||
mHead = n;
|
mHead = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebugDrawer::drawCapsule(const Point3F &a, const F32 &radius, const F32 &height, const ColorF &color)
|
||||||
|
{
|
||||||
|
if(isFrozen || !isDrawing)
|
||||||
|
return;
|
||||||
|
|
||||||
|
DebugPrim *n = mPrimChunker.alloc();
|
||||||
|
|
||||||
|
n->useZ = true;
|
||||||
|
n->dieTime = 0;
|
||||||
|
n->a = a;
|
||||||
|
n->b.x = radius;
|
||||||
|
n->b.y = height;
|
||||||
|
n->color = color;
|
||||||
|
n->type = DebugPrim::Capsule;
|
||||||
|
|
||||||
|
n->next = mHead;
|
||||||
|
mHead = n;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebugDrawer::drawDirectionLine(const Point3F &a, const Point3F &b, const ColorF &color)
|
||||||
|
{
|
||||||
|
if(isFrozen || !isDrawing)
|
||||||
|
return;
|
||||||
|
|
||||||
|
DebugPrim *n = mPrimChunker.alloc();
|
||||||
|
|
||||||
|
n->useZ = true;
|
||||||
|
n->dieTime = 0;
|
||||||
|
n->a = a;
|
||||||
|
n->b = b;
|
||||||
|
n->color = color;
|
||||||
|
n->type = DebugPrim::DirectionLine;
|
||||||
|
|
||||||
|
n->next = mHead;
|
||||||
|
mHead = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebugDrawer::drawOutlinedText(const Point3F& pos, const String& text, const ColorF &color, const ColorF &colorOutline)
|
||||||
|
{
|
||||||
|
if(isFrozen || !isDrawing)
|
||||||
|
return;
|
||||||
|
|
||||||
|
DebugPrim *n = mPrimChunker.alloc();
|
||||||
|
|
||||||
|
n->useZ = false;
|
||||||
|
n->dieTime = 0;
|
||||||
|
n->a = pos;
|
||||||
|
n->color = color;
|
||||||
|
n->color2 = colorOutline;
|
||||||
|
dStrncpy(n->mText, text.c_str(), 256);
|
||||||
|
n->type = DebugPrim::OutlinedText;
|
||||||
|
|
||||||
|
n->next = mHead;
|
||||||
|
mHead = n;
|
||||||
|
}
|
||||||
|
|
||||||
void DebugDrawer::drawTri(const Point3F &a, const Point3F &b, const Point3F &c, const ColorF &color)
|
void DebugDrawer::drawTri(const Point3F &a, const Point3F &b, const Point3F &c, const ColorF &color)
|
||||||
{
|
{
|
||||||
if(isFrozen || !isDrawing)
|
if(isFrozen || !isDrawing)
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,9 @@ public:
|
||||||
void drawLine(const Point3F &a, const Point3F &b, const ColorF &color = ColorF(1.0f,1.0f,1.0f));
|
void drawLine(const Point3F &a, const Point3F &b, const ColorF &color = ColorF(1.0f,1.0f,1.0f));
|
||||||
void drawTri(const Point3F &a, const Point3F &b, const Point3F &c, const ColorF &color = ColorF(1.0f,1.0f,1.0f));
|
void drawTri(const Point3F &a, const Point3F &b, const Point3F &c, const ColorF &color = ColorF(1.0f,1.0f,1.0f));
|
||||||
void drawText(const Point3F& pos, const String& text, const ColorF &color = ColorF(1.0f,1.0f,1.0f));
|
void drawText(const Point3F& pos, const String& text, const ColorF &color = ColorF(1.0f,1.0f,1.0f));
|
||||||
|
void drawCapsule(const Point3F &a, const F32 &radius, const F32 &height, const ColorF &color = ColorF(1.0f, 1.0f, 1.0f));
|
||||||
|
void drawDirectionLine(const Point3F &a, const Point3F &b, const ColorF &color = ColorF(1.0f, 1.0f, 1.0f));
|
||||||
|
void drawOutlinedText(const Point3F& pos, const String& text, const ColorF &color = ColorF(1.0f, 1.0f, 1.0f), const ColorF &colorOutline = ColorF(0.0f, 0.0f, 0.0f));
|
||||||
|
|
||||||
/// Render a wireframe view of the given polyhedron.
|
/// Render a wireframe view of the given polyhedron.
|
||||||
void drawPolyhedron( const AnyPolyhedron& polyhedron, const ColorF& color = ColorF( 1.f, 1.f, 1.f ) );
|
void drawPolyhedron( const AnyPolyhedron& polyhedron, const ColorF& color = ColorF( 1.f, 1.f, 1.f ) );
|
||||||
|
|
@ -161,6 +164,7 @@ private:
|
||||||
{
|
{
|
||||||
/// Color used for this primitive.
|
/// Color used for this primitive.
|
||||||
ColorF color;
|
ColorF color;
|
||||||
|
ColorF color2;
|
||||||
|
|
||||||
/// Points used to store positional data. Exact semantics determined by type.
|
/// Points used to store positional data. Exact semantics determined by type.
|
||||||
Point3F a, b, c;
|
Point3F a, b, c;
|
||||||
|
|
@ -168,7 +172,10 @@ private:
|
||||||
Tri,
|
Tri,
|
||||||
Box,
|
Box,
|
||||||
Line,
|
Line,
|
||||||
Text
|
Text,
|
||||||
|
DirectionLine,
|
||||||
|
OutlinedText,
|
||||||
|
Capsule,
|
||||||
} type; ///< Type of the primitive. The meanings of a,b,c are determined by this.
|
} type; ///< Type of the primitive. The meanings of a,b,c are determined by this.
|
||||||
|
|
||||||
SimTime dieTime; ///< Time at which we should remove this from the list.
|
SimTime dieTime; ///< Time at which we should remove this from the list.
|
||||||
|
|
@ -188,6 +195,7 @@ private:
|
||||||
|
|
||||||
GFXStateBlockRef mRenderZOffSB;
|
GFXStateBlockRef mRenderZOffSB;
|
||||||
GFXStateBlockRef mRenderZOnSB;
|
GFXStateBlockRef mRenderZOnSB;
|
||||||
|
GFXStateBlockRef mRenderAlpha;
|
||||||
|
|
||||||
Resource<GFont> mFont;
|
Resource<GFont> mFont;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -321,8 +321,11 @@ void GuiCanvas::setWindowTitle(const char *newTitle)
|
||||||
mPlatformWindow->setCaption(newTitle);
|
mPlatformWindow->setCaption(newTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CanvasSizeChangeSignal GuiCanvas::smCanvasSizeChangeSignal;
|
||||||
|
|
||||||
void GuiCanvas::handleResize( WindowId did, S32 width, S32 height )
|
void GuiCanvas::handleResize( WindowId did, S32 width, S32 height )
|
||||||
{
|
{
|
||||||
|
getCanvasSizeChangeSignal().trigger(this);
|
||||||
if (Journal::IsPlaying() && mPlatformWindow)
|
if (Journal::IsPlaying() && mPlatformWindow)
|
||||||
{
|
{
|
||||||
mPlatformWindow->lockSize(false);
|
mPlatformWindow->lockSize(false);
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,10 @@
|
||||||
#include "platform/platformInput.h"
|
#include "platform/platformInput.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _SIGNAL_H_
|
||||||
|
#include "core/util/tSignal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "component/interfaces/IProcessInput.h"
|
#include "component/interfaces/IProcessInput.h"
|
||||||
#include "windowManager/platformWindowMgr.h"
|
#include "windowManager/platformWindowMgr.h"
|
||||||
#include "gfx/gfxFence.h"
|
#include "gfx/gfxFence.h"
|
||||||
|
|
@ -74,6 +78,8 @@
|
||||||
/// screen will be painted normally. If you are making an animated GuiControl
|
/// screen will be painted normally. If you are making an animated GuiControl
|
||||||
/// you need to add your control to the dirty areas of the canvas.
|
/// you need to add your control to the dirty areas of the canvas.
|
||||||
///
|
///
|
||||||
|
class guiCanvas;
|
||||||
|
typedef Signal<void(GuiCanvas* canvas)> CanvasSizeChangeSignal;
|
||||||
class GuiCanvas : public GuiControl, public IProcessInput
|
class GuiCanvas : public GuiControl, public IProcessInput
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -183,6 +189,8 @@ protected:
|
||||||
virtual void setupFences();
|
virtual void setupFences();
|
||||||
|
|
||||||
void checkLockMouseMove( const GuiEvent& event );
|
void checkLockMouseMove( const GuiEvent& event );
|
||||||
|
//Signal used to let others know this canvas has changed size.
|
||||||
|
static CanvasSizeChangeSignal smCanvasSizeChangeSignal;
|
||||||
|
|
||||||
GuiControl *mMenuBarCtrl;
|
GuiControl *mMenuBarCtrl;
|
||||||
|
|
||||||
|
|
@ -200,6 +208,8 @@ public:
|
||||||
|
|
||||||
static void initPersistFields();
|
static void initPersistFields();
|
||||||
|
|
||||||
|
static CanvasSizeChangeSignal& getCanvasSizeChangeSignal() { return smCanvasSizeChangeSignal; }
|
||||||
|
|
||||||
/// @name Rendering methods
|
/// @name Rendering methods
|
||||||
///
|
///
|
||||||
/// @{
|
/// @{
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,9 @@ ImplementEnumType( GuiHorizontalSizing,
|
||||||
{ GuiControl::horizResizeLeft, "left" },
|
{ GuiControl::horizResizeLeft, "left" },
|
||||||
{ GuiControl::horizResizeCenter, "center" },
|
{ GuiControl::horizResizeCenter, "center" },
|
||||||
{ GuiControl::horizResizeRelative, "relative" },
|
{ GuiControl::horizResizeRelative, "relative" },
|
||||||
|
{ GuiControl::horizResizeAspectLeft, "aspectLeft" },
|
||||||
|
{ GuiControl::horizResizeAspectRight, "aspectRight" },
|
||||||
|
{ GuiControl::horizResizeAspectCenter, "aspectCenter" },
|
||||||
{ GuiControl::horizResizeWindowRelative, "windowRelative" }
|
{ GuiControl::horizResizeWindowRelative, "windowRelative" }
|
||||||
EndImplementEnumType;
|
EndImplementEnumType;
|
||||||
|
|
||||||
|
|
@ -186,6 +189,9 @@ ImplementEnumType( GuiVerticalSizing,
|
||||||
{ GuiControl::vertResizeTop, "top" },
|
{ GuiControl::vertResizeTop, "top" },
|
||||||
{ GuiControl::vertResizeCenter, "center" },
|
{ GuiControl::vertResizeCenter, "center" },
|
||||||
{ GuiControl::vertResizeRelative, "relative" },
|
{ GuiControl::vertResizeRelative, "relative" },
|
||||||
|
{ GuiControl::vertResizeAspectTop, "aspectTop" },
|
||||||
|
{ GuiControl::vertResizeAspectBottom, "aspectBottom" },
|
||||||
|
{ GuiControl::vertResizeAspectCenter, "aspectCenter" },
|
||||||
{ GuiControl::vertResizeWindowRelative, "windowRelative" }
|
{ GuiControl::vertResizeWindowRelative, "windowRelative" }
|
||||||
EndImplementEnumType;
|
EndImplementEnumType;
|
||||||
|
|
||||||
|
|
@ -1370,6 +1376,36 @@ void GuiControl::parentResized(const RectI &oldParentRect, const RectI &newParen
|
||||||
newPosition.x = newLeft;
|
newPosition.x = newLeft;
|
||||||
newExtent.x = newWidth;
|
newExtent.x = newWidth;
|
||||||
}
|
}
|
||||||
|
else if (mHorizSizing == horizResizeAspectLeft && oldParentRect.extent.x != 0)
|
||||||
|
{
|
||||||
|
S32 newLeft = mRoundToNearest((F32(newPosition.x) / F32(oldParentRect.extent.x)) * F32(newParentRect.extent.x));
|
||||||
|
S32 newWidth = mRoundToNearest((F32(newExtent.x) / F32(oldParentRect.extent.y)) * F32(newParentRect.extent.y));
|
||||||
|
|
||||||
|
newPosition.x = newLeft;
|
||||||
|
newExtent.x = newWidth;
|
||||||
|
}
|
||||||
|
else if (mHorizSizing == horizResizeAspectRight && oldParentRect.extent.x != 0)
|
||||||
|
{
|
||||||
|
S32 newLeft = mRoundToNearest((F32(newPosition.x) / F32(oldParentRect.extent.x)) * F32(newParentRect.extent.x));
|
||||||
|
S32 newWidth = mRoundToNearest((F32(newExtent.x) / F32(oldParentRect.extent.y)) * F32(newParentRect.extent.y)); //origional aspect ratio corrected width
|
||||||
|
S32 rWidth = mRoundToNearest((F32(newExtent.x) / F32(oldParentRect.extent.x)) * F32(newParentRect.extent.x)); //parent aspect ratio relative width
|
||||||
|
|
||||||
|
S32 offset = rWidth - newWidth; // account for change in relative width
|
||||||
|
newLeft += offset;
|
||||||
|
newPosition.x = newLeft;
|
||||||
|
newExtent.x = newWidth;
|
||||||
|
}
|
||||||
|
else if (mHorizSizing == horizResizeAspectCenter && oldParentRect.extent.x != 0)
|
||||||
|
{
|
||||||
|
S32 newLeft = mRoundToNearest((F32(newPosition.x) / F32(oldParentRect.extent.x)) * F32(newParentRect.extent.x));
|
||||||
|
S32 newWidth = mRoundToNearest((F32(newExtent.x) / F32(oldParentRect.extent.y)) * F32(newParentRect.extent.y)); //origional aspect ratio corrected width
|
||||||
|
S32 rWidth = mRoundToNearest((F32(newExtent.x) / F32(oldParentRect.extent.x)) * F32(newParentRect.extent.x)); //parent aspect ratio relative width
|
||||||
|
|
||||||
|
S32 offset = rWidth - newWidth; // account for change in relative width
|
||||||
|
newLeft += offset/2;
|
||||||
|
newPosition.x = newLeft;
|
||||||
|
newExtent.x = newWidth;
|
||||||
|
}
|
||||||
|
|
||||||
if (mVertSizing == vertResizeCenter)
|
if (mVertSizing == vertResizeCenter)
|
||||||
newPosition.y = (newParentRect.extent.y - getHeight()) >> 1;
|
newPosition.y = (newParentRect.extent.y - getHeight()) >> 1;
|
||||||
|
|
@ -1385,6 +1421,36 @@ void GuiControl::parentResized(const RectI &oldParentRect, const RectI &newParen
|
||||||
newPosition.y = newTop;
|
newPosition.y = newTop;
|
||||||
newExtent.y = newHeight;
|
newExtent.y = newHeight;
|
||||||
}
|
}
|
||||||
|
else if (mVertSizing == vertResizeAspectTop && oldParentRect.extent.y != 0)
|
||||||
|
{
|
||||||
|
S32 newTop = mRoundToNearest((F32(newPosition.y) / F32(oldParentRect.extent.y)) * F32(newParentRect.extent.y));
|
||||||
|
S32 newHeight = mRoundToNearest((F32(newExtent.y) / F32(oldParentRect.extent.x)) * F32(newParentRect.extent.x));
|
||||||
|
|
||||||
|
newPosition.y = newTop;
|
||||||
|
newExtent.y = newHeight;
|
||||||
|
}
|
||||||
|
else if (mVertSizing == vertResizeAspectBottom && oldParentRect.extent.y != 0)
|
||||||
|
{
|
||||||
|
S32 newTop = mRoundToNearest((F32(newPosition.y) / F32(oldParentRect.extent.y)) * F32(newParentRect.extent.y));
|
||||||
|
S32 newHeight = mRoundToNearest((F32(newExtent.y) / F32(oldParentRect.extent.x)) * F32(newParentRect.extent.x)); //origional aspect ratio corrected hieght
|
||||||
|
S32 rHeight = mRoundToNearest((F32(newExtent.y) / F32(oldParentRect.extent.y)) * F32(newParentRect.extent.y)); //parent aspect ratio relative hieght
|
||||||
|
|
||||||
|
S32 offset = rHeight - newHeight; // account for change in relative hieght
|
||||||
|
newTop += offset;
|
||||||
|
newPosition.y = newTop;
|
||||||
|
newExtent.y = newHeight;
|
||||||
|
}
|
||||||
|
else if (mVertSizing == vertResizeAspectCenter && oldParentRect.extent.y != 0)
|
||||||
|
{
|
||||||
|
S32 newTop = mRoundToNearest((F32(newPosition.y) / F32(oldParentRect.extent.y)) * F32(newParentRect.extent.y));
|
||||||
|
S32 newHeight = mRoundToNearest((F32(newExtent.y) / F32(oldParentRect.extent.x)) * F32(newParentRect.extent.x)); //origional aspect ratio corrected hieght
|
||||||
|
S32 rHeight = mRoundToNearest((F32(newExtent.y) / F32(oldParentRect.extent.y)) * F32(newParentRect.extent.y)); //parent aspect ratio relative hieght
|
||||||
|
|
||||||
|
S32 offset = rHeight - newHeight; // account for change in relative hieght
|
||||||
|
newTop += offset / 2;
|
||||||
|
newPosition.y = newTop;
|
||||||
|
newExtent.y = newHeight;
|
||||||
|
}
|
||||||
|
|
||||||
// Resizing Re factor [9/18/2006]
|
// Resizing Re factor [9/18/2006]
|
||||||
// Only resize if our minExtent is satisfied with it.
|
// Only resize if our minExtent is satisfied with it.
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,9 @@ class GuiControl : public SimGroup
|
||||||
horizResizeLeft, ///< fixed on the right and width
|
horizResizeLeft, ///< fixed on the right and width
|
||||||
horizResizeCenter,
|
horizResizeCenter,
|
||||||
horizResizeRelative, ///< resize relative
|
horizResizeRelative, ///< resize relative
|
||||||
|
horizResizeAspectLeft, ///< resize relative to height delta (offset Left)
|
||||||
|
horizResizeAspectRight, ///< resize relative to height delta (offset Right)
|
||||||
|
horizResizeAspectCenter, ///< resize relative to height delta (Centered)
|
||||||
horizResizeWindowRelative ///< resize window relative
|
horizResizeWindowRelative ///< resize window relative
|
||||||
};
|
};
|
||||||
enum vertSizingOptions
|
enum vertSizingOptions
|
||||||
|
|
@ -130,6 +133,9 @@ class GuiControl : public SimGroup
|
||||||
vertResizeTop, ///< fixed in height and on the bottom
|
vertResizeTop, ///< fixed in height and on the bottom
|
||||||
vertResizeCenter,
|
vertResizeCenter,
|
||||||
vertResizeRelative, ///< resize relative
|
vertResizeRelative, ///< resize relative
|
||||||
|
vertResizeAspectTop, ///< resize relative to width delta (offset Left)
|
||||||
|
vertResizeAspectBottom, ///< resize relative to width delta (offset Right)
|
||||||
|
vertResizeAspectCenter, ///< resize relative to width delta Centered)
|
||||||
vertResizeWindowRelative ///< resize window relative
|
vertResizeWindowRelative ///< resize window relative
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2810,7 +2810,7 @@ void WorldEditor::clearSelection()
|
||||||
|
|
||||||
void WorldEditor::selectObject( SimObject *obj )
|
void WorldEditor::selectObject( SimObject *obj )
|
||||||
{
|
{
|
||||||
if ( mSelectionLocked || !mSelected )
|
if ( mSelectionLocked || !mSelected || !obj )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Don't check isSelectionEnabled of SceneObjects here as we
|
// Don't check isSelectionEnabled of SceneObjects here as we
|
||||||
|
|
@ -2833,7 +2833,7 @@ void WorldEditor::selectObject( const char* obj )
|
||||||
|
|
||||||
void WorldEditor::unselectObject( SimObject *obj )
|
void WorldEditor::unselectObject( SimObject *obj )
|
||||||
{
|
{
|
||||||
if ( mSelectionLocked || !mSelected )
|
if ( mSelectionLocked || !mSelected || !obj )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( !objClassIgnored( obj ) && mSelected->objInSet( obj ) )
|
if ( !objClassIgnored( obj ) && mSelected->objInSet( obj ) )
|
||||||
|
|
|
||||||
|
|
@ -318,6 +318,8 @@ void AdvancedLightBinManager::render( SceneRenderState *state )
|
||||||
const U32 numPrims = curEntry.numPrims;
|
const U32 numPrims = curEntry.numPrims;
|
||||||
const U32 numVerts = curEntry.vertBuffer->mNumVerts;
|
const U32 numVerts = curEntry.vertBuffer->mNumVerts;
|
||||||
|
|
||||||
|
ShadowMapParams *lsp = curLightInfo->getExtended<ShadowMapParams>();
|
||||||
|
|
||||||
// Skip lights which won't affect the scene.
|
// Skip lights which won't affect the scene.
|
||||||
if ( !curLightMat || curLightInfo->getBrightness() <= 0.001f )
|
if ( !curLightMat || curLightInfo->getBrightness() <= 0.001f )
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -329,15 +331,12 @@ void AdvancedLightBinManager::render( SceneRenderState *state )
|
||||||
mShadowManager->setLightShadowMap( curEntry.shadowMap );
|
mShadowManager->setLightShadowMap( curEntry.shadowMap );
|
||||||
mShadowManager->setLightDynamicShadowMap( curEntry.dynamicShadowMap );
|
mShadowManager->setLightDynamicShadowMap( curEntry.dynamicShadowMap );
|
||||||
|
|
||||||
// Let the shadow know we're about to render from it.
|
|
||||||
if ( curEntry.shadowMap )
|
|
||||||
curEntry.shadowMap->preLightRender();
|
|
||||||
if ( curEntry.dynamicShadowMap ) curEntry.dynamicShadowMap->preLightRender();
|
|
||||||
|
|
||||||
// Set geometry
|
// Set geometry
|
||||||
GFX->setVertexBuffer( curEntry.vertBuffer );
|
GFX->setVertexBuffer( curEntry.vertBuffer );
|
||||||
GFX->setPrimitiveBuffer( curEntry.primBuffer );
|
GFX->setPrimitiveBuffer( curEntry.primBuffer );
|
||||||
|
|
||||||
|
lsp->getOcclusionQuery()->begin();
|
||||||
|
|
||||||
// Render the material passes
|
// Render the material passes
|
||||||
while( curLightMat->matInstance->setupPass( state, sgData ) )
|
while( curLightMat->matInstance->setupPass( state, sgData ) )
|
||||||
{
|
{
|
||||||
|
|
@ -352,10 +351,7 @@ void AdvancedLightBinManager::render( SceneRenderState *state )
|
||||||
GFX->drawPrimitive(GFXTriangleList, 0, numPrims);
|
GFX->drawPrimitive(GFXTriangleList, 0, numPrims);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell it we're done rendering.
|
lsp->getOcclusionQuery()->end();
|
||||||
if ( curEntry.shadowMap )
|
|
||||||
curEntry.shadowMap->postLightRender();
|
|
||||||
if ( curEntry.dynamicShadowMap ) curEntry.dynamicShadowMap->postLightRender();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set NULL for active shadow map (so nothing gets confused)
|
// Set NULL for active shadow map (so nothing gets confused)
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ void AdvancedLightManager::activate( SceneManager *sceneManager )
|
||||||
// we prefer the floating point format if it works.
|
// we prefer the floating point format if it works.
|
||||||
Vector<GFXFormat> formats;
|
Vector<GFXFormat> formats;
|
||||||
formats.push_back( GFXFormatR16G16B16A16F );
|
formats.push_back( GFXFormatR16G16B16A16F );
|
||||||
formats.push_back( GFXFormatR16G16B16A16 );
|
//formats.push_back( GFXFormatR16G16B16A16 );
|
||||||
GFXFormat blendTargetFormat = GFX->selectSupportedFormat( &GFXDefaultRenderTargetProfile,
|
GFXFormat blendTargetFormat = GFX->selectSupportedFormat( &GFXDefaultRenderTargetProfile,
|
||||||
formats,
|
formats,
|
||||||
true,
|
true,
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,6 @@ LightShadowMap::LightShadowMap( LightInfo *light )
|
||||||
mLastUpdate( 0 ),
|
mLastUpdate( 0 ),
|
||||||
mLastCull( 0 ),
|
mLastCull( 0 ),
|
||||||
mIsViewDependent( false ),
|
mIsViewDependent( false ),
|
||||||
mVizQuery( NULL ),
|
|
||||||
mWasOccluded( false ),
|
|
||||||
mLastScreenSize( 0.0f ),
|
mLastScreenSize( 0.0f ),
|
||||||
mLastPriority( 0.0f ),
|
mLastPriority( 0.0f ),
|
||||||
mIsDynamic( false )
|
mIsDynamic( false )
|
||||||
|
|
@ -98,9 +96,7 @@ LightShadowMap::LightShadowMap( LightInfo *light )
|
||||||
GFXTextureManager::addEventDelegate( this, &LightShadowMap::_onTextureEvent );
|
GFXTextureManager::addEventDelegate( this, &LightShadowMap::_onTextureEvent );
|
||||||
|
|
||||||
mTarget = GFX->allocRenderToTextureTarget();
|
mTarget = GFX->allocRenderToTextureTarget();
|
||||||
mVizQuery = GFX->createOcclusionQuery();
|
smShadowMaps.push_back( this );
|
||||||
|
|
||||||
smShadowMaps.push_back(this);
|
|
||||||
mStaticRefreshTimer = PlatformTimer::create();
|
mStaticRefreshTimer = PlatformTimer::create();
|
||||||
mDynamicRefreshTimer = PlatformTimer::create();
|
mDynamicRefreshTimer = PlatformTimer::create();
|
||||||
}
|
}
|
||||||
|
|
@ -108,7 +104,8 @@ LightShadowMap::LightShadowMap( LightInfo *light )
|
||||||
LightShadowMap::~LightShadowMap()
|
LightShadowMap::~LightShadowMap()
|
||||||
{
|
{
|
||||||
mTarget = NULL;
|
mTarget = NULL;
|
||||||
SAFE_DELETE( mVizQuery );
|
SAFE_DELETE(mStaticRefreshTimer);
|
||||||
|
SAFE_DELETE(mDynamicRefreshTimer);
|
||||||
|
|
||||||
releaseTextures();
|
releaseTextures();
|
||||||
|
|
||||||
|
|
@ -334,23 +331,6 @@ void LightShadowMap::render( RenderPassManager* renderPass,
|
||||||
mLastUpdate = Sim::getCurrentTime();
|
mLastUpdate = Sim::getCurrentTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightShadowMap::preLightRender()
|
|
||||||
{
|
|
||||||
PROFILE_SCOPE( LightShadowMap_prepLightRender );
|
|
||||||
|
|
||||||
if ( mVizQuery )
|
|
||||||
{
|
|
||||||
mWasOccluded = mVizQuery->getStatus( true ) == GFXOcclusionQuery::Occluded;
|
|
||||||
mVizQuery->begin();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LightShadowMap::postLightRender()
|
|
||||||
{
|
|
||||||
if ( mVizQuery )
|
|
||||||
mVizQuery->end();
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseMatInstance* LightShadowMap::getShadowMaterial( BaseMatInstance *inMat ) const
|
BaseMatInstance* LightShadowMap::getShadowMaterial( BaseMatInstance *inMat ) const
|
||||||
{
|
{
|
||||||
// See if we have an existing material hook.
|
// See if we have an existing material hook.
|
||||||
|
|
@ -610,11 +590,14 @@ ShadowMapParams::ShadowMapParams( LightInfo *light )
|
||||||
shadowSoftness = 0.15f;
|
shadowSoftness = 0.15f;
|
||||||
fadeStartDist = 0.0f;
|
fadeStartDist = 0.0f;
|
||||||
lastSplitTerrainOnly = false;
|
lastSplitTerrainOnly = false;
|
||||||
|
mQuery = GFX->createOcclusionQuery();
|
||||||
|
|
||||||
_validate();
|
_validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
ShadowMapParams::~ShadowMapParams()
|
ShadowMapParams::~ShadowMapParams()
|
||||||
{
|
{
|
||||||
|
SAFE_DELETE( mQuery );
|
||||||
SAFE_DELETE( mShadowMap );
|
SAFE_DELETE( mShadowMap );
|
||||||
SAFE_DELETE( mDynamicShadowMap );
|
SAFE_DELETE( mDynamicShadowMap );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,9 @@
|
||||||
#ifndef _GFXSHADER_H_
|
#ifndef _GFXSHADER_H_
|
||||||
#include "gfx/gfxShader.h"
|
#include "gfx/gfxShader.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef _GFXOCCLUSIONQUERY_H_
|
||||||
|
#include "gfx/gfxOcclusionQuery.h"
|
||||||
|
#endif
|
||||||
#ifndef _PLATFORM_PLATFORMTIMER_H_
|
#ifndef _PLATFORM_PLATFORMTIMER_H_
|
||||||
#include "platform/platformTimer.h"
|
#include "platform/platformTimer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -61,7 +64,6 @@ struct SceneData;
|
||||||
class GFXShaderConstBuffer;
|
class GFXShaderConstBuffer;
|
||||||
class GFXShaderConstHandle;
|
class GFXShaderConstHandle;
|
||||||
class GFXShader;
|
class GFXShader;
|
||||||
class GFXOcclusionQuery;
|
|
||||||
class LightManager;
|
class LightManager;
|
||||||
class RenderPassManager;
|
class RenderPassManager;
|
||||||
|
|
||||||
|
|
@ -169,12 +171,6 @@ public:
|
||||||
|
|
||||||
bool isViewDependent() const { return mIsViewDependent; }
|
bool isViewDependent() const { return mIsViewDependent; }
|
||||||
|
|
||||||
bool wasOccluded() const { return mWasOccluded; }
|
|
||||||
|
|
||||||
void preLightRender();
|
|
||||||
|
|
||||||
void postLightRender();
|
|
||||||
|
|
||||||
void updatePriority( const SceneRenderState *state, U32 currTimeMs );
|
void updatePriority( const SceneRenderState *state, U32 currTimeMs );
|
||||||
|
|
||||||
F32 getLastScreenSize() const { return mLastScreenSize; }
|
F32 getLastScreenSize() const { return mLastScreenSize; }
|
||||||
|
|
@ -257,15 +253,6 @@ protected:
|
||||||
/// The time this shadow was last culled and prioritized.
|
/// The time this shadow was last culled and prioritized.
|
||||||
U32 mLastCull;
|
U32 mLastCull;
|
||||||
|
|
||||||
/// The shadow occlusion query used when the light is
|
|
||||||
/// rendered to determine if any pixel of it is visible.
|
|
||||||
GFXOcclusionQuery *mVizQuery;
|
|
||||||
|
|
||||||
/// If true the light was occluded by geometry the
|
|
||||||
/// last frame it was updated.
|
|
||||||
//the last frame.
|
|
||||||
bool mWasOccluded;
|
|
||||||
|
|
||||||
F32 mLastScreenSize;
|
F32 mLastScreenSize;
|
||||||
|
|
||||||
F32 mLastPriority;
|
F32 mLastPriority;
|
||||||
|
|
@ -325,6 +312,8 @@ public:
|
||||||
|
|
||||||
bool hasCookieTex() const { return cookie.isNotEmpty(); }
|
bool hasCookieTex() const { return cookie.isNotEmpty(); }
|
||||||
|
|
||||||
|
GFXOcclusionQuery* getOcclusionQuery() const { return mQuery; }
|
||||||
|
|
||||||
GFXTextureObject* getCookieTex();
|
GFXTextureObject* getCookieTex();
|
||||||
|
|
||||||
GFXCubemap* getCookieCubeTex();
|
GFXCubemap* getCookieCubeTex();
|
||||||
|
|
@ -339,6 +328,7 @@ protected:
|
||||||
///
|
///
|
||||||
LightShadowMap *mShadowMap;
|
LightShadowMap *mShadowMap;
|
||||||
LightShadowMap *mDynamicShadowMap;
|
LightShadowMap *mDynamicShadowMap;
|
||||||
|
GFXOcclusionQuery* mQuery;
|
||||||
|
|
||||||
LightInfo *mLight;
|
LightInfo *mLight;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -174,12 +174,12 @@ void ShadowMapPass::render( SceneManager *sceneManager,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// --- Static Shadow Map ---
|
// --- Static Shadow Map ---
|
||||||
LightShadowMap *lsm = params->getOrCreateShadowMap();
|
LightShadowMap *lsm = params->getOrCreateShadowMap();
|
||||||
LightShadowMap *dlsm = params->getOrCreateShadowMap(true);
|
LightShadowMap *dlsm = params->getOrCreateShadowMap(true);
|
||||||
|
|
||||||
// First check the visiblity query... if it wasn't
|
// First check the visiblity query... if it wasn't
|
||||||
// visible skip it.
|
// visible skip it.
|
||||||
if (lsm->wasOccluded() || dlsm->wasOccluded())
|
if(params->getOcclusionQuery()->getStatus(true) == GFXOcclusionQuery::Occluded)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Any shadow that is visible is counted as being
|
// Any shadow that is visible is counted as being
|
||||||
|
|
@ -187,9 +187,9 @@ void ShadowMapPass::render( SceneManager *sceneManager,
|
||||||
++smActiveShadowMaps;
|
++smActiveShadowMaps;
|
||||||
|
|
||||||
// Do a priority update for this shadow.
|
// Do a priority update for this shadow.
|
||||||
lsm->updatePriority(diffuseState, currTime);
|
lsm->updatePriority(diffuseState, currTime);
|
||||||
|
|
||||||
shadowMaps.push_back(lsm);
|
shadowMaps.push_back(lsm);
|
||||||
|
|
||||||
// --- Dynamic Shadow Map ---
|
// --- Dynamic Shadow Map ---
|
||||||
|
|
||||||
|
|
@ -198,7 +198,7 @@ void ShadowMapPass::render( SceneManager *sceneManager,
|
||||||
++smActiveShadowMaps;
|
++smActiveShadowMaps;
|
||||||
|
|
||||||
// Do a priority update for this shadow.
|
// Do a priority update for this shadow.
|
||||||
dlsm->updatePriority(diffuseState, currTime);
|
dlsm->updatePriority(diffuseState, currTime);
|
||||||
|
|
||||||
shadowMaps.push_back( dlsm );
|
shadowMaps.push_back( dlsm );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ ImplementFeatureType( MFT_AlphaTest, MFG_Texture, 7.0f, true );
|
||||||
ImplementFeatureType( MFT_SpecularMap, MFG_Texture, 8.0f, true );
|
ImplementFeatureType( MFT_SpecularMap, MFG_Texture, 8.0f, true );
|
||||||
ImplementFeatureType( MFT_NormalMap, MFG_Texture, 9.0f, true );
|
ImplementFeatureType( MFT_NormalMap, MFG_Texture, 9.0f, true );
|
||||||
ImplementFeatureType( MFT_DetailNormalMap, MFG_Texture, 10.0f, true );
|
ImplementFeatureType( MFT_DetailNormalMap, MFG_Texture, 10.0f, true );
|
||||||
|
ImplementFeatureType( MFT_Imposter, U32(-1), -1, true );
|
||||||
|
|
||||||
ImplementFeatureType( MFT_AccuMap, MFG_PreLighting, 2.0f, true );
|
ImplementFeatureType( MFT_AccuMap, MFG_PreLighting, 2.0f, true );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@ DeclareFeatureType( MFT_OverlayMap );
|
||||||
DeclareFeatureType( MFT_DetailMap );
|
DeclareFeatureType( MFT_DetailMap );
|
||||||
DeclareFeatureType( MFT_DiffuseColor );
|
DeclareFeatureType( MFT_DiffuseColor );
|
||||||
DeclareFeatureType( MFT_DetailNormalMap );
|
DeclareFeatureType( MFT_DetailNormalMap );
|
||||||
|
DeclareFeatureType( MFT_Imposter );
|
||||||
|
|
||||||
DeclareFeatureType( MFT_AccuMap );
|
DeclareFeatureType( MFT_AccuMap );
|
||||||
DeclareFeatureType( MFT_AccuScale );
|
DeclareFeatureType( MFT_AccuScale );
|
||||||
|
|
|
||||||
|
|
@ -438,6 +438,7 @@ inline Point2I Point2I::operator/(const Point2I &_vec) const
|
||||||
|
|
||||||
inline Point2I& Point2I::operator/=(const Point2I &_vec)
|
inline Point2I& Point2I::operator/=(const Point2I &_vec)
|
||||||
{
|
{
|
||||||
|
AssertFatal(_vec.x != 0 && _vec.y != 0, "Error, div by zero attempted");
|
||||||
x /= _vec.x;
|
x /= _vec.x;
|
||||||
y /= _vec.y;
|
y /= _vec.y;
|
||||||
return *this;
|
return *this;
|
||||||
|
|
@ -645,6 +646,7 @@ inline Point2F Point2F::operator/(const Point2F &_vec) const
|
||||||
|
|
||||||
inline Point2F& Point2F::operator/=(const Point2F &_vec)
|
inline Point2F& Point2F::operator/=(const Point2F &_vec)
|
||||||
{
|
{
|
||||||
|
AssertFatal(_vec.x != 0 && _vec.y != 0, "Error, div by zero attempted");
|
||||||
x /= _vec.x;
|
x /= _vec.x;
|
||||||
y /= _vec.y;
|
y /= _vec.y;
|
||||||
return *this;
|
return *this;
|
||||||
|
|
|
||||||
|
|
@ -227,8 +227,8 @@ inline F32 QuatF::dot( const QuatF &q ) const
|
||||||
|
|
||||||
inline F32 QuatF::angleBetween( const QuatF & q )
|
inline F32 QuatF::angleBetween( const QuatF & q )
|
||||||
{
|
{
|
||||||
// angle between to quaternions
|
// angle between two normalized quaternions.
|
||||||
return mAcos(x * q.x + y * q.y + z * q.z + w * q.w);
|
return mAcos(q.dot(*this)) * 2.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _MQUAT_H_
|
#endif // _MQUAT_H_
|
||||||
|
|
|
||||||
|
|
@ -1847,7 +1847,7 @@ U32 extrudePolygonEdgesFromPoint( const Point3F* vertices, U32 numVertices, cons
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void MathUtils::mBuildHull2D(const Vector<Point2F> _inPoints, Vector<Point2F> &hullPoints)
|
void mBuildHull2D(const Vector<Point2F> _inPoints, Vector<Point2F> &hullPoints)
|
||||||
{
|
{
|
||||||
/// Andrew's monotone chain convex hull algorithm implementation
|
/// Andrew's monotone chain convex hull algorithm implementation
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -663,7 +663,7 @@ DefineEngineMethod(NavMesh, build, bool, (bool background, bool save), (true, fa
|
||||||
|
|
||||||
void NavMesh::cancelBuild()
|
void NavMesh::cancelBuild()
|
||||||
{
|
{
|
||||||
while(!mDirtyTiles.empty()) mDirtyTiles.pop();
|
mDirtyTiles.clear();
|
||||||
ctx->stopTimer(RC_TIMER_TOTAL);
|
ctx->stopTimer(RC_TIMER_TOTAL);
|
||||||
mBuilding = false;
|
mBuilding = false;
|
||||||
}
|
}
|
||||||
|
|
@ -733,7 +733,7 @@ void NavMesh::updateTiles(bool dirty)
|
||||||
|
|
||||||
mTiles.clear();
|
mTiles.clear();
|
||||||
mTileData.clear();
|
mTileData.clear();
|
||||||
while(!mDirtyTiles.empty()) mDirtyTiles.pop();
|
mDirtyTiles.clear();
|
||||||
|
|
||||||
const Box3F &box = DTStoRC(getWorldBox());
|
const Box3F &box = DTStoRC(getWorldBox());
|
||||||
if(box.isEmpty())
|
if(box.isEmpty())
|
||||||
|
|
@ -767,7 +767,7 @@ void NavMesh::updateTiles(bool dirty)
|
||||||
tileBmin, tileBmax));
|
tileBmin, tileBmax));
|
||||||
|
|
||||||
if(dirty)
|
if(dirty)
|
||||||
mDirtyTiles.push(mTiles.size() - 1);
|
mDirtyTiles.push_back_unique(mTiles.size() - 1);
|
||||||
|
|
||||||
if(mSaveIntermediates)
|
if(mSaveIntermediates)
|
||||||
mTileData.increment();
|
mTileData.increment();
|
||||||
|
|
@ -786,7 +786,7 @@ void NavMesh::buildNextTile()
|
||||||
{
|
{
|
||||||
// Pop a single dirty tile and process it.
|
// Pop a single dirty tile and process it.
|
||||||
U32 i = mDirtyTiles.front();
|
U32 i = mDirtyTiles.front();
|
||||||
mDirtyTiles.pop();
|
mDirtyTiles.pop_front();
|
||||||
const Tile &tile = mTiles[i];
|
const Tile &tile = mTiles[i];
|
||||||
// Intermediate data for tile build.
|
// Intermediate data for tile build.
|
||||||
TileData tempdata;
|
TileData tempdata;
|
||||||
|
|
@ -1098,7 +1098,7 @@ void NavMesh::buildTiles(const Box3F &box)
|
||||||
if(!tile.box.isOverlapped(box))
|
if(!tile.box.isOverlapped(box))
|
||||||
continue;
|
continue;
|
||||||
// Mark as dirty.
|
// Mark as dirty.
|
||||||
mDirtyTiles.push(i);
|
mDirtyTiles.push_back_unique(i);
|
||||||
}
|
}
|
||||||
if(mDirtyTiles.size())
|
if(mDirtyTiles.size())
|
||||||
ctx->startTimer(RC_TIMER_TOTAL);
|
ctx->startTimer(RC_TIMER_TOTAL);
|
||||||
|
|
@ -1114,7 +1114,7 @@ void NavMesh::buildTile(const U32 &tile)
|
||||||
{
|
{
|
||||||
if(tile < mTiles.size())
|
if(tile < mTiles.size())
|
||||||
{
|
{
|
||||||
mDirtyTiles.push(tile);
|
mDirtyTiles.push_back_unique(tile);
|
||||||
ctx->startTimer(RC_TIMER_TOTAL);
|
ctx->startTimer(RC_TIMER_TOTAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1136,7 +1136,7 @@ void NavMesh::buildLinks()
|
||||||
mLinksUnsynced[j])
|
mLinksUnsynced[j])
|
||||||
{
|
{
|
||||||
// Mark tile for build.
|
// Mark tile for build.
|
||||||
mDirtyTiles.push(i);
|
mDirtyTiles.push_back_unique(i);
|
||||||
// Delete link if necessary
|
// Delete link if necessary
|
||||||
if(mDeleteLinks[j])
|
if(mDeleteLinks[j])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,7 @@ private:
|
||||||
Vector<TileData> mTileData;
|
Vector<TileData> mTileData;
|
||||||
|
|
||||||
/// List of indices to the tile array which are dirty.
|
/// List of indices to the tile array which are dirty.
|
||||||
std::queue<U32> mDirtyTiles;
|
Vector<U32> mDirtyTiles;
|
||||||
|
|
||||||
/// Update tile dimensions.
|
/// Update tile dimensions.
|
||||||
void updateTiles(bool dirty = false);
|
void updateTiles(bool dirty = false);
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ bool fsTiXmlDocument::LoadFile( const char * pFilename, TiXmlEncoding encoding )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// File open for read?
|
// File open for read?
|
||||||
if ( !stream.open( filenameBuffer, Torque::FS::File::AccessMode::Read ) )
|
if ( !stream.open( filenameBuffer, Torque::FS::File::Read ) )
|
||||||
{
|
{
|
||||||
// No, so warn.
|
// No, so warn.
|
||||||
Con::warnf("TamlXmlParser::parse() - Could not open filename '%s' for parse.", filenameBuffer );
|
Con::warnf("TamlXmlParser::parse() - Could not open filename '%s' for parse.", filenameBuffer );
|
||||||
|
|
@ -67,7 +67,7 @@ bool fsTiXmlDocument::SaveFile( const char * pFilename ) const
|
||||||
FileStream stream;
|
FileStream stream;
|
||||||
|
|
||||||
// File opened?
|
// File opened?
|
||||||
if ( !stream.open( filenameBuffer, Torque::FS::File::AccessMode::Write ) )
|
if ( !stream.open( filenameBuffer, Torque::FS::File::Write ) )
|
||||||
{
|
{
|
||||||
// No, so warn.
|
// No, so warn.
|
||||||
Con::warnf("Taml::writeFile() - Could not open filename '%s' for write.", filenameBuffer );
|
Con::warnf("Taml::writeFile() - Could not open filename '%s' for write.", filenameBuffer );
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef TINYXML_INCLUDED
|
#ifndef TINYXML_INCLUDED
|
||||||
#include "tinyXML/tinyxml.h"
|
#include "tinyxml/tinyxml.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TINYXML_INCLUDED
|
#ifndef TINYXML_INCLUDED
|
||||||
#include "tinyXML/tinyxml.h"
|
#include "tinyxml/tinyxml.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
// Debug Profiling.
|
// Debug Profiling.
|
||||||
#include "platform/profiler.h"
|
#include "platform/profiler.h"
|
||||||
#include "persistence/taml/fsTinyxml.h"
|
#include "persistence/taml/fsTinyXml.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
// Debug Profiling.
|
// Debug Profiling.
|
||||||
#include "platform/profiler.h"
|
#include "platform/profiler.h"
|
||||||
#include "persistence/taml/fsTinyxml.h"
|
#include "persistence/taml/fsTinyXml.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -724,6 +724,11 @@ bool Platform::hasSubDirectory(const char *path)
|
||||||
return false; // either this dir had no subdirectories, or they were all on the exclude list.
|
return false; // either this dir had no subdirectories, or they were all on the exclude list.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Platform::fileDelete(const char * name)
|
||||||
|
{
|
||||||
|
return dFileDelete(name);
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool recurseDumpDirectories(const char *basePath, const char *path, Vector<StringTableEntry> &directoryVector, S32 depth, bool noBasePath)
|
bool recurseDumpDirectories(const char *basePath, const char *path, Vector<StringTableEntry> &directoryVector, S32 depth, bool noBasePath)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -13,18 +13,16 @@ namespace PlatformGL
|
||||||
return;
|
return;
|
||||||
|
|
||||||
inited = true;
|
inited = true;
|
||||||
const U32 majorOGL = 4;
|
const U32 majorOGL = 3;
|
||||||
const U32 minorOGL = 2;
|
const U32 minorOGL = 2;
|
||||||
U32 debugFlag = 0;
|
U32 debugFlag = 0;
|
||||||
#ifdef TORQUE_DEBUG
|
#ifdef TORQUE_DEBUG
|
||||||
debugFlag |= SDL_GL_CONTEXT_DEBUG_FLAG;
|
debugFlag |= SDL_GL_CONTEXT_DEBUG_FLAG;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0 // cause problem with glew, no extension load
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, majorOGL);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, majorOGL);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, minorOGL);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, minorOGL);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||||
#endif
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, debugFlag);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, debugFlag);
|
||||||
|
|
||||||
SDL_ClearError();
|
SDL_ClearError();
|
||||||
|
|
|
||||||
|
|
@ -1321,6 +1321,7 @@ static bool recurseDumpDirectories(const char *basePath, const char *subPath, Ve
|
||||||
dsize_t subtrLen = subPath ? dStrlen(subPath) : 0;
|
dsize_t subtrLen = subPath ? dStrlen(subPath) : 0;
|
||||||
char trail = trLen > 0 ? basePath[ trLen - 1 ] : '\0';
|
char trail = trLen > 0 ? basePath[ trLen - 1 ] : '\0';
|
||||||
char subTrail = subtrLen > 0 ? subPath[ subtrLen - 1 ] : '\0';
|
char subTrail = subtrLen > 0 ? subPath[ subtrLen - 1 ] : '\0';
|
||||||
|
char subLead = subtrLen > 0 ? subPath[0] : '\0';
|
||||||
|
|
||||||
if( trail == '/' )
|
if( trail == '/' )
|
||||||
{
|
{
|
||||||
|
|
@ -1380,13 +1381,23 @@ static bool recurseDumpDirectories(const char *basePath, const char *subPath, Ve
|
||||||
{
|
{
|
||||||
if( ( subPath && ( dStrncmp( subPath, "", 1 ) != 0 ) ) )
|
if( ( subPath && ( dStrncmp( subPath, "", 1 ) != 0 ) ) )
|
||||||
{
|
{
|
||||||
char szPath [ 1024 ];
|
char szPath[1024];
|
||||||
dMemset( szPath, 0, 1024 );
|
dMemset(szPath, 0, 1024);
|
||||||
if( trail != '/' )
|
if (trail == '/')
|
||||||
dSprintf( szPath, 1024, "%s%s", basePath, subPath );
|
{
|
||||||
|
if (subLead == '/')
|
||||||
|
dSprintf(szPath, 1024, "%s%s", basePath, &subPath[1]);
|
||||||
|
else
|
||||||
|
dSprintf(szPath, 1024, "%s%s", basePath, subPath);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
dSprintf( szPath, 1024, "%s%s", basePath, &subPath[1] );
|
{
|
||||||
directoryVector.push_back( StringTable->insert( szPath ) );
|
if (subLead == '/')
|
||||||
|
dSprintf(szPath, 1024, "%s%s", basePath, subPath);
|
||||||
|
else
|
||||||
|
dSprintf(szPath, 1024, "%s/%s", basePath, subPath);
|
||||||
|
}
|
||||||
|
directoryVector.push_back(StringTable->insert(szPath));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
directoryVector.push_back( StringTable->insert( basePath ) );
|
directoryVector.push_back( StringTable->insert( basePath ) );
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
|
||||||
if (modType == TOUCH)
|
if (modType == TOUCH)
|
||||||
return(utime(prefPathName, 0) != -1);
|
return(utime(prefPathName, 0) != -1);
|
||||||
else if (modType == DELETE)
|
else if (modType == DELETE)
|
||||||
return (remove(prefPathName) != -1);
|
return (remove(prefPathName) == 0);
|
||||||
else
|
else
|
||||||
AssertFatal(false, "Unknown File Mod type");
|
AssertFatal(false, "Unknown File Mod type");
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1140,6 +1140,11 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Platform::fileDelete(const char * name)
|
||||||
|
{
|
||||||
|
return ModifyFile(name, DELETE);
|
||||||
|
}
|
||||||
|
|
||||||
static bool recurseDumpDirectories(const char *basePath, const char *subPath, Vector<StringTableEntry> &directoryVector, S32 currentDepth, S32 recurseDepth, bool noBasePath)
|
static bool recurseDumpDirectories(const char *basePath, const char *subPath, Vector<StringTableEntry> &directoryVector, S32 currentDepth, S32 recurseDepth, bool noBasePath)
|
||||||
{
|
{
|
||||||
char Path[1024];
|
char Path[1024];
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ const RenderInstType RenderPassManager::RIT_ObjectTranslucent("ObjectTranslucent
|
||||||
const RenderInstType RenderPassManager::RIT_Decal("Decal");
|
const RenderInstType RenderPassManager::RIT_Decal("Decal");
|
||||||
const RenderInstType RenderPassManager::RIT_Water("Water");
|
const RenderInstType RenderPassManager::RIT_Water("Water");
|
||||||
const RenderInstType RenderPassManager::RIT_Foliage("Foliage");
|
const RenderInstType RenderPassManager::RIT_Foliage("Foliage");
|
||||||
|
const RenderInstType RenderPassManager::RIT_VolumetricFog("ObjectVolumetricFog");
|
||||||
const RenderInstType RenderPassManager::RIT_Translucent("Translucent");
|
const RenderInstType RenderPassManager::RIT_Translucent("Translucent");
|
||||||
const RenderInstType RenderPassManager::RIT_Begin("Begin");
|
const RenderInstType RenderPassManager::RIT_Begin("Begin");
|
||||||
const RenderInstType RenderPassManager::RIT_Custom("Custom");
|
const RenderInstType RenderPassManager::RIT_Custom("Custom");
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,7 @@ public:
|
||||||
static const RenderInstType RIT_Decal;
|
static const RenderInstType RIT_Decal;
|
||||||
static const RenderInstType RIT_Water;
|
static const RenderInstType RIT_Water;
|
||||||
static const RenderInstType RIT_Foliage;
|
static const RenderInstType RIT_Foliage;
|
||||||
|
static const RenderInstType RIT_VolumetricFog;
|
||||||
static const RenderInstType RIT_Translucent;
|
static const RenderInstType RIT_Translucent;
|
||||||
static const RenderInstType RIT_Begin;
|
static const RenderInstType RIT_Begin;
|
||||||
static const RenderInstType RIT_Custom;
|
static const RenderInstType RIT_Custom;
|
||||||
|
|
|
||||||
|
|
@ -107,8 +107,7 @@ void RenderTexTargetBinManager::initPersistFields()
|
||||||
|
|
||||||
bool RenderTexTargetBinManager::setTargetSize(const Point2I &newTargetSize)
|
bool RenderTexTargetBinManager::setTargetSize(const Point2I &newTargetSize)
|
||||||
{
|
{
|
||||||
if( GFX->getAdapterType() != OpenGL && // Targets need to match up exactly in size on OpenGL.
|
if( mTargetSize.x >= newTargetSize.x &&
|
||||||
mTargetSize.x >= newTargetSize.x &&
|
|
||||||
mTargetSize.y >= newTargetSize.y )
|
mTargetSize.y >= newTargetSize.y )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ RenderTranslucentMgr::RenderTranslucentMgr()
|
||||||
{
|
{
|
||||||
notifyType( RenderPassManager::RIT_ObjectTranslucent );
|
notifyType( RenderPassManager::RIT_ObjectTranslucent );
|
||||||
notifyType( RenderPassManager::RIT_Particle );
|
notifyType( RenderPassManager::RIT_Particle );
|
||||||
|
notifyType( RenderPassManager::RIT_VolumetricFog);
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTranslucentMgr::~RenderTranslucentMgr()
|
RenderTranslucentMgr::~RenderTranslucentMgr()
|
||||||
|
|
@ -187,6 +188,15 @@ void RenderTranslucentMgr::render( SceneRenderState *state )
|
||||||
j++;
|
j++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (baseRI->type == RenderPassManager::RIT_VolumetricFog)
|
||||||
|
{
|
||||||
|
ObjectRenderInst* objRI = static_cast<ObjectRenderInst*>(baseRI);
|
||||||
|
objRI->renderDelegate(objRI, state, NULL);
|
||||||
|
lastVB = NULL;
|
||||||
|
lastPB = NULL;
|
||||||
|
j++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
else if ( baseRI->type == RenderPassManager::RIT_Particle )
|
else if ( baseRI->type == RenderPassManager::RIT_Particle )
|
||||||
{
|
{
|
||||||
ParticleRenderInst *ri = static_cast<ParticleRenderInst*>(baseRI);
|
ParticleRenderInst *ri = static_cast<ParticleRenderInst*>(baseRI);
|
||||||
|
|
|
||||||
|
|
@ -105,8 +105,8 @@ struct FModFNTable
|
||||||
}
|
}
|
||||||
~FModFNTable()
|
~FModFNTable()
|
||||||
{
|
{
|
||||||
eventDllRef = NULL;
|
|
||||||
dllRef = NULL;
|
dllRef = NULL;
|
||||||
|
eventDllRef = NULL;
|
||||||
delete mutex;
|
delete mutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,8 @@ void AccuTexFeatGLSL::processPix(Vector<ShaderComponent*> &componentList,
|
||||||
|
|
||||||
// get the accu pixel color
|
// get the accu pixel color
|
||||||
meta->addStatement( new GenOp( " @ = tex2D(@, @ * @);\r\n", colorAccuDecl, accuMap, inTex, accuScale ) );
|
meta->addStatement( new GenOp( " @ = tex2D(@, @ * @);\r\n", colorAccuDecl, accuMap, inTex, accuScale ) );
|
||||||
|
if (!fd.features[MFT_Imposter])
|
||||||
|
meta->addStatement(new GenOp(" @ = toLinear(@);\r\n", accuColor, accuColor));
|
||||||
|
|
||||||
// scale up normals
|
// scale up normals
|
||||||
meta->addStatement( new GenOp( " @.xyz = @.xyz * 2.0 - 0.5;\r\n", bumpNorm, bumpNorm ) );
|
meta->addStatement( new GenOp( " @.xyz = @.xyz * 2.0 - 0.5;\r\n", bumpNorm, bumpNorm ) );
|
||||||
|
|
|
||||||
|
|
@ -828,6 +828,12 @@ Var* ShaderFeatureGLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &compon
|
||||||
// Base Texture
|
// Base Texture
|
||||||
//****************************************************************************
|
//****************************************************************************
|
||||||
|
|
||||||
|
DiffuseMapFeatGLSL::DiffuseMapFeatGLSL()
|
||||||
|
: mTorqueDep("shaders/common/gl/torque.glsl")
|
||||||
|
{
|
||||||
|
addDependency(&mTorqueDep);
|
||||||
|
}
|
||||||
|
|
||||||
void DiffuseMapFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
void DiffuseMapFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||||
const MaterialFeatureData &fd )
|
const MaterialFeatureData &fd )
|
||||||
{
|
{
|
||||||
|
|
@ -855,20 +861,23 @@ void DiffuseMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
diffuseMap->sampler = true;
|
diffuseMap->sampler = true;
|
||||||
diffuseMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
diffuseMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||||
|
|
||||||
|
// create sample color var
|
||||||
|
Var *diffColor = new Var;
|
||||||
|
diffColor->setType("vec4");
|
||||||
|
diffColor->setName("diffuseColor");
|
||||||
|
LangElement *colorDecl = new DecOp( diffColor );
|
||||||
|
|
||||||
|
MultiLine * meta = new MultiLine;
|
||||||
|
output = meta;
|
||||||
|
|
||||||
if ( fd.features[MFT_CubeMap] )
|
if ( fd.features[MFT_CubeMap] )
|
||||||
{
|
{
|
||||||
MultiLine * meta = new MultiLine;
|
|
||||||
|
|
||||||
// create sample color
|
|
||||||
Var *diffColor = new Var;
|
|
||||||
diffColor->setType( "vec4" );
|
|
||||||
diffColor->setName( "diffuseColor" );
|
|
||||||
LangElement *colorDecl = new DecOp( diffColor );
|
|
||||||
|
|
||||||
meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n",
|
meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n",
|
||||||
colorDecl,
|
colorDecl,
|
||||||
diffuseMap,
|
diffuseMap,
|
||||||
inTex ) );
|
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 ) ) );
|
meta->addStatement( new GenOp( " @;\r\n", assignColor( diffColor, Material::Mul ) ) );
|
||||||
output = meta;
|
output = meta;
|
||||||
|
|
@ -877,8 +886,6 @@ void DiffuseMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
{
|
{
|
||||||
// Handle atlased textures
|
// Handle atlased textures
|
||||||
// http://www.infinity-universe.com/Infinity/index.php?option=com_content&task=view&id=65&Itemid=47
|
// http://www.infinity-universe.com/Infinity/index.php?option=com_content&task=view&id=65&Itemid=47
|
||||||
MultiLine * meta = new MultiLine;
|
|
||||||
output = meta;
|
|
||||||
|
|
||||||
Var *atlasedTex = new Var;
|
Var *atlasedTex = new Var;
|
||||||
atlasedTex->setName("atlasedTexCoord");
|
atlasedTex->setName("atlasedTexCoord");
|
||||||
|
|
@ -934,11 +941,6 @@ void DiffuseMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
// For the rest of the feature...
|
// For the rest of the feature...
|
||||||
inTex = atlasedTex;
|
inTex = atlasedTex;
|
||||||
|
|
||||||
// create sample color var
|
|
||||||
Var *diffColor = new Var;
|
|
||||||
diffColor->setType("vec4");
|
|
||||||
diffColor->setName("diffuseColor");
|
|
||||||
|
|
||||||
// To dump out UV coords...
|
// To dump out UV coords...
|
||||||
//#define DEBUG_ATLASED_UV_COORDS
|
//#define DEBUG_ATLASED_UV_COORDS
|
||||||
#ifdef DEBUG_ATLASED_UV_COORDS
|
#ifdef DEBUG_ATLASED_UV_COORDS
|
||||||
|
|
@ -954,21 +956,26 @@ void DiffuseMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
{
|
{
|
||||||
meta->addStatement(new GenOp( " @ = tex2Dlod(@, float4(@, 0.0, mipLod));\r\n",
|
meta->addStatement(new GenOp( " @ = tex2Dlod(@, float4(@, 0.0, mipLod));\r\n",
|
||||||
new DecOp(diffColor), diffuseMap, inTex));
|
new DecOp(diffColor), diffuseMap, inTex));
|
||||||
|
if (!fd.features[MFT_Imposter])
|
||||||
|
meta->addStatement(new GenOp(" @ = toLinear(@);\r\n", diffColor, diffColor));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
meta->addStatement(new GenOp( " @ = tex2D(@, @);\r\n",
|
meta->addStatement(new GenOp( " @ = tex2D(@, @);\r\n",
|
||||||
new DecOp(diffColor), diffuseMap, inTex));
|
new DecOp(diffColor), 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)));
|
meta->addStatement(new GenOp( " @;\r\n", assignColor(diffColor, Material::Mul)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LangElement *statement = new GenOp( "tex2D(@, @)", diffuseMap, inTex );
|
meta->addStatement(new GenOp("@ = tex2D(@, @);\r\n", colorDecl, diffuseMap, inTex));
|
||||||
output = new GenOp( " @;\r\n", assignColor( statement, Material::Mul ) );
|
if (!fd.features[MFT_Imposter])
|
||||||
|
meta->addStatement(new GenOp(" @ = toLinear(@);\r\n", diffColor, diffColor));
|
||||||
|
meta->addStatement(new GenOp(" @;\r\n", assignColor(diffColor, Material::Mul)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderFeature::Resources DiffuseMapFeatGLSL::getResources( const MaterialFeatureData &fd )
|
ShaderFeature::Resources DiffuseMapFeatGLSL::getResources( const MaterialFeatureData &fd )
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,12 @@ public:
|
||||||
/// Base texture
|
/// Base texture
|
||||||
class DiffuseMapFeatGLSL : public ShaderFeatureGLSL
|
class DiffuseMapFeatGLSL : public ShaderFeatureGLSL
|
||||||
{
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
ShaderIncludeDependency mTorqueDep;
|
||||||
public:
|
public:
|
||||||
|
DiffuseMapFeatGLSL();
|
||||||
virtual void processVert( Vector<ShaderComponent*> &componentList,
|
virtual void processVert( Vector<ShaderComponent*> &componentList,
|
||||||
const MaterialFeatureData &fd );
|
const MaterialFeatureData &fd );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ void _initShaderGenGLSL( ShaderGen *shaderGen )
|
||||||
FEATUREMGR->registerFeature( MFT_IsTranslucent, new NamedFeatureGLSL( "Translucent" ) );
|
FEATUREMGR->registerFeature( MFT_IsTranslucent, new NamedFeatureGLSL( "Translucent" ) );
|
||||||
FEATUREMGR->registerFeature( MFT_Visibility, new VisibilityFeatGLSL );
|
FEATUREMGR->registerFeature( MFT_Visibility, new VisibilityFeatGLSL );
|
||||||
FEATUREMGR->registerFeature( MFT_Fog, new FogFeatGLSL );
|
FEATUREMGR->registerFeature( MFT_Fog, new FogFeatGLSL );
|
||||||
|
FEATUREMGR->registerFeature( MFT_Imposter, new NamedFeatureGLSL( "Imposter" ) );
|
||||||
|
|
||||||
FEATUREMGR->registerFeature( MFT_NormalsOut, new NormalsOutFeatGLSL );
|
FEATUREMGR->registerFeature( MFT_NormalsOut, new NormalsOutFeatGLSL );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,8 @@ void AccuTexFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
|
|
||||||
// get the accu pixel color
|
// get the accu pixel color
|
||||||
meta->addStatement( new GenOp( " @ = tex2D(@, @ * @);\r\n", colorAccuDecl, accuMap, inTex, accuScale ) );
|
meta->addStatement( new GenOp( " @ = tex2D(@, @ * @);\r\n", colorAccuDecl, accuMap, inTex, accuScale ) );
|
||||||
|
if (!fd.features[MFT_Imposter])
|
||||||
|
meta->addStatement(new GenOp(" @ = toLinear(@);\r\n", accuColor, accuColor));
|
||||||
|
|
||||||
// scale up normals
|
// scale up normals
|
||||||
meta->addStatement( new GenOp( " @.xyz = @.xyz * 2.0 - 0.5;\r\n", bumpNorm, bumpNorm ) );
|
meta->addStatement( new GenOp( " @.xyz = @.xyz * 2.0 - 0.5;\r\n", bumpNorm, bumpNorm ) );
|
||||||
|
|
|
||||||
|
|
@ -826,6 +826,12 @@ Var* ShaderFeatureHLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &compon
|
||||||
// Base Texture
|
// Base Texture
|
||||||
//****************************************************************************
|
//****************************************************************************
|
||||||
|
|
||||||
|
DiffuseMapFeatHLSL::DiffuseMapFeatHLSL()
|
||||||
|
: mTorqueDep("shaders/common/torque.hlsl")
|
||||||
|
{
|
||||||
|
addDependency(&mTorqueDep);
|
||||||
|
}
|
||||||
|
|
||||||
void DiffuseMapFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
void DiffuseMapFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||||
const MaterialFeatureData &fd )
|
const MaterialFeatureData &fd )
|
||||||
{
|
{
|
||||||
|
|
@ -853,30 +859,30 @@ void DiffuseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
diffuseMap->sampler = true;
|
diffuseMap->sampler = true;
|
||||||
diffuseMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
diffuseMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||||
|
|
||||||
|
// create sample color
|
||||||
|
Var *diffColor = new Var;
|
||||||
|
diffColor->setType("float4");
|
||||||
|
diffColor->setName("diffuseColor");
|
||||||
|
LangElement *colorDecl = new DecOp(diffColor);
|
||||||
|
|
||||||
|
MultiLine * meta = new MultiLine;
|
||||||
|
output = meta;
|
||||||
|
|
||||||
if ( fd.features[MFT_CubeMap] )
|
if ( fd.features[MFT_CubeMap] )
|
||||||
{
|
{
|
||||||
MultiLine * meta = new MultiLine;
|
|
||||||
|
|
||||||
// create sample color
|
|
||||||
Var *diffColor = new Var;
|
|
||||||
diffColor->setType( "float4" );
|
|
||||||
diffColor->setName( "diffuseColor" );
|
|
||||||
LangElement *colorDecl = new DecOp( diffColor );
|
|
||||||
|
|
||||||
meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n",
|
meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n",
|
||||||
colorDecl,
|
colorDecl,
|
||||||
diffuseMap,
|
diffuseMap,
|
||||||
inTex ) );
|
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 ) ) );
|
meta->addStatement( new GenOp( " @;\r\n", assignColor( diffColor, Material::Mul ) ) );
|
||||||
output = meta;
|
|
||||||
}
|
}
|
||||||
else if(fd.features[MFT_DiffuseMapAtlas])
|
else if(fd.features[MFT_DiffuseMapAtlas])
|
||||||
{
|
{
|
||||||
// Handle atlased textures
|
// Handle atlased textures
|
||||||
// http://www.infinity-universe.com/Infinity/index.php?option=com_content&task=view&id=65&Itemid=47
|
// http://www.infinity-universe.com/Infinity/index.php?option=com_content&task=view&id=65&Itemid=47
|
||||||
MultiLine * meta = new MultiLine;
|
|
||||||
output = meta;
|
|
||||||
|
|
||||||
Var *atlasedTex = new Var;
|
Var *atlasedTex = new Var;
|
||||||
atlasedTex->setName("atlasedTexCoord");
|
atlasedTex->setName("atlasedTexCoord");
|
||||||
|
|
@ -932,11 +938,6 @@ void DiffuseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
// For the rest of the feature...
|
// For the rest of the feature...
|
||||||
inTex = atlasedTex;
|
inTex = atlasedTex;
|
||||||
|
|
||||||
// create sample color var
|
|
||||||
Var *diffColor = new Var;
|
|
||||||
diffColor->setType("float4");
|
|
||||||
diffColor->setName("diffuseColor");
|
|
||||||
|
|
||||||
// To dump out UV coords...
|
// To dump out UV coords...
|
||||||
//#define DEBUG_ATLASED_UV_COORDS
|
//#define DEBUG_ATLASED_UV_COORDS
|
||||||
#ifdef DEBUG_ATLASED_UV_COORDS
|
#ifdef DEBUG_ATLASED_UV_COORDS
|
||||||
|
|
@ -958,15 +959,18 @@ void DiffuseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
meta->addStatement(new GenOp( " @ = tex2D(@, @);\r\n",
|
meta->addStatement(new GenOp( " @ = tex2D(@, @);\r\n",
|
||||||
new DecOp(diffColor), diffuseMap, inTex));
|
new DecOp(diffColor), 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)));
|
meta->addStatement(new GenOp( " @;\r\n", assignColor(diffColor, Material::Mul)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LangElement *statement = new GenOp( "tex2D(@, @)", diffuseMap, inTex );
|
meta->addStatement(new GenOp("@ = tex2D(@, @);\r\n", colorDecl, diffuseMap, inTex));
|
||||||
output = new GenOp( " @;\r\n", assignColor( statement, Material::Mul ) );
|
if (!fd.features[MFT_Imposter])
|
||||||
|
meta->addStatement(new GenOp(" @ = toLinear(@);\r\n", diffColor, diffColor));
|
||||||
|
meta->addStatement(new GenOp(" @;\r\n", assignColor(diffColor, Material::Mul)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderFeature::Resources DiffuseMapFeatHLSL::getResources( const MaterialFeatureData &fd )
|
ShaderFeature::Resources DiffuseMapFeatHLSL::getResources( const MaterialFeatureData &fd )
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,12 @@ public:
|
||||||
/// Base texture
|
/// Base texture
|
||||||
class DiffuseMapFeatHLSL : public ShaderFeatureHLSL
|
class DiffuseMapFeatHLSL : public ShaderFeatureHLSL
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
ShaderIncludeDependency mTorqueDep;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
DiffuseMapFeatHLSL();
|
||||||
virtual void processVert( Vector<ShaderComponent*> &componentList,
|
virtual void processVert( Vector<ShaderComponent*> &componentList,
|
||||||
const MaterialFeatureData &fd );
|
const MaterialFeatureData &fd );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ void _initShaderGenHLSL( ShaderGen *shaderGen )
|
||||||
FEATUREMGR->registerFeature( MFT_GlossMap, new NamedFeatureHLSL( "Gloss Map" ) );
|
FEATUREMGR->registerFeature( MFT_GlossMap, new NamedFeatureHLSL( "Gloss Map" ) );
|
||||||
FEATUREMGR->registerFeature( MFT_LightbufferMRT, new NamedFeatureHLSL( "Lightbuffer MRT" ) );
|
FEATUREMGR->registerFeature( MFT_LightbufferMRT, new NamedFeatureHLSL( "Lightbuffer MRT" ) );
|
||||||
FEATUREMGR->registerFeature( MFT_RenderTarget1_Zero, new RenderTargetZeroHLSL( ShaderFeature::RenderTarget1 ) );
|
FEATUREMGR->registerFeature( MFT_RenderTarget1_Zero, new RenderTargetZeroHLSL( ShaderFeature::RenderTarget1 ) );
|
||||||
|
FEATUREMGR->registerFeature( MFT_Imposter, new NamedFeatureHLSL( "Imposter" ) );
|
||||||
|
|
||||||
FEATUREMGR->registerFeature( MFT_DiffuseMapAtlas, new NamedFeatureHLSL( "Diffuse Map Atlas" ) );
|
FEATUREMGR->registerFeature( MFT_DiffuseMapAtlas, new NamedFeatureHLSL( "Diffuse Map Atlas" ) );
|
||||||
FEATUREMGR->registerFeature( MFT_NormalMapAtlas, new NamedFeatureHLSL( "Normal Map Atlas" ) );
|
FEATUREMGR->registerFeature( MFT_NormalMapAtlas, new NamedFeatureHLSL( "Normal Map Atlas" ) );
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ void FeatureSet::removeFeature( const FeatureType &type )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U32 FeatureSet::getNextFeatureIndex( const FeatureType &type, S32 index ) const
|
S32 FeatureSet::getNextFeatureIndex( const FeatureType &type, S32 index ) const
|
||||||
{
|
{
|
||||||
for ( U32 i=0; i < mFeatures.size(); i++ )
|
for ( U32 i=0; i < mFeatures.size(); i++ )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ public:
|
||||||
void removeFeature( const FeatureType &type );
|
void removeFeature( const FeatureType &type );
|
||||||
|
|
||||||
///
|
///
|
||||||
U32 getNextFeatureIndex( const FeatureType &type, S32 index ) const;
|
S32 getNextFeatureIndex( const FeatureType &type, S32 index ) const;
|
||||||
|
|
||||||
/// Removes features that are not in the input set.
|
/// Removes features that are not in the input set.
|
||||||
void filter( const FeatureSet &features );
|
void filter( const FeatureSet &features );
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ public:
|
||||||
void setProcessIndex( S32 index ) { mProcessIndex = index; }
|
void setProcessIndex( S32 index ) { mProcessIndex = index; }
|
||||||
|
|
||||||
///
|
///
|
||||||
U32 getProcessIndex() const { return mProcessIndex; }
|
S32 getProcessIndex() const { return mProcessIndex; }
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Virtual Functions
|
// Virtual Functions
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,12 @@ MODULE_BEGIN( TerrainFeatGLSL )
|
||||||
MODULE_END;
|
MODULE_END;
|
||||||
|
|
||||||
|
|
||||||
|
TerrainFeatGLSL::TerrainFeatGLSL()
|
||||||
|
: mTorqueDep( "shaders/common/gl/torque.glsl" )
|
||||||
|
{
|
||||||
|
addDependency( &mTorqueDep );
|
||||||
|
}
|
||||||
|
|
||||||
Var* TerrainFeatGLSL::_getUniformVar( const char *name, const char *type, ConstantSortPosition csp )
|
Var* TerrainFeatGLSL::_getUniformVar( const char *name, const char *type, ConstantSortPosition csp )
|
||||||
{
|
{
|
||||||
Var *theVar = (Var*)LangElement::find( name );
|
Var *theVar = (Var*)LangElement::find( name );
|
||||||
|
|
@ -262,6 +268,7 @@ void TerrainBaseMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentLis
|
||||||
baseColor->setType( "vec4" );
|
baseColor->setType( "vec4" );
|
||||||
baseColor->setName( "baseColor" );
|
baseColor->setName( "baseColor" );
|
||||||
meta->addStatement( new GenOp( " @ = tex2D( @, @.xy );\r\n", new DecOp( baseColor ), diffuseMap, texCoord ) );
|
meta->addStatement( new GenOp( " @ = tex2D( @, @.xy );\r\n", new DecOp( baseColor ), diffuseMap, texCoord ) );
|
||||||
|
meta->addStatement(new GenOp(" @ = toLinear(@);\r\n", baseColor, baseColor));
|
||||||
meta->addStatement( new GenOp( " @;\r\n", assignColor( baseColor, Material::Mul ) ) );
|
meta->addStatement( new GenOp( " @;\r\n", assignColor( baseColor, Material::Mul ) ) );
|
||||||
|
|
||||||
output = meta;
|
output = meta;
|
||||||
|
|
@ -291,7 +298,7 @@ TerrainDetailMapFeatGLSL::TerrainDetailMapFeatGLSL()
|
||||||
void TerrainDetailMapFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
void TerrainDetailMapFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||||
const MaterialFeatureData &fd )
|
const MaterialFeatureData &fd )
|
||||||
{
|
{
|
||||||
const U32 detailIndex = getProcessIndex();
|
const S32 detailIndex = getProcessIndex();
|
||||||
|
|
||||||
// Grab incoming texture coords... the base map feature
|
// Grab incoming texture coords... the base map feature
|
||||||
// made sure this was created.
|
// made sure this was created.
|
||||||
|
|
@ -376,7 +383,7 @@ void TerrainDetailMapFeatGLSL::processVert( Vector<ShaderComponent*> &component
|
||||||
void TerrainDetailMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
void TerrainDetailMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
const MaterialFeatureData &fd )
|
const MaterialFeatureData &fd )
|
||||||
{
|
{
|
||||||
const U32 detailIndex = getProcessIndex();
|
const S32 detailIndex = getProcessIndex();
|
||||||
Var *inTex = getVertTexCoord( "texCoord" );
|
Var *inTex = getVertTexCoord( "texCoord" );
|
||||||
|
|
||||||
MultiLine *meta = new MultiLine;
|
MultiLine *meta = new MultiLine;
|
||||||
|
|
@ -609,7 +616,7 @@ TerrainMacroMapFeatGLSL::TerrainMacroMapFeatGLSL()
|
||||||
void TerrainMacroMapFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
void TerrainMacroMapFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||||
const MaterialFeatureData &fd )
|
const MaterialFeatureData &fd )
|
||||||
{
|
{
|
||||||
const U32 detailIndex = getProcessIndex();
|
const S32 detailIndex = getProcessIndex();
|
||||||
|
|
||||||
// Grab incoming texture coords... the base map feature
|
// Grab incoming texture coords... the base map feature
|
||||||
// made sure this was created.
|
// made sure this was created.
|
||||||
|
|
@ -667,7 +674,7 @@ void TerrainMacroMapFeatGLSL::processVert( Vector<ShaderComponent*> &componentL
|
||||||
void TerrainMacroMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
void TerrainMacroMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
const MaterialFeatureData &fd )
|
const MaterialFeatureData &fd )
|
||||||
{
|
{
|
||||||
const U32 detailIndex = getProcessIndex();
|
const S32 detailIndex = getProcessIndex();
|
||||||
Var *inTex = getVertTexCoord( "texCoord" );
|
Var *inTex = getVertTexCoord( "texCoord" );
|
||||||
|
|
||||||
MultiLine *meta = new MultiLine;
|
MultiLine *meta = new MultiLine;
|
||||||
|
|
@ -893,7 +900,7 @@ void TerrainNormalMapFeatGLSL::processPix( Vector<ShaderComponent*> &component
|
||||||
meta->addStatement( new GenOp( " @ = tGetMatrix3Row(@, 2);\r\n", new DecOp( gbNormal ), viewToTangent ) );
|
meta->addStatement( new GenOp( " @ = tGetMatrix3Row(@, 2);\r\n", new DecOp( gbNormal ), viewToTangent ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
const U32 normalIndex = getProcessIndex();
|
const S32 normalIndex = getProcessIndex();
|
||||||
|
|
||||||
Var *detailBlend = (Var*)LangElement::find( String::ToString( "detailBlend%d", normalIndex ) );
|
Var *detailBlend = (Var*)LangElement::find( String::ToString( "detailBlend%d", normalIndex ) );
|
||||||
AssertFatal( detailBlend, "The detail blend is missing!" );
|
AssertFatal( detailBlend, "The detail blend is missing!" );
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,10 @@
|
||||||
class TerrainFeatGLSL : public ShaderFeatureGLSL
|
class TerrainFeatGLSL : public ShaderFeatureGLSL
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
ShaderIncludeDependency mTorqueDep;
|
||||||
|
|
||||||
|
public:
|
||||||
|
TerrainFeatGLSL();
|
||||||
Var* _getInDetailCoord(Vector<ShaderComponent*> &componentList );
|
Var* _getInDetailCoord(Vector<ShaderComponent*> &componentList );
|
||||||
|
|
||||||
Var* _getInMacroCoord(Vector<ShaderComponent*> &componentList );
|
Var* _getInMacroCoord(Vector<ShaderComponent*> &componentList );
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,12 @@ MODULE_BEGIN( TerrainFeatHLSL )
|
||||||
MODULE_END;
|
MODULE_END;
|
||||||
|
|
||||||
|
|
||||||
|
TerrainFeatHLSL::TerrainFeatHLSL()
|
||||||
|
: mTorqueDep( "shaders/common/torque.hlsl" )
|
||||||
|
{
|
||||||
|
addDependency( &mTorqueDep );
|
||||||
|
}
|
||||||
|
|
||||||
Var* TerrainFeatHLSL::_getUniformVar( const char *name, const char *type, ConstantSortPosition csp )
|
Var* TerrainFeatHLSL::_getUniformVar( const char *name, const char *type, ConstantSortPosition csp )
|
||||||
{
|
{
|
||||||
Var *theVar = (Var*)LangElement::find( name );
|
Var *theVar = (Var*)LangElement::find( name );
|
||||||
|
|
@ -262,6 +268,7 @@ void TerrainBaseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentLis
|
||||||
baseColor->setType( "float4" );
|
baseColor->setType( "float4" );
|
||||||
baseColor->setName( "baseColor" );
|
baseColor->setName( "baseColor" );
|
||||||
meta->addStatement( new GenOp( " @ = tex2D( @, @.xy );\r\n", new DecOp( baseColor ), diffuseMap, texCoord ) );
|
meta->addStatement( new GenOp( " @ = tex2D( @, @.xy );\r\n", new DecOp( baseColor ), diffuseMap, texCoord ) );
|
||||||
|
meta->addStatement(new GenOp(" @ = toLinear(@);\r\n", baseColor, baseColor));
|
||||||
meta->addStatement( new GenOp( " @;\r\n", assignColor( baseColor, Material::Mul ) ) );
|
meta->addStatement( new GenOp( " @;\r\n", assignColor( baseColor, Material::Mul ) ) );
|
||||||
|
|
||||||
output = meta;
|
output = meta;
|
||||||
|
|
@ -291,7 +298,7 @@ TerrainDetailMapFeatHLSL::TerrainDetailMapFeatHLSL()
|
||||||
void TerrainDetailMapFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
void TerrainDetailMapFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||||
const MaterialFeatureData &fd )
|
const MaterialFeatureData &fd )
|
||||||
{
|
{
|
||||||
const U32 detailIndex = getProcessIndex();
|
const S32 detailIndex = getProcessIndex();
|
||||||
|
|
||||||
// Grab incoming texture coords... the base map feature
|
// Grab incoming texture coords... the base map feature
|
||||||
// made sure this was created.
|
// made sure this was created.
|
||||||
|
|
@ -376,7 +383,7 @@ void TerrainDetailMapFeatHLSL::processVert( Vector<ShaderComponent*> &component
|
||||||
void TerrainDetailMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
void TerrainDetailMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
const MaterialFeatureData &fd )
|
const MaterialFeatureData &fd )
|
||||||
{
|
{
|
||||||
const U32 detailIndex = getProcessIndex();
|
const S32 detailIndex = getProcessIndex();
|
||||||
Var *inTex = getVertTexCoord( "texCoord" );
|
Var *inTex = getVertTexCoord( "texCoord" );
|
||||||
|
|
||||||
MultiLine *meta = new MultiLine;
|
MultiLine *meta = new MultiLine;
|
||||||
|
|
@ -608,7 +615,7 @@ TerrainMacroMapFeatHLSL::TerrainMacroMapFeatHLSL()
|
||||||
void TerrainMacroMapFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
void TerrainMacroMapFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||||
const MaterialFeatureData &fd )
|
const MaterialFeatureData &fd )
|
||||||
{
|
{
|
||||||
const U32 detailIndex = getProcessIndex();
|
const S32 detailIndex = getProcessIndex();
|
||||||
|
|
||||||
// Grab incoming texture coords... the base map feature
|
// Grab incoming texture coords... the base map feature
|
||||||
// made sure this was created.
|
// made sure this was created.
|
||||||
|
|
@ -666,7 +673,7 @@ void TerrainMacroMapFeatHLSL::processVert( Vector<ShaderComponent*> &componentL
|
||||||
void TerrainMacroMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
void TerrainMacroMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
const MaterialFeatureData &fd )
|
const MaterialFeatureData &fd )
|
||||||
{
|
{
|
||||||
const U32 detailIndex = getProcessIndex();
|
const S32 detailIndex = getProcessIndex();
|
||||||
Var *inTex = getVertTexCoord( "texCoord" );
|
Var *inTex = getVertTexCoord( "texCoord" );
|
||||||
|
|
||||||
MultiLine *meta = new MultiLine;
|
MultiLine *meta = new MultiLine;
|
||||||
|
|
@ -893,7 +900,7 @@ void TerrainNormalMapFeatHLSL::processPix( Vector<ShaderComponent*> &component
|
||||||
meta->addStatement( new GenOp( " @ = @[2];\r\n", new DecOp( gbNormal ), viewToTangent ) );
|
meta->addStatement( new GenOp( " @ = @[2];\r\n", new DecOp( gbNormal ), viewToTangent ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
const U32 normalIndex = getProcessIndex();
|
const S32 normalIndex = getProcessIndex();
|
||||||
|
|
||||||
Var *detailBlend = (Var*)LangElement::find( String::ToString( "detailBlend%d", normalIndex ) );
|
Var *detailBlend = (Var*)LangElement::find( String::ToString( "detailBlend%d", normalIndex ) );
|
||||||
AssertFatal( detailBlend, "The detail blend is missing!" );
|
AssertFatal( detailBlend, "The detail blend is missing!" );
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,10 @@ class TerrainFeatHLSL : public ShaderFeatureHLSL
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
ShaderIncludeDependency mTorqueDep;
|
||||||
|
|
||||||
|
public:
|
||||||
|
TerrainFeatHLSL();
|
||||||
Var* _getInDetailCoord(Vector<ShaderComponent*> &componentList );
|
Var* _getInDetailCoord(Vector<ShaderComponent*> &componentList );
|
||||||
|
|
||||||
Var* _getInMacroCoord(Vector<ShaderComponent*> &componentList );
|
Var* _getInMacroCoord(Vector<ShaderComponent*> &componentList );
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#define _COLLADA_APPMESH_H_
|
#define _COLLADA_APPMESH_H_
|
||||||
|
|
||||||
#ifndef _TDICTIONARY_H_
|
#ifndef _TDICTIONARY_H_
|
||||||
#include "core/tDictionary.h"
|
#include "core/util/tDictionary.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef _APPMESH_H_
|
#ifndef _APPMESH_H_
|
||||||
#include "ts/loader/appMesh.h"
|
#include "ts/loader/appMesh.h"
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#define _COLLADA_APPNODE_H_
|
#define _COLLADA_APPNODE_H_
|
||||||
|
|
||||||
#ifndef _TDICTIONARY_H_
|
#ifndef _TDICTIONARY_H_
|
||||||
#include "core/tDictionary.h"
|
#include "core/util/tDictionary.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef _APPNODE_H_
|
#ifndef _APPNODE_H_
|
||||||
#include "ts/loader/appNode.h"
|
#include "ts/loader/appNode.h"
|
||||||
|
|
|
||||||
|
|
@ -593,7 +593,7 @@ S32 TSShapeInstance::setDetailFromDistance( const SceneRenderState *state, F32 s
|
||||||
// 4:3 aspect ratio, we've changed the reference value
|
// 4:3 aspect ratio, we've changed the reference value
|
||||||
// to 300 to be more compatible with legacy shapes.
|
// to 300 to be more compatible with legacy shapes.
|
||||||
//
|
//
|
||||||
const F32 pixelScale = state->getViewport().extent.y / 300.0f;
|
const F32 pixelScale = (state->getViewport().extent.x / state->getViewport().extent.y);
|
||||||
|
|
||||||
// This is legacy DTS support for older "multires" based
|
// This is legacy DTS support for older "multires" based
|
||||||
// meshes. The original crossbow weapon uses this.
|
// meshes. The original crossbow weapon uses this.
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,7 @@ void ImposterCaptureMaterialHook::_overrideFeatures( ProcessedMaterial *mat,
|
||||||
fd.features.addFeature( MFT_NormalsOut );
|
fd.features.addFeature( MFT_NormalsOut );
|
||||||
|
|
||||||
fd.features.addFeature( MFT_ForwardShading );
|
fd.features.addFeature( MFT_ForwardShading );
|
||||||
|
fd.features.addFeature( MFT_Imposter );
|
||||||
}
|
}
|
||||||
|
|
||||||
ImposterCaptureMaterialHook* ImposterCaptureMaterialHook::_getOrCreateHook( BaseMatInstance *inMat )
|
ImposterCaptureMaterialHook* ImposterCaptureMaterialHook::_getOrCreateHook( BaseMatInstance *inMat )
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "windowManager/platformWindow.h"
|
#include "windowManager/platformWindow.h"
|
||||||
|
|
||||||
|
ScreenResChangeSignal PlatformWindow::smScreenResChangeSignal;
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void PlatformWindow::setFullscreen( const bool fullscreen )
|
void PlatformWindow::setFullscreen( const bool fullscreen )
|
||||||
|
|
@ -48,3 +48,8 @@ bool PlatformWindow::shouldNotTranslate( U32 modifiers, U32 keyCode ) const
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
void PlatformWindow::setVideoMode(const GFXVideoMode &mode)
|
||||||
|
{
|
||||||
|
_setVideoMode(mode);
|
||||||
|
getScreenResChangeSignal().trigger(this, true);
|
||||||
|
}
|
||||||
|
|
@ -28,6 +28,9 @@
|
||||||
#include "core/util/safeDelete.h"
|
#include "core/util/safeDelete.h"
|
||||||
#include "windowManager/platformCursorController.h"
|
#include "windowManager/platformCursorController.h"
|
||||||
#include "windowManager/windowInputGenerator.h"
|
#include "windowManager/windowInputGenerator.h"
|
||||||
|
#ifndef _SIGNAL_H_ //Volumetric Fog
|
||||||
|
#include "core/util/tSignal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
//forward decl's
|
//forward decl's
|
||||||
class PlatformWindowManager;
|
class PlatformWindowManager;
|
||||||
|
|
@ -35,7 +38,7 @@ class GFXDevice;
|
||||||
struct GFXVideoMode;
|
struct GFXVideoMode;
|
||||||
class GFXWindowTarget;
|
class GFXWindowTarget;
|
||||||
class IProcessInput;
|
class IProcessInput;
|
||||||
|
typedef Signal<void(PlatformWindow *PlatformWindow, bool resize)> ScreenResChangeSignal;
|
||||||
/// Abstract representation of a native OS window.
|
/// Abstract representation of a native OS window.
|
||||||
///
|
///
|
||||||
/// Every windowing system has its own representations and conventions as
|
/// Every windowing system has its own representations and conventions as
|
||||||
|
|
@ -110,7 +113,7 @@ protected:
|
||||||
// This controller maps window input (Mouse/Keyboard) to a generic input consumer
|
// This controller maps window input (Mouse/Keyboard) to a generic input consumer
|
||||||
mWindowInputGenerator = new WindowInputGenerator( this );
|
mWindowInputGenerator = new WindowInputGenerator( this );
|
||||||
}
|
}
|
||||||
|
static ScreenResChangeSignal smScreenResChangeSignal;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// To get rid of a window, just delete it. Make sure the GFXDevice is
|
/// To get rid of a window, just delete it. Make sure the GFXDevice is
|
||||||
|
|
@ -158,7 +161,7 @@ public:
|
||||||
virtual GFXWindowTarget *getGFXTarget()=0;
|
virtual GFXWindowTarget *getGFXTarget()=0;
|
||||||
|
|
||||||
/// Set the video mode for this window.
|
/// Set the video mode for this window.
|
||||||
virtual void setVideoMode(const GFXVideoMode &mode)=0;
|
virtual void setVideoMode(const GFXVideoMode &mode);
|
||||||
|
|
||||||
/// Get our current video mode - if the window has been resized, it will
|
/// Get our current video mode - if the window has been resized, it will
|
||||||
/// reflect this.
|
/// reflect this.
|
||||||
|
|
@ -497,6 +500,7 @@ public:
|
||||||
IdleEvent idleEvent;
|
IdleEvent idleEvent;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
static ScreenResChangeSignal& getScreenResChangeSignal() { return smScreenResChangeSignal; }
|
||||||
|
|
||||||
/// Get the platform specific object needed to create or attach an accelerated
|
/// Get the platform specific object needed to create or attach an accelerated
|
||||||
/// graohics drawing context on or to the window
|
/// graohics drawing context on or to the window
|
||||||
|
|
@ -507,6 +511,7 @@ public:
|
||||||
virtual void* getPlatformDrawable() const = 0;
|
virtual void* getPlatformDrawable() const = 0;
|
||||||
protected:
|
protected:
|
||||||
virtual void _setFullscreen(const bool fullScreen) {};
|
virtual void _setFullscreen(const bool fullScreen) {};
|
||||||
|
virtual void _setVideoMode(const GFXVideoMode &mode) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,10 @@
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include <winuser.h>
|
#include <winuser.h>
|
||||||
#include "math/mMath.h"
|
#include "math/mMath.h"
|
||||||
|
#include "gfx/gfxDevice.h"
|
||||||
#include "gfx/gfxStructs.h"
|
#include "gfx/gfxStructs.h"
|
||||||
|
|
||||||
|
#include "windowManager/platformWindowMgr.h"
|
||||||
#include "windowManager/win32/win32Window.h"
|
#include "windowManager/win32/win32Window.h"
|
||||||
#include "windowManager/win32/win32WindowMgr.h"
|
#include "windowManager/win32/win32WindowMgr.h"
|
||||||
#include "windowManager/win32/win32CursorController.h"
|
#include "windowManager/win32/win32CursorController.h"
|
||||||
|
|
@ -39,11 +41,6 @@
|
||||||
// for winState structure
|
// for winState structure
|
||||||
#include "platformWin32/platformWin32.h"
|
#include "platformWin32/platformWin32.h"
|
||||||
|
|
||||||
#include <d3d9types.h>
|
|
||||||
#include "gfx/gfxDevice.h"
|
|
||||||
|
|
||||||
#include <zmouse.h>
|
|
||||||
|
|
||||||
const UTF16* _MainWindowClassName = L"TorqueJuggernaughtWindow";
|
const UTF16* _MainWindowClassName = L"TorqueJuggernaughtWindow";
|
||||||
const UTF16* _CurtainWindowClassName = L"TorqueJuggernaughtCurtainWindow";
|
const UTF16* _CurtainWindowClassName = L"TorqueJuggernaughtCurtainWindow";
|
||||||
|
|
||||||
|
|
@ -148,96 +145,93 @@ const GFXVideoMode & Win32Window::getVideoMode()
|
||||||
|
|
||||||
void Win32Window::setVideoMode( const GFXVideoMode &mode )
|
void Win32Window::setVideoMode( const GFXVideoMode &mode )
|
||||||
{
|
{
|
||||||
bool needCurtain = (mVideoMode.fullScreen != mode.fullScreen);
|
bool needCurtain = ( mVideoMode.fullScreen != mode.fullScreen );
|
||||||
|
|
||||||
if(needCurtain)
|
if( needCurtain )
|
||||||
{
|
{
|
||||||
Con::errorf("Win32Window::setVideoMode - invoking curtain");
|
Con::printf( "Win32Window::setVideoMode - invoking curtain" );
|
||||||
mOwningManager->lowerCurtain();
|
mOwningManager->lowerCurtain();
|
||||||
}
|
}
|
||||||
|
|
||||||
mVideoMode = mode;
|
mVideoMode = mode;
|
||||||
mSuppressReset = true;
|
mSuppressReset = true;
|
||||||
|
|
||||||
// Can't switch to fullscreen while a child of another window
|
// Can't switch to fullscreen while a child of another window
|
||||||
if(mode.fullScreen && !Platform::getWebDeployment() && mOwningManager->getParentWindow())
|
if( mode.fullScreen && !Platform::getWebDeployment() && mOwningManager->getParentWindow() )
|
||||||
{
|
{
|
||||||
mOldParent = (HWND)mOwningManager->getParentWindow();
|
mOldParent = reinterpret_cast<HWND>( mOwningManager->getParentWindow() );
|
||||||
mOwningManager->setParentWindow(NULL);
|
mOwningManager->setParentWindow( NULL );
|
||||||
}
|
}
|
||||||
else if(!mode.fullScreen && mOldParent)
|
else if( !mode.fullScreen && mOldParent )
|
||||||
{
|
{
|
||||||
mOwningManager->setParentWindow(mOldParent);
|
mOwningManager->setParentWindow( mOldParent );
|
||||||
mOldParent = NULL;
|
mOldParent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set our window to have the right style based on the mode
|
// Set our window to have the right style based on the mode
|
||||||
if(mode.fullScreen && !Platform::getWebDeployment() && !mOffscreenRender)
|
if( mode.fullScreen && !Platform::getWebDeployment() && !mOffscreenRender )
|
||||||
{
|
{
|
||||||
WINDOWPLACEMENT wplacement = { sizeof(wplacement) };
|
WINDOWPLACEMENT wplacement = { sizeof( wplacement ) };
|
||||||
DWORD dwStyle = GetWindowLong(getHWND(), GWL_STYLE);
|
DWORD dwStyle = GetWindowLong( getHWND(), GWL_STYLE );
|
||||||
MONITORINFO mi = { sizeof(mi) };
|
MONITORINFO mi = { sizeof(mi) };
|
||||||
|
|
||||||
if (GetWindowPlacement(getHWND(), &wplacement) && GetMonitorInfo(MonitorFromWindow(getHWND(), MONITOR_DEFAULTTOPRIMARY), &mi))
|
if ( GetWindowPlacement( getHWND(), &wplacement ) && GetMonitorInfo( MonitorFromWindow( getHWND(), MONITOR_DEFAULTTOPRIMARY ), &mi ) )
|
||||||
{
|
|
||||||
DISPLAY_DEVICE dd = GetPrimaryDevice();
|
|
||||||
DEVMODE dv;
|
|
||||||
ZeroMemory(&dv, sizeof(dv));
|
|
||||||
dv.dmSize = sizeof(DEVMODE);
|
|
||||||
EnumDisplaySettings(dd.DeviceName, ENUM_CURRENT_SETTINGS, &dv);
|
|
||||||
dv.dmPelsWidth = mode.resolution.x;
|
|
||||||
dv.dmPelsHeight = mode.resolution.y;
|
|
||||||
dv.dmBitsPerPel = mode.bitDepth;
|
|
||||||
dv.dmDisplayFrequency = mode.refreshRate;
|
|
||||||
dv.dmFields = (DM_PELSWIDTH | DM_PELSHEIGHT);
|
|
||||||
ChangeDisplaySettings(&dv, CDS_FULLSCREEN);
|
|
||||||
SetWindowLong(getHWND(), GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW);
|
|
||||||
SetWindowPos(getHWND(), HWND_TOP,
|
|
||||||
mi.rcMonitor.left,
|
|
||||||
mi.rcMonitor.top,
|
|
||||||
mi.rcMonitor.right - mi.rcMonitor.left,
|
|
||||||
mi.rcMonitor.bottom - mi.rcMonitor.top,
|
|
||||||
SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mDisplayWindow)
|
|
||||||
ShowWindow(getHWND(), SW_SHOWNORMAL);
|
|
||||||
|
|
||||||
// Clear the menu bar from the window for full screen
|
|
||||||
HMENU menu = GetMenu(getHWND());
|
|
||||||
if(menu)
|
|
||||||
{
|
{
|
||||||
SetMenu(getHWND(), NULL);
|
DISPLAY_DEVICE dd = GetPrimaryDevice();
|
||||||
|
DEVMODE dv;
|
||||||
|
ZeroMemory( &dv, sizeof( dv ) );
|
||||||
|
dv.dmSize = sizeof( DEVMODE );
|
||||||
|
EnumDisplaySettings( dd.DeviceName, ENUM_CURRENT_SETTINGS, &dv );
|
||||||
|
dv.dmPelsWidth = mode.resolution.x;
|
||||||
|
dv.dmPelsHeight = mode.resolution.y;
|
||||||
|
dv.dmBitsPerPel = mode.bitDepth;
|
||||||
|
dv.dmDisplayFrequency = mode.refreshRate;
|
||||||
|
dv.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
|
||||||
|
ChangeDisplaySettings( &dv, CDS_FULLSCREEN );
|
||||||
|
SetWindowLong( getHWND(), GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW );
|
||||||
|
SetWindowPos( getHWND(), HWND_TOP, mi.rcMonitor.left,
|
||||||
|
mi.rcMonitor.top,
|
||||||
|
mi.rcMonitor.right - mi.rcMonitor.left,
|
||||||
|
mi.rcMonitor.bottom - mi.rcMonitor.top,
|
||||||
|
SWP_NOOWNERZORDER | SWP_FRAMECHANGED );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( mDisplayWindow )
|
||||||
|
ShowWindow( getHWND(), SW_SHOWNORMAL );
|
||||||
|
|
||||||
|
// Clear the menu bar from the window for full screen
|
||||||
|
if( GetMenu( getHWND() ) )
|
||||||
|
SetMenu( getHWND(), NULL );
|
||||||
|
|
||||||
// When switching to Fullscreen, reset device after setting style
|
// When switching to Fullscreen, reset device after setting style
|
||||||
if(mTarget.isValid())
|
if( mTarget.isValid() )
|
||||||
mTarget->resetMode();
|
mTarget->resetMode();
|
||||||
|
|
||||||
mFullscreen = true;
|
mFullscreen = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DISPLAY_DEVICE dd = GetPrimaryDevice();
|
DISPLAY_DEVICE dd = GetPrimaryDevice();
|
||||||
DEVMODE dv;
|
DEVMODE dv;
|
||||||
ZeroMemory(&dv, sizeof(dv));
|
ZeroMemory( &dv, sizeof( dv ) );
|
||||||
dv.dmSize = sizeof(DEVMODE);
|
dv.dmSize = sizeof( DEVMODE );
|
||||||
EnumDisplaySettings(dd.DeviceName, ENUM_CURRENT_SETTINGS, &dv);
|
EnumDisplaySettings( dd.DeviceName, ENUM_CURRENT_SETTINGS, &dv );
|
||||||
|
|
||||||
if ((mode.resolution.x != dv.dmPelsWidth) || (mode.resolution.y != dv.dmPelsHeight))
|
if ( ( WindowManager->getDesktopResolution() != mode.resolution ||
|
||||||
ChangeDisplaySettings(NULL, 0);
|
( mode.resolution.x != dv.dmPelsWidth ) || ( mode.resolution.y != dv.dmPelsHeight ) ) )
|
||||||
|
ChangeDisplaySettings( NULL, 0 );
|
||||||
|
|
||||||
// Reset device *first*, so that when we call setSize() and let it
|
// Reset device *first*, so that when we call setSize() and let it
|
||||||
// access the monitor settings, it won't end up with our fullscreen
|
// access the monitor settings, it won't end up with our fullscreen
|
||||||
// geometry that is just about to change.
|
// geometry that is just about to change.
|
||||||
|
|
||||||
if(mTarget.isValid())
|
if( mTarget.isValid() )
|
||||||
mTarget->resetMode();
|
mTarget->resetMode();
|
||||||
|
|
||||||
if (!mOffscreenRender)
|
if ( !mOffscreenRender )
|
||||||
{
|
{
|
||||||
SetWindowLong( getHWND(), GWL_STYLE, mWindowedWindowStyle);
|
SetWindowLong( getHWND(), GWL_STYLE, mWindowedWindowStyle);
|
||||||
SetWindowPos( getHWND(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
SetWindowPos( getHWND(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||||
|
|
||||||
// Put back the menu bar, if any
|
// Put back the menu bar, if any
|
||||||
if(mMenuHandle)
|
if(mMenuHandle)
|
||||||
|
|
@ -253,40 +247,37 @@ void Win32Window::setVideoMode( const GFXVideoMode &mode )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HWND parentWin = (HWND)mOwningManager->getParentWindow();
|
HWND parentWin = reinterpret_cast<HWND>( mOwningManager->getParentWindow() );
|
||||||
RECT windowRect;
|
RECT windowRect;
|
||||||
GetClientRect(parentWin, &windowRect);
|
GetClientRect( parentWin, &windowRect );
|
||||||
Point2I res(windowRect.right-windowRect.left, windowRect.bottom-windowRect.top);
|
Point2I res( windowRect.right - windowRect.left, windowRect.bottom - windowRect.top );
|
||||||
if (res.x == 0 || res.y == 0)
|
|
||||||
{
|
if ( res.x == 0 || res.y == 0 )
|
||||||
// Must be too early in the window set up to obtain the parent's size.
|
setSize( mode.resolution ); // Must be too early in the window set up to obtain the parent's size.
|
||||||
setSize(mode.resolution);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
setSize( res );
|
||||||
setSize(res);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mOffscreenRender)
|
if ( !mOffscreenRender )
|
||||||
{
|
{
|
||||||
// We have to force Win32 to update the window frame and make the window
|
// We have to force Win32 to update the window frame and make the window
|
||||||
// visible and no longer topmost - this code might be possible to simplify.
|
// visible and no longer topmost - this code might be possible to simplify.
|
||||||
SetWindowPos( getHWND(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
SetWindowPos( getHWND(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED );
|
||||||
|
|
||||||
if(mDisplayWindow)
|
if(mDisplayWindow)
|
||||||
ShowWindow( getHWND(), SW_SHOWNORMAL);
|
ShowWindow( getHWND(), SW_SHOWNORMAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
mFullscreen = false;
|
mFullscreen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mSuppressReset = false;
|
mSuppressReset = false;
|
||||||
|
|
||||||
if(needCurtain)
|
if( needCurtain )
|
||||||
mOwningManager->raiseCurtain();
|
mOwningManager->raiseCurtain();
|
||||||
|
|
||||||
SetForegroundWindow(getHWND());
|
SetForegroundWindow( getHWND() );
|
||||||
|
getScreenResChangeSignal().trigger( this, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Win32Window::clearFullscreen()
|
bool Win32Window::clearFullscreen()
|
||||||
|
|
|
||||||
BIN
Templates/Empty/game/art/environment/FogMod_heavy.dds
Normal file
BIN
Templates/Empty/game/art/environment/FogMod_heavy.dds
Normal file
Binary file not shown.
BIN
Templates/Empty/game/art/environment/FogMod_light.dds
Normal file
BIN
Templates/Empty/game/art/environment/FogMod_light.dds
Normal file
Binary file not shown.
BIN
Templates/Empty/game/art/environment/FogMod_med.dds
Normal file
BIN
Templates/Empty/game/art/environment/FogMod_med.dds
Normal file
Binary file not shown.
177
Templates/Empty/game/art/environment/Fog_Cube.DAE
Normal file
177
Templates/Empty/game/art/environment/Fog_Cube.DAE
Normal file
|
|
@ -0,0 +1,177 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
|
||||||
|
<asset>
|
||||||
|
<contributor>
|
||||||
|
<author>Richard</author>
|
||||||
|
<authoring_tool>OpenCOLLADA for 3ds Max; Version: 1.4.1; Revision: exported; Platform: x64; Configuration: Release_Max2011_static</authoring_tool>
|
||||||
|
<source_data>file:///G:/Documents%20and%20Settings/Richard/Mijn%20documenten/3dsmax/scenes/FogVolumes.max</source_data>
|
||||||
|
</contributor>
|
||||||
|
<created>2014-08-16T10:10:23</created>
|
||||||
|
<modified>2014-08-16T10:10:23</modified>
|
||||||
|
<unit name="meter" meter="1"/>
|
||||||
|
<up_axis>Z_UP</up_axis>
|
||||||
|
</asset>
|
||||||
|
<library_effects>
|
||||||
|
<effect id="NoMat">
|
||||||
|
<profile_COMMON>
|
||||||
|
<technique sid="common">
|
||||||
|
<blinn>
|
||||||
|
<emission>
|
||||||
|
<color>0 0 0 1</color>
|
||||||
|
</emission>
|
||||||
|
<ambient>
|
||||||
|
<color>0.588 0.588 0.588 1</color>
|
||||||
|
</ambient>
|
||||||
|
<diffuse>
|
||||||
|
<color>0.588 0.588 0.588 1</color>
|
||||||
|
</diffuse>
|
||||||
|
<specular>
|
||||||
|
<color>0.9 0.9 0.9 1</color>
|
||||||
|
</specular>
|
||||||
|
<shininess>
|
||||||
|
<float>0</float>
|
||||||
|
</shininess>
|
||||||
|
<reflective>
|
||||||
|
<color>0 0 0 1</color>
|
||||||
|
</reflective>
|
||||||
|
<transparent opaque="A_ONE">
|
||||||
|
<color>1 1 1 1</color>
|
||||||
|
</transparent>
|
||||||
|
<transparency>
|
||||||
|
<float>1</float>
|
||||||
|
</transparency>
|
||||||
|
</blinn>
|
||||||
|
</technique>
|
||||||
|
</profile_COMMON>
|
||||||
|
<extra>
|
||||||
|
<technique profile="OpenCOLLADA3dsMax">
|
||||||
|
<extended_shader>
|
||||||
|
<apply_reflection_dimming>0</apply_reflection_dimming>
|
||||||
|
<dim_level>0</dim_level>
|
||||||
|
<falloff_type>0</falloff_type>
|
||||||
|
<index_of_refraction>1.5</index_of_refraction>
|
||||||
|
<opacity_type>0</opacity_type>
|
||||||
|
<reflection_level>3</reflection_level>
|
||||||
|
<wire_size>1</wire_size>
|
||||||
|
<wire_units>0</wire_units>
|
||||||
|
</extended_shader>
|
||||||
|
<shader>
|
||||||
|
<ambient_diffuse_lock>1</ambient_diffuse_lock>
|
||||||
|
<ambient_diffuse_texture_lock>1</ambient_diffuse_texture_lock>
|
||||||
|
<diffuse_specular_lock>0</diffuse_specular_lock>
|
||||||
|
<soften>0.1</soften>
|
||||||
|
<use_self_illum_color>0</use_self_illum_color>
|
||||||
|
</shader>
|
||||||
|
</technique>
|
||||||
|
</extra>
|
||||||
|
</effect>
|
||||||
|
</library_effects>
|
||||||
|
<library_materials>
|
||||||
|
<material id="NoMat-material" name="NoMat">
|
||||||
|
<instance_effect url="#NoMat"/>
|
||||||
|
</material>
|
||||||
|
</library_materials>
|
||||||
|
<library_geometries>
|
||||||
|
<geometry id="geom-FogCube1" name="FogCube1">
|
||||||
|
<mesh>
|
||||||
|
<source id="geom-FogCube1-positions">
|
||||||
|
<float_array id="geom-FogCube1-positions-array" count="72">-0.85 -1 -0.85 0.85 -0.85 -1 -1 0.85 -0.85 0.85 0.85 -1 -0.85 -1 0.85 1 -0.85 0.85 -1 0.85 0.85 0.85 1 0.85 -1 -0.85 -0.85 -0.85 -0.85 -1 1 -0.85 -0.85 0.85 -1 -0.85 -0.85 1 -0.85 -0.85 0.85 -1 0.85 1 -0.85 1 0.85 -0.85 -0.85 -0.85 1 -1 -0.85 0.85 0.85 -0.85 1 0.85 -1 0.85 -0.85 0.85 1 -0.85 1 0.85 0.85 0.85 1 1 0.85 0.85</float_array>
|
||||||
|
<technique_common>
|
||||||
|
<accessor source="#geom-FogCube1-positions-array" count="24" stride="3">
|
||||||
|
<param name="X" type="float"/>
|
||||||
|
<param name="Y" type="float"/>
|
||||||
|
<param name="Z" type="float"/>
|
||||||
|
</accessor>
|
||||||
|
</technique_common>
|
||||||
|
</source>
|
||||||
|
<source id="geom-FogCube1-normals">
|
||||||
|
<float_array id="geom-FogCube1-normals-array" count="72">-0.341586 -0.341586 -0.8755786 -0.341586 0.341586 -0.8755788 0.341586 0.341586 -0.8755788 0.341586 -0.341586 -0.8755788 -0.341586 -0.341586 0.8755786 0.341586 -0.341586 0.8755788 0.341586 0.341586 0.8755788 -0.341586 0.341586 0.8755788 -0.341586 -0.8755786 -0.341586 0.341586 -0.8755788 -0.341586 0.341586 -0.8755786 0.341586 -0.341586 -0.8755788 0.341586 0.8755786 -0.341586 -0.341586 0.8755788 0.341586 -0.341586 0.8755786 0.341586 0.341586 0.8755788 -0.341586 0.341586 0.341586 0.8755786 -0.341586 -0.341586 0.8755788 -0.341586 -0.341586 0.8755786 0.341586 0.341586 0.8755788 0.341586 -0.8755786 0.341586 -0.341586 -0.8755788 -0.341586 -0.341586 -0.8755786 -0.341586 0.341586 -0.8755788 0.341586 0.341586</float_array>
|
||||||
|
<technique_common>
|
||||||
|
<accessor source="#geom-FogCube1-normals-array" count="24" stride="3">
|
||||||
|
<param name="X" type="float"/>
|
||||||
|
<param name="Y" type="float"/>
|
||||||
|
<param name="Z" type="float"/>
|
||||||
|
</accessor>
|
||||||
|
</technique_common>
|
||||||
|
</source>
|
||||||
|
<source id="geom-FogCube1-map1">
|
||||||
|
<float_array id="geom-FogCube1-map1-array" count="228">0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0 0.07542458 0.07542461 4.99755e-4 0.07542479 0.07542461 4.99547e-4 0.07542455 0.07542461 4.99755e-4 0.07542461 0.9245752 4.99547e-4 0.07542458 0.9245754 4.99755e-4 0.07542458 0.9245754 0.9995003 0.07542455 0.9245754 4.99755e-4 0.07542455 0.9245754 0.9995003 0.9245752 0.07542461 4.99576e-4 0.9245754 0.07542479 4.99547e-4 0.07542458 0.07542461 0.9995003 0.9245752 0.07542461 4.99576e-4 0.9245752 0.07542461 0.9995004 0.9245752 0.9245754 4.99547e-4 0.07542455 0.07542461 0.9995003 0.9245752 0.07542461 0.9995004 0.07542461 0.07542479 0.9995005 0.9245752 0.9245754 4.99576e-4 0.9245752 0.07542461 0.9995005 0.9245752 0.9245754 4.99576e-4 0.07542479 0.9245754 0.9995005 0.9245752 0.9245754 0.9995004 0.9245754 0.9245752 0.9995005 0.9245752 0.9245754 0.9995004 0.9995003 0.07542461 0.07542458 0.9245752 4.99547e-4 0.07542461 0.9245752 4.99547e-4 0.07542461 0.9995003 0.07542461 0.07542458 0.9995003 0.07542461 0.9245754 0.9245752 4.99547e-4 0.9245754 0.9245752 4.99547e-4 0.9245754 0.9995003 0.07542461 0.9245754 0.9995003 0.9245754 0.07542458 0.9245752 0.9995005 0.07542461 0.9995003 0.9245754 0.07542458 0.9245752 0.9995005 0.07542461 0.9995003 0.9245754 0.9245754 0.9245752 0.9995005 0.9245754 0.9995003 0.9245754 0.9245754 0.9245752 0.9995005 0.9245754 0.9995004 0.07542482 0.07542461 0.9995003 0.9245754 0.07542461 0.9245752 0.9995004 0.07542461 0.07542455 0.9995003 0.07542461 4.99606e-4 0.9245752 0.07542461 4.99725e-4 0.07542458 0.07542461 0.07542479 4.99576e-4 0.07542461 0.9245754 4.99755e-4 0.07542461 0.07542458 4.99755e-4 0.9245754 0.9245752 4.99576e-4 0.9245754 0.9995003 0.07542458 0.9245754 0.9995004 0.9245752 0.9245754 0.9245754 0.9995003 0.9245754 0.07542482 0.9995004 0.9245754 4.99755e-4 0.9245754 0.9245754 4.99576e-4 0.07542482 0.9245754 0.9995003 0.07542461 0.07542458 0.9995003 0.9245754 0.07542458 0.9995003 0.9245754 0.07542458 0.9995003 0.07542461 0.07542458 0.9995003 0.07542461 0.9245754 0.9995003 0.9245754 0.9245754 0.9995003 0.07542461 0.9245754 0.9995003 0.9245754 0.9245754</float_array>
|
||||||
|
<technique_common>
|
||||||
|
<accessor source="#geom-FogCube1-map1-array" count="76" stride="3">
|
||||||
|
<param name="S" type="float"/>
|
||||||
|
<param name="T" type="float"/>
|
||||||
|
<param name="P" type="float"/>
|
||||||
|
</accessor>
|
||||||
|
</technique_common>
|
||||||
|
</source>
|
||||||
|
<source id="geom-FogCube1-map1-textangents">
|
||||||
|
<float_array id="geom-FogCube1-map1-textangents-array" count="192">-0.8644259 0.01841655 0.3300502 -0.8715108 -0.05526615 0.3184382 -0.8644259 0.01841664 -0.3300501 -0.8715108 -0.05526611 -0.3184382 0.8738725 -0.06754867 0.3145678 0.8597026 -0.006149054 -0.3377912 0.8738725 -0.06754874 -0.3145678 0.8597026 -0.006148929 0.3377911 0.883319 -0.2990854 -0.116681 0.8478944 0.3571441 -0.06756432 0.8597026 0.3377913 0.00614921 0.883319 -0.2990854 0.116681 0.2990854 0.883319 -0.116681 -0.3571441 0.8478944 -0.06756432 -0.3377913 0.8597026 0.00614921 0.2990854 0.883319 0.116681 -0.883319 0.2990854 -0.116681 -0.8478944 -0.3571441 -0.06756432 -0.8597026 -0.3377913 0.00614921 -0.883319 0.2990854 0.116681 -0.2990854 -0.883319 -0.116681 0.3571441 -0.8478944 -0.06756432 0.3377913 -0.8597026 0.00614921 -0.2990854 -0.883319 0.116681 0.8360862 -0.3764972 0.1289794 0.7071068 -0.7071068 0 0.7071068 0.7071068 0 0.3764972 0.8360862 0.1289794 -0.3764972 -0.8360862 0.1289794 -0.7071068 -0.7071068 0 -0.7071068 0.7071068 0 -0.8360862 0.3764972 0.1289794 0.8360862 -0.3764971 -0.1289794 0.7071068 -0.7071068 0 0.3764971 0.8360862 -0.1289794 0.7071068 0.7071068 0 -0.3764971 -0.8360862 -0.1289794 -0.7071068 -0.7071068 0 -0.8360862 0.3764971 -0.1289794 -0.7071068 0.7071068 0 -0.376497 0.1289792 0.8360862 -0.3764973 -0.1289798 0.8360861 -0.8833191 -0.2990855 0.1166808 -0.883319 0.2990853 -0.1166812 -0.3764971 0.1289794 -0.8360862 -0.3764972 -0.1289795 -0.8360862 -0.8833191 -0.2990855 -0.1166807 -0.883319 0.2990853 0.1166812 0.883319 -0.2990853 0.1166812 0.8833191 0.2990855 -0.1166807 0.3764971 0.1289797 -0.8360862 0.3764971 -0.1289793 -0.8360862 0.883319 -0.2990853 -0.1166811 0.8833191 0.2990855 0.1166808 0.3764972 0.1289799 0.8360861 0.3764971 -0.128979 0.8360862 0.3764972 0.8360862 0.1289794 0.3764971 0.8360862 -0.1289794 0.8360862 -0.3764971 -0.1289794 0.8360862 -0.3764972 0.1289794 -0.8360862 0.3764972 0.1289794 -0.8360862 0.3764971 -0.1289794 -0.3764972 -0.8360862 0.1289794 -0.3764971 -0.8360862 -0.1289794</float_array>
|
||||||
|
<technique_common>
|
||||||
|
<accessor source="#geom-FogCube1-map1-textangents-array" count="64" stride="3">
|
||||||
|
<param name="X" type="float"/>
|
||||||
|
<param name="Y" type="float"/>
|
||||||
|
<param name="Z" type="float"/>
|
||||||
|
</accessor>
|
||||||
|
</technique_common>
|
||||||
|
</source>
|
||||||
|
<source id="geom-FogCube1-map1-texbinormals">
|
||||||
|
<float_array id="geom-FogCube1-map1-texbinormals-array" count="192">0.1043954 -0.9396398 0.3258505 -0.06496345 -0.9379679 -0.3405817 0.1043953 -0.9396398 -0.3258505 -0.06496349 -0.937968 0.3405817 0.05187585 -0.9370471 -0.3453283 -0.1307439 -0.939827 -0.3156443 0.05187577 -0.9370471 0.3453283 -0.1307438 -0.939827 0.3156443 0 0.3634471 -0.9316148 -0.196368 0.2889368 -0.9369926 0.1307441 -0.3156442 -0.939827 0 -0.3634471 -0.9316148 -0.3634471 0 -0.9316148 -0.2889368 -0.196368 -0.9369926 0.3156442 0.1307441 -0.939827 0.3634471 0 -0.9316148 0 -0.3634471 -0.9316148 0.196368 -0.2889368 -0.9369926 -0.1307441 0.3156442 -0.939827 0 0.3634471 -0.9316148 0.3634471 0 -0.9316148 0.2889368 0.196368 -0.9369926 -0.3156442 -0.1307441 -0.939827 -0.3634471 0 -0.9316148 0.2608475 0.2608475 -0.9294714 0.6191276 0.6191276 -0.4830755 -0.6191276 0.6191276 -0.4830755 -0.2608475 0.2608475 -0.9294714 0.2608475 -0.2608475 -0.9294714 0.6191276 -0.6191276 -0.4830755 -0.6191276 -0.6191276 -0.4830755 -0.2608475 -0.2608475 -0.9294714 -0.2608475 -0.2608475 -0.9294714 -0.6191276 -0.6191276 -0.4830755 0.2608475 -0.2608475 -0.9294714 0.6191276 -0.6191276 -0.4830755 -0.2608475 0.2608475 -0.9294714 -0.6191276 0.6191276 -0.4830755 0.2608475 0.2608475 -0.9294714 0.6191276 0.6191276 -0.4830755 0.2608476 -0.9294715 0.2608473 -0.2608474 -0.9294714 -0.2608479 1.81809e-7 -0.363447 -0.9316149 2.27262e-7 -0.3634472 -0.9316148 0.2608475 -0.9294714 -0.2608475 -0.2608475 -0.9294714 0.2608477 2.72714e-7 -0.363447 0.9316149 2.72714e-7 -0.3634472 0.9316148 2.72714e-7 -0.3634472 -0.9316148 2.72714e-7 -0.363447 -0.9316149 -0.2608474 -0.9294714 -0.2608478 0.2608476 -0.9294714 0.2608474 1.81809e-7 -0.3634472 0.9316148 2.27262e-7 -0.3634471 0.9316149 -0.2608473 -0.9294714 0.260848 0.2608477 -0.9294715 -0.2608472 -0.2608475 0.2608475 -0.9294714 0.2608475 -0.2608475 -0.9294714 -0.2608475 -0.2608475 -0.9294714 0.2608475 0.2608475 -0.9294714 -0.2608475 -0.2608475 -0.9294714 0.2608475 0.2608475 -0.9294714 0.2608475 -0.2608475 -0.9294714 -0.2608475 0.2608475 -0.9294714</float_array>
|
||||||
|
<technique_common>
|
||||||
|
<accessor source="#geom-FogCube1-map1-texbinormals-array" count="64" stride="3">
|
||||||
|
<param name="X" type="float"/>
|
||||||
|
<param name="Y" type="float"/>
|
||||||
|
<param name="Z" type="float"/>
|
||||||
|
</accessor>
|
||||||
|
</technique_common>
|
||||||
|
</source>
|
||||||
|
<vertices id="geom-FogCube1-vertices">
|
||||||
|
<input semantic="POSITION" source="#geom-FogCube1-positions"/>
|
||||||
|
</vertices>
|
||||||
|
<triangles material="NoMat" count="44">
|
||||||
|
<input semantic="VERTEX" source="#geom-FogCube1-vertices" offset="0"/>
|
||||||
|
<input semantic="NORMAL" source="#geom-FogCube1-normals" offset="1"/>
|
||||||
|
<input semantic="TEXCOORD" source="#geom-FogCube1-map1" offset="2" set="0"/>
|
||||||
|
<input semantic="TEXTANGENT" source="#geom-FogCube1-map1-textangents" offset="3" set="1"/>
|
||||||
|
<input semantic="TEXBINORMAL" source="#geom-FogCube1-map1-texbinormals" offset="3" set="1"/>
|
||||||
|
<p>9 0 21 0 13 1 25 1 3 2 15 2 3 2 15 2 1 3 13 3 9 0 21 0 16 4 28 4 18 5 30 5 22 6 34 6 22 6 34 6 20 7 32 7 16 4 28 4 0 8 12 8 11 9 23 9 19 10 31 10 19 10 31 10 4 11 16 11 0 8 12 8 10 12 22 12 15 13 27 13 23 14 35 14 23 14 35 14 5 15 17 15 10 12 22 12 14 16 26 16 12 17 24 17 21 18 33 18 21 18 33 18 7 19 19 19 14 16 26 16 2 20 14 20 8 21 20 21 17 22 29 22 17 22 29 22 6 23 18 23 2 20 14 20 0 8 36 24 8 21 20 21 9 0 37 25 1 3 38 26 10 12 39 27 11 9 23 9 2 20 40 28 12 17 24 17 13 1 41 29 3 2 42 30 14 16 43 31 15 13 27 13 4 11 44 32 16 4 45 33 17 22 29 22 5 15 46 34 18 5 47 35 19 10 31 10 6 23 48 36 20 7 49 37 21 18 33 18 7 19 50 38 22 6 51 39 23 14 35 14 9 0 21 0 8 21 52 40 2 20 53 41 2 20 53 41 13 1 25 1 9 0 21 0 13 1 25 1 12 17 54 42 14 16 55 43 14 16 55 43 3 2 15 2 13 1 25 1 3 2 15 2 15 13 56 44 10 12 57 45 10 12 57 45 1 3 13 3 3 2 15 2 1 3 13 3 11 9 58 46 0 8 59 47 0 8 59 47 9 0 21 0 1 3 13 3 16 4 28 4 4 11 60 48 19 10 61 49 19 10 61 49 18 5 30 5 16 4 28 4 18 5 30 5 5 15 62 50 23 14 63 51 23 14 63 51 22 6 34 6 18 5 30 5 22 6 34 6 7 19 64 52 21 18 65 53 21 18 65 53 20 7 32 7 22 6 34 6 20 7 32 7 6 23 66 54 17 22 67 55 17 22 67 55 16 4 28 4 20 7 32 7 11 9 23 9 10 12 68 56 5 15 69 57 5 15 69 57 19 10 31 10 11 9 23 9 4 11 70 58 17 22 29 22 8 21 20 21 8 21 20 21 0 8 71 59 4 11 70 58 15 13 27 13 14 16 72 60 7 19 73 61 7 19 73 61 23 14 35 14 15 13 27 13 12 17 24 17 2 20 74 62 6 23 75 63 6 23 75 63 21 18 33 18 12 17 24 17</p>
|
||||||
|
</triangles>
|
||||||
|
</mesh>
|
||||||
|
</geometry>
|
||||||
|
</library_geometries>
|
||||||
|
<library_lights>
|
||||||
|
<light id="EnvironmentAmbientLight" name="EnvironmentAmbientLight">
|
||||||
|
<technique_common>
|
||||||
|
<ambient>
|
||||||
|
<color>0 0 0</color>
|
||||||
|
</ambient>
|
||||||
|
</technique_common>
|
||||||
|
</light>
|
||||||
|
</library_lights>
|
||||||
|
<library_visual_scenes>
|
||||||
|
<visual_scene id="MaxScene">
|
||||||
|
<node name="EnvironmentAmbientLight">
|
||||||
|
<instance_light url="#EnvironmentAmbientLight"/>
|
||||||
|
</node>
|
||||||
|
<node id="node-FogCube1" name="FogCube1">
|
||||||
|
<instance_geometry url="#geom-FogCube1">
|
||||||
|
<bind_material>
|
||||||
|
<technique_common>
|
||||||
|
<instance_material symbol="NoMat" target="#NoMat-material"/>
|
||||||
|
</technique_common>
|
||||||
|
</bind_material>
|
||||||
|
</instance_geometry>
|
||||||
|
<extra>
|
||||||
|
<technique profile="OpenCOLLADA">
|
||||||
|
<cast_shadows>1</cast_shadows>
|
||||||
|
<primary_visibility>1</primary_visibility>
|
||||||
|
<receive_shadows>1</receive_shadows>
|
||||||
|
<secondary_visibility>1</secondary_visibility>
|
||||||
|
</technique>
|
||||||
|
</extra>
|
||||||
|
</node>
|
||||||
|
</visual_scene>
|
||||||
|
</library_visual_scenes>
|
||||||
|
<scene>
|
||||||
|
<instance_visual_scene url="#MaxScene"/>
|
||||||
|
</scene>
|
||||||
|
</COLLADA>
|
||||||
8
Templates/Empty/game/art/environment/Fog_Cube.cs
Normal file
8
Templates/Empty/game/art/environment/Fog_Cube.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
singleton TSShapeConstructor(Fog_CubeDAE)
|
||||||
|
{
|
||||||
|
baseShape = "./Fog_Cube.DAE";
|
||||||
|
lodType = "TrailingNumber";
|
||||||
|
neverImport = "env*";
|
||||||
|
loadLights = "0";
|
||||||
|
};
|
||||||
|
|
@ -141,11 +141,11 @@ function parseArgs()
|
||||||
switch$ (%arg)
|
switch$ (%arg)
|
||||||
{
|
{
|
||||||
case "-fullscreen":
|
case "-fullscreen":
|
||||||
setFullScreen(true);
|
$cliFullscreen = true;
|
||||||
$argUsed[%i]++;
|
$argUsed[%i]++;
|
||||||
|
|
||||||
case "-windowed":
|
case "-windowed":
|
||||||
setFullScreen(false);
|
$cliFullscreen = false;
|
||||||
$argUsed[%i]++;
|
$argUsed[%i]++;
|
||||||
|
|
||||||
case "-openGL":
|
case "-openGL":
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,13 @@ function configureCanvas()
|
||||||
%rate = getWord($pref::Video::mode, $WORD::REFRESH);
|
%rate = getWord($pref::Video::mode, $WORD::REFRESH);
|
||||||
%fsaa = getWord($pref::Video::mode, $WORD::AA);
|
%fsaa = getWord($pref::Video::mode, $WORD::AA);
|
||||||
|
|
||||||
|
if($cliFullscreen !$= "") {
|
||||||
|
%fs = $cliFullscreen;
|
||||||
|
$cliFullscreen = "";
|
||||||
|
}
|
||||||
|
|
||||||
echo("--------------");
|
echo("--------------");
|
||||||
echo("Attempting to set resolution to \"" @ $pref::Video::mode @ "\"");
|
echo("Attempting to set resolution to \"" @ %resX SPC %resY SPC %fs SPC %bpp SPC %rate SPC %fsaa @ "\"");
|
||||||
|
|
||||||
%deskRes = getDesktopResolution();
|
%deskRes = getDesktopResolution();
|
||||||
%deskResX = getWord(%deskRes, $WORD::RES_X);
|
%deskResX = getWord(%deskRes, $WORD::RES_X);
|
||||||
|
|
|
||||||
|
|
@ -106,3 +106,79 @@ singleton PostEffect( GlowPostFx )
|
||||||
target = "$backBuffer";
|
target = "$backBuffer";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
singleton ShaderData( PFX_VolFogGlowBlurVertShader )
|
||||||
|
{
|
||||||
|
DXVertexShaderFile = "shaders/common/postFx/glowBlurV.hlsl";
|
||||||
|
DXPixelShaderFile = "shaders/common/postFx/VolFogGlowP.hlsl";
|
||||||
|
|
||||||
|
OGLVertexShaderFile = "shaders/common/postFx/gl/glowBlurV.glsl";
|
||||||
|
OGLPixelShaderFile = "shaders/common/postFx/gl/VolFogGlowP.glsl";
|
||||||
|
|
||||||
|
defines = "BLUR_DIR=float2(0.0,1.0)";
|
||||||
|
samplerNames[0] = "$diffuseMap";
|
||||||
|
pixVersion = 2.0;
|
||||||
|
};
|
||||||
|
singleton ShaderData( PFX_VolFogGlowBlurHorzShader : PFX_VolFogGlowBlurVertShader )
|
||||||
|
{
|
||||||
|
DXVertexShaderFile = "shaders/common/postFx/glowBlurV.hlsl";
|
||||||
|
DXPixelShaderFile = "shaders/common/postFx/VolFogGlowP.hlsl";
|
||||||
|
|
||||||
|
OGLVertexShaderFile = "shaders/common/postFx/gl/glowBlurV.glsl";
|
||||||
|
OGLPixelShaderFile = "shaders/common/postFx/gl/VolFogGlowP.glsl";
|
||||||
|
|
||||||
|
defines = "BLUR_DIR=float2(1.0,0.0)";
|
||||||
|
};
|
||||||
|
|
||||||
|
$VolFogGlowPostFx::glowStrength = 0.3;
|
||||||
|
|
||||||
|
singleton PostEffect( VolFogGlowPostFx )
|
||||||
|
{
|
||||||
|
// Do not allow the glow effect to work in reflection
|
||||||
|
// passes by default so we don't do the extra drawing.
|
||||||
|
allowReflectPass = false;
|
||||||
|
renderTime = "PFXAfterBin";
|
||||||
|
renderBin = "FogBin";
|
||||||
|
renderPriority = 1;
|
||||||
|
// First we down sample the glow buffer.
|
||||||
|
shader = PFX_PassthruShader;
|
||||||
|
stateBlock = PFX_DefaultStateBlock;
|
||||||
|
texture[0] = "$backbuffer";
|
||||||
|
target = "$outTex";
|
||||||
|
targetScale = "0.5 0.5";
|
||||||
|
isEnabled = true;
|
||||||
|
// Blur vertically
|
||||||
|
new PostEffect()
|
||||||
|
{
|
||||||
|
shader = PFX_VolFogGlowBlurVertShader;
|
||||||
|
stateBlock = PFX_DefaultStateBlock;
|
||||||
|
internalName = "vert";
|
||||||
|
texture[0] = "$inTex";
|
||||||
|
target = "$outTex";
|
||||||
|
};
|
||||||
|
// Blur horizontally
|
||||||
|
new PostEffect()
|
||||||
|
{
|
||||||
|
shader = PFX_VolFogGlowBlurHorzShader;
|
||||||
|
stateBlock = PFX_DefaultStateBlock;
|
||||||
|
internalName = "hor";
|
||||||
|
texture[0] = "$inTex";
|
||||||
|
target = "$outTex";
|
||||||
|
};
|
||||||
|
// Upsample and combine with the back buffer.
|
||||||
|
new PostEffect()
|
||||||
|
{
|
||||||
|
shader = PFX_PassthruShader;
|
||||||
|
stateBlock = PFX_GlowCombineStateBlock;
|
||||||
|
texture[0] = "$inTex";
|
||||||
|
target = "$backBuffer";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
function VolFogGlowPostFx::setShaderConsts( %this )
|
||||||
|
{
|
||||||
|
%vp=%this-->vert;
|
||||||
|
%vp.setShaderConst( "$strength", $VolFogGlowPostFx::glowStrength );
|
||||||
|
%vp=%this-->hor;
|
||||||
|
%vp.setShaderConst( "$strength", $VolFogGlowPostFx::glowStrength );
|
||||||
|
}
|
||||||
|
|
@ -70,6 +70,7 @@ function PostFXManager::settingsSetEnabled(%this, %bEnablePostFX)
|
||||||
|
|
||||||
postVerbose("% - PostFX Manager - PostFX disabled");
|
postVerbose("% - PostFX Manager - PostFX disabled");
|
||||||
}
|
}
|
||||||
|
VolFogGlowPostFx.disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
function PostFXManager::settingsEffectSetEnabled(%this, %sName, %bEnable)
|
function PostFXManager::settingsEffectSetEnabled(%this, %sName, %bEnable)
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,8 @@ function initRenderManager()
|
||||||
DiffuseRenderPassManager.addManager( new RenderParticleMgr() { renderOrder = 1.35; processAddOrder = 1.35; } );
|
DiffuseRenderPassManager.addManager( new RenderParticleMgr() { renderOrder = 1.35; processAddOrder = 1.35; } );
|
||||||
DiffuseRenderPassManager.addManager( new RenderTranslucentMgr() { renderOrder = 1.4; processAddOrder = 1.4; } );
|
DiffuseRenderPassManager.addManager( new RenderTranslucentMgr() { renderOrder = 1.4; processAddOrder = 1.4; } );
|
||||||
|
|
||||||
|
DiffuseRenderPassManager.addManager(new RenderObjectMgr(FogBin){ bintype = "ObjectVolumetricFog"; renderOrder = 1.45; processAddOrder = 1.45; } );
|
||||||
|
|
||||||
// Note that the GlowPostFx is triggered after this bin.
|
// Note that the GlowPostFx is triggered after this bin.
|
||||||
DiffuseRenderPassManager.addManager( new RenderGlowMgr(GlowBin) { renderOrder = 1.5; processAddOrder = 1.5; } );
|
DiffuseRenderPassManager.addManager( new RenderGlowMgr(GlowBin) { renderOrder = 1.5; processAddOrder = 1.5; } );
|
||||||
|
|
||||||
|
|
|
||||||
106
Templates/Empty/game/scripts/server/VolumetricFog.cs
Normal file
106
Templates/Empty/game/scripts/server/VolumetricFog.cs
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function VolumetricFog::onEnterFog(%this,%obj)
|
||||||
|
{
|
||||||
|
// This method is called whenever the control object (Camera or Player)
|
||||||
|
// %obj enters the fog area.
|
||||||
|
|
||||||
|
// echo("Control Object " @ %obj @ " enters fog " @ %this);
|
||||||
|
}
|
||||||
|
|
||||||
|
function VolumetricFog::onLeaveFog(%this,%obj)
|
||||||
|
{
|
||||||
|
// This method is called whenever the control object (Camera or Player)
|
||||||
|
// %obj leaves the fog area.
|
||||||
|
|
||||||
|
// echo("Control Object " @ %obj @ " left fog " @ %this);
|
||||||
|
}
|
||||||
|
|
||||||
|
function VolumetricFog::Dissolve(%this,%speed,%delete)
|
||||||
|
{
|
||||||
|
// This method dissolves the fog at speed milliseconds
|
||||||
|
%this.isBuilding = true;
|
||||||
|
if (%this.FogDensity > 0)
|
||||||
|
{
|
||||||
|
%this.setFogDensity(%this.FogDensity - 0.005);
|
||||||
|
%this.schedule(%speed,Dissolve,%speed,%delete);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
%this.isBuilding = false;
|
||||||
|
%this.SetFogDensity(0.0);
|
||||||
|
if (%delete !$= "" && %delete !$="0" && %delete !$="false")
|
||||||
|
%this.schedule(250,delete);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function VolumetricFog::Thicken(%this,%speed, %end_density)
|
||||||
|
{
|
||||||
|
// This method thickens the fog at speed milliseconds to a density of %end_density
|
||||||
|
|
||||||
|
%this.isBuilding = true;
|
||||||
|
if (%this.FogDensity + 0.005 < %end_density)
|
||||||
|
{
|
||||||
|
%this.setFogDensity(%this.FogDensity + 0.005);
|
||||||
|
%this.schedule(%speed,Thicken,%speed, %end_density);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
%this.setFogDensity(%end_density);
|
||||||
|
%this.isBuilding = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function GenerateFog(%pos,%scale,%color,%density)
|
||||||
|
{
|
||||||
|
// This function can be used to generate some fog caused by massive gunfire etc.
|
||||||
|
// Change shape and modulation data to your likings.
|
||||||
|
|
||||||
|
%fog=new VolumetricFog() {
|
||||||
|
shapeName = "art/environment/Fog_Sphere.dts";
|
||||||
|
fogColor = %color;
|
||||||
|
fogDensity = "0.0";
|
||||||
|
ignoreWater = "0";
|
||||||
|
MinSize = "250";
|
||||||
|
FadeSize = "750";
|
||||||
|
texture = "art/environment/FogMod_heavy.dds";
|
||||||
|
tiles = "1";
|
||||||
|
modStrength = "0.2";
|
||||||
|
PrimSpeed = "-0.01 0.04";
|
||||||
|
SecSpeed = "0.02 0.02";
|
||||||
|
position = %pos;
|
||||||
|
rotation = "0 0 1 20.354";
|
||||||
|
scale = %scale;
|
||||||
|
canSave = "1";
|
||||||
|
canSaveDynamicFields = "1";
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isObject(%fog))
|
||||||
|
{
|
||||||
|
MissionCleanup.add(%fog);
|
||||||
|
|
||||||
|
%fog.Thicken(500,%density);
|
||||||
|
}
|
||||||
|
|
||||||
|
return %fog;
|
||||||
|
}
|
||||||
|
|
@ -22,3 +22,4 @@
|
||||||
|
|
||||||
// Load up all scripts. This function is called when
|
// Load up all scripts. This function is called when
|
||||||
// a server is constructed.
|
// a server is constructed.
|
||||||
|
exec("./VolumetricFog.cs");
|
||||||
87
Templates/Empty/game/shaders/common/VolumetricFog/VFogP.hlsl
Normal file
87
Templates/Empty/game/shaders/common/VolumetricFog/VFogP.hlsl
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Volumetric Fog final pixel shader V2.00
|
||||||
|
|
||||||
|
#include "shadergen:/autogenConditioners.h"
|
||||||
|
#include "../torque.hlsl"
|
||||||
|
|
||||||
|
uniform sampler2D prepassTex : register(S0);
|
||||||
|
uniform sampler2D depthBuffer : register(S1);
|
||||||
|
uniform sampler2D frontBuffer : register(S2);
|
||||||
|
uniform sampler2D density : register(S3);
|
||||||
|
|
||||||
|
uniform float accumTime;
|
||||||
|
uniform float4 fogColor;
|
||||||
|
uniform float fogDensity;
|
||||||
|
uniform float preBias;
|
||||||
|
uniform float textured;
|
||||||
|
uniform float modstrength;
|
||||||
|
uniform float4 modspeed;//xy speed layer 1, zw speed layer 2
|
||||||
|
uniform float2 viewpoint;
|
||||||
|
uniform float2 texscale;
|
||||||
|
uniform float3 ambientColor;
|
||||||
|
uniform float numtiles;
|
||||||
|
uniform float fadesize;
|
||||||
|
uniform float2 PixelSize;
|
||||||
|
|
||||||
|
struct ConnectData
|
||||||
|
{
|
||||||
|
float4 hpos : POSITION;
|
||||||
|
float4 htpos : TEXCOORD0;
|
||||||
|
float2 uv0 : TEXCOORD1;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 main( ConnectData IN ) : COLOR0
|
||||||
|
{
|
||||||
|
float2 uvscreen=((IN.htpos.xy/IN.htpos.w) + 1.0 ) / 2.0;
|
||||||
|
uvscreen.y = 1.0 - uvscreen.y;
|
||||||
|
|
||||||
|
float obj_test = prepassUncondition( prepassTex, uvscreen).w * preBias;
|
||||||
|
float depth = tex2D(depthBuffer,uvscreen).r;
|
||||||
|
float front = tex2D(frontBuffer,uvscreen).r;
|
||||||
|
|
||||||
|
if (depth <= front)
|
||||||
|
return float4(0,0,0,0);
|
||||||
|
else if ( obj_test < depth )
|
||||||
|
depth = obj_test;
|
||||||
|
if ( front >= 0.0)
|
||||||
|
depth -= front;
|
||||||
|
|
||||||
|
float diff = 1.0;
|
||||||
|
float3 col = fogColor.rgb;
|
||||||
|
if (textured != 0.0)
|
||||||
|
{
|
||||||
|
float2 offset = viewpoint + ((-0.5 + (texscale * uvscreen)) * numtiles);
|
||||||
|
|
||||||
|
float2 mod1 = tex2D(density,(offset + (modspeed.xy*accumTime))).rg;
|
||||||
|
float2 mod2= tex2D(density,(offset + (modspeed.zw*accumTime))).rg;
|
||||||
|
diff = (mod2.r + mod1.r) * modstrength;
|
||||||
|
col *= (2.0 - ((mod1.g + mod2.g) * fadesize))/2.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
col *= ambientColor;
|
||||||
|
|
||||||
|
float4 resultColor = float4(col, 1.0 - saturate(exp(-fogDensity * depth * diff * fadesize)));
|
||||||
|
|
||||||
|
return hdrEncode(resultColor);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Volumetric Fog prepass pixel shader V1.00
|
||||||
|
|
||||||
|
struct ConnectData
|
||||||
|
{
|
||||||
|
float4 hpos : POSITION;
|
||||||
|
float4 pos : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 main( ConnectData IN ) : COLOR0
|
||||||
|
{
|
||||||
|
float OUT;
|
||||||
|
|
||||||
|
clip( IN.pos.w );
|
||||||
|
OUT = IN.pos.w;
|
||||||
|
|
||||||
|
return float4(OUT,0,0,1);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Volumetric Fog prepass vertex shader V1.00
|
||||||
|
|
||||||
|
#include "shaders/common/hlslstructs.h"
|
||||||
|
|
||||||
|
struct ConnectData
|
||||||
|
{
|
||||||
|
float4 hpos : POSITION;
|
||||||
|
float4 pos : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
|
uniform float4x4 modelView;
|
||||||
|
|
||||||
|
ConnectData main( VertexIn_P IN)
|
||||||
|
{
|
||||||
|
ConnectData OUT;
|
||||||
|
|
||||||
|
float4 inPos = IN.pos;
|
||||||
|
inPos.w = 1.0;
|
||||||
|
|
||||||
|
OUT.hpos = mul( modelView, inPos );
|
||||||
|
OUT.pos = OUT.hpos;
|
||||||
|
|
||||||
|
return OUT;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
uniform float4 fogColor;
|
||||||
|
uniform float fogDensity;
|
||||||
|
uniform float reflStrength;
|
||||||
|
|
||||||
|
struct ConnectData
|
||||||
|
{
|
||||||
|
float4 hpos : POSITION;
|
||||||
|
float4 pos : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 main( ConnectData IN ) : COLOR0
|
||||||
|
{
|
||||||
|
return float4(fogColor.rgb,saturate(fogDensity*reflStrength));
|
||||||
|
}
|
||||||
45
Templates/Empty/game/shaders/common/VolumetricFog/VFogV.hlsl
Normal file
45
Templates/Empty/game/shaders/common/VolumetricFog/VFogV.hlsl
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Volumetric Fog final vertex shader V1.00
|
||||||
|
|
||||||
|
#include "shaders/common/hlslstructs.h"
|
||||||
|
|
||||||
|
struct ConnectData
|
||||||
|
{
|
||||||
|
float4 hpos : POSITION;
|
||||||
|
float4 htpos : TEXCOORD0;
|
||||||
|
float2 uv0 : TEXCOORD1;
|
||||||
|
};
|
||||||
|
|
||||||
|
uniform float4x4 modelView;
|
||||||
|
|
||||||
|
ConnectData main( VertexIn_PNT IN)
|
||||||
|
{
|
||||||
|
ConnectData OUT;
|
||||||
|
|
||||||
|
OUT.hpos = mul(modelView, IN.pos);
|
||||||
|
OUT.htpos = OUT.hpos;
|
||||||
|
OUT.uv0 = IN.uv0;
|
||||||
|
|
||||||
|
return OUT;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
#include "shadergen:/autogenConditioners.h"
|
||||||
|
#include "../../gl/torque.glsl"
|
||||||
|
|
||||||
|
uniform sampler2D prepassTex;
|
||||||
|
uniform sampler2D depthBuffer;
|
||||||
|
uniform sampler2D frontBuffer;
|
||||||
|
uniform sampler2D density;
|
||||||
|
|
||||||
|
uniform float accumTime;
|
||||||
|
uniform vec4 fogColor;
|
||||||
|
uniform float fogDensity;
|
||||||
|
uniform float preBias;
|
||||||
|
uniform float textured;
|
||||||
|
uniform float modstrength;
|
||||||
|
uniform vec4 modspeed;//xy speed layer 1, zw speed layer 2
|
||||||
|
uniform vec2 viewpoint;
|
||||||
|
uniform vec2 texscale;
|
||||||
|
uniform vec3 ambientColor;
|
||||||
|
uniform float numtiles;
|
||||||
|
uniform float fadesize;
|
||||||
|
uniform vec2 PixelSize;
|
||||||
|
|
||||||
|
in vec4 _hpos;
|
||||||
|
#define IN_hpos _hpos
|
||||||
|
out vec4 OUT_col;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec2 uvscreen=((IN_hpos.xy/IN_hpos.w) + 1.0 ) / 2.0;
|
||||||
|
uvscreen.y = 1.0 - uvscreen.y;
|
||||||
|
|
||||||
|
float obj_test = prepassUncondition( prepassTex, uvscreen).w * preBias;
|
||||||
|
float depth = tex2D(depthBuffer,uvscreen).r;
|
||||||
|
float front = tex2D(frontBuffer,uvscreen).r;
|
||||||
|
|
||||||
|
if (depth <= front)
|
||||||
|
{
|
||||||
|
OUT_col = vec4(0,0,0,0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ( obj_test < depth )
|
||||||
|
depth = obj_test;
|
||||||
|
if ( front >= 0.0)
|
||||||
|
depth -= front;
|
||||||
|
|
||||||
|
float diff = 1.0;
|
||||||
|
vec3 col = fogColor.rgb;
|
||||||
|
if (textured != 0.0)
|
||||||
|
{
|
||||||
|
vec2 offset = viewpoint + ((-0.5 + (texscale * uvscreen)) * numtiles);
|
||||||
|
|
||||||
|
vec2 mod1 = tex2D(density,(offset + (modspeed.xy*accumTime))).rg;
|
||||||
|
vec2 mod2= tex2D(density,(offset + (modspeed.zw*accumTime))).rg;
|
||||||
|
diff = (mod2.r + mod1.r) * modstrength;
|
||||||
|
col *= (2.0 - ((mod1.g + mod2.g) * fadesize))/2.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
col *= ambientColor;
|
||||||
|
|
||||||
|
vec4 returnColor = vec4(col, 1.0 - saturate(exp(-fogDensity * depth * diff * fadesize)));
|
||||||
|
|
||||||
|
OUT_col = hdrEncode(returnColor);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
|
||||||
|
in vec4 _hpos;
|
||||||
|
#define IN_hpos _hpos
|
||||||
|
|
||||||
|
out vec4 OUT_col;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
float OUT;
|
||||||
|
clip( IN_hpos.w );
|
||||||
|
OUT = IN_hpos.w;
|
||||||
|
|
||||||
|
OUT_col = vec4(OUT,0,0,1);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
|
||||||
|
in vec4 vPosition;
|
||||||
|
#define IN_position vPosition
|
||||||
|
|
||||||
|
out vec4 _hpos;
|
||||||
|
#define OUT_hpos _hpos
|
||||||
|
|
||||||
|
uniform mat4 modelView;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 inPos = IN_position;
|
||||||
|
inPos.w = 1.0;
|
||||||
|
|
||||||
|
OUT_hpos = tMul( modelView, inPos );
|
||||||
|
|
||||||
|
gl_Position = OUT_hpos;
|
||||||
|
correctSSP(gl_Position);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
|
||||||
|
uniform vec4 fogColor;
|
||||||
|
uniform float fogDensity;
|
||||||
|
uniform float reflStrength;
|
||||||
|
out vec4 OUT_col;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
OUT_col = vec4(fogColor.rgb,saturate(fogDensity*reflStrength));
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
|
||||||
|
in vec4 vPosition;
|
||||||
|
#define IN_position vPosition
|
||||||
|
|
||||||
|
out vec4 _hpos;
|
||||||
|
#define OUT_hpos _hpos
|
||||||
|
|
||||||
|
uniform mat4 modelView;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
OUT_hpos = tMul(modelView, IN_position);
|
||||||
|
gl_Position = OUT_hpos;
|
||||||
|
correctSSP(gl_Position);
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue