Added ability to pass ints to post effect shader consts

Reorg'd probe init to flow better and be more robust on load
Cleaned up various parts of the probe render manager to be more stable
Fixed issue with crash on release due to numProbe in loops being 0
Updated glsl probe array shader
Beginning of rework of editor settings
Beginning of conversion of asset import config to similar system as editor settings
This commit is contained in:
Areloch 2019-06-13 00:37:12 -05:00
parent b40d33a663
commit dd3422b5a2
21 changed files with 300 additions and 420 deletions

View file

@ -183,6 +183,16 @@ void PostEffect::EffectConst::set(const F32 &newVal)
mValueType = FloatType;
}
void PostEffect::EffectConst::set(const int& newVal)
{
if (mIntVal == newVal)
return;
mIntVal = newVal;
mDirty = true;
mValueType = IntType;
}
void PostEffect::EffectConst::set(const Point4F &newVal)
{
if (mPointVal == newVal)
@ -326,6 +336,21 @@ void PostEffect::EffectConst::setToBuffer( GFXShaderConstBufferRef buff )
const char* err = avar("PostEffect::EffectConst::setToBuffer $s type is not implemented", mName.c_str());
Con::errorf(err);
GFXAssertFatal(0, err);
#endif
}
}
else if (mValueType == IntType)
{
if (type == GFXSCT_Int)
{
buff->set(mHandle, mIntVal);
}
else
{
#if TORQUE_DEBUG
const char* err = avar("PostEffect::EffectConst::setToBuffer $s type is not implemented", mName.c_str());
Con::errorf(err);
GFXAssertFatal(0, err);
#endif
}
}
@ -1676,6 +1701,20 @@ void PostEffect::setShaderConst(const String &name, const F32 &val)
iter->value->set(val);
}
void PostEffect::setShaderConst(const String& name, const int& val)
{
PROFILE_SCOPE(PostEffect_SetShaderConst_Float);
EffectConstTable::Iterator iter = mEffectConsts.find(name);
if (iter == mEffectConsts.end())
{
EffectConst* newConst = new EffectConst(name, val);
iter = mEffectConsts.insertUnique(name, newConst);
}
iter->value->set(val);
}
void PostEffect::setShaderConst(const String &name, const Point4F &val)
{
PROFILE_SCOPE(PostEffect_SetShaderConst_Point);

View file

@ -230,6 +230,14 @@ protected:
set(val);
}
EffectConst(const String& name, const int& val)
: mName(name),
mHandle(NULL),
mDirty(true)
{
set(val);
}
EffectConst(const String &name, const Point4F &val)
: mName(name),
mHandle(NULL),
@ -264,6 +272,7 @@ protected:
void set( const String &newVal );
void set(const F32 &newVal);
void set(const int& newVal);
void set(const Point4F &newVal);
void set(const MatrixF &newVal);
void set(const Vector<Point4F> &newVal);
@ -277,6 +286,7 @@ protected:
String mStringVal;
S32 mIntVal;
F32 mFloatVal;
Point4F mPointVal;
MatrixF mMatrixVal;
@ -287,6 +297,7 @@ protected:
enum
{
StringType,
IntType,
FloatType,
PointType,
MatrixType,
@ -427,6 +438,7 @@ public:
///
void setShaderConst( const String &name, const String &val );
void setShaderConst(const String &name, const F32 &val);
void setShaderConst(const String& name, const int& val);
void setShaderConst(const String &name, const Point4F &val);
void setShaderConst(const String &name, const MatrixF &val);
void setShaderConst(const String &name, const Vector<Point4F> &val);