mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
Merge branch 'master' into console-func-refactor
Conflicts: Engine/source/app/net/net.cpp Engine/source/console/astNodes.cpp Engine/source/console/compiledEval.cpp Engine/source/console/console.h Engine/source/console/consoleInternal.h Engine/source/console/engineAPI.h
This commit is contained in:
commit
b507dc9555
6487 changed files with 315149 additions and 609761 deletions
|
|
@ -26,6 +26,7 @@
|
|||
#include "basicClouds.h"
|
||||
|
||||
#include "gfx/gfxTransformSaver.h"
|
||||
#include "gfx/gfxTextureManager.h"
|
||||
#include "core/stream/fileStream.h"
|
||||
#include "core/stream/bitStream.h"
|
||||
#include "scene/sceneRenderState.h"
|
||||
|
|
@ -336,7 +337,7 @@ void BasicClouds::_initTexture()
|
|||
mTexture[i].set( mTexName[i], &GFXDefaultStaticDiffuseProfile, "BasicClouds" );
|
||||
|
||||
if ( mTexture[i].isNull() )
|
||||
mTexture[i].set( "core/art/warnmat", &GFXDefaultStaticDiffuseProfile, "BasicClouds" );
|
||||
mTexture[i].set( GFXTextureManager::getWarningTexturePath(), &GFXDefaultStaticDiffuseProfile, "BasicClouds" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "cloudLayer.h"
|
||||
|
||||
#include "gfx/gfxTransformSaver.h"
|
||||
#include "gfx/gfxTextureManager.h"
|
||||
#include "core/stream/fileStream.h"
|
||||
#include "core/stream/bitStream.h"
|
||||
#include "scene/sceneRenderState.h"
|
||||
|
|
@ -387,7 +388,7 @@ void CloudLayer::_initTexture()
|
|||
mTexture.set( mTextureName, &GFXDefaultStaticDiffuseProfile, "CloudLayer" );
|
||||
|
||||
if ( mTexture.isNull() )
|
||||
mTexture.set( "core/art/warnmat", &GFXDefaultStaticDiffuseProfile, "CloudLayer" );
|
||||
mTexture.set( GFXTextureManager::getWarningTexturePath(), &GFXDefaultStaticDiffuseProfile, "CloudLayer" );
|
||||
}
|
||||
|
||||
void CloudLayer::_initBuffers()
|
||||
|
|
@ -399,6 +400,7 @@ void CloudLayer::_initBuffers()
|
|||
|
||||
mVB.set( GFX, smVertCount, GFXBufferTypeStatic );
|
||||
GFXCloudVertex *pVert = mVB.lock();
|
||||
if(!pVert) return;
|
||||
|
||||
for ( U32 y = 0; y < smVertStride; y++ )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -721,7 +721,7 @@ void DecalRoad::prepRenderImage( SceneRenderState* state )
|
|||
if ( !smShowRoad && smEditorOpen )
|
||||
return;
|
||||
|
||||
const Frustum &frustum = state->getFrustum();
|
||||
const Frustum &frustum = state->getCameraFrustum();
|
||||
|
||||
MeshRenderInst coreRI;
|
||||
coreRI.clear();
|
||||
|
|
@ -1452,7 +1452,8 @@ void DecalRoad::_captureVerts()
|
|||
mPB.set( GFX, mTriangleCount * 3, 0, GFXBufferTypeStatic );
|
||||
|
||||
// Lock the VertexBuffer
|
||||
GFXVertexPNTBT *vertPtr = mVB.lock();
|
||||
GFXVertexPNTBT *vertPtr = mVB.lock();
|
||||
if(!vertPtr) return;
|
||||
U32 vertIdx = 0;
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1223,9 +1223,10 @@ ConsoleMethod( GuiMeshRoadEditorCtrl, setNodeDepth, void, 3, 3, "" )
|
|||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, getNodePosition, const char*, 2, 2, "" )
|
||||
{
|
||||
char* returnBuffer = Con::getReturnBuffer(256);
|
||||
static const U32 bufSize = 256;
|
||||
char* returnBuffer = Con::getReturnBuffer(bufSize);
|
||||
|
||||
dSprintf(returnBuffer, 256, "%f %f %f",
|
||||
dSprintf(returnBuffer, bufSize, "%f %f %f",
|
||||
object->getNodePosition().x, object->getNodePosition().y, object->getNodePosition().z);
|
||||
|
||||
return returnBuffer;
|
||||
|
|
@ -1249,9 +1250,10 @@ ConsoleMethod( GuiMeshRoadEditorCtrl, setNodePosition, void, 3, 3, "" )
|
|||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, getNodeNormal, const char*, 2, 2, "" )
|
||||
{
|
||||
char* returnBuffer = Con::getReturnBuffer(256);
|
||||
static const U32 bufSize = 256;
|
||||
char* returnBuffer = Con::getReturnBuffer(bufSize);
|
||||
|
||||
dSprintf(returnBuffer, 256, "%f %f %f",
|
||||
dSprintf(returnBuffer, bufSize, "%f %f %f",
|
||||
object->getNodeNormal().x, object->getNodeNormal().y, object->getNodeNormal().z);
|
||||
|
||||
return returnBuffer;
|
||||
|
|
|
|||
|
|
@ -1430,9 +1430,10 @@ ConsoleMethod( GuiRiverEditorCtrl, setNodeDepth, void, 3, 3, "" )
|
|||
|
||||
ConsoleMethod( GuiRiverEditorCtrl, getNodePosition, const char*, 2, 2, "" )
|
||||
{
|
||||
char* returnBuffer = Con::getReturnBuffer(256);
|
||||
static const U32 bufSize = 256;
|
||||
char* returnBuffer = Con::getReturnBuffer(bufSize);
|
||||
|
||||
dSprintf(returnBuffer, 256, "%f %f %f",
|
||||
dSprintf(returnBuffer, bufSize, "%f %f %f",
|
||||
object->getNodePosition().x, object->getNodePosition().y, object->getNodePosition().z);
|
||||
|
||||
return returnBuffer;
|
||||
|
|
@ -1456,9 +1457,10 @@ ConsoleMethod( GuiRiverEditorCtrl, setNodePosition, void, 3, 3, "" )
|
|||
|
||||
ConsoleMethod( GuiRiverEditorCtrl, getNodeNormal, const char*, 2, 2, "" )
|
||||
{
|
||||
char* returnBuffer = Con::getReturnBuffer(256);
|
||||
static const U32 bufSize = 256;
|
||||
char* returnBuffer = Con::getReturnBuffer(bufSize);
|
||||
|
||||
dSprintf(returnBuffer, 256, "%f %f %f",
|
||||
dSprintf(returnBuffer, bufSize, "%f %f %f",
|
||||
object->getNodeNormal().x, object->getNodeNormal().y, object->getNodeNormal().z);
|
||||
|
||||
return returnBuffer;
|
||||
|
|
|
|||
|
|
@ -1064,9 +1064,10 @@ ConsoleMethod( GuiRoadEditorCtrl, setNodeWidth, void, 3, 3, "" )
|
|||
|
||||
ConsoleMethod( GuiRoadEditorCtrl, getNodePosition, const char*, 2, 2, "" )
|
||||
{
|
||||
char* returnBuffer = Con::getReturnBuffer(256);
|
||||
static const U32 bufSize = 256;
|
||||
char* returnBuffer = Con::getReturnBuffer(bufSize);
|
||||
|
||||
dSprintf(returnBuffer, 256, "%f %f %f",
|
||||
dSprintf(returnBuffer, bufSize, "%f %f %f",
|
||||
object->getNodePosition().x, object->getNodePosition().y, object->getNodePosition().z);
|
||||
|
||||
return returnBuffer;
|
||||
|
|
|
|||
|
|
@ -1074,7 +1074,7 @@ void MeshRoad::unpackUpdate(NetConnection * con, BitStream * stream)
|
|||
stream->read( &mMaterialName[i] );
|
||||
|
||||
if ( !Sim::findObject( mMaterialName[i], pMat ) )
|
||||
Con::printf( "DecalRoad::unpackUpdate, failed to find Material of name &s!", mMaterialName[i].c_str() );
|
||||
Con::printf( "DecalRoad::unpackUpdate, failed to find Material of name %s", mMaterialName[i].c_str() );
|
||||
else
|
||||
mMaterial[i] = pMat;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,33 +90,33 @@ GFXImplementVertexFormat( ScatterSkyVertex )
|
|||
}
|
||||
|
||||
ScatterSky::ScatterSky()
|
||||
{
|
||||
{
|
||||
mPrimCount = 0;
|
||||
mVertCount = 0;
|
||||
|
||||
|
||||
// Rayleigh scattering constant.
|
||||
mRayleighScattering = 0.0035f;
|
||||
mRayleighScattering = 0.0035f;
|
||||
mRayleighScattering4PI = mRayleighScattering * 4.0f * M_PI_F;
|
||||
|
||||
// Mie scattering constant.
|
||||
mMieScattering = 0.0045f;
|
||||
mMieScattering = 0.0045f;
|
||||
mMieScattering4PI = mMieScattering * 4.0f * M_PI_F;
|
||||
|
||||
// Overall scatter scalar.
|
||||
mSkyBrightness = 25.0f;
|
||||
mSkyBrightness = 25.0f;
|
||||
|
||||
// The Mie phase asymmetry factor.
|
||||
mMiePhaseAssymetry = -0.75f;
|
||||
mMiePhaseAssymetry = -0.75f;
|
||||
|
||||
mSphereInnerRadius = 1.0f;
|
||||
mSphereOuterRadius = 1.0f * 1.025f;
|
||||
mScale = 1.0f / (mSphereOuterRadius - mSphereInnerRadius);
|
||||
|
||||
// 650 nm for red
|
||||
// 570 nm for green
|
||||
|
||||
// 650 nm for red
|
||||
// 570 nm for green
|
||||
// 475 nm for blue
|
||||
mWavelength.set( 0.650f, 0.570f, 0.475f, 0 );
|
||||
mWavelength.set( 0.650f, 0.570f, 0.475f, 0 );
|
||||
|
||||
mWavelength4[0] = mPow(mWavelength[0], 4.0f);
|
||||
mWavelength4[1] = mPow(mWavelength[1], 4.0f);
|
||||
|
|
@ -127,9 +127,9 @@ ScatterSky::ScatterSky()
|
|||
|
||||
mAmbientColor.set( 0, 0, 0, 1.0f );
|
||||
mAmbientScale.set( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
|
||||
|
||||
mSunColor.set( 0, 0, 0, 1.0f );
|
||||
mSunScale = ColorF::WHITE;
|
||||
mSunScale = ColorF::WHITE;
|
||||
|
||||
mFogColor.set( 0, 0, 0, 1.0f );
|
||||
mFogScale = ColorF::WHITE;
|
||||
|
|
@ -138,7 +138,7 @@ ScatterSky::ScatterSky()
|
|||
mNightInterpolant = 0;
|
||||
|
||||
mShader = NULL;
|
||||
|
||||
|
||||
mTimeOfDay = 0;
|
||||
|
||||
mSunAzimuth = 0.0f;
|
||||
|
|
@ -153,7 +153,7 @@ ScatterSky::ScatterSky()
|
|||
mDirty = true;
|
||||
|
||||
mLight = LightManager::createLightInfo();
|
||||
mLight->setType( LightInfo::Vector );
|
||||
mLight->setType( LightInfo::Vector );
|
||||
|
||||
mFlareData = NULL;
|
||||
mFlareState.clear();
|
||||
|
|
@ -169,6 +169,7 @@ ScatterSky::ScatterSky()
|
|||
mNightColor.set( 0.0196078f, 0.0117647f, 0.109804f, 1.0f );
|
||||
mNightFogColor = mNightColor;
|
||||
mUseNightCubemap = false;
|
||||
mSunSize = 1.0f;
|
||||
|
||||
mMoonMatInst = NULL;
|
||||
|
||||
|
|
@ -179,11 +180,14 @@ ScatterSky::ScatterSky()
|
|||
|
||||
mMatrixSet = reinterpret_cast<MatrixSet *>(dMalloc_aligned(sizeof(MatrixSet), 16));
|
||||
constructInPlace(mMatrixSet);
|
||||
|
||||
mColorizeAmt = 0;
|
||||
mColorize.set(0,0,0);
|
||||
}
|
||||
|
||||
ScatterSky::~ScatterSky()
|
||||
{
|
||||
SAFE_DELETE( mLight );
|
||||
SAFE_DELETE( mLight );
|
||||
SAFE_DELETE( mMoonMatInst );
|
||||
|
||||
dFree_aligned(mMatrixSet);
|
||||
|
|
@ -192,19 +196,20 @@ ScatterSky::~ScatterSky()
|
|||
bool ScatterSky::onAdd()
|
||||
{
|
||||
PROFILE_SCOPE(ScatterSky_onAdd);
|
||||
|
||||
|
||||
// onNewDatablock for the server is called here
|
||||
// for the client it is called in unpackUpdate
|
||||
|
||||
if ( !Parent::onAdd() )
|
||||
return false;
|
||||
|
||||
if ( isClientObject() )
|
||||
TimeOfDay::getTimeOfDayUpdateSignal().notify( this, &ScatterSky::_updateTimeOfDay );
|
||||
|
||||
setGlobalBounds();
|
||||
setGlobalBounds();
|
||||
resetWorldBox();
|
||||
|
||||
addToScene();
|
||||
addToScene();
|
||||
|
||||
if ( isClientObject() )
|
||||
{
|
||||
|
|
@ -232,18 +237,18 @@ void ScatterSky::_conformLights()
|
|||
F32 val = mCurves[0].getVal( mTimeOfDay );
|
||||
mNightInterpolant = 1.0f - val;
|
||||
|
||||
VectorF lightDirection;
|
||||
VectorF lightDirection;
|
||||
F32 brightness;
|
||||
|
||||
// Build the light direction from the azimuth and elevation.
|
||||
F32 yaw = mDegToRad(mClampF(mSunAzimuth,0,359));
|
||||
F32 pitch = mDegToRad(mClampF(mSunElevation,-360,+360));
|
||||
F32 pitch = mDegToRad(mClampF(mSunElevation,-360,+360));
|
||||
MathUtils::getVectorFromAngles(lightDirection, yaw, pitch);
|
||||
lightDirection.normalize();
|
||||
mSunDir = -lightDirection;
|
||||
|
||||
yaw = mDegToRad(mClampF(mMoonAzimuth,0,359));
|
||||
pitch = mDegToRad(mClampF(mMoonElevation,-360,+360));
|
||||
pitch = mDegToRad(mClampF(mMoonElevation,-360,+360));
|
||||
MathUtils::getVectorFromAngles( mMoonLightDir, yaw, pitch );
|
||||
mMoonLightDir.normalize();
|
||||
mMoonLightDir = -mMoonLightDir;
|
||||
|
|
@ -251,12 +256,12 @@ void ScatterSky::_conformLights()
|
|||
brightness = mCurves[2].getVal( mTimeOfDay );
|
||||
|
||||
if ( mNightInterpolant >= 1.0f )
|
||||
lightDirection = -mMoonLightDir;
|
||||
|
||||
lightDirection = -mMoonLightDir;
|
||||
|
||||
mLight->setDirection( -lightDirection );
|
||||
mLight->setBrightness( brightness * mBrightness );
|
||||
mLightDir = lightDirection;
|
||||
|
||||
mLightDir = lightDirection;
|
||||
|
||||
// Have to do interpolation
|
||||
// after the light direction is set
|
||||
// otherwise the sun color will be invalid.
|
||||
|
|
@ -268,7 +273,7 @@ void ScatterSky::_conformLights()
|
|||
|
||||
FogData fog = getSceneManager()->getFogData();
|
||||
fog.color = mFogColor;
|
||||
getSceneManager()->setFogData( fog );
|
||||
getSceneManager()->setFogData( fog );
|
||||
}
|
||||
|
||||
void ScatterSky::submitLights( LightManager *lm, bool staticLighting )
|
||||
|
|
@ -293,7 +298,7 @@ void ScatterSky::setAzimuth( F32 azimuth )
|
|||
void ScatterSky::setElevation( F32 elevation )
|
||||
{
|
||||
mSunElevation = elevation;
|
||||
|
||||
|
||||
while( elevation < 0 )
|
||||
elevation += 360.0f;
|
||||
|
||||
|
|
@ -313,61 +318,67 @@ void ScatterSky::inspectPostApply()
|
|||
|
||||
void ScatterSky::initPersistFields()
|
||||
{
|
||||
addGroup( "ScatterSky",
|
||||
addGroup( "ScatterSky",
|
||||
"Only azimuth and elevation are networked fields. To trigger a full update of all other fields use the applyChanges ConsoleMethod." );
|
||||
|
||||
addField( "skyBrightness", TypeF32, Offset( mSkyBrightness, ScatterSky ),
|
||||
"Global brightness and intensity applied to the sky and objects in the level." );
|
||||
|
||||
addField( "mieScattering", TypeF32, Offset( mMieScattering, ScatterSky ),
|
||||
"Affects the size and intensity of light scattering around the sun." );
|
||||
|
||||
|
||||
addField( "sunSize", TypeF32, Offset( mSunSize, ScatterSky ),
|
||||
"Affects the size of the sun's disk." );
|
||||
|
||||
addField( "colorizeAmount", TypeF32, Offset( mColorizeAmt, ScatterSky ),
|
||||
"Controls how much the the alpha component of colorize brigthens the sky. Setting to 0 returns default behavior." );
|
||||
|
||||
addField( "colorize", TypeColorF, Offset( mColorize, ScatterSky ),
|
||||
"Tints the sky the color specified, the alpha controls the brigthness. The brightness is multipled by the value of colorizeAmt." );
|
||||
|
||||
addField( "rayleighScattering", TypeF32, Offset( mRayleighScattering, ScatterSky ),
|
||||
"Controls how blue the atmosphere is during the day." );
|
||||
"Controls how blue the atmosphere is during the day." );
|
||||
|
||||
addField( "sunScale", TypeColorF, Offset( mSunScale, ScatterSky ),
|
||||
"Modulates the directional color of sunlight." );
|
||||
|
||||
"Modulates the directional color of sunlight." );
|
||||
|
||||
addField( "ambientScale", TypeColorF, Offset( mAmbientScale, ScatterSky ),
|
||||
"Modulates the ambient color of sunlight." );
|
||||
"Modulates the ambient color of sunlight." );
|
||||
|
||||
addField( "fogScale", TypeColorF, Offset( mFogScale, ScatterSky ),
|
||||
"Modulates the fog color. Note that this overrides the LevelInfo.fogColor "
|
||||
"property, so you should not use LevelInfo.fogColor if the level contains "
|
||||
"a ScatterSky object." );
|
||||
|
||||
|
||||
addField( "exposure", TypeF32, Offset( mExposure, ScatterSky ),
|
||||
"Controls the contrast of the sky and sun during daytime." );
|
||||
|
||||
endGroup( "ScatterSky" );
|
||||
|
||||
addGroup( "Orbit" );
|
||||
|
||||
|
||||
addProtectedField( "azimuth", TypeF32, Offset( mSunAzimuth, ScatterSky ), &ScatterSky::ptSetAzimuth, &defaultProtectedGetFn,
|
||||
"The horizontal angle of the sun measured clockwise from the positive Y world axis. This field is networked." );
|
||||
|
||||
addProtectedField( "elevation", TypeF32, Offset( mSunElevation, ScatterSky ), &ScatterSky::ptSetElevation, &defaultProtectedGetFn,
|
||||
"The elevation angle of the sun above or below the horizon. This field is networked." );
|
||||
|
||||
addField( "moonAzimuth", TypeF32, Offset( mMoonAzimuth, ScatterSky ),
|
||||
addField( "moonAzimuth", TypeF32, Offset( mMoonAzimuth, ScatterSky ),
|
||||
"The horizontal angle of the moon measured clockwise from the positive Y world axis. This is not animated by time or networked." );
|
||||
|
||||
addField( "moonElevation", TypeF32, Offset( mMoonElevation, ScatterSky ),
|
||||
addField( "moonElevation", TypeF32, Offset( mMoonElevation, ScatterSky ),
|
||||
"The elevation angle of the moon above or below the horizon. This is not animated by time or networked." );
|
||||
|
||||
endGroup( "Orbit" );
|
||||
endGroup( "Orbit" );
|
||||
|
||||
// We only add the basic lighting options that all lighting
|
||||
// systems would use... the specific lighting system options
|
||||
// are injected at runtime by the lighting system itself.
|
||||
|
||||
addGroup( "Lighting" );
|
||||
|
||||
|
||||
addField( "castShadows", TypeBool, Offset( mCastShadows, ScatterSky ),
|
||||
"Enables/disables shadows cast by objects due to ScatterSky light." );
|
||||
|
||||
addField( "brightness", TypeF32, Offset( mBrightness, ScatterSky ),
|
||||
"The brightness of the ScatterSky's light object." );
|
||||
addField( "brightness", TypeF32, Offset( mBrightness, ScatterSky ),
|
||||
"The brightness of the ScatterSky's light object." );
|
||||
|
||||
endGroup( "Lighting" );
|
||||
|
||||
|
|
@ -385,33 +396,33 @@ void ScatterSky::initPersistFields()
|
|||
|
||||
addField( "nightColor", TypeColorF, Offset( mNightColor, ScatterSky ),
|
||||
"The ambient color during night. Also used for the sky color if useNightCubemap is false." );
|
||||
|
||||
|
||||
addField( "nightFogColor", TypeColorF, Offset( mNightFogColor, ScatterSky ),
|
||||
"The fog color during night." );
|
||||
|
||||
|
||||
addField( "moonEnabled", TypeBool, Offset( mMoonEnabled, ScatterSky ),
|
||||
"Enable or disable rendering of the moon sprite during night." );
|
||||
|
||||
|
||||
addField( "moonMat", TypeMaterialName, Offset( mMoonMatName, ScatterSky ),
|
||||
"Material for the moon sprite." );
|
||||
|
||||
|
||||
addField( "moonScale", TypeF32, Offset( mMoonScale, ScatterSky ),
|
||||
"Controls size the moon sprite renders, specified as a fractional amount of the screen height." );
|
||||
|
||||
|
||||
addField( "moonLightColor", TypeColorF, Offset( mMoonTint, ScatterSky ),
|
||||
"Color of light cast by the directional light during night." );
|
||||
|
||||
|
||||
addField( "useNightCubemap", TypeBool, Offset( mUseNightCubemap, ScatterSky ),
|
||||
"Transition to the nightCubemap during night. If false we use nightColor." );
|
||||
|
||||
|
||||
addField( "nightCubemap", TypeCubemapName, Offset( mNightCubemapName, ScatterSky ),
|
||||
"Cubemap visible during night." );
|
||||
"Cubemap visible during night." );
|
||||
|
||||
endGroup( "Night" );
|
||||
|
||||
// Now inject any light manager specific fields.
|
||||
LightManager::initLightFields();
|
||||
|
||||
|
||||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
|
|
@ -436,30 +447,34 @@ U32 ScatterSky::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
mMieScattering4PI = mMieScattering * 4.0f * M_PI_F;
|
||||
|
||||
stream->write( mMieScattering4PI );
|
||||
|
||||
|
||||
stream->write( mSunSize );
|
||||
|
||||
stream->write( mSkyBrightness );
|
||||
|
||||
|
||||
stream->write( mMiePhaseAssymetry );
|
||||
|
||||
|
||||
stream->write( mSphereInnerRadius );
|
||||
stream->write( mSphereOuterRadius );
|
||||
|
||||
|
||||
stream->write( mScale );
|
||||
|
||||
|
||||
stream->write( mWavelength );
|
||||
|
||||
|
||||
stream->write( mWavelength4[0] );
|
||||
stream->write( mWavelength4[1] );
|
||||
stream->write( mWavelength4[2] );
|
||||
|
||||
|
||||
stream->write( mRayleighScaleDepth );
|
||||
stream->write( mMieScaleDepth );
|
||||
|
||||
stream->write( mNightColor );
|
||||
stream->write( mNightFogColor );
|
||||
stream->write( mNightFogColor );
|
||||
stream->write( mAmbientScale );
|
||||
stream->write( mSunScale );
|
||||
stream->write( mFogScale );
|
||||
stream->write( mColorizeAmt );
|
||||
stream->write( mColorize );
|
||||
|
||||
stream->write( mExposure );
|
||||
|
||||
|
|
@ -472,7 +487,7 @@ U32 ScatterSky::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
if ( stream->writeFlag( mFlareData ) )
|
||||
{
|
||||
stream->writeRangedU32( mFlareData->getId(),
|
||||
DataBlockObjectIdFirst,
|
||||
DataBlockObjectIdFirst,
|
||||
DataBlockObjectIdLast );
|
||||
}
|
||||
|
||||
|
|
@ -486,7 +501,7 @@ U32 ScatterSky::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
stream->write( mMoonAzimuth );
|
||||
stream->write( mMoonElevation );
|
||||
|
||||
mLight->packExtended( stream );
|
||||
mLight->packExtended( stream );
|
||||
}
|
||||
|
||||
return retMask;
|
||||
|
|
@ -495,7 +510,7 @@ U32 ScatterSky::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
void ScatterSky::unpackUpdate(NetConnection *con, BitStream *stream)
|
||||
{
|
||||
Parent::unpackUpdate(con, stream);
|
||||
|
||||
|
||||
if ( stream->readFlag() ) // TimeMask
|
||||
{
|
||||
F32 temp = 0;
|
||||
|
|
@ -513,32 +528,44 @@ void ScatterSky::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
|
||||
stream->read( &mMieScattering );
|
||||
stream->read( &mMieScattering4PI );
|
||||
|
||||
|
||||
stream->read( &mSunSize );
|
||||
|
||||
stream->read( &mSkyBrightness );
|
||||
|
||||
|
||||
stream->read( &mMiePhaseAssymetry );
|
||||
|
||||
|
||||
stream->read( &mSphereInnerRadius );
|
||||
stream->read( &mSphereOuterRadius );
|
||||
|
||||
|
||||
stream->read( &mScale );
|
||||
|
||||
|
||||
ColorF tmpColor( 0, 0, 0 );
|
||||
|
||||
stream->read( &tmpColor );
|
||||
|
||||
|
||||
stream->read( &mWavelength4[0] );
|
||||
stream->read( &mWavelength4[1] );
|
||||
stream->read( &mWavelength4[2] );
|
||||
|
||||
|
||||
stream->read( &mRayleighScaleDepth );
|
||||
stream->read( &mMieScaleDepth );
|
||||
|
||||
stream->read( &mNightColor );
|
||||
stream->read( &mNightFogColor );
|
||||
stream->read( &mNightFogColor );
|
||||
stream->read( &mAmbientScale );
|
||||
stream->read( &mSunScale );
|
||||
stream->read( &mFogScale );
|
||||
F32 colorizeAmt;
|
||||
stream->read( &colorizeAmt );
|
||||
|
||||
if(mColorizeAmt != colorizeAmt) {
|
||||
mColorizeAmt = colorizeAmt;
|
||||
mShader = NULL; //forces shader refresh
|
||||
}
|
||||
|
||||
stream->read( &mColorize );
|
||||
|
||||
|
||||
if ( tmpColor != mWavelength )
|
||||
{
|
||||
|
|
@ -558,7 +585,7 @@ void ScatterSky::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
|
||||
if ( stream->readFlag() )
|
||||
{
|
||||
SimObjectId id = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );
|
||||
SimObjectId id = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );
|
||||
LightFlareData *datablock = NULL;
|
||||
|
||||
if ( Sim::findObject( id, datablock ) )
|
||||
|
|
@ -577,12 +604,12 @@ void ScatterSky::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
stream->read( &mMoonScale );
|
||||
stream->read( &mMoonTint );
|
||||
mUseNightCubemap = stream->readFlag();
|
||||
stream->read( &mNightCubemapName );
|
||||
stream->read( &mNightCubemapName );
|
||||
|
||||
stream->read( &mMoonAzimuth );
|
||||
stream->read( &mMoonElevation );
|
||||
|
||||
mLight->unpackExtended( stream );
|
||||
mLight->unpackExtended( stream );
|
||||
|
||||
if ( isProperlyAdded() )
|
||||
{
|
||||
|
|
@ -638,7 +665,7 @@ void ScatterSky::prepRenderImage( SceneRenderState *state )
|
|||
if ( mNightInterpolant <= 0.0f )
|
||||
return;
|
||||
|
||||
// Render instance for Moon sprite.
|
||||
// Render instance for Moon sprite.
|
||||
if ( mMoonEnabled && mMoonMatInst )
|
||||
{
|
||||
mMatrixSet->setSceneView(GFX->getWorldMatrix());
|
||||
|
|
@ -647,7 +674,7 @@ void ScatterSky::prepRenderImage( SceneRenderState *state )
|
|||
|
||||
ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>();
|
||||
ri->renderDelegate.bind( this, &ScatterSky::_renderMoon );
|
||||
ri->type = RenderPassManager::RIT_Sky;
|
||||
ri->type = RenderPassManager::RIT_Sky;
|
||||
// Render after sky objects and before CloudLayer!
|
||||
ri->defaultKey = 5;
|
||||
ri->defaultKey2 = 0;
|
||||
|
|
@ -663,8 +690,12 @@ bool ScatterSky::_initShader()
|
|||
Con::warnf( "ScatterSky::_initShader - failed to locate shader ScatterSkyShaderData!" );
|
||||
return false;
|
||||
}
|
||||
Vector<GFXShaderMacro> macros;
|
||||
if ( mColorizeAmt )
|
||||
macros.push_back( GFXShaderMacro( "USE_COLORIZE" ) );
|
||||
|
||||
mShader = shaderData->getShader( macros );
|
||||
|
||||
mShader = shaderData->getShader();
|
||||
if ( !mShader )
|
||||
return false;
|
||||
|
||||
|
|
@ -677,20 +708,20 @@ bool ScatterSky::_initShader()
|
|||
mStateBlock = GFX->createStateBlock( data->getState() );
|
||||
}
|
||||
|
||||
if ( !mStateBlock )
|
||||
if ( !mStateBlock )
|
||||
return false;
|
||||
|
||||
mShaderConsts = mShader->allocConstBuffer();
|
||||
mModelViewProjSC = mShader->getShaderConstHandle( "$modelView" );
|
||||
|
||||
// Camera height, cam height squared, scale and scale over depth.
|
||||
mMiscSC = mShader->getShaderConstHandle( "$misc" );
|
||||
mMiscSC = mShader->getShaderConstHandle( "$misc" );
|
||||
|
||||
// Inner and out radius, and inner and outer radius squared.
|
||||
mSphereRadiiSC = mShader->getShaderConstHandle( "$sphereRadii" );
|
||||
mSphereRadiiSC = mShader->getShaderConstHandle( "$sphereRadii" );
|
||||
|
||||
// Rayleigh sun brightness, mie sun brightness and 4 * PI * coefficients.
|
||||
mScatteringCoefficientsSC = mShader->getShaderConstHandle( "$scatteringCoeffs" );
|
||||
mScatteringCoefficientsSC = mShader->getShaderConstHandle( "$scatteringCoeffs" );
|
||||
mCamPosSC = mShader->getShaderConstHandle( "$camPos" );
|
||||
mLightDirSC = mShader->getShaderConstHandle( "$lightDir" );
|
||||
mSunDirSC = mShader->getShaderConstHandle( "$sunDir" );
|
||||
|
|
@ -698,6 +729,7 @@ bool ScatterSky::_initShader()
|
|||
mInverseWavelengthSC = mShader->getShaderConstHandle( "$invWaveLength" );
|
||||
mNightInterpolantAndExposureSC = mShader->getShaderConstHandle( "$nightInterpAndExposure" );
|
||||
mUseCubemapSC = mShader->getShaderConstHandle( "$useCubemap" );
|
||||
mColorizeSC = mShader->getShaderConstHandle( "$colorize" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -713,9 +745,10 @@ void ScatterSky::_initVBIB()
|
|||
Point3F vertScale( 16.0f, 16.0f, 4.0f );
|
||||
|
||||
F32 zOffset = -( mCos( mSqrt( 1.0f ) ) + 0.01f );
|
||||
|
||||
mVB.set( GFX, mVertCount, GFXBufferTypeStatic );
|
||||
ScatterSkyVertex *pVert = mVB.lock();
|
||||
|
||||
mVB.set( GFX, mVertCount, GFXBufferTypeStatic );
|
||||
ScatterSkyVertex *pVert = mVB.lock();
|
||||
if(!pVert) return;
|
||||
|
||||
for ( U32 y = 0; y < vertStride; y++ )
|
||||
{
|
||||
|
|
@ -741,12 +774,12 @@ void ScatterSky::_initVBIB()
|
|||
|
||||
mVB.unlock();
|
||||
|
||||
// Primitive Buffer...
|
||||
// Primitive Buffer...
|
||||
mPrimBuffer.set( GFX, mPrimCount * 3, mPrimCount, GFXBufferTypeStatic );
|
||||
|
||||
U16 *pIdx = NULL;
|
||||
mPrimBuffer.lock(&pIdx);
|
||||
U32 curIdx = 0;
|
||||
U16 *pIdx = NULL;
|
||||
mPrimBuffer.lock(&pIdx);
|
||||
U32 curIdx = 0;
|
||||
|
||||
for ( U32 y = 0; y < strideMinusOne; y++ )
|
||||
{
|
||||
|
|
@ -770,7 +803,7 @@ void ScatterSky::_initVBIB()
|
|||
}
|
||||
}
|
||||
|
||||
mPrimBuffer.unlock();
|
||||
mPrimBuffer.unlock();
|
||||
}
|
||||
|
||||
void ScatterSky::_initMoon()
|
||||
|
|
@ -781,8 +814,8 @@ void ScatterSky::_initMoon()
|
|||
if ( mMoonMatInst )
|
||||
SAFE_DELETE( mMoonMatInst );
|
||||
|
||||
if ( mMoonMatName.isNotEmpty() )
|
||||
mMoonMatInst = MATMGR->createMatInstance( mMoonMatName, MATMGR->getDefaultFeatures(), getGFXVertexFormat<GFXVertexPCT>() );
|
||||
if ( mMoonMatName.isNotEmpty() )
|
||||
mMoonMatInst = MATMGR->createMatInstance( mMoonMatName, MATMGR->getDefaultFeatures(), getGFXVertexFormat<GFXVertexPCT>() );
|
||||
}
|
||||
|
||||
void ScatterSky::_initCurves()
|
||||
|
|
@ -792,70 +825,79 @@ void ScatterSky::_initCurves()
|
|||
|
||||
// Takes time of day (0-2) and returns
|
||||
// the night interpolant (0-1) day/night factor.
|
||||
// moonlight = 0, sunlight > 0
|
||||
mCurves[0].clear();
|
||||
mCurves[0].addPoint( 0.0f, 0.5f );
|
||||
mCurves[0].addPoint( 0.1f, 1.0f );
|
||||
mCurves[0].addPoint( 0.9f, 1.0f );
|
||||
mCurves[0].addPoint( 1.0f, 0.5f );
|
||||
mCurves[0].addPoint( 1.1f, 0.0f );
|
||||
mCurves[0].addPoint( 1.9f, 0.0f );
|
||||
mCurves[0].addPoint( 2.0f, 0.5f );
|
||||
//mCurves[0].addPoint( 0.0f, 0.25f );
|
||||
//mCurves[0].addPoint( 0.05f, 0.5f );
|
||||
//mCurves[0].addPoint( 0.1f, 1.0f );
|
||||
//mCurves[0].addPoint( 0.6f, 1.0f );
|
||||
//mCurves[0].addPoint( 0.98f, 0.895f );
|
||||
//mCurves[0].addPoint( 1.0f, 0.15f );
|
||||
//mCurves[0].addPoint( 1.15f, 0.0f );
|
||||
//mCurves[0].addPoint( 1.9f, 0.0f );
|
||||
//mCurves[0].addPoint( 2.0f, 0.15f );
|
||||
mCurves[0].addPoint( 0.0f, 0.5f );// Sunrise
|
||||
mCurves[0].addPoint( 0.025f, 1.0f );//
|
||||
mCurves[0].addPoint( 0.975f, 1.0f );//
|
||||
mCurves[0].addPoint( 1.0f, 0.5f );//Sunset
|
||||
mCurves[0].addPoint( 1.02f, 0.0f );//Sunlight ends
|
||||
mCurves[0].addPoint( 1.98f, 0.0f );//Sunlight begins
|
||||
mCurves[0].addPoint( 2.0f, 0.5f );// Sunrise
|
||||
|
||||
|
||||
// Takes time of day (0-2) and returns
|
||||
// the moon light brightness.
|
||||
// Takes time of day (0-2) and returns mieScattering factor
|
||||
// Regulates the size of the sun's disk
|
||||
mCurves[1].clear();
|
||||
mCurves[1].addPoint( 0.0f, 0.0f );
|
||||
mCurves[1].addPoint( 1.0f, 0.0f );
|
||||
mCurves[1].addPoint( 1.1f, 0.0f );
|
||||
mCurves[1].addPoint( 1.2f, 0.5f );
|
||||
mCurves[1].addPoint( 1.3f, 1.0f );
|
||||
mCurves[1].addPoint( 1.8f, 0.5f );
|
||||
mCurves[1].addPoint( 1.9f, 0.0f );
|
||||
mCurves[1].addPoint( 2.0f, 0.0f );
|
||||
mCurves[1].addPoint( 0.0f, 0.0006f );
|
||||
mCurves[1].addPoint( 0.01f, 0.00035f );
|
||||
mCurves[1].addPoint( 0.03f, 0.00023f );
|
||||
mCurves[1].addPoint( 0.1f, 0.00022f );
|
||||
mCurves[1].addPoint( 0.2f, 0.00043f );
|
||||
mCurves[1].addPoint( 0.3f, 0.00062f );
|
||||
mCurves[1].addPoint( 0.4f, 0.0008f );
|
||||
mCurves[1].addPoint( 0.5f, 0.00086f );// High noon
|
||||
mCurves[1].addPoint( 0.6f, 0.0008f );
|
||||
mCurves[1].addPoint( 0.7f, 0.00062f );
|
||||
mCurves[1].addPoint( 0.8f, 0.00043f );
|
||||
mCurves[1].addPoint( 0.9f, 0.00022f );
|
||||
mCurves[1].addPoint( 0.97f, 0.00023f );
|
||||
mCurves[1].addPoint( 0.99f, 0.00035f );
|
||||
mCurves[1].addPoint( 1.0f, 0.0006f );
|
||||
mCurves[1].addPoint( 2.0f, 0.0006f );
|
||||
|
||||
// Takes time of day and returns brightness
|
||||
// Controls sunlight and moonlight brightness
|
||||
mCurves[2].clear();
|
||||
mCurves[2].addPoint( 0.0f, 0.4f );
|
||||
mCurves[2].addPoint( 0.25f, 1.0f );
|
||||
mCurves[2].addPoint( 0.5f, 1.0f );
|
||||
mCurves[2].addPoint( 0.75f, 0.9f );
|
||||
mCurves[2].addPoint( 1.0f, 0.3f );
|
||||
mCurves[2].addPoint( 1.02877f, 0.0f );
|
||||
mCurves[2].addPoint( 1.05f, 0.0f );
|
||||
mCurves[2].addPoint( 1.15f, 0.0f );
|
||||
mCurves[2].addPoint( 1.2f, 0.0f );
|
||||
mCurves[2].addPoint( 1.3f, 0.3f );
|
||||
mCurves[2].addPoint( 1.85f, 0.4f );
|
||||
mCurves[2].addPoint( 1.9f, 0.0f );
|
||||
mCurves[2].addPoint( 2.0f, 0.0f );
|
||||
mCurves[2].addPoint( 0.0f, 0.2f );// Sunrise
|
||||
mCurves[2].addPoint( 0.1f, 1.0f );
|
||||
mCurves[2].addPoint( 0.9f, 1.0f );// Sunset
|
||||
mCurves[2].addPoint( 1.008f, 0.0f );//Adjust end of sun's reflection
|
||||
mCurves[2].addPoint( 1.02001f, 0.0f );
|
||||
mCurves[2].addPoint( 1.05f, 0.5f );// Turn brightness up for moonlight
|
||||
mCurves[2].addPoint( 1.93f, 0.5f );
|
||||
mCurves[2].addPoint( 1.97999f, 0.0f );// No brightness when sunlight starts
|
||||
mCurves[2].addPoint( 1.992f, 0.0f );//Adjust start of sun's reflection
|
||||
mCurves[2].addPoint( 2.0f, 0.2f ); // Sunrise
|
||||
|
||||
// Interpolation of day/night color sets
|
||||
// 0/1 ambient/nightcolor
|
||||
// 0 = day colors only anytime
|
||||
// 1 = night colors only anytime
|
||||
// between 0 and 1 renders both color sets anytime
|
||||
|
||||
mCurves[3].clear();
|
||||
mCurves[3].addPoint( 0.0f, 0.01f );
|
||||
mCurves[3].addPoint( 0.05f, 0.0f );
|
||||
mCurves[3].addPoint( 0.0f, 0.8f );//Sunrise
|
||||
mCurves[3].addPoint( 0.1f, 0.0f );
|
||||
mCurves[3].addPoint( 0.6f, 0.0f );
|
||||
mCurves[3].addPoint( 0.98f, 0.75f );
|
||||
mCurves[3].addPoint( 1.0f, 1.0f );
|
||||
mCurves[3].addPoint( 1.02877f, 1.0f );
|
||||
mCurves[3].addPoint( 1.05f, 1.0f );
|
||||
mCurves[3].addPoint( 1.2f, 1.0f );
|
||||
mCurves[3].addPoint( 1.3f, 1.0f );
|
||||
mCurves[3].addPoint( 1.85f, 1.0f );
|
||||
mCurves[3].addPoint( 1.9f, 1.0f );
|
||||
mCurves[3].addPoint( 2.0f, 1.0f );
|
||||
}
|
||||
mCurves[3].addPoint( 0.99f, 0.0f );
|
||||
mCurves[3].addPoint( 1.0f, 0.8f );// Sunset
|
||||
mCurves[3].addPoint( 1.01999f, 1.0f );//
|
||||
mCurves[3].addPoint( 1.98001f, 1.0f );// Sunlight begins with full night colors
|
||||
mCurves[3].addPoint( 2.0f, 0.8f ); //Sunrise
|
||||
|
||||
// Takes time of day (0-2) and returns smoothing factor
|
||||
// Interpolates between mMoonTint color and mNightColor
|
||||
|
||||
mCurves[4].clear();
|
||||
mCurves[4].addPoint( 0.0f, 1.0f );
|
||||
mCurves[4].addPoint( 0.96f, 1.0f );
|
||||
mCurves[4].addPoint( 1.01999f, 0.5f );
|
||||
mCurves[4].addPoint( 1.02001f, 0.5f );
|
||||
mCurves[4].addPoint( 1.08f, 1.0f );
|
||||
mCurves[4].addPoint( 1.92f, 1.0f );
|
||||
mCurves[4].addPoint( 1.97999f, 0.5f );
|
||||
mCurves[4].addPoint( 1.98001f, 0.5f );
|
||||
mCurves[4].addPoint( 2.0f, 1.0f );
|
||||
}
|
||||
void ScatterSky::_updateTimeOfDay( TimeOfDay *timeOfDay, F32 time )
|
||||
{
|
||||
setElevation( timeOfDay->getElevationDegrees() );
|
||||
|
|
@ -869,9 +911,6 @@ void ScatterSky::_render( ObjectRenderInst *ri, SceneRenderState *state, BaseMat
|
|||
|
||||
GFXTransformSaver saver;
|
||||
|
||||
//mLightDir = -mLight->getDirection();
|
||||
//mLightDir.normalize();
|
||||
|
||||
if ( mVB.isNull() || mPrimBuffer.isNull() )
|
||||
_initVBIB();
|
||||
|
||||
|
|
@ -884,30 +923,22 @@ void ScatterSky::_render( ObjectRenderInst *ri, SceneRenderState *state, BaseMat
|
|||
Point4F scatteringCoeffs( mRayleighScattering * mSkyBrightness, mRayleighScattering4PI,
|
||||
mMieScattering * mSkyBrightness, mMieScattering4PI );
|
||||
|
||||
Point4F invWavelength( 1.0f / mWavelength4[0],
|
||||
1.0f / mWavelength4[1],
|
||||
Point4F invWavelength( 1.0f / mWavelength4[0],
|
||||
1.0f / mWavelength4[1],
|
||||
1.0f / mWavelength4[2], 1.0f );
|
||||
|
||||
Point3F camPos( 0, 0, smViewerHeight );
|
||||
Point4F miscParams( camPos.z, camPos.z * camPos.z, mScale, mScale / mRayleighScaleDepth );
|
||||
Point4F miscParams( camPos.z, camPos.z * camPos.z, mScale, mScale / mRayleighScaleDepth );
|
||||
|
||||
Frustum frust = state->getFrustum();
|
||||
Frustum frust = state->getCameraFrustum();
|
||||
frust.setFarDist( smEarthRadius + smAtmosphereRadius );
|
||||
MatrixF proj( true );
|
||||
frust.getProjectionMatrix( &proj );
|
||||
|
||||
//MatrixF camMat = state->getCameraTransform();
|
||||
//camMat.inverse();
|
||||
//MatrixF tmp( true );
|
||||
//tmp = camMat;
|
||||
//tmp.setPosition( Point3F( 0, 0, 0 ) );
|
||||
|
||||
//proj.mul( tmp );
|
||||
|
||||
Point3F camPos2 = state->getCameraPosition();
|
||||
MatrixF xfm(true);
|
||||
xfm.setPosition(camPos2);//-Point3F( 0, 0, 200000.0f));
|
||||
GFX->multWorld(xfm);
|
||||
GFX->multWorld(xfm);
|
||||
MatrixF xform(proj);//GFX->getProjectionMatrix());
|
||||
xform *= GFX->getViewMatrix();
|
||||
xform *= GFX->getWorldMatrix();
|
||||
|
|
@ -922,6 +953,7 @@ void ScatterSky::_render( ObjectRenderInst *ri, SceneRenderState *state, BaseMat
|
|||
mShaderConsts->setSafe( mNightColorSC, mNightColor );
|
||||
mShaderConsts->setSafe( mInverseWavelengthSC, invWavelength );
|
||||
mShaderConsts->setSafe( mNightInterpolantAndExposureSC, Point2F( mExposure, mNightInterpolant ) );
|
||||
mShaderConsts->setSafe( mColorizeSC, mColorize*mColorizeAmt );
|
||||
|
||||
if ( GFXDevice::getWireframe() )
|
||||
{
|
||||
|
|
@ -931,7 +963,7 @@ void ScatterSky::_render( ObjectRenderInst *ri, SceneRenderState *state, BaseMat
|
|||
}
|
||||
else
|
||||
GFX->setStateBlock( mStateBlock );
|
||||
|
||||
|
||||
if ( mUseNightCubemap && mNightCubemap )
|
||||
{
|
||||
mShaderConsts->setSafe( mUseCubemapSC, 1.0f );
|
||||
|
|
@ -939,11 +971,11 @@ void ScatterSky::_render( ObjectRenderInst *ri, SceneRenderState *state, BaseMat
|
|||
if ( !mNightCubemap->mCubemap )
|
||||
mNightCubemap->createMap();
|
||||
|
||||
GFX->setCubeTexture( 0, mNightCubemap->mCubemap );
|
||||
}
|
||||
GFX->setCubeTexture( 0, mNightCubemap->mCubemap );
|
||||
}
|
||||
else
|
||||
{
|
||||
GFX->setCubeTexture( 0, NULL );
|
||||
GFX->setCubeTexture( 0, NULL );
|
||||
mShaderConsts->setSafe( mUseCubemapSC, 0.0f );
|
||||
}
|
||||
|
||||
|
|
@ -979,7 +1011,7 @@ void ScatterSky::_debugRender( ObjectRenderInst *ri, SceneRenderState *state, Ba
|
|||
}
|
||||
|
||||
void ScatterSky::_renderMoon( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat )
|
||||
{
|
||||
{
|
||||
if ( !mMoonMatInst )
|
||||
return;
|
||||
|
||||
|
|
@ -994,13 +1026,13 @@ void ScatterSky::_renderMoon( ObjectRenderInst *ri, SceneRenderState *state, Bas
|
|||
F32 worldRadius = screenRadius * dist / state->getWorldToScreenScale().y;
|
||||
|
||||
// Calculate Billboard Radius (in world units) to be constant, independent of distance.
|
||||
// Takes into account distance, viewport size, and specified size in editor
|
||||
// Takes into account distance, viewport size, and specified size in editor
|
||||
|
||||
F32 BBRadius = worldRadius;
|
||||
|
||||
|
||||
mMatrixSet->restoreSceneViewProjection();
|
||||
|
||||
|
||||
|
||||
mMatrixSet->restoreSceneViewProjection();
|
||||
|
||||
if ( state->isReflectPass() )
|
||||
mMatrixSet->setProjection( state->getSceneManager()->getNonClipProjection() );
|
||||
|
||||
|
|
@ -1013,19 +1045,19 @@ void ScatterSky::_renderMoon( ObjectRenderInst *ri, SceneRenderState *state, Bas
|
|||
points[2] = Point3F( BBRadius, 0.0, BBRadius);
|
||||
points[3] = Point3F( BBRadius, 0.0, -BBRadius);
|
||||
|
||||
static const Point2F sCoords[4] =
|
||||
static const Point2F sCoords[4] =
|
||||
{
|
||||
Point2F( 0.0f, 0.0f ),
|
||||
Point2F( 0.0f, 1.0f ),
|
||||
Point2F( 0.0f, 1.0f ),
|
||||
Point2F( 1.0f, 1.0f ),
|
||||
Point2F( 1.0f, 0.0f )
|
||||
};
|
||||
|
||||
// Get info we need to adjust points
|
||||
const MatrixF &camView = state->getCameraTransform();
|
||||
const MatrixF &camView = state->getCameraTransform();
|
||||
|
||||
// Finalize points
|
||||
for(int i = 0; i < 4; i++)
|
||||
for(S32 i = 0; i < 4; i++)
|
||||
{
|
||||
// align with camera
|
||||
camView.mulV(points[i]);
|
||||
|
|
@ -1034,13 +1066,14 @@ void ScatterSky::_renderMoon( ObjectRenderInst *ri, SceneRenderState *state, Bas
|
|||
}
|
||||
|
||||
// Vertex color.
|
||||
ColorF moonVertColor( 1.0f, 1.0f, 1.0f, mNightInterpolant );
|
||||
ColorF moonVertColor( 1.0f, 1.0f, 1.0f, mNightInterpolant );
|
||||
|
||||
// Copy points to buffer.
|
||||
|
||||
GFXVertexBufferHandle< GFXVertexPCT > vb;
|
||||
vb.set( GFX, 4, GFXBufferTypeVolatile );
|
||||
GFXVertexPCT *pVert = vb.lock();
|
||||
if(!pVert) return;
|
||||
|
||||
for ( S32 i = 0; i < 4; i++ )
|
||||
{
|
||||
|
|
@ -1065,14 +1098,14 @@ void ScatterSky::_renderMoon( ObjectRenderInst *ri, SceneRenderState *state, Bas
|
|||
mMoonMatInst->setTransforms( *mMatrixSet, state );
|
||||
mMoonMatInst->setSceneInfo( state, sgData );
|
||||
|
||||
GFX->setVertexBuffer( vb );
|
||||
GFX->setVertexBuffer( vb );
|
||||
GFX->drawPrimitive( GFXTriangleFan, 0, 2 );
|
||||
}
|
||||
}
|
||||
|
||||
void ScatterSky::_generateSkyPoints()
|
||||
{
|
||||
U32 rings=60, segments=20;//rings=160, segments=20;
|
||||
U32 rings=60, segments=20;//rings=160, segments=20;
|
||||
|
||||
Point3F tmpPoint( 0, 0, 0 );
|
||||
|
||||
|
|
@ -1081,13 +1114,13 @@ void ScatterSky::_generateSkyPoints()
|
|||
F32 deltaSegAngle = ( 2.0f * M_PI_F / (F32)segments );
|
||||
|
||||
// Generate the group of rings for the sphere.
|
||||
for( int ring = 0; ring < 2; ring++ )
|
||||
for( S32 ring = 0; ring < 2; ring++ )
|
||||
{
|
||||
F32 r0 = mSin( ring * deltaRingAngle );
|
||||
F32 y0 = mCos( ring * deltaRingAngle );
|
||||
F32 y0 = mCos( ring * deltaRingAngle );
|
||||
|
||||
// Generate the group of segments for the current ring.
|
||||
for( int seg = 0; seg < segments + 1 ; seg++ )
|
||||
for( S32 seg = 0; seg < segments + 1 ; seg++ )
|
||||
{
|
||||
F32 x0 = r0 * sinf( seg * deltaSegAngle );
|
||||
F32 z0 = r0 * cosf( seg * deltaSegAngle );
|
||||
|
|
@ -1112,7 +1145,7 @@ void ScatterSky::_interpolateColors()
|
|||
mAmbientColor.set( 0, 0, 0, 0 );
|
||||
mSunColor.set( 0, 0, 0, 0 );
|
||||
|
||||
_getFogColor( &mFogColor );
|
||||
_getFogColor( &mFogColor );
|
||||
_getAmbientColor( &mAmbientColor );
|
||||
_getSunColor( &mSunColor );
|
||||
|
||||
|
|
@ -1120,7 +1153,15 @@ void ScatterSky::_interpolateColors()
|
|||
mSunColor *= mSunScale;
|
||||
mFogColor *= mFogScale;
|
||||
|
||||
mFogColor.interpolate( mFogColor, mNightFogColor, mCurves[3].getVal( mTimeOfDay ) );//mNightInterpolant );
|
||||
mMieScattering = (mCurves[1].getVal( mTimeOfDay) * mSunSize ); //Scale the size of the sun's disk
|
||||
|
||||
ColorF moonTemp = mMoonTint;
|
||||
ColorF nightTemp = mNightColor;
|
||||
|
||||
moonTemp.interpolate( mNightColor, mMoonTint, mCurves[4].getVal( mTimeOfDay ) );
|
||||
nightTemp.interpolate( mMoonTint, mNightColor, mCurves[4].getVal( mTimeOfDay ) );
|
||||
|
||||
mFogColor.interpolate( mFogColor, mNightFogColor, mCurves[3].getVal( mTimeOfDay ) );//mNightInterpolant );
|
||||
mFogColor.alpha = 1.0f;
|
||||
|
||||
mAmbientColor.interpolate( mAmbientColor, mNightColor, mCurves[3].getVal( mTimeOfDay ) );//mNightInterpolant );
|
||||
|
|
@ -1134,7 +1175,7 @@ void ScatterSky::_getSunColor( ColorF *outColor )
|
|||
U32 count = 0;
|
||||
ColorF tmpColor( 0, 0, 0 );
|
||||
VectorF tmpVec( 0, 0, 0 );
|
||||
|
||||
|
||||
tmpVec = mLightDir;
|
||||
tmpVec.x *= smEarthRadius + smAtmosphereRadius;
|
||||
tmpVec.y *= smEarthRadius + smAtmosphereRadius;
|
||||
|
|
@ -1148,7 +1189,7 @@ void ScatterSky::_getSunColor( ColorF *outColor )
|
|||
tmpVec.x += (smEarthRadius * 0.5f) + (smAtmosphereRadius * 0.5f);
|
||||
count++;
|
||||
}
|
||||
|
||||
|
||||
if ( count > 0 )
|
||||
(*outColor) /= count;
|
||||
}
|
||||
|
|
@ -1175,11 +1216,6 @@ void ScatterSky::_getAmbientColor( ColorF *outColor )
|
|||
|
||||
if ( count > 0 )
|
||||
(*outColor) /= count;
|
||||
//Point3F pColor( outColor->red, outColor->green, outColor->blue );
|
||||
//F32 len = pColor.len();
|
||||
//if ( len > 0 )
|
||||
// (*outColor) /= len;
|
||||
|
||||
mMieScattering = oldMieScattering;
|
||||
}
|
||||
|
||||
|
|
@ -1232,16 +1268,8 @@ void ScatterSky::_getFogColor( ColorF *outColor )
|
|||
|
||||
F32 ScatterSky::_vernierScale( F32 fCos )
|
||||
{
|
||||
/*
|
||||
F32 x5 = x * 5.25;
|
||||
F32 x5p6 = (-6.80 + x5);
|
||||
F32 xnew = (3.83 + x * x5p6);
|
||||
F32 xfinal = (0.459 + x * xnew);
|
||||
F32 xfinal2 = -0.00287 + x * xfinal;
|
||||
F32 outx = mExp( xfinal2 );
|
||||
return 0.25 * outx;*/
|
||||
F32 x = 1.0 - fCos;
|
||||
return 0.25f * exp( -0.00287f + x * (0.459f + x * (3.83f + x * ((-6.80f + (x * 5.25f))))) );
|
||||
return 0.25f * exp( -0.00287f + x * (0.459f + x * (3.83f + x * ((-6.80f + (x * 5.25f))))) );
|
||||
}
|
||||
|
||||
F32 ScatterSky::_getMiePhase( F32 fCos, F32 fCos2, F32 g, F32 g2)
|
||||
|
|
@ -1262,13 +1290,13 @@ void ScatterSky::_getColor( const Point3F &pos, ColorF *outColor )
|
|||
F32 rayleighBrightness = mRayleighScattering * mSkyBrightness;
|
||||
F32 mieBrightness = mMieScattering * mSkyBrightness;
|
||||
|
||||
Point3F invWaveLength( 1.0f / mWavelength4[0],
|
||||
1.0f / mWavelength4[1],
|
||||
Point3F invWaveLength( 1.0f / mWavelength4[0],
|
||||
1.0f / mWavelength4[1],
|
||||
1.0f / mWavelength4[2] );
|
||||
|
||||
Point3F v3Pos = pos / 6378000.0f;
|
||||
v3Pos.z += mSphereInnerRadius;
|
||||
|
||||
|
||||
Point3F newCamPos( 0, 0, smViewerHeight );
|
||||
|
||||
VectorF v3Ray = v3Pos - newCamPos;
|
||||
|
|
@ -1297,16 +1325,16 @@ void ScatterSky::_getColor( const Point3F &pos, ColorF *outColor )
|
|||
|
||||
F32 fScatter = (fStartOffset + fDepth * ( _vernierScale( fLightAngle ) - _vernierScale( fCameraAngle ) ));
|
||||
Point3F v3Attenuate( 0, 0, 0 );
|
||||
|
||||
|
||||
F32 tmp = mExp( -fScatter * (invWaveLength[0] * mRayleighScattering4PI + mMieScattering4PI) );
|
||||
v3Attenuate.x = tmp;
|
||||
|
||||
|
||||
tmp = mExp( -fScatter * (invWaveLength[1] * mRayleighScattering4PI + mMieScattering4PI) );
|
||||
v3Attenuate.y = tmp;
|
||||
|
||||
tmp = mExp( -fScatter * (invWaveLength[2] * mRayleighScattering4PI + mMieScattering4PI) );
|
||||
v3Attenuate.z = tmp;
|
||||
|
||||
|
||||
v3FrontColor += v3Attenuate * (fDepth * fScaledLength);
|
||||
v3SamplePoint += v3SampleRay;
|
||||
}
|
||||
|
|
@ -1322,18 +1350,10 @@ void ScatterSky::_getColor( const Point3F &pos, ColorF *outColor )
|
|||
F32 g = -0.991f;
|
||||
F32 g2 = g * g;
|
||||
F32 miePhase = _getMiePhase( fCos, fCos2, g, g2 );
|
||||
//F32 rayleighPhase = _getRayleighPhase( fCos2 );
|
||||
|
||||
Point3F color = rayleighColor + (miePhase * mieColor);
|
||||
ColorF tmp( color.x, color.y, color.z, color.y );
|
||||
|
||||
//if ( !tmp.isValidColor() )
|
||||
//{
|
||||
// F32 len = color.len();
|
||||
// if ( len > 0 )
|
||||
// color /= len;
|
||||
//}
|
||||
|
||||
Point3F expColor( 0, 0, 0 );
|
||||
expColor.x = 1.0f - exp(-mExposure * color.x);
|
||||
expColor.y = 1.0f - exp(-mExposure * color.y);
|
||||
|
|
@ -1400,7 +1420,7 @@ void ScatterSky::_onUnselected()
|
|||
// ConsoleMethods
|
||||
|
||||
DefineEngineMethod( ScatterSky, applyChanges, void, (),,
|
||||
"Apply a full network update of all fields to all clients."
|
||||
"Apply a full network update of all fields to all clients."
|
||||
)
|
||||
{
|
||||
object->inspectPostApply();
|
||||
|
|
|
|||
|
|
@ -60,10 +60,9 @@ class MatrixSet;
|
|||
|
||||
GFXDeclareVertexFormat( ScatterSkyVertex )
|
||||
{
|
||||
// .xyz = coords
|
||||
Point3F point;
|
||||
VectorF normal;
|
||||
ColorF color;
|
||||
GFXVertexColor color;
|
||||
};
|
||||
|
||||
class ScatterSky : public SceneObject, public ISceneLight
|
||||
|
|
@ -134,7 +133,7 @@ protected:
|
|||
void _getSunColor( ColorF *outColor );
|
||||
void _interpolateColors();
|
||||
|
||||
void _conformLights();
|
||||
void _conformLights();
|
||||
|
||||
void _updateTimeOfDay( TimeOfDay *timeofDay, F32 time );
|
||||
|
||||
|
|
@ -152,7 +151,7 @@ protected:
|
|||
static const F32 smAtmosphereRadius;
|
||||
static const F32 smViewerHeight;
|
||||
|
||||
#define CURVE_COUNT 4
|
||||
#define CURVE_COUNT 5
|
||||
|
||||
FloatCurve mCurves[CURVE_COUNT];
|
||||
|
||||
|
|
@ -161,7 +160,7 @@ protected:
|
|||
|
||||
F32 mRayleighScattering;
|
||||
F32 mRayleighScattering4PI;
|
||||
|
||||
F32 mSunSize;
|
||||
F32 mMieScattering;
|
||||
F32 mMieScattering4PI;
|
||||
|
||||
|
|
@ -200,7 +199,7 @@ protected:
|
|||
ColorF mSunColor; ///< Not a field
|
||||
ColorF mFogColor; ///< Not a field
|
||||
|
||||
ColorF mAmbientScale;
|
||||
ColorF mAmbientScale;
|
||||
ColorF mSunScale;
|
||||
ColorF mFogScale;
|
||||
|
||||
|
|
@ -212,15 +211,15 @@ protected:
|
|||
LightFlareData *mFlareData;
|
||||
LightFlareState mFlareState;
|
||||
F32 mFlareScale;
|
||||
|
||||
bool mMoonEnabled;
|
||||
String mMoonMatName;
|
||||
|
||||
bool mMoonEnabled;
|
||||
String mMoonMatName;
|
||||
BaseMatInstance *mMoonMatInst;
|
||||
F32 mMoonScale;
|
||||
ColorF mMoonTint;
|
||||
ColorF mMoonTint;
|
||||
VectorF mMoonLightDir;
|
||||
CubemapData *mNightCubemap;
|
||||
String mNightCubemapName;
|
||||
String mNightCubemapName;
|
||||
bool mUseNightCubemap;
|
||||
MatrixSet *mMatrixSet;
|
||||
|
||||
|
|
@ -246,6 +245,10 @@ protected:
|
|||
GFXShaderConstHandle *mInverseWavelengthSC;
|
||||
GFXShaderConstHandle *mNightInterpolantAndExposureSC;
|
||||
GFXShaderConstHandle *mUseCubemapSC;
|
||||
F32 mColorizeAmt;
|
||||
ColorF mColorize;
|
||||
GFXShaderConstHandle *mColorizeSC;
|
||||
|
||||
};
|
||||
|
||||
#endif // _SCATTERSKY_H_
|
||||
|
|
|
|||
|
|
@ -400,6 +400,11 @@ void SkyBox::_initRender()
|
|||
}
|
||||
|
||||
GFXVertexPNTT *vertPtr = mVB.lock();
|
||||
if (!vertPtr)
|
||||
{
|
||||
delete[] tmpVerts;
|
||||
return;
|
||||
}
|
||||
|
||||
dMemcpy( vertPtr, tmpVerts, sizeof ( GFXVertexPNTT ) * vertCount );
|
||||
|
||||
|
|
@ -412,6 +417,7 @@ void SkyBox::_initRender()
|
|||
mFogBandVB.set( GFX, 48, GFXBufferTypeStatic );
|
||||
|
||||
GFXVertexPC *bandVertPtr = mFogBandVB.lock();
|
||||
if(!bandVertPtr) return;
|
||||
|
||||
// Grab the fog color.
|
||||
ColorI fogColor( mLastFogColor.red * 255, mLastFogColor.green * 255, mLastFogColor.blue * 255 );
|
||||
|
|
|
|||
|
|
@ -470,7 +470,7 @@ void Sun::_renderCorona( ObjectRenderInst *ri, SceneRenderState *state, BaseMatI
|
|||
const MatrixF &camView = state->getCameraTransform();
|
||||
|
||||
// Finalize points
|
||||
for(int i = 0; i < 4; i++)
|
||||
for(S32 i = 0; i < 4; i++)
|
||||
{
|
||||
// align with camera
|
||||
camView.mulV(points[i]);
|
||||
|
|
@ -487,6 +487,7 @@ void Sun::_renderCorona( ObjectRenderInst *ri, SceneRenderState *state, BaseMatI
|
|||
GFXVertexBufferHandle< GFXVertexPCT > vb;
|
||||
vb.set( GFX, 4, GFXBufferTypeVolatile );
|
||||
GFXVertexPCT *pVert = vb.lock();
|
||||
if(!pVert) return;
|
||||
|
||||
for ( S32 i = 0; i < 4; i++ )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ void WaterBlock::setupVertexBlock( U32 width, U32 height, U32 rowOffset )
|
|||
// to a ray cast could detected.
|
||||
if(gClientContainer.castRay(start, end,
|
||||
//StaticObjectType |
|
||||
InteriorObjectType |
|
||||
//InteriorObjectType |
|
||||
//ShapeBaseObjectType |
|
||||
//StaticShapeObjectType |
|
||||
//ItemObjectType |
|
||||
|
|
@ -280,7 +280,7 @@ void WaterBlock::setupVertexBlock( U32 width, U32 height, U32 rowOffset )
|
|||
|
||||
if(gClientContainer.castRay(worldPoint, worldPoint + sunVector * 9000.f,
|
||||
//StaticObjectType |
|
||||
InteriorObjectType |
|
||||
//InteriorObjectType |
|
||||
//ShapeBaseObjectType |
|
||||
//StaticShapeObjectType |
|
||||
//ItemObjectType |
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include "T3D/gameBase/gameConnection.h"
|
||||
#include "T3D/shapeBase.h"
|
||||
#include "gfx/gfxOcclusionQuery.h"
|
||||
#include "gfx/gfxTextureManager.h"
|
||||
#include "gfx/sim/cubemapData.h"
|
||||
#include "math/util/matrixSet.h"
|
||||
#include "sfx/sfxAmbience.h"
|
||||
|
|
@ -90,6 +91,7 @@ void WaterMatParams::clear()
|
|||
mSpecularParamsSC = NULL;
|
||||
mDepthGradMaxSC = NULL;
|
||||
mReflectivitySC = NULL;
|
||||
mDepthGradSamplerSC = NULL;
|
||||
}
|
||||
|
||||
void WaterMatParams::init( BaseMatInstance* matInst )
|
||||
|
|
@ -131,6 +133,7 @@ void WaterMatParams::init( BaseMatInstance* matInst )
|
|||
mSpecularParamsSC = matInst->getMaterialParameterHandle( "$specularParams" );
|
||||
mDepthGradMaxSC = matInst->getMaterialParameterHandle( "$depthGradMax" );
|
||||
mReflectivitySC = matInst->getMaterialParameterHandle( "$reflectivity" );
|
||||
mDepthGradSamplerSC = matInst->getMaterialParameterHandle( "$depthGradMap" );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -731,6 +734,11 @@ void WaterObject::renderObject( ObjectRenderInst *ri, SceneRenderState *state, B
|
|||
|
||||
bool doQuery = ( !mPlaneReflector.mQueryPending && query && mReflectorDesc.useOcclusionQuery );
|
||||
|
||||
// We need to call this for avoid a DX9 or Nvidia bug.
|
||||
// At some resollutions read from render target,
|
||||
// break current occlusion query.
|
||||
REFLECTMGR->getRefractTex();
|
||||
|
||||
if ( doQuery )
|
||||
query->begin();
|
||||
|
||||
|
|
@ -746,22 +754,20 @@ void WaterObject::renderObject( ObjectRenderInst *ri, SceneRenderState *state, B
|
|||
|
||||
void WaterObject::setCustomTextures( S32 matIdx, U32 pass, const WaterMatParams ¶mHandles )
|
||||
{
|
||||
// TODO: Retrieve sampler numbers from parameter handles, see r22631.
|
||||
|
||||
// Always use the ripple texture.
|
||||
GFX->setTexture( 0, mRippleTex );
|
||||
GFX->setTexture( paramHandles.mRippleSamplerSC->getSamplerRegister(pass), mRippleTex );
|
||||
|
||||
// Only above-water in advanced-lighting uses the foam texture.
|
||||
if ( matIdx == WaterMat )
|
||||
{
|
||||
GFX->setTexture( 5, mFoamTex );
|
||||
GFX->setTexture( 6, mDepthGradientTex );
|
||||
GFX->setTexture( paramHandles.mFoamSamplerSC->getSamplerRegister(pass), mFoamTex );
|
||||
GFX->setTexture( paramHandles.mDepthGradSamplerSC->getSamplerRegister(pass), mDepthGradientTex );
|
||||
}
|
||||
|
||||
if ( ( matIdx == WaterMat || matIdx == BasicWaterMat ) && mCubemap )
|
||||
GFX->setCubeTexture( 4, mCubemap->mCubemap );
|
||||
else
|
||||
GFX->setCubeTexture( 4, NULL );
|
||||
GFX->setCubeTexture( paramHandles.mCubemapSamplerSC->getSamplerRegister(pass), mCubemap->mCubemap );
|
||||
else if(paramHandles.mCubemapSamplerSC->getSamplerRegister(pass) != -1 )
|
||||
GFX->setCubeTexture( paramHandles.mCubemapSamplerSC->getSamplerRegister(pass), NULL );
|
||||
}
|
||||
|
||||
void WaterObject::drawUnderwaterFilter( SceneRenderState *state )
|
||||
|
|
@ -1152,12 +1158,12 @@ void WaterObject::initTextures()
|
|||
if ( mRippleTexName.isNotEmpty() )
|
||||
mRippleTex.set( mRippleTexName, &GFXDefaultStaticDiffuseProfile, "WaterObject::mRippleTex" );
|
||||
if ( mRippleTex.isNull() )
|
||||
mRippleTex.set( "core/art/warnmat", &GFXDefaultStaticDiffuseProfile, "WaterObject::mRippleTex" );
|
||||
mRippleTex.set( GFXTextureManager::getWarningTexturePath(), &GFXDefaultStaticDiffuseProfile, "WaterObject::mRippleTex" );
|
||||
|
||||
if ( mDepthGradientTexName.isNotEmpty() )
|
||||
mDepthGradientTex.set( mDepthGradientTexName, &GFXDefaultStaticDiffuseProfile, "WaterObject::mDepthGradientTex" );
|
||||
if ( mDepthGradientTex.isNull() )
|
||||
mDepthGradientTex.set( "core/art/warnmat", &GFXDefaultStaticDiffuseProfile, "WaterObject::mDepthGradientTex" );
|
||||
mDepthGradientTex.set( GFXTextureManager::getWarningTexturePath(), &GFXDefaultStaticDiffuseProfile, "WaterObject::mDepthGradientTex" );
|
||||
|
||||
if ( mNamedDepthGradTex.isRegistered() )
|
||||
mNamedDepthGradTex.setTexture( mDepthGradientTex );
|
||||
|
|
@ -1165,7 +1171,7 @@ void WaterObject::initTextures()
|
|||
if ( mFoamTexName.isNotEmpty() )
|
||||
mFoamTex.set( mFoamTexName, &GFXDefaultStaticDiffuseProfile, "WaterObject::mFoamTex" );
|
||||
if ( mFoamTex.isNull() )
|
||||
mFoamTex.set( "core/art/warnmat", &GFXDefaultStaticDiffuseProfile, "WaterObject::mFoamTex" );
|
||||
mFoamTex.set( GFXTextureManager::getWarningTexturePath(), &GFXDefaultStaticDiffuseProfile, "WaterObject::mFoamTex" );
|
||||
|
||||
if ( mCubemapName.isNotEmpty() )
|
||||
Sim::findObject( mCubemapName, mCubemap );
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ struct WaterMatParams
|
|||
MaterialParameterHandle* mSpecularParamsSC;
|
||||
MaterialParameterHandle* mDepthGradMaxSC;
|
||||
MaterialParameterHandle* mReflectivitySC;
|
||||
MaterialParameterHandle* mDepthGradSamplerSC;
|
||||
|
||||
void clear();
|
||||
void init(BaseMatInstance* matInst);
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ void WaterPlane::unpackUpdate(NetConnection* con, BitStream* stream)
|
|||
|
||||
if( stream->readFlag() ) // UpdateMask
|
||||
{
|
||||
float posZ;
|
||||
F32 posZ;
|
||||
stream->read( &posZ );
|
||||
Point3F newPos = getPosition();
|
||||
newPos.z = posZ;
|
||||
|
|
@ -173,7 +173,7 @@ void WaterPlane::unpackUpdate(NetConnection* con, BitStream* stream)
|
|||
|
||||
void WaterPlane::setupVBIB( SceneRenderState *state )
|
||||
{
|
||||
const Frustum &frustum = state->getFrustum();
|
||||
const Frustum &frustum = state->getCullingFrustum();
|
||||
|
||||
// Water base-color, assigned as color for all verts.
|
||||
const GFXVertexColor vertCol(mWaterFogData.color);
|
||||
|
|
@ -708,7 +708,7 @@ void WaterPlane::prepRenderImage( SceneRenderState *state )
|
|||
|
||||
mMatrixSet->setSceneView(GFX->getWorldMatrix());
|
||||
|
||||
const Frustum &frustum = state->getFrustum();
|
||||
const Frustum &frustum = state->getCameraFrustum();
|
||||
|
||||
if ( mPrimBuff.isNull() ||
|
||||
mGenerateVB ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue