Merge pull request #1328 from GarageGames/release-3.7

Release 3.7
This commit is contained in:
Daniel Buckmaster 2015-06-24 19:00:57 +10:00
commit 39f0e269d6
48 changed files with 317 additions and 102 deletions

View file

@ -1024,8 +1024,10 @@ bool GameConnection::readDemoStartBlock(BitStream *stream)
void GameConnection::demoPlaybackComplete()
{
static ConsoleValueRef demoPlaybackArgv[1] = { "demoPlaybackComplete" };
Sim::postCurrentEvent(Sim::getRootGroup(), new SimConsoleEvent(1, demoPlaybackArgv, false));
static const char* demoPlaybackArgv[1] = { "demoPlaybackComplete" };
static StringStackConsoleWrapper demoPlaybackCmd(1, demoPlaybackArgv);
Sim::postCurrentEvent(Sim::getRootGroup(), new SimConsoleEvent(demoPlaybackCmd.argc, demoPlaybackCmd.argv, false));
Parent::demoPlaybackComplete();
}

View file

@ -76,9 +76,10 @@ extern "C" {
if (!entry)
return "";
ConsoleValueRef argv[] = {"consoleExportXML"};
static const char* exportArgv[1] = { "consoleExportXML" };
static StringStackConsoleWrapper exportCmd(1, exportArgv);
return entry->cb.mStringCallbackFunc(NULL, 1, argv);
return entry->cb.mStringCallbackFunc(NULL, exportCmd.argc, exportCmd.argv);
}
MarshalNativeEntry* script_get_namespace_entry(const char* nameSpace, const char* name)

View file

@ -1534,9 +1534,16 @@ StringTableEntry getModNameFromPath(const char *path)
void postConsoleInput( RawData data )
{
// Schedule this to happen at the next time event.
ConsoleValue values[2];
ConsoleValueRef argv[2];
argv[0] = "eval";
argv[1] = ( const char* ) data.data;
values[0].init();
values[0].setStringValue("eval");
values[1].init();
values[1].setStringValue((const char*)data.data);
argv[0].value = &values[0];
argv[1].value = &values[1];
Sim::postCurrentEvent(Sim::getRootGroup(), new SimConsoleEvent(2, argv, false));
}
@ -1610,36 +1617,6 @@ ConsoleValueRef::ConsoleValueRef(const ConsoleValueRef &ref)
value = ref.value;
}
ConsoleValueRef::ConsoleValueRef(const char *newValue) : value(NULL)
{
*this = newValue;
}
ConsoleValueRef::ConsoleValueRef(const String &newValue) : value(NULL)
{
*this = (const char*)(newValue.utf8());
}
ConsoleValueRef::ConsoleValueRef(U32 newValue) : value(NULL)
{
*this = newValue;
}
ConsoleValueRef::ConsoleValueRef(S32 newValue) : value(NULL)
{
*this = newValue;
}
ConsoleValueRef::ConsoleValueRef(F32 newValue) : value(NULL)
{
*this = newValue;
}
ConsoleValueRef::ConsoleValueRef(F64 newValue) : value(NULL)
{
*this = newValue;
}
ConsoleValueRef& ConsoleValueRef::operator=(const ConsoleValueRef &newValue)
{
value = newValue.value;

View file

@ -215,12 +215,6 @@ public:
~ConsoleValueRef() { ; }
ConsoleValueRef(const ConsoleValueRef &ref);
ConsoleValueRef(const char *value);
ConsoleValueRef(const String &ref);
ConsoleValueRef(U32 value);
ConsoleValueRef(S32 value);
ConsoleValueRef(F32 value);
ConsoleValueRef(F64 value);
static ConsoleValueRef fromValue(ConsoleValue *value) { ConsoleValueRef ref; ref.value = value; return ref; }

View file

@ -129,7 +129,7 @@ ConsoleValueRef SimConsoleThreadExecCallback::waitForResult()
return retVal;
}
return (const char*)NULL;
return ConsoleValueRef();
}
//-----------------------------------------------------------------------------

View file

@ -97,7 +97,6 @@ void ForestEditorCtrl::onSleep()
bool ForestEditorCtrl::updateActiveForest( bool createNew )
{
mForest = dynamic_cast<Forest*>( Sim::findObject( "theForest" ) );
Con::executef( this, "onActiveForestUpdated", mForest ? mForest->getIdString() : "", createNew ? "1" : "0" );
if ( mTool )
@ -400,4 +399,13 @@ DefineConsoleMethod( ForestEditorCtrl, deleteMeshSafe, void, ( const char * obj
DefineConsoleMethod( ForestEditorCtrl, isDirty, bool, (), , "" )
{
return object->isDirty();
}
DefineConsoleMethod(ForestEditorCtrl, setActiveForest, void, (const char * obj), , "( Forest obj )")
{
Forest *forestObject;
if (!Sim::findObject(obj, forestObject))
return;
object->setActiveForest(forestObject);
}

View file

@ -86,6 +86,9 @@ class ForestEditorCtrl : public EditTSCtrl
/// Causes the editor to reselect the active forest.
bool updateActiveForest( bool createNew );
/// Sets the active Forest
void setActiveForest(Forest* forestObject) { mForest = forestObject; }
/// Returns the active Forest.
Forest *getActiveForest() const { return mForest; }

View file

@ -88,7 +88,7 @@ public:
const Vector<S32>& getLOSDetails() const { return mLOSDetails; }
// ForestItemData
const Box3F& getObjBox() const { return mShape ? mShape->bounds : Box3F::Invalid; }
const Box3F& getObjBox() const { return mShape ? mShape->bounds : Box3F::Zero; }
bool render( TSRenderState *rdata, const ForestItem& item ) const;
ForestCellBatch* allocateBatch() const;
bool canBillboard( const SceneRenderState *state, const ForestItem &item, F32 distToCamera ) const;

View file

@ -811,9 +811,9 @@ GFXShader* GFXGLDevice::createShader()
return shader;
}
void GFXGLDevice::setShader( GFXShader *shader )
void GFXGLDevice::setShader(GFXShader *shader, bool force)
{
if(mCurrentShader == shader)
if(mCurrentShader == shader && !force)
return;
if ( shader )

View file

@ -90,7 +90,7 @@ public:
virtual F32 getPixelShaderVersion() const { return mPixelShaderVersion; }
virtual void setPixelShaderVersion( F32 version ) { mPixelShaderVersion = version; }
virtual void setShader(GFXShader* shd);
virtual void setShader(GFXShader *shader, bool force = false);
/// @attention GL cannot check if the given format supports blending or filtering!
virtual GFXFormat selectSupportedFormat(GFXTextureProfile *profile,

View file

@ -1019,7 +1019,7 @@ F32 mRandF()
return gRandGen.randF();
}
DefineConsoleFunction( getRandom, F32, (S32 a, S32 b), (1, 0),
DefineConsoleFunction(getRandom, F32, (S32 a, S32 b), (S32_MAX, S32_MAX),
"( int a, int b ) "
"@brief Returns a random number based on parameters passed in..\n\n"
"If no parameters are passed in, getRandom() will return a float between 0.0 and 1.0. If one "
@ -1033,21 +1033,21 @@ DefineConsoleFunction( getRandom, F32, (S32 a, S32 b), (1, 0),
"@see setRandomSeed\n"
"@ingroup Random" )
{
if (b == 0)
return F32(gRandGen.randI(0,getMax( a, 0 )));
else
if (a != S32_MAX)
{
if (b != 0)
if (b == S32_MAX)
return F32(gRandGen.randI(0, getMax(a, 0)));
else
{
S32 min = a;
S32 max = b;
if (min > max)
if (min > max)
{
S32 t = min;
min = max;
max = t;
}
return F32(gRandGen.randI(min,max));
return F32(gRandGen.randI(min, max));
}
}
return gRandGen.randF();

View file

@ -42,7 +42,7 @@ inline void dFetchAndAdd( volatile U32& ref, U32 val )
#if defined(TORQUE_OS_PS3)
cellAtomicAdd32( (std::uint32_t *)&ref, val );
#elif !defined(TORQUE_OS_MAC)
__sync_fetch_and_add( ( volatile long* ) &ref, val );
__sync_fetch_and_add(&ref, val );
#else
OSAtomicAdd32( val, (int32_t* ) &ref);
#endif
@ -53,7 +53,7 @@ inline void dFetchAndAdd( volatile S32& ref, S32 val )
#if defined(TORQUE_OS_PS3)
cellAtomicAdd32( (std::uint32_t *)&ref, val );
#elif !defined(TORQUE_OS_MAC)
__sync_fetch_and_add( ( volatile long* ) &ref, val );
__sync_fetch_and_add( &ref, val );
#else
OSAtomicAdd32( val, (int32_t* ) &ref);
#endif

View file

@ -412,15 +412,7 @@ void ThreadPool::queueWorkItem( WorkItem* item )
mWorkItemQueue.insert( item->getPriority(), item );
// Wake up some thread, if we need to.
// Use the ready count here as the wake count does
// not correctly protect the critical section in the
// thread's run function. This may lead us to release
// the semaphore more often than necessary, but it avoids
// a race condition.
if( !dCompareAndSwap( mNumThreadsReady, mNumThreads, mNumThreads ) )
mSemaphore.release();
mSemaphore.release();
}
}

View file

@ -202,6 +202,10 @@ void RenderGlowMgr::render( SceneRenderState *state )
}
ParticleRenderInst *ri = static_cast<ParticleRenderInst*>(_ri);
GFX->setStateBlock(mParticleRenderMgr->_getHighResStateBlock(ri));
mParticleRenderMgr->_getShaderConsts().mShaderConsts->setSafe(mParticleRenderMgr->_getShaderConsts().mModelViewProjSC, *ri->modelViewProj);
mParticleRenderMgr->renderParticle(ri, state);
j++;
continue;

View file

@ -137,11 +137,13 @@ protected:
GFXStateBlockRef mOffscreenBlocks[ParticleRenderInst::BlendStyle_COUNT];
GFXStateBlockRef mBackbufferBlocks[ParticleRenderInst::BlendStyle_COUNT];
GFXStateBlockRef mMixedResBlocks[ParticleRenderInst::BlendStyle_COUNT];
public:
GFXStateBlockRef _getHighResStateBlock(ParticleRenderInst *ri);
GFXStateBlockRef _getMixedResStateBlock(ParticleRenderInst *ri);
GFXStateBlockRef _getOffscreenStateBlock(ParticleRenderInst *ri);
GFXStateBlockRef _getCompositeStateBlock(ParticleRenderInst *ri);
ShaderConsts &_getShaderConsts() { return mParticleShaderConsts; };
};

View file

@ -1374,7 +1374,7 @@ F32 SceneContainer::containerSearchCurrRadiusDist()
void SceneContainer::getBinRange( const F32 min, const F32 max, U32& minBin, U32& maxBin )
{
AssertFatal(max >= min, "Error, bad range! in getBinRange");
AssertFatal(max >= min, avar("Error, bad range in getBinRange. min: %f, max: %f", min, max));
if ((max - min) >= (SceneContainer::csmTotalBinSize - SceneContainer::csmBinSize))
{

View file

@ -545,8 +545,8 @@ void TerrainDetailMapFeatHLSL::processPix( Vector<ShaderComponent*> &component
Var *baseColor = (Var*)LangElement::find( "baseColor" );
Var *outColor = (Var*)LangElement::find( "col" );
meta->addStatement( new GenOp( " @ = lerp( @, @ + @, @ );\r\n",
outColor, outColor, baseColor, detailColor, detailBlend ) );
meta->addStatement( new GenOp( " @ += @ * @;\r\n",
outColor, detailColor, detailBlend));
meta->addStatement( new GenOp( " }\r\n" ) );
@ -742,7 +742,7 @@ void TerrainMacroMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentL
}
// Add to the blend total.
meta->addStatement( new GenOp( " @ = max( @, @ );\r\n", blendTotal, blendTotal, detailBlend ) );
meta->addStatement( new GenOp( " @ += @;\r\n", blendTotal, detailBlend ) );
// If this is a prepass then we skip color.
if ( fd.features.hasFeature( MFT_PrePassConditioner ) )
@ -815,9 +815,8 @@ void TerrainMacroMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentL
//Var *baseColor = (Var*)LangElement::find( "baseColor" );
Var *outColor = (Var*)LangElement::find( "col" );
meta->addStatement( new GenOp( " @ = lerp( @, @ + @, @ );\r\n",
outColor, outColor, outColor, detailColor, detailBlend ) );
//outColor, outColor, baseColor, detailColor, detailBlend ) );
meta->addStatement(new GenOp(" @ += @ * @;\r\n",
outColor, detailColor, detailBlend));
meta->addStatement( new GenOp( " }\r\n" ) );

View file

@ -287,8 +287,14 @@ bool TerrainBlock::_setBaseTexFormat(void *obj, const char *index, const char *d
{
terrain->mBaseTexFormat = (BaseTexFormat)eTable[i].mInt;
terrain->_updateMaterials();
if (terrain->isServerObject()) return false;
terrain->_updateLayerTexture();
terrain->_updateBaseTexture(true);
// If the cached base texture is older that the terrain file or
// it doesn't exist then generate and cache it.
String baseCachePath = terrain->_getBaseTexCacheFileName();
if (Platform::compareModifiedTimes(baseCachePath, terrain->mTerrFileName) < 0)
terrain->_updateBaseTexture(true);
break;
}
}

View file

@ -170,7 +170,7 @@ bool TerrainBlock::_initBaseShader()
desc.zDefined = true;
desc.zWriteEnable = false;
desc.zEnable = false;
desc.setBlend( true, GFXBlendSrcAlpha, GFXBlendOne );
desc.setBlend( true, GFXBlendSrcAlpha, GFXBlendOne );
desc.cullDefined = true;
desc.cullMode = GFXCullNone;
desc.colorWriteAlpha = false;