mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-19 22:53:47 +00:00
Merge branch 'Preview4_0' into alpha40_lightreview
# Conflicts: # Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl
This commit is contained in:
commit
1e107ceb94
76 changed files with 682 additions and 297 deletions
|
|
@ -238,6 +238,11 @@ bool Trigger::castRay(const Point3F &start, const Point3F &end, RayInfo* info)
|
|||
DECLARE_STRUCT( Polyhedron );
|
||||
IMPLEMENT_STRUCT( Polyhedron, Polyhedron,,
|
||||
"" )
|
||||
|
||||
FIELD(mPointList, pointList, 1, "")
|
||||
FIELD(mPlaneList, planeList, 1, "")
|
||||
FIELD(mEdgeList, edgeList, 1, "")
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
ConsoleType(floatList, TypeTriggerPolyhedron, Polyhedron, "")
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class GuiSpeedometerHud : public GuiBitmapCtrl
|
|||
F32 mMaxAngle; ///< Max pos of needle
|
||||
F32 mMinAngle; ///< Min pos of needle
|
||||
Point2F mCenter; ///< Center of needle rotation
|
||||
LinearColorF mColor; ///< Needle Color
|
||||
LinearColorF mNeedleColor; ///< Needle Color
|
||||
F32 mNeedleLength;
|
||||
F32 mNeedleWidth;
|
||||
F32 mTailLength;
|
||||
|
|
@ -103,7 +103,7 @@ GuiSpeedometerHud::GuiSpeedometerHud()
|
|||
mNeedleWidth = 3;
|
||||
mNeedleLength = 10;
|
||||
mTailLength = 5;
|
||||
mColor.set(1,0,0,1);
|
||||
mNeedleColor.set(1,0,0,1);
|
||||
}
|
||||
|
||||
void GuiSpeedometerHud::initPersistFields()
|
||||
|
|
@ -122,7 +122,7 @@ void GuiSpeedometerHud::initPersistFields()
|
|||
"Angle (in radians) of the needle when the Vehicle speed is >= maxSpeed. "
|
||||
"An angle of 0 points right, 90 points up etc)." );
|
||||
|
||||
addField("color", TypeColorF, Offset( mColor, GuiSpeedometerHud ),
|
||||
addField("color", TypeColorF, Offset( mNeedleColor, GuiSpeedometerHud ),
|
||||
"Color of the needle" );
|
||||
|
||||
addField("center", TypePoint2F, Offset( mCenter, GuiSpeedometerHud ),
|
||||
|
|
@ -210,7 +210,7 @@ void GuiSpeedometerHud::onRender(Point2I offset, const RectI &updateRect)
|
|||
GFX->setTexture(0, NULL);
|
||||
|
||||
// Render the needle
|
||||
PrimBuild::color4f(mColor.red, mColor.green, mColor.blue, mColor.alpha);
|
||||
PrimBuild::color4f(mNeedleColor.red, mNeedleColor.green, mNeedleColor.blue, mNeedleColor.alpha);
|
||||
PrimBuild::begin(GFXLineStrip, 5);
|
||||
for(int k=0; k<5; k++){
|
||||
rotMatrix.mulP(vertList[k]);
|
||||
|
|
|
|||
|
|
@ -253,13 +253,13 @@ DefineEngineMethod(afxEffectGroupData, reset, void, (),,
|
|||
object->reloadReset();
|
||||
}
|
||||
|
||||
DefineEngineMethod(afxEffectGroupData, addEffect, void, (afxEffectBaseData* effect),,
|
||||
DefineEngineMethod(afxEffectGroupData, pushEffect, void, (afxEffectBaseData* effect),,
|
||||
"Adds an effect (wrapper or group) to an effect-group.\n\n"
|
||||
"@ingroup AFX")
|
||||
{
|
||||
if (!effect)
|
||||
{
|
||||
Con::errorf("afxEffectGroupData::addEffect() -- missing afxEffectWrapperData.");
|
||||
Con::errorf("afxEffectGroupData::pushEffect() -- missing afxEffectWrapperData.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -216,13 +216,13 @@ DefineEngineMethod(afxEffectronData, reset, void, (),,
|
|||
object->reloadReset();
|
||||
}
|
||||
|
||||
DefineEngineMethod(afxEffectronData, addEffect, void, (afxEffectBaseData* effect),,
|
||||
DefineEngineMethod(afxEffectronData, pushEffect, void, (afxEffectBaseData* effect),,
|
||||
"Adds an effect (wrapper or group) to an effectron's phase.\n\n"
|
||||
"@ingroup AFX")
|
||||
{
|
||||
if (!effect)
|
||||
{
|
||||
Con::errorf("afxEffectronData::addEffect() -- missing afxEffectWrapperData.");
|
||||
Con::errorf("afxEffectronData::pushEffect() -- missing afxEffectWrapperData.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -460,7 +460,7 @@ DefineEngineMethod(afxMagicSpellData, reset, void, (),,
|
|||
object->reloadReset();
|
||||
}
|
||||
|
||||
DefineEngineMethod(afxMagicSpellData, addCastingEffect, void, (afxEffectBaseData* effect),,
|
||||
DefineEngineMethod(afxMagicSpellData, pushCastingEffect, void, (afxEffectBaseData* effect),,
|
||||
"Adds an effect (wrapper or group) to a spell's casting phase.\n\n"
|
||||
"@ingroup AFX")
|
||||
{
|
||||
|
|
@ -475,7 +475,7 @@ DefineEngineMethod(afxMagicSpellData, addCastingEffect, void, (afxEffectBaseData
|
|||
object->mCasting_fx_list.push_back(effect);
|
||||
}
|
||||
|
||||
DefineEngineMethod(afxMagicSpellData, addLaunchEffect, void, (afxEffectBaseData* effect),,
|
||||
DefineEngineMethod(afxMagicSpellData, pushLaunchEffect, void, (afxEffectBaseData* effect),,
|
||||
"Adds an effect (wrapper or group) to a spell's launch phase.\n\n"
|
||||
"@ingroup AFX")
|
||||
|
||||
|
|
@ -491,7 +491,7 @@ DefineEngineMethod(afxMagicSpellData, addLaunchEffect, void, (afxEffectBaseData*
|
|||
object->mLaunch_fx_list.push_back(effect);
|
||||
}
|
||||
|
||||
DefineEngineMethod(afxMagicSpellData, addDeliveryEffect, void, (afxEffectBaseData* effect),,
|
||||
DefineEngineMethod(afxMagicSpellData, pushDeliveryEffect, void, (afxEffectBaseData* effect),,
|
||||
"Adds an effect (wrapper or group) to a spell's delivery phase.\n\n"
|
||||
"@ingroup AFX")
|
||||
|
||||
|
|
@ -507,7 +507,7 @@ DefineEngineMethod(afxMagicSpellData, addDeliveryEffect, void, (afxEffectBaseDat
|
|||
object->mDelivery_fx_list.push_back(effect);
|
||||
}
|
||||
|
||||
DefineEngineMethod(afxMagicSpellData, addImpactEffect, void, (afxEffectBaseData* effect),,
|
||||
DefineEngineMethod(afxMagicSpellData, pushImpactEffect, void, (afxEffectBaseData* effect),,
|
||||
"Adds an effect (wrapper or group) to a spell's impact phase.\n\n"
|
||||
"@ingroup AFX")
|
||||
|
||||
|
|
@ -523,7 +523,7 @@ DefineEngineMethod(afxMagicSpellData, addImpactEffect, void, (afxEffectBaseData*
|
|||
object->mImpact_fx_list.push_back(effect);
|
||||
}
|
||||
|
||||
DefineEngineMethod(afxMagicSpellData, addLingerEffect, void, (afxEffectBaseData* effect),,
|
||||
DefineEngineMethod(afxMagicSpellData, pushLingerEffect, void, (afxEffectBaseData* effect),,
|
||||
"Adds an effect (wrapper or group) to a spell's linger phase.\n\n"
|
||||
"@ingroup AFX")
|
||||
|
||||
|
|
|
|||
|
|
@ -297,12 +297,12 @@ void afxPhraseEffectData::gather_cons_defs(Vector<afxConstraintDef>& defs)
|
|||
|
||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
DefineEngineMethod( afxPhraseEffectData, addEffect, void, ( afxEffectBaseData* effectData ),,
|
||||
DefineEngineMethod( afxPhraseEffectData, pushEffect, void, ( afxEffectBaseData* effectData ),,
|
||||
"Add a child effect to a phrase effect datablock. Argument can be an afxEffectWrappperData or an afxEffectGroupData.\n" )
|
||||
{
|
||||
if (!effectData)
|
||||
{
|
||||
Con::errorf("afxPhraseEffectData::addEffect() -- failed to resolve effect datablock.");
|
||||
Con::errorf("afxPhraseEffectData::pushEffect() -- failed to resolve effect datablock.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
namespace Con
|
||||
{
|
||||
/* Consumer Callback is not defined as EngineType yet, until then we have to define these methods directly.
|
||||
DefineNewEngineFunction(AddConsumer, void, (ConsumerCallback cb), , "")
|
||||
{
|
||||
addConsumer(cb);
|
||||
|
|
@ -35,6 +36,17 @@ namespace Con
|
|||
{
|
||||
removeConsumer(cb);
|
||||
}
|
||||
*/
|
||||
|
||||
TORQUE_API void fnAddConsumer(ConsumerCallback cb)
|
||||
{
|
||||
addConsumer(cb);
|
||||
}
|
||||
|
||||
TORQUE_API void fnRemoveConsumer(ConsumerCallback cb)
|
||||
{
|
||||
removeConsumer(cb);
|
||||
}
|
||||
|
||||
DefineNewEngineFunction(GetConsoleString, String, (String name),, "")
|
||||
{
|
||||
|
|
@ -75,4 +87,4 @@ namespace Con
|
|||
{
|
||||
setBoolVariable(StringTable->insert(name), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,16 +28,6 @@ DefineNewEngineMethod(SimObject, RegisterObject, bool, (),,"")
|
|||
return object->registerObject();
|
||||
}
|
||||
|
||||
DefineNewEngineMethod(SimObject, GetField, String, (String fieldName, String arrayIndex),, "")
|
||||
{
|
||||
return object->getDataField(StringTable->insert(fieldName), StringTable->insert(arrayIndex));
|
||||
}
|
||||
|
||||
DefineNewEngineMethod(SimObject, SetField, void, (String fieldName, String arrayIndex, String value),, "")
|
||||
{
|
||||
object->setDataField(StringTable->insert(fieldName), StringTable->insert(arrayIndex), StringTable->insert(value));
|
||||
}
|
||||
|
||||
DefineNewEngineMethod(SimObject, CopyFrom, void, (SimObject* parent),, "")
|
||||
{
|
||||
if (parent)
|
||||
|
|
@ -66,4 +56,4 @@ DefineNewEngineMethod(SimObject, InspectPreApply, void, (), , "")
|
|||
DefineNewEngineMethod(SimObject, InspectPostApply, void, (), , "")
|
||||
{
|
||||
object->inspectPostApply();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2082,7 +2082,7 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip)
|
|||
mNSEntry = Namespace::global()->lookup(fnName);
|
||||
|
||||
StringStackWrapper args(mCallArgc, mCallArgv);
|
||||
cRetRes = CInterface::GetCInterface().CallFunction(fnNamespace, fnName, args.argv, args.argc, &cFunctionRes);
|
||||
cRetRes = CInterface::CallFunction(fnNamespace, fnName, args.argv + 1, args.argc - 1, &cFunctionRes);
|
||||
}
|
||||
else if (callType == FuncCallExprNode::MethodCall)
|
||||
{
|
||||
|
|
@ -2115,7 +2115,7 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip)
|
|||
mNSEntry = NULL;
|
||||
|
||||
StringStackWrapper args(mCallArgc, mCallArgv);
|
||||
cRetRes = CInterface::GetCInterface().CallMethod(gEvalState.thisObject, fnName, args.argv, args.argc, &cFunctionRes);
|
||||
cRetRes = CInterface::CallMethod(gEvalState.thisObject, fnName, args.argv + 2, args.argc - 2, &cFunctionRes);
|
||||
}
|
||||
else // it's a ParentCall
|
||||
{
|
||||
|
|
@ -2181,14 +2181,15 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip)
|
|||
|
||||
// ConsoleFunctionType is for any function defined by script.
|
||||
// Any 'callback' type is an engine function that is exposed to script.
|
||||
if (mNSEntry->mType == Namespace::Entry::ConsoleFunctionType
|
||||
|| cFunctionRes)
|
||||
if (cFunctionRes || mNSEntry->mType == Namespace::Entry::ConsoleFunctionType)
|
||||
{
|
||||
ConsoleValue retVal;
|
||||
ConsoleValueRef ret;
|
||||
if (cFunctionRes)
|
||||
{
|
||||
StringStackConsoleWrapper retVal(1, &cRetRes);
|
||||
ret = retVal.argv[0];
|
||||
retVal.init();
|
||||
ret.value = &retVal;
|
||||
retVal.setStackStringValue(cRetRes);
|
||||
}
|
||||
else if (mNSEntry->mFunctionOffset)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "console/consoleFunctions.h"
|
||||
#endif
|
||||
|
||||
#include "cinterface/cinterface.h"
|
||||
#include "core/strings/findMatch.h"
|
||||
#include "core/strings/stringUnit.h"
|
||||
#include "core/strings/unicode.h"
|
||||
|
|
@ -2426,6 +2427,10 @@ DefineEngineFunction( isMethod, bool, ( const char* nameSpace, const char* metho
|
|||
"@return True if the method exists, false if not\n"
|
||||
"@ingroup Scripting\n")
|
||||
{
|
||||
if (CInterface::isMethod(nameSpace, method)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Namespace* ns = Namespace::find( StringTable->insert( nameSpace ) );
|
||||
Namespace::Entry* nse = ns->lookup( StringTable->insert( method ) );
|
||||
if( !nse )
|
||||
|
|
|
|||
|
|
@ -284,6 +284,26 @@ const EngineTypeInfo* _MAPTYPE() { return TYPE< T >(); }
|
|||
}; \
|
||||
ConsoleType ## type gConsoleType ## type ## Instance;
|
||||
|
||||
#define ConsoleMappedType( typeName, type, consoleType, nativeType, typePrefix ) \
|
||||
S32 type; \
|
||||
class ConsoleType##type : public ConsoleBaseType \
|
||||
{ \
|
||||
public: \
|
||||
typedef nativeType T; \
|
||||
ConsoleType##type() \
|
||||
: ConsoleBaseType( sizeof( nativeType ), &type, #type ) \
|
||||
{ \
|
||||
mTypeInfo = _MAPTYPE< consoleType >(); \
|
||||
} \
|
||||
virtual void setData(void *dptr, S32 argc, const char **argv, const EnumTable *tbl, BitSet32 flag); \
|
||||
virtual const char *getData(void *dptr, const EnumTable *tbl, BitSet32 flag ); \
|
||||
virtual const char *getTypeClassName() { return #typeName ; } \
|
||||
virtual void *getNativeVariable() { T* var = new T; return (void*)var; } \
|
||||
virtual void deleteNativeVariable(void* var) { T* nativeVar = reinterpret_cast<T*>(var); delete nativeVar; } \
|
||||
virtual StringTableEntry getTypePrefix( void ) const { return StringTable->insert( typePrefix ); } \
|
||||
}; \
|
||||
ConsoleType ## type gConsoleType ## type ## Instance;
|
||||
|
||||
#define ImplementConsoleTypeCasters( type, nativeType ) \
|
||||
const char *castConsoleTypeToString( _ConsoleConstType< nativeType >::ConstType &arg ) { return Con::getData(type, const_cast< nativeType* >( &arg ), 0); } \
|
||||
bool castConsoleTypeFromString( nativeType &arg, const char *str ) { Con::setData(type, const_cast< nativeType* >( &arg ), 0, 1, &str); return true; } \
|
||||
|
|
|
|||
|
|
@ -104,20 +104,6 @@ namespace engineAPI {
|
|||
extern bool gIsInitialized;
|
||||
}
|
||||
|
||||
|
||||
//FIXME: this allows const char* to be used as a struct field type
|
||||
|
||||
// Temp support for allowing const char* to remain in the API functions as long as we
|
||||
// still have the console system around. When that is purged, these definitions should
|
||||
// be deleted and all const char* uses be replaced with String.
|
||||
template<> struct EngineTypeTraits< const char* > : public EngineTypeTraits< String > {};
|
||||
template<> inline const EngineTypeInfo* TYPE< const char* >() { return TYPE< String >(); }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// @name Marshalling
|
||||
///
|
||||
/// Functions for converting to/from string-based data representations.
|
||||
|
|
@ -349,10 +335,9 @@ template<typename T> struct _EngineTrampoline {
|
|||
template< typename R, typename ...ArgTs >
|
||||
struct _EngineTrampoline< R( ArgTs ... ) >
|
||||
{
|
||||
typedef std::tuple<ArgTs ...> Args;
|
||||
std::tuple<ArgTs ...> argT;
|
||||
typedef fixed_tuple<ArgTs ...> FixedArgs;
|
||||
fixed_tuple<ArgTs ...> fixedArgT;
|
||||
template<typename T> using AVT = typename EngineTypeTraits<T>::ArgumentValueType;
|
||||
typedef fixed_tuple<AVT<ArgTs> ...> Args;
|
||||
Args argT;
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
|
|
@ -370,21 +355,21 @@ struct _EngineFunctionTrampoline< R(ArgTs...) > : public _EngineFunctionTrampoli
|
|||
{
|
||||
private:
|
||||
using Super = _EngineFunctionTrampolineBase< R(ArgTs...) >;
|
||||
using ArgsType = typename Super::Args;
|
||||
using FixedArgsType = typename Super::FixedArgs;
|
||||
using SelfType = _EngineFunctionTrampoline< R(ArgTs...) >;
|
||||
using ArgsType = typename _EngineFunctionTrampolineBase< R(ArgTs ...) >::Args;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
|
||||
template<size_t I>
|
||||
static typename fixed_tuple_element<I, fixed_tuple<ArgTs...>>::type getAndToType(const ArgsType& args) {
|
||||
return EngineTypeTraits<typename fixed_tuple_element<I, fixed_tuple<ArgTs...>>::type>::ArgumentToValue(fixed_tuple_accessor<I>::get(args));
|
||||
}
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(typename Super::FunctionType fn, const ArgsType& args, Seq<I...>) {
|
||||
return R( fn(std::get<I>(args) ...) );
|
||||
}
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(typename Super::FunctionType fn, const FixedArgsType& args, Seq<I...>) {
|
||||
return R( fn(fixed_tuple_accessor<I>::get(args) ...) );
|
||||
return R( fn(SelfType::template getAndToType<I>(args) ...) );
|
||||
}
|
||||
|
||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||
|
|
@ -393,11 +378,6 @@ public:
|
|||
{
|
||||
return dispatchHelper(fn, args, SeqType());
|
||||
}
|
||||
|
||||
static R jmp(typename Super::FunctionType fn, const FixedArgsType& args )
|
||||
{
|
||||
return dispatchHelper(fn, args, SeqType());
|
||||
}
|
||||
};
|
||||
|
||||
// Trampolines for engine methods
|
||||
|
|
@ -414,21 +394,21 @@ struct _EngineMethodTrampoline< Frame, R(ArgTs ...) > : public _EngineMethodTram
|
|||
using FunctionType = R( typename Frame::ObjectType*, ArgTs ...);
|
||||
private:
|
||||
using Super = _EngineMethodTrampolineBase< R(ArgTs ...) >;
|
||||
using ArgsType = typename _EngineFunctionTrampolineBase< R(ArgTs ...) >::Args;
|
||||
using FixedArgsType = typename Super::FixedArgs;
|
||||
using SelfType = _EngineMethodTrampoline< Frame, R(ArgTs ...) >;
|
||||
using ArgsType = typename _EngineMethodTrampolineBase< R(ArgTs ...) >::Args;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(Frame f, const ArgsType& args, Seq<I...>) {
|
||||
return R( f._exec(std::get<I>(args) ...) );
|
||||
|
||||
template<size_t I>
|
||||
static typename fixed_tuple_element<I, fixed_tuple<ArgTs...>>::type getAndToType(const ArgsType& args) {
|
||||
return EngineTypeTraits<typename fixed_tuple_element<I, fixed_tuple<ArgTs...>>::type>::ArgumentToValue(fixed_tuple_accessor<I>::get(args));
|
||||
}
|
||||
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(Frame f, const FixedArgsType& args, Seq<I...>) {
|
||||
return R( f._exec(fixed_tuple_accessor<I>::get(args) ...) );
|
||||
static R dispatchHelper(Frame f, const ArgsType& args, Seq<I...>) {
|
||||
return R(f._exec(SelfType::template getAndToType<I>(args) ...));
|
||||
}
|
||||
|
||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||
|
|
@ -440,14 +420,6 @@ public:
|
|||
f.object = object;
|
||||
return dispatchHelper(f, args, SeqType());
|
||||
}
|
||||
|
||||
static R jmp( typename Frame::ObjectType* object, const FixedArgsType& args )
|
||||
{
|
||||
|
||||
Frame f;
|
||||
f.object = object;
|
||||
return dispatchHelper(f, args, SeqType());
|
||||
}
|
||||
};
|
||||
|
||||
/// @}
|
||||
|
|
@ -582,7 +554,7 @@ namespace engineAPI{
|
|||
{
|
||||
return EngineUnmarshallData< IthArgType<index> >()( argv[ startArgc + index ] );
|
||||
} else {
|
||||
return std::get<index + method_offset>(defaultArgs.mArgs);
|
||||
return fixed_tuple_accessor<index + method_offset>::get(defaultArgs.mArgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -714,7 +686,7 @@ public:
|
|||
#define DefineEngineFunction( name, returnType, args, defaultArgs, usage ) \
|
||||
static inline returnType _fn ## name ## impl args; \
|
||||
TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## name \
|
||||
( _EngineFunctionTrampoline< returnType args >::FixedArgs a ) \
|
||||
( _EngineFunctionTrampoline< returnType args >::Args a ) \
|
||||
{ \
|
||||
_CHECK_ENGINE_INITIALIZED( name, returnType ); \
|
||||
return EngineTypeTraits< returnType >::ReturnValue( \
|
||||
|
|
@ -768,7 +740,7 @@ public:
|
|||
|
||||
#define _DefineMethodTrampoline( className, name, returnType, args ) \
|
||||
TORQUE_API EngineTypeTraits< returnType >::ReturnValueType \
|
||||
fn ## className ## _ ## name ( className* object, _EngineMethodTrampoline< _ ## className ## name ## frame, returnType args >::FixedArgs a )\
|
||||
fn ## className ## _ ## name ( className* object, _EngineMethodTrampoline< _ ## className ## name ## frame, returnType args >::Args a )\
|
||||
{ \
|
||||
_CHECK_ENGINE_INITIALIZED( className::name, returnType ); \
|
||||
return EngineTypeTraits< returnType >::ReturnValue( \
|
||||
|
|
@ -851,7 +823,7 @@ public:
|
|||
#define DefineEngineStaticMethod( className, name, returnType, args, defaultArgs, usage ) \
|
||||
static inline returnType _fn ## className ## name ## impl args; \
|
||||
TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## className ## _ ## name \
|
||||
( _EngineFunctionTrampoline< returnType args >::FixedArgs a ) \
|
||||
( _EngineFunctionTrampoline< returnType args >::Args a ) \
|
||||
{ \
|
||||
_CHECK_ENGINE_INITIALIZED( className::name, returnType ); \
|
||||
return EngineTypeTraits< returnType >::ReturnValue( \
|
||||
|
|
@ -886,25 +858,25 @@ public:
|
|||
); \
|
||||
static inline returnType _fn ## className ## name ## impl args
|
||||
|
||||
# define DefineEngineStringlyVariadicFunction(name,returnType,minArgs,maxArgs,usage) \
|
||||
# define DefineEngineStringlyVariadicFunction(name,returnType,minArgs,maxArgs,usage) \
|
||||
static inline returnType _fn ## name ## impl (SimObject *, S32 argc, ConsoleValueRef *argv); \
|
||||
TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## name \
|
||||
(S32 argc, const char** argv) \
|
||||
(Vector<const char*>* vec) \
|
||||
{ \
|
||||
_CHECK_ENGINE_INITIALIZED( name, returnType ); \
|
||||
StringStackConsoleWrapper args(argc, argv); \
|
||||
StringStackConsoleWrapper args(vec->size(), vec->address()); \
|
||||
return EngineTypeTraits< returnType >::ReturnValue( \
|
||||
_fn ## name ## impl(NULL, args.count(), args) \
|
||||
); \
|
||||
} \
|
||||
static _EngineFunctionDefaultArguments< void (S32 argc, const char** argv) > _fn ## name ## DefaultArgs; \
|
||||
static _EngineFunctionDefaultArguments< void (Vector<const char*>* vec) > _fn ## name ## DefaultArgs; \
|
||||
static EngineFunctionInfo _fn ## name ## FunctionInfo( \
|
||||
#name, \
|
||||
&_SCOPE<>()(), \
|
||||
usage, \
|
||||
#returnType " " #name "(S32 argc, const char** argv)", \
|
||||
#returnType " " #name "(Vector<String> args)", \
|
||||
"fn" #name, \
|
||||
TYPE< returnType (S32 argc, const char** argv) >(), \
|
||||
TYPE< returnType (Vector<const char*>* vec) >(), \
|
||||
&_fn ## name ## DefaultArgs, \
|
||||
( void* ) &fn ## name, \
|
||||
0 \
|
||||
|
|
@ -913,34 +885,44 @@ public:
|
|||
returnType _fn ## name ## impl(SimObject *, S32 argc, ConsoleValueRef *argv)
|
||||
|
||||
# define DefineEngineStringlyVariadicMethod(className, name,returnType,minArgs,maxArgs,usage) \
|
||||
static inline returnType _fn ## className ## _ ## name ## impl (className* object, S32 argc, ConsoleValueRef* argv); \
|
||||
struct _ ## className ## name ## frame \
|
||||
{ \
|
||||
typedef className ObjectType; \
|
||||
className* object; \
|
||||
inline returnType _exec (S32 argc, ConsoleValueRef* argv) const; \
|
||||
}; \
|
||||
TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## className ## _ ## name \
|
||||
(className* object, S32 argc, const char** argv) \
|
||||
(className* object, Vector<const char*>* vec) \
|
||||
{ \
|
||||
_CHECK_ENGINE_INITIALIZED( name, returnType ); \
|
||||
StringStackConsoleWrapper args(argc, argv); \
|
||||
StringStackConsoleWrapper args(vec->size(), vec->address()); \
|
||||
_ ## className ## name ## frame frame {}; \
|
||||
frame.object = static_cast< className* >( object ); \
|
||||
return EngineTypeTraits< returnType >::ReturnValue( \
|
||||
_fn ## className ## _ ## name ## impl(object, args.count(), args) \
|
||||
frame._exec(args.count(), args) \
|
||||
); \
|
||||
} \
|
||||
static _EngineFunctionDefaultArguments< void (className* object, S32 argc, const char** argv) > _fn ## className ## _ ## name ## DefaultArgs; \
|
||||
static EngineFunctionInfo _fn ## className ## _ ## name ## FunctionInfo( \
|
||||
static _EngineFunctionDefaultArguments< void (className* object, S32 argc, const char** argv) > \
|
||||
_fn ## className ## name ## DefaultArgs; \
|
||||
static EngineFunctionInfo _fn ## className ## name ## FunctionInfo( \
|
||||
#name, \
|
||||
&_SCOPE<>()(), \
|
||||
&_SCOPE< className >()(), \
|
||||
usage, \
|
||||
#returnType " " #name "(SimObject* object, S32 argc, const char** argv)", \
|
||||
"virtual " #returnType " " #name "(Vector<String> args)", \
|
||||
"fn" #className "_" #name, \
|
||||
TYPE< returnType (SimObject* object, S32 argc, const char** argv) >(), \
|
||||
&_fn ## className ## _ ## name ## DefaultArgs, \
|
||||
TYPE< _EngineMethodTrampoline< _ ## className ## name ## frame, returnType (Vector<const char*> vec) >::FunctionType >(), \
|
||||
&_fn ## className ## name ## DefaultArgs, \
|
||||
( void* ) &fn ## className ## _ ## name, \
|
||||
0 \
|
||||
); \
|
||||
returnType cm_##className##_##name##_caster(SimObject* object, S32 argc, ConsoleValueRef* argv) { \
|
||||
AssertFatal( dynamic_cast<className*>( object ), "Object passed to " #name " is not a " #className "!" ); \
|
||||
conmethod_return_##returnType ) _fn ## className ## _ ## name ## impl(static_cast<className*>(object),argc,argv); \
|
||||
_ ## className ## name ## frame frame {}; \
|
||||
frame.object = static_cast< className* >( object ); \
|
||||
conmethod_return_##returnType ) frame._exec(argc,argv); \
|
||||
}; \
|
||||
ConsoleConstructor cc_##className##_##name##_obj(#className,#name,cm_##className##_##name##_caster,usage,minArgs,maxArgs); \
|
||||
static inline returnType _fn ## className ## _ ## name ## impl(className *object, S32 argc, ConsoleValueRef *argv)
|
||||
inline returnType _ ## className ## name ## frame::_exec(S32 argc, ConsoleValueRef *argv) const
|
||||
|
||||
|
||||
|
||||
|
|
@ -951,7 +933,7 @@ public:
|
|||
#define DefineNewEngineFunction( name, returnType, args, defaultArgs, usage ) \
|
||||
static inline returnType _fn ## name ## impl args; \
|
||||
TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## name \
|
||||
( _EngineFunctionTrampoline< returnType args >::FixedArgs a ) \
|
||||
( _EngineFunctionTrampoline< returnType args >::Args a ) \
|
||||
{ \
|
||||
_CHECK_ENGINE_INITIALIZED( name, returnType ); \
|
||||
return EngineTypeTraits< returnType >::ReturnValue( \
|
||||
|
|
@ -998,7 +980,7 @@ public:
|
|||
#define DefineNewEngineStaticMethod( className, name, returnType, args, defaultArgs, usage ) \
|
||||
static inline returnType _fn ## className ## name ## impl args; \
|
||||
TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## className ## _ ## name \
|
||||
( _EngineFunctionTrampoline< returnType args >::FixedArgs a ) \
|
||||
( _EngineFunctionTrampoline< returnType args >::Args a ) \
|
||||
{ \
|
||||
_CHECK_ENGINE_INITIALIZED( className::name, returnType ); \
|
||||
return EngineTypeTraits< returnType >::ReturnValue( \
|
||||
|
|
|
|||
|
|
@ -67,18 +67,9 @@ struct EngineFunctionDefaultArguments
|
|||
/// @warn This is @b NOT the size of the memory block returned by getArgs() and also
|
||||
/// not the number of elements it contains.
|
||||
U32 mNumDefaultArgs;
|
||||
|
||||
/// Return a pointer to the variable-sized array of default argument values.
|
||||
///
|
||||
/// @warn The arguments must be stored @b IMMEDIATELY after #mNumDefaultArgs.
|
||||
/// @warn This is a @b FULL frame and not just the default arguments, i.e. it starts with the
|
||||
/// first argument that the function takes and ends with the last argument it takes.
|
||||
/// @warn If the compiler's #pragma pack is buggy, the elements in this structure are allowed
|
||||
/// to be 4-byte aligned rather than byte-aligned as they should be.
|
||||
const U8* getArgs() const
|
||||
{
|
||||
return ( const U8* ) &( mNumDefaultArgs ) + sizeof( mNumDefaultArgs );
|
||||
}
|
||||
|
||||
U32* mOffsets;
|
||||
U8* mFirst;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -94,22 +85,21 @@ struct EngineFunctionDefaultArguments
|
|||
template< typename T >
|
||||
struct _EngineFunctionDefaultArguments {};
|
||||
|
||||
template<typename ...ArgTs>
|
||||
struct _EngineFunctionDefaultArguments< void(ArgTs...) > : public EngineFunctionDefaultArguments
|
||||
template<typename R, typename ...ArgTs>
|
||||
struct _EngineFunctionDefaultArguments< R(ArgTs...) > : public EngineFunctionDefaultArguments
|
||||
{
|
||||
template<typename T> using DefVST = typename EngineTypeTraits<T>::DefaultArgumentValueStoreType;
|
||||
fixed_tuple<DefVST<ArgTs> ...> mFixedArgs;
|
||||
std::tuple<DefVST<ArgTs> ...> mArgs;
|
||||
using SelfType = _EngineFunctionDefaultArguments< R(ArgTs...) >;
|
||||
fixed_tuple<DefVST<ArgTs>...> mArgs;
|
||||
|
||||
private:
|
||||
using SelfType = _EngineFunctionDefaultArguments< void(ArgTs...) >;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
template<typename ...TailTs, size_t ...I>
|
||||
static void copyHelper(std::tuple<DefVST<ArgTs> ...> &args, std::tuple<DefVST<TailTs> ...> &defaultArgs, Seq<I...>) {
|
||||
static void copyHelper(std::tuple<DefVST<ArgTs> ...> &args, std::tuple<DefVST<TailTs> ...> &defaultArgs, Seq<I...>) {
|
||||
std::tie(std::get<I + (sizeof...(ArgTs) - sizeof...(TailTs))>(args)...) = defaultArgs;
|
||||
}
|
||||
|
||||
|
|
@ -117,26 +107,43 @@ private:
|
|||
template<typename ...TailTs>
|
||||
struct DodgyVCHelper
|
||||
{
|
||||
using type = typename std::enable_if<sizeof...(TailTs) <= sizeof...(ArgTs), decltype(mArgs)>::type;
|
||||
using type = typename std::enable_if<sizeof...(TailTs) <= sizeof...(ArgTs), std::tuple<DefVST<ArgTs>...>>::type;
|
||||
};
|
||||
|
||||
template<typename ...TailTs> using MaybeSelfEnabled = typename DodgyVCHelper<TailTs...>::type;
|
||||
#else
|
||||
template<typename ...TailTs> using MaybeSelfEnabled = typename std::enable_if<sizeof...(TailTs) <= sizeof...(ArgTs), decltype(mArgs)>::type;
|
||||
template<typename ...TailTs> using MaybeSelfEnabled = typename std::enable_if<sizeof...(TailTs) <= sizeof...(ArgTs), std::tuple<DefVST<ArgTs>...>>::type;
|
||||
#endif
|
||||
|
||||
template<typename ...TailTs> static MaybeSelfEnabled<TailTs...> tailInit(TailTs ...tail) {
|
||||
std::tuple<DefVST<ArgTs>...> argsT;
|
||||
std::tuple<DefVST<TailTs>...> tailT = std::make_tuple(tail...);
|
||||
SelfType::copyHelper<TailTs...>(argsT, tailT, typename Gens<sizeof...(TailTs)>::type());
|
||||
SelfType::template copyHelper<TailTs...>(argsT, tailT, typename Gens<sizeof...(TailTs)>::type());
|
||||
return argsT;
|
||||
};
|
||||
|
||||
template<size_t I = 0>
|
||||
typename std::enable_if<I == sizeof...(ArgTs)>::type initOffsetsHelper()
|
||||
{ }
|
||||
|
||||
template<size_t I = 0>
|
||||
typename std::enable_if < I < sizeof...(ArgTs)>::type initOffsetsHelper()
|
||||
{
|
||||
mOffsets[I] = fixed_tuple_offset<I>(mArgs);
|
||||
initOffsetsHelper<I + 1>();
|
||||
}
|
||||
|
||||
public:
|
||||
template<typename ...TailTs> _EngineFunctionDefaultArguments(TailTs ...tail)
|
||||
: EngineFunctionDefaultArguments({sizeof...(TailTs)}), mArgs(SelfType::tailInit(tail...))
|
||||
: EngineFunctionDefaultArguments()
|
||||
{
|
||||
fixed_tuple_mutator<void(DefVST<ArgTs>...), void(DefVST<ArgTs>...)>::copy(mArgs, mFixedArgs);
|
||||
std::tuple<DefVST<ArgTs>...> tmpTup = SelfType::tailInit(tail...);
|
||||
fixed_tuple_mutator<void(DefVST<ArgTs>...), void(DefVST<ArgTs>...)>::copy(tmpTup, mArgs);
|
||||
|
||||
mNumDefaultArgs = sizeof...(TailTs);
|
||||
mOffsets = new U32[sizeof...(ArgTs)];
|
||||
initOffsetsHelper();
|
||||
mFirst = (U8*)& mArgs;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -27,9 +27,23 @@
|
|||
IMPLEMENT_PRIMITIVE( bool, bool,, "Boolean true/false." );
|
||||
IMPLEMENT_PRIMITIVE( S8, byte,, "8bit signed integer." );
|
||||
IMPLEMENT_PRIMITIVE( U8, ubyte,, "8bit unsigned integer." );
|
||||
IMPLEMENT_PRIMITIVE( S16, short,, "16bit signed integer.");
|
||||
IMPLEMENT_PRIMITIVE( U16, ushort,, "16bit unsigned integer.");
|
||||
IMPLEMENT_PRIMITIVE( S32, int,, "32bit signed integer." );
|
||||
IMPLEMENT_PRIMITIVE( U32, uint,, "32bit unsigned integer." );
|
||||
IMPLEMENT_PRIMITIVE( F32, float,, "32bit single-precision floating-point." );
|
||||
IMPLEMENT_PRIMITIVE( F64, double,, "64bit double-precision floating-point." );
|
||||
IMPLEMENT_PRIMITIVE( String, string,, "Null-terminated UTF-16 Unicode string." );
|
||||
IMPLEMENT_PRIMITIVE( const UTF8*, cstring,, "Null-terminated UTF-8 Unicode string.");
|
||||
IMPLEMENT_PRIMITIVE( void*, ptr,, "Opaque pointer." );
|
||||
|
||||
// Define pointer types for vectors.
|
||||
IMPLEMENT_PRIMITIVE( bool*, ptr_bool,, "Pointer to a bool." );
|
||||
IMPLEMENT_PRIMITIVE( U8*, ptr_ubyte,, "Pointer to an unsigned byte." );
|
||||
IMPLEMENT_PRIMITIVE( U32*, ptr_uint,, "Pointer to an unsigned 32bit int." );
|
||||
IMPLEMENT_PRIMITIVE( S32*, ptr_int,, "Pointer to a 32bit int." );
|
||||
IMPLEMENT_PRIMITIVE( F32*, ptr_float,, "Pointer to a 32bit float." );
|
||||
IMPLEMENT_PRIMITIVE( Point3F*, ptr_Point3F,, "Pointer to a Point3F struct." );
|
||||
IMPLEMENT_PRIMITIVE( PlaneF*, ptr_PlaneF,, "Pointer to a PlaneF struct." );
|
||||
IMPLEMENT_PRIMITIVE( PolyhedronData::Edge*, ptr_Edge,, "Pointer to an Edge struct." );
|
||||
IMPLEMENT_PRIMITIVE( const UTF8**, ptr_string,, "Pointer to an UTF-8 string." );
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
#include "console/engineTypes.h"
|
||||
#endif
|
||||
|
||||
#include "math/mPlane.h"
|
||||
#include "math/mPolyhedron.h"
|
||||
|
||||
/// @file
|
||||
/// Definitions for the core primitive types used in the
|
||||
|
|
@ -37,6 +39,8 @@
|
|||
DECLARE_PRIMITIVE_R( bool );
|
||||
DECLARE_PRIMITIVE_R(S8);
|
||||
DECLARE_PRIMITIVE_R(U8);
|
||||
DECLARE_PRIMITIVE_R(S16);
|
||||
DECLARE_PRIMITIVE_R(U16);
|
||||
DECLARE_PRIMITIVE_R(S32);
|
||||
DECLARE_PRIMITIVE_R(U32);
|
||||
DECLARE_PRIMITIVE_R(F32);
|
||||
|
|
@ -45,11 +49,20 @@ DECLARE_PRIMITIVE_R(U64);
|
|||
DECLARE_PRIMITIVE_R(S64);
|
||||
DECLARE_PRIMITIVE_R(void*);
|
||||
|
||||
DECLARE_PRIMITIVE_R(bool*);
|
||||
DECLARE_PRIMITIVE_R(U8*);
|
||||
DECLARE_PRIMITIVE_R(S32*);
|
||||
DECLARE_PRIMITIVE_R(U32*);
|
||||
DECLARE_PRIMITIVE_R(F32*);
|
||||
DECLARE_PRIMITIVE_R(Point3F*);
|
||||
DECLARE_PRIMITIVE_R(PlaneF*);
|
||||
DECLARE_PRIMITIVE_R(PolyhedronData::Edge*);
|
||||
DECLARE_PRIMITIVE_R(const char**);
|
||||
|
||||
//FIXME: this allows String to be used as a struct field type
|
||||
|
||||
// String is special in the way its data is exchanged through the API. Through
|
||||
// calls, strings are passed as plain, null-terminated UTF-16 character strings.
|
||||
// calls, strings are passed as plain, null-terminated UTF-8 character strings.
|
||||
// In addition, strings passed back as return values from engine API functions
|
||||
// are considered to be owned by the API layer itself. The rule here is that such
|
||||
// a string is only valid until the next API call is made. Usually, control layers
|
||||
|
|
@ -58,21 +71,20 @@ _DECLARE_TYPE_R(String);
|
|||
template<>
|
||||
struct EngineTypeTraits< String > : public _EnginePrimitiveTypeTraits< String >
|
||||
{
|
||||
typedef const UTF16* ArgumentValueType;
|
||||
typedef const UTF16* ReturnValueType;
|
||||
typedef const UTF8* ArgumentValueType;
|
||||
typedef const UTF8* ReturnValueType;
|
||||
|
||||
//FIXME: this needs to be sorted out; for now, we store default value literals in ASCII
|
||||
typedef const char* DefaultArgumentValueStoreType;
|
||||
|
||||
static const UTF16* ReturnValue( const String& str )
|
||||
static const UTF8* ReturnValue( const String& str )
|
||||
{
|
||||
static String sTemp;
|
||||
sTemp = str;
|
||||
return sTemp.utf16();
|
||||
return sTemp.utf8();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// For struct fields, String cannot be used directly but "const UTF16*" must be used
|
||||
// instead. Make sure this works with the template machinery by redirecting the type
|
||||
// back to String.
|
||||
|
|
@ -80,4 +92,20 @@ template<> struct EngineTypeTraits< const UTF16* > : public EngineTypeTraits< St
|
|||
template<> inline const EngineTypeInfo* TYPE< const UTF16* >() { return TYPE< String >(); }
|
||||
inline const EngineTypeInfo* TYPE( const UTF16*& ) { return TYPE< String >(); }
|
||||
|
||||
// Temp support for allowing const char* to remain in the API functions as long as we
|
||||
// still have the console system around. When that is purged, these definitions should
|
||||
// be deleted and all const char* uses be replaced with String.
|
||||
_DECLARE_TYPE_R(const UTF8*);
|
||||
template<>
|
||||
struct EngineTypeTraits< const UTF8* > : public _EnginePrimitiveTypeTraits< const UTF8* >
|
||||
{
|
||||
static const UTF8* ReturnValue(const String& str)
|
||||
{
|
||||
static String sTemp;
|
||||
sTemp = str;
|
||||
return sTemp.utf8();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif // !_ENGINEPRIMITIVES_H_
|
||||
|
|
|
|||
|
|
@ -25,32 +25,42 @@
|
|||
#include "core/util/tVector.h"
|
||||
#include "core/util/uuid.h"
|
||||
#include "core/color.h"
|
||||
#include "math/mPolyhedron.h"
|
||||
|
||||
IMPLEMENT_STRUCT(PlaneF,
|
||||
PlaneF, ,
|
||||
"")
|
||||
|
||||
IMPLEMENT_STRUCT( Vector< bool >,
|
||||
BoolVector,,
|
||||
FIELD(x, x, 1, "")
|
||||
FIELD(y, y, 1, "")
|
||||
FIELD(z, z, 1, "")
|
||||
FIELD(d, d, 1, "")
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
|
||||
IMPLEMENT_STRUCT( PolyhedronData::Edge,
|
||||
Edge,,
|
||||
"" )
|
||||
|
||||
FIELD_AS(U32, face, face, 2, "")
|
||||
FIELD_AS(U32, vertex, vertex, 2, "")
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
|
||||
|
||||
IMPLEMENT_STRUCT( Vector< S32 >,
|
||||
IntVector,,
|
||||
"" )
|
||||
IMPLEMENT_STRUCT(Torque::UUID,
|
||||
UUID, ,
|
||||
"")
|
||||
|
||||
Torque::UUIDEngineExport::getAField(),
|
||||
Torque::UUIDEngineExport::getBField(),
|
||||
Torque::UUIDEngineExport::getCField(),
|
||||
Torque::UUIDEngineExport::getDField(),
|
||||
Torque::UUIDEngineExport::getEField(),
|
||||
Torque::UUIDEngineExport::getFField(),
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
|
||||
|
||||
IMPLEMENT_STRUCT( Vector< F32 >,
|
||||
FloatVector,,
|
||||
"" )
|
||||
END_IMPLEMENT_STRUCT;
|
||||
|
||||
|
||||
IMPLEMENT_STRUCT( Torque::UUID,
|
||||
UUID,,
|
||||
"" )
|
||||
END_IMPLEMENT_STRUCT;
|
||||
|
||||
|
||||
IMPLEMENT_STRUCT( ColorI,
|
||||
ColorI,,
|
||||
"RGBA color quadruple in 8bit integer precision per channel." )
|
||||
|
|
@ -73,3 +83,74 @@ IMPLEMENT_STRUCT( LinearColorF,
|
|||
FIELD( alpha, alpha, 1, "Alpha channel value." )
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
|
||||
// Vectors
|
||||
IMPLEMENT_STRUCT( Vector< bool >,
|
||||
BoolVector,,
|
||||
"" )
|
||||
|
||||
VectorFieldEngineExport::getElementCountField< bool >(),
|
||||
VectorFieldEngineExport::getArraySizeField< bool >(),
|
||||
VectorFieldEngineExport::getArrayField< bool >(),
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
|
||||
IMPLEMENT_STRUCT( Vector< S32 >,
|
||||
IntVector,,
|
||||
"" )
|
||||
|
||||
VectorFieldEngineExport::getElementCountField< S32 >(),
|
||||
VectorFieldEngineExport::getArraySizeField< S32 >(),
|
||||
VectorFieldEngineExport::getArrayField< S32 >(),
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
|
||||
IMPLEMENT_STRUCT( Vector< F32 >,
|
||||
FloatVector,,
|
||||
"" )
|
||||
|
||||
VectorFieldEngineExport::getElementCountField< F32 >(),
|
||||
VectorFieldEngineExport::getArraySizeField< F32 >(),
|
||||
VectorFieldEngineExport::getArrayField< F32 >(),
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
|
||||
IMPLEMENT_STRUCT( Vector< Point3F >,
|
||||
Point3FVector,,
|
||||
"" )
|
||||
|
||||
VectorFieldEngineExport::getElementCountField< Point3F >(),
|
||||
VectorFieldEngineExport::getArraySizeField< Point3F >(),
|
||||
VectorFieldEngineExport::getArrayField< Point3F >(),
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
|
||||
IMPLEMENT_STRUCT(Vector< PlaneF >,
|
||||
PlaneFVector, ,
|
||||
"")
|
||||
|
||||
VectorFieldEngineExport::getElementCountField< PlaneF >(),
|
||||
VectorFieldEngineExport::getArraySizeField< PlaneF >(),
|
||||
VectorFieldEngineExport::getArrayField< PlaneF >(),
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
|
||||
IMPLEMENT_STRUCT(Vector< PolyhedronData::Edge >,
|
||||
EdgeVector, ,
|
||||
"")
|
||||
|
||||
VectorFieldEngineExport::getElementCountField< PolyhedronData::Edge >(),
|
||||
VectorFieldEngineExport::getArraySizeField< PolyhedronData::Edge >(),
|
||||
VectorFieldEngineExport::getArrayField< PolyhedronData::Edge >(),
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
|
||||
IMPLEMENT_STRUCT(Vector< const char* >,
|
||||
StringVector, ,
|
||||
"")
|
||||
|
||||
VectorFieldEngineExport::getElementCountField< const char* >(),
|
||||
VectorFieldEngineExport::getArraySizeField< const char* >(),
|
||||
VectorFieldEngineExport::getArrayField< const char* >(),
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
#include "console/engineTypes.h"
|
||||
#endif
|
||||
|
||||
#include "math/mPlane.h"
|
||||
#include "math/mPolyhedron.h"
|
||||
|
||||
/// @file
|
||||
/// Definitions for the core engine structured types.
|
||||
|
|
@ -44,6 +46,12 @@ class LinearColorF;
|
|||
DECLARE_STRUCT_R(Vector< bool >);
|
||||
DECLARE_STRUCT_R(Vector< S32 >);
|
||||
DECLARE_STRUCT_R(Vector< F32 >);
|
||||
DECLARE_STRUCT_R(Vector< Point3F >);
|
||||
DECLARE_STRUCT_R(PlaneF);
|
||||
DECLARE_STRUCT_R(Vector< PlaneF >);
|
||||
DECLARE_STRUCT_R(PolyhedronData::Edge);
|
||||
DECLARE_STRUCT_R(Vector< PolyhedronData::Edge >);
|
||||
DECLARE_STRUCT_R(Vector< const char* >);
|
||||
DECLARE_STRUCT_R(Torque::UUID);
|
||||
DECLARE_STRUCT_R(ColorI);
|
||||
DECLARE_STRUCT_R(LinearColorF);
|
||||
|
|
|
|||
|
|
@ -240,12 +240,12 @@ struct _EngineStructTypeTraits
|
|||
typedef void SuperType;
|
||||
|
||||
// Structs get passed in as pointers and passed out as full copies.
|
||||
typedef T ArgumentValueType;
|
||||
typedef T* ArgumentValueType;
|
||||
typedef T ReturnValueType;
|
||||
typedef T DefaultArgumentValueStoreType;
|
||||
|
||||
typedef ReturnValueType ReturnValue;
|
||||
static ValueType ArgumentToValue( ArgumentValueType val ) { return val; }
|
||||
static ValueType ArgumentToValue( ArgumentValueType val ) { return *val; }
|
||||
|
||||
static const EngineTypeInfo* const TYPEINFO;
|
||||
};
|
||||
|
|
@ -564,12 +564,18 @@ namespace _Private {
|
|||
|
||||
|
||||
///
|
||||
#define _FIELD( fieldName, exportName, numElements, doc ) \
|
||||
{ #exportName, doc, numElements, TYPE( ( ( ThisType* ) 16 )->fieldName ), (U32)FIELDOFFSET( fieldName ) } // Artificial offset to avoid compiler warnings.
|
||||
|
||||
#define FIELD( fieldName, exportName, numElements, doc ) \
|
||||
{ #exportName, doc, numElements, TYPE( ( ( ThisType* ) 16 )->fieldName ), (U32)FIELDOFFSET( fieldName ) }, // Artificial offset to avoid compiler warnings.
|
||||
_FIELD(fieldName, exportName, numElements, doc),
|
||||
|
||||
///
|
||||
#define _FIELD_AS( type, fieldName, exportName, numElements, doc ) \
|
||||
{ #exportName, doc, numElements, TYPE( *( ( type* ) &( ( ThisType* ) 16 )->fieldName ) ), (U32)FIELDOFFSET( fieldName ) } // Artificial offset to avoid compiler warnings.
|
||||
|
||||
#define FIELD_AS( type, fieldName, exportName, numElements, doc ) \
|
||||
{ #exportName, doc, numElements, TYPE( *( ( type* ) &( ( ThisType* ) 16 )->fieldName ) ), (U32)FIELDOFFSET( fieldName ) }, // Artificial offset to avoid compiler warnings.
|
||||
_FIELD_AS(type, fieldName, exportName, numElements, doc),
|
||||
|
||||
///
|
||||
#define FIELDOFFSET( fieldName ) \
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ static const char* getDocString(const EngineExport* exportInfo)
|
|||
}
|
||||
|
||||
template< typename T >
|
||||
inline T getArgValue(const EngineFunctionDefaultArguments* defaultArgs, U32 offset)
|
||||
inline T getArgValue(const EngineFunctionDefaultArguments* defaultArgs, U32 idx)
|
||||
{
|
||||
return *reinterpret_cast< const T* >(defaultArgs->getArgs() + offset);
|
||||
return *(const T*)(defaultArgs->mFirst + defaultArgs->mOffsets[idx]);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ static Vector< String > parseFunctionArgumentNames(const EngineFunctionInfo* fun
|
|||
// Parse out name.
|
||||
|
||||
const char* end = ptr + 1;
|
||||
while (ptr > prototype && dIsalnum(*ptr))
|
||||
while (ptr > prototype && (dIsalnum(*ptr) || *ptr == '_'))
|
||||
ptr--;
|
||||
const char* start = ptr + 1;
|
||||
|
||||
|
|
@ -169,20 +169,19 @@ static Vector< String > parseFunctionArgumentNames(const EngineFunctionInfo* fun
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static String getDefaultArgumentValue(const EngineFunctionInfo* function, const EngineTypeInfo* type, U32 offset)
|
||||
static String getValueForType(const EngineTypeInfo* type, void* addr)
|
||||
{
|
||||
String value;
|
||||
const EngineFunctionDefaultArguments* defaultArgs = function->getDefaultArguments();
|
||||
#define ADDRESS_TO_TYPE(tp) *(const tp*)(addr);
|
||||
|
||||
switch (type->getTypeKind())
|
||||
{
|
||||
case EngineTypeKindPrimitive:
|
||||
{
|
||||
#define PRIMTYPE( tp ) \
|
||||
#define PRIMTYPE( tp ) \
|
||||
if( TYPE< tp >() == type ) \
|
||||
{ \
|
||||
tp val = getArgValue< tp >( defaultArgs, offset ); \
|
||||
tp val = ADDRESS_TO_TYPE(tp); \
|
||||
value = String::ToString( val ); \
|
||||
}
|
||||
|
||||
|
|
@ -195,9 +194,9 @@ static String getDefaultArgumentValue(const EngineFunctionInfo* function, const
|
|||
PRIMTYPE(F64);
|
||||
|
||||
//TODO: for now we store string literals in ASCII; needs to be sorted out
|
||||
if (TYPE< const char* >() == type)
|
||||
if (TYPE< String >() == type || TYPE< const UTF8* >() == type)
|
||||
{
|
||||
const char* val = reinterpret_cast<const char*>(defaultArgs->getArgs() + offset);
|
||||
const UTF8* val = *((const UTF8**)(addr));
|
||||
value = val;
|
||||
}
|
||||
|
||||
|
|
@ -207,7 +206,7 @@ static String getDefaultArgumentValue(const EngineFunctionInfo* function, const
|
|||
|
||||
case EngineTypeKindEnum:
|
||||
{
|
||||
S32 val = getArgValue< S32 >(defaultArgs, offset);
|
||||
S32 val = ADDRESS_TO_TYPE(S32);
|
||||
AssertFatal(type->getEnumTable(), "engineXMLExport - Enum type without table!");
|
||||
|
||||
const EngineEnumTable& table = *(type->getEnumTable());
|
||||
|
|
@ -225,7 +224,7 @@ static String getDefaultArgumentValue(const EngineFunctionInfo* function, const
|
|||
|
||||
case EngineTypeKindBitfield:
|
||||
{
|
||||
S32 val = getArgValue< S32 >(defaultArgs, offset);
|
||||
S32 val = ADDRESS_TO_TYPE(S32);
|
||||
AssertFatal(type->getEnumTable(), "engineXMLExport - Bitfield type without table!");
|
||||
|
||||
const EngineEnumTable& table = *(type->getEnumTable());
|
||||
|
|
@ -247,7 +246,28 @@ static String getDefaultArgumentValue(const EngineFunctionInfo* function, const
|
|||
|
||||
case EngineTypeKindStruct:
|
||||
{
|
||||
//TODO: struct type default argument values
|
||||
AssertFatal(type->getFieldTable(), "engineXMLExport - Struct type without table!");
|
||||
const EngineFieldTable* fieldTable = type->getFieldTable();
|
||||
U32 numFields = fieldTable->getNumFields();
|
||||
|
||||
|
||||
for (int i = 0; i < numFields; ++i)
|
||||
{
|
||||
const EngineTypeInfo* fieldType = (*fieldTable)[i].getType();
|
||||
U32 fieldOffset = (*fieldTable)[i].getOffset();
|
||||
U32 numElements = (*fieldTable)[i].getNumElements();
|
||||
|
||||
for (int j = 0; j < numElements; ++j)
|
||||
{
|
||||
if (i == 0 && j == 0) {
|
||||
value = getValueForType(fieldType, (void*)((size_t)addr + fieldOffset));
|
||||
}
|
||||
else {
|
||||
value += " " + getValueForType(fieldType, (void*)((size_t)addr + (size_t)fieldOffset * ((size_t)j * fieldType->getInstanceSize())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -257,7 +277,7 @@ static String getDefaultArgumentValue(const EngineFunctionInfo* function, const
|
|||
// For these two kinds, we support "null" as the only valid
|
||||
// default value.
|
||||
|
||||
const void* ptr = getArgValue< const void* >(defaultArgs, offset);
|
||||
const void* ptr = ADDRESS_TO_TYPE(void*);
|
||||
if (!ptr)
|
||||
value = "null";
|
||||
break;
|
||||
|
|
@ -267,11 +287,20 @@ static String getDefaultArgumentValue(const EngineFunctionInfo* function, const
|
|||
break;
|
||||
}
|
||||
|
||||
#undef ADDRESS_TO_TYPE
|
||||
return value;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static String getDefaultArgumentValue(const EngineFunctionInfo* function, const EngineTypeInfo* type, U32 idx)
|
||||
{
|
||||
const EngineFunctionDefaultArguments* defaultArgs = function->getDefaultArguments();
|
||||
return getValueForType(type, (void*)(defaultArgs->mFirst + defaultArgs->mOffsets[idx]));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void exportFunction(const EngineFunctionInfo* function, SimXMLDocument* xml)
|
||||
{
|
||||
if (isExportFiltered(function))
|
||||
|
|
@ -295,9 +324,6 @@ static void exportFunction(const EngineFunctionInfo* function, SimXMLDocument* x
|
|||
Vector< String > argumentNames = parseFunctionArgumentNames(function);
|
||||
const U32 numArgumentNames = argumentNames.size();
|
||||
|
||||
// Accumulated offset in function argument frame vector.
|
||||
U32 argFrameOffset = 0;
|
||||
|
||||
for (U32 i = 0; i < numArguments; ++i)
|
||||
{
|
||||
xml->pushNewElement("EngineFunctionArgument");
|
||||
|
|
@ -313,21 +339,17 @@ static void exportFunction(const EngineFunctionInfo* function, SimXMLDocument* x
|
|||
|
||||
if (i >= firstDefaultArg)
|
||||
{
|
||||
String defaultValue = getDefaultArgumentValue(function, type, argFrameOffset);
|
||||
String defaultValue = getDefaultArgumentValue(function, type, i);
|
||||
xml->setAttribute("defaultValue", defaultValue);
|
||||
}
|
||||
|
||||
// A bit hacky, default arguments have all offsets.
|
||||
if (function->getDefaultArguments() != NULL)
|
||||
{
|
||||
xml->setAttribute("offset", String::ToString(function->getDefaultArguments()->mOffsets[i]));
|
||||
}
|
||||
|
||||
xml->popElement();
|
||||
|
||||
if (type->getTypeKind() == EngineTypeKindStruct)
|
||||
argFrameOffset += type->getInstanceSize();
|
||||
else
|
||||
argFrameOffset += type->getValueSize();
|
||||
|
||||
#ifdef _PACK_BUG_WORKAROUNDS
|
||||
if (argFrameOffset % 4 > 0)
|
||||
argFrameOffset += 4 - (argFrameOffset % 4);
|
||||
#endif
|
||||
}
|
||||
|
||||
xml->popElement();
|
||||
|
|
@ -492,7 +514,12 @@ static void exportType(const EngineTypeInfo* type, SimXMLDocument* xml)
|
|||
ConsoleBaseType *cbt = ConsoleBaseType::getType(property.getType());
|
||||
if (cbt != NULL)
|
||||
{
|
||||
xml->setAttribute("type", cbt->getTypeClassName());
|
||||
if (cbt->getTypeInfo() != NULL) {
|
||||
xml->setAttribute("type", cbt->getTypeInfo()->getTypeName());
|
||||
}
|
||||
else {
|
||||
xml->setAttribute("type", cbt->getTypeClassName());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -554,6 +581,7 @@ static void exportScope(const EngineExportScope* scope, SimXMLDocument* xml, boo
|
|||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(true, "Unknown EngineExportKind: " + exportInfo->getExportKind());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -579,4 +607,4 @@ DefineEngineFunction(exportEngineAPIToXML, SimXMLDocument*, (), ,
|
|||
exportScope(EngineExportScope::getGlobalScope(), xml, true);
|
||||
|
||||
return xml;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@
|
|||
|
||||
#ifndef _FIXEDTUPLE_H_
|
||||
#define _FIXEDTUPLE_H_
|
||||
|
||||
#include "engineTypes.h"
|
||||
|
||||
/// @name Fixed-layout tuple definition
|
||||
/// These structs and templates serve as a way to pass arguments from external
|
||||
/// applications and into the T3D console system.
|
||||
|
|
@ -113,6 +116,21 @@ struct fixed_tuple_accessor<0>
|
|||
}
|
||||
};
|
||||
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4267 )
|
||||
template <size_t I, class... Ts>
|
||||
static U32 fixed_tuple_offset(fixed_tuple<Ts...>& t)
|
||||
{
|
||||
return (U32)((size_t)& fixed_tuple_accessor<I>::get(t)) - ((size_t)& t);
|
||||
}
|
||||
|
||||
template <size_t I, class... Ts>
|
||||
static U32 fixed_tuple_offset(const fixed_tuple<Ts...>& t)
|
||||
{
|
||||
return (U32)((size_t)& fixed_tuple_accessor<I>::get(t)) - ((size_t)& t);
|
||||
}
|
||||
#pragma warning(pop)
|
||||
|
||||
template< typename T1, typename T2 >
|
||||
struct fixed_tuple_mutator {};
|
||||
|
||||
|
|
@ -150,4 +168,4 @@ struct fixed_tuple_mutator<void(Tdest...), void(Tsrc...)>
|
|||
/// @}
|
||||
|
||||
|
||||
#endif // !_FIXEDTUPLE_H_
|
||||
#endif // !_FIXEDTUPLE_H_
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
#include "persistence/taml/tamlCustom.h"
|
||||
|
||||
#include "sim/netObject.h"
|
||||
#include "cinterface/cinterface.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT( SimObject );
|
||||
|
||||
|
|
@ -831,6 +832,10 @@ bool SimObject::isMethod( const char* methodName )
|
|||
if( !methodName || !methodName[0] )
|
||||
return false;
|
||||
|
||||
if (CInterface::isMethod(this->getName(), methodName) || CInterface::isMethod(this->getClassName(), methodName)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
StringTableEntry stname = StringTable->insert( methodName );
|
||||
|
||||
if( getNamespace() )
|
||||
|
|
|
|||
|
|
@ -24,16 +24,26 @@
|
|||
#include "console/simObject.h"
|
||||
#include "core/util/tDictionary.h"
|
||||
#include "core/util/safeDelete.h"
|
||||
#include "engineAPI.h"
|
||||
|
||||
|
||||
//#define DEBUG_SPEW
|
||||
|
||||
IMPLEMENT_CLASS(SimPersistID, "")
|
||||
END_IMPLEMENT_CLASS;
|
||||
|
||||
SimPersistID::LookupTableType* SimPersistID::smLookupTable;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
SimPersistID::SimPersistID()
|
||||
{
|
||||
mObject = NULL;
|
||||
mUUID.generate();
|
||||
smLookupTable->insertUnique(mUUID, this);
|
||||
}
|
||||
|
||||
SimPersistID::SimPersistID( SimObject* object )
|
||||
: mObject( object )
|
||||
{
|
||||
|
|
@ -136,3 +146,13 @@ SimPersistID* SimPersistID::findOrCreate( const Torque::UUID& uuid )
|
|||
|
||||
return pid;
|
||||
}
|
||||
|
||||
DefineNewEngineMethod(SimPersistID, getUUID, Torque::UUID, (), , "")
|
||||
{
|
||||
return object->getUUID();
|
||||
}
|
||||
|
||||
DefineNewEngineMethod(SimPersistID, getObject, SimObject*, (), , "")
|
||||
{
|
||||
return object->getObject();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@
|
|||
#include "core/util/refBase.h"
|
||||
#endif
|
||||
|
||||
#ifndef _ENGINEOBJECT_H_
|
||||
#include "console/engineObject.h"
|
||||
#endif
|
||||
|
||||
/// @file
|
||||
/// Persistent IDs for SimObjects.
|
||||
|
|
@ -40,12 +43,27 @@ template< typename, typename > class HashTable;
|
|||
|
||||
|
||||
/// A globally unique persistent ID for a SimObject.
|
||||
class SimPersistID : public StrongRefBase
|
||||
class SimPersistID : public EngineObject
|
||||
{
|
||||
public:
|
||||
DECLARE_CLASS(SimPersistID, EngineObject);
|
||||
|
||||
typedef void Parent;
|
||||
friend class SimObject;
|
||||
|
||||
///
|
||||
SimPersistID();
|
||||
|
||||
/// Construct a new persistent ID for "object" by generating a fresh
|
||||
/// unique identifier.
|
||||
SimPersistID(SimObject* object);
|
||||
|
||||
/// Construct a persistent ID stub for the given unique identifier.
|
||||
/// The stub remains not bound to any object until it is resolved.
|
||||
SimPersistID(const Torque::UUID& uuid);
|
||||
|
||||
///
|
||||
~SimPersistID();
|
||||
|
||||
protected:
|
||||
|
||||
|
|
@ -60,17 +78,6 @@ class SimPersistID : public StrongRefBase
|
|||
|
||||
/// Table of persistent object IDs.
|
||||
static LookupTableType* smLookupTable;
|
||||
|
||||
/// Construct a new persistent ID for "object" by generating a fresh
|
||||
/// unique identifier.
|
||||
SimPersistID( SimObject* object );
|
||||
|
||||
/// Construct a persistent ID stub for the given unique identifier.
|
||||
/// The stub remains not bound to any object until it is resolved.
|
||||
SimPersistID( const Torque::UUID& uuid );
|
||||
|
||||
///
|
||||
~SimPersistID();
|
||||
|
||||
/// Bind this unresolved PID to the given object.
|
||||
void resolve( SimObject* object );
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
#include "math/mMathFn.h"
|
||||
|
||||
|
||||
IMPLEMENT_CONOBJECT( SimSet );
|
||||
IMPLEMENT_CONOBJECT_CHILDREN( SimSet );
|
||||
IMPLEMENT_CONOBJECT( SimGroup );
|
||||
|
||||
ConsoleDocClass( SimSet,
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ class SimSet : public SimObject, public TamlChildren
|
|||
public:
|
||||
|
||||
typedef SimObject Parent;
|
||||
typedef SimObject Children;
|
||||
|
||||
enum SetModification
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@
|
|||
#include "platform/platform.h"
|
||||
#endif
|
||||
#include <algorithm>
|
||||
#include "console/engineTypes.h"
|
||||
#include "console/engineTypeInfo.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helper definitions for the vector class.
|
||||
|
|
@ -63,6 +65,7 @@ extern bool VectorResize(U32 *aSize, U32 *aCount, void **arrayPtr, U32 newCount,
|
|||
template<class T>
|
||||
class Vector
|
||||
{
|
||||
friend class VectorFieldEngineExport;
|
||||
protected:
|
||||
U32 mElementCount; ///< Number of elements currently in the Vector.
|
||||
U32 mArraySize; ///< Number of elements allocated for the Vector.
|
||||
|
|
@ -188,6 +191,29 @@ class Vector
|
|||
/// @}
|
||||
};
|
||||
|
||||
class VectorFieldEngineExport
|
||||
{
|
||||
public:
|
||||
template <class T>
|
||||
static EngineFieldTable::Field getElementCountField()
|
||||
{
|
||||
typedef Vector<T> ThisType;
|
||||
return _FIELD(mElementCount, elementCount, 1, "");
|
||||
};
|
||||
template <class T>
|
||||
static EngineFieldTable::Field getArraySizeField()
|
||||
{
|
||||
typedef Vector<T> ThisType;
|
||||
return _FIELD(mArraySize, arraySize, 1, "");
|
||||
};
|
||||
template <class T>
|
||||
static EngineFieldTable::Field getArrayField()
|
||||
{
|
||||
typedef Vector<T> ThisType;
|
||||
return _FIELD(mArray, array, 1, "");
|
||||
};
|
||||
};
|
||||
|
||||
template<class T> inline Vector<T>::~Vector()
|
||||
{
|
||||
clear();
|
||||
|
|
@ -966,7 +992,7 @@ public:
|
|||
};
|
||||
|
||||
// Include vector specializations
|
||||
#ifndef _VECTORSPEC_H_
|
||||
#ifndef _TVECTORSPEC_H_
|
||||
#include "core/util/tVectorSpecializations.h"
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
#include <ctype.h>
|
||||
|
||||
#include "core/util/md5.h"
|
||||
#include "console/enginePrimitives.h"
|
||||
|
||||
#if defined (TORQUE_OS_MAC) && defined(TORQUE_CPU_X64)
|
||||
typedef unsigned int unsigned32;
|
||||
|
|
@ -451,3 +452,42 @@ namespace Torque
|
|||
return ( a + b + c + d + e + f[ 0 ] + f[ 1 ] + f[ 2 ] + f[ 3 ] + f[ 4 ] + f[ 5 ] );
|
||||
}
|
||||
}
|
||||
|
||||
EngineFieldTable::Field Torque::UUIDEngineExport::getAField()
|
||||
{
|
||||
typedef UUID ThisType;
|
||||
return _FIELD(a, a, 1, "");
|
||||
}
|
||||
|
||||
EngineFieldTable::Field Torque::UUIDEngineExport::getBField()
|
||||
{
|
||||
typedef UUID ThisType;
|
||||
return _FIELD(b, b, 1, "");
|
||||
}
|
||||
|
||||
EngineFieldTable::Field Torque::UUIDEngineExport::getCField()
|
||||
{
|
||||
typedef UUID ThisType;
|
||||
return _FIELD(c, c, 1, "");
|
||||
}
|
||||
|
||||
EngineFieldTable::Field Torque::UUIDEngineExport::getDField()
|
||||
{
|
||||
typedef UUID ThisType;
|
||||
return _FIELD(d, d, 1, "");
|
||||
}
|
||||
|
||||
EngineFieldTable::Field Torque::UUIDEngineExport::getEField()
|
||||
{
|
||||
typedef UUID ThisType;
|
||||
return _FIELD(e, e, 1, "");
|
||||
}
|
||||
|
||||
EngineFieldTable::Field Torque::UUIDEngineExport::getFField()
|
||||
{
|
||||
typedef UUID ThisType;
|
||||
return _FIELD_AS(U8, f, f, 6, "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#ifndef _PLATFORM_H_
|
||||
#include "platform/platform.h"
|
||||
#endif
|
||||
#include "console/engineTypeInfo.h"
|
||||
|
||||
|
||||
namespace Torque
|
||||
|
|
@ -33,6 +34,7 @@ namespace Torque
|
|||
/// A universally unique identifier.
|
||||
class UUID
|
||||
{
|
||||
friend class UUIDEngineExport;
|
||||
public:
|
||||
|
||||
typedef void Parent;
|
||||
|
|
@ -81,6 +83,17 @@ namespace Torque
|
|||
return !( *this == uuid );
|
||||
}
|
||||
};
|
||||
|
||||
class UUIDEngineExport
|
||||
{
|
||||
public:
|
||||
static EngineFieldTable::Field getAField();
|
||||
static EngineFieldTable::Field getBField();
|
||||
static EngineFieldTable::Field getCField();
|
||||
static EngineFieldTable::Field getDField();
|
||||
static EngineFieldTable::Field getEField();
|
||||
static EngineFieldTable::Field getFField();
|
||||
};
|
||||
}
|
||||
|
||||
namespace DictHash
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ class GFont;
|
|||
///
|
||||
class DebugDrawer : public SimObject
|
||||
{
|
||||
typedef SimObject Parent;
|
||||
public:
|
||||
DECLARE_CONOBJECT(DebugDrawer);
|
||||
|
||||
|
|
@ -162,8 +163,6 @@ public:
|
|||
|
||||
/// @}
|
||||
private:
|
||||
typedef SimObject Parent;
|
||||
|
||||
static DebugDrawer* sgDebugDrawer;
|
||||
|
||||
struct DebugPrim
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
//#define DEBUG_SPEW
|
||||
|
||||
|
||||
IMPLEMENT_CONOBJECT( GuiControl );
|
||||
IMPLEMENT_CONOBJECT_CHILDREN( GuiControl );
|
||||
|
||||
ConsoleDocClass( GuiControl,
|
||||
"@brief Base class for all Gui control objects.\n\n"
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ class GuiControl : public SimGroup
|
|||
public:
|
||||
|
||||
typedef SimGroup Parent;
|
||||
typedef GuiControl Children;
|
||||
|
||||
friend class GuiWindowCtrl; // mCollapseGroupVec
|
||||
friend class GuiCanvas;
|
||||
|
|
|
|||
|
|
@ -69,13 +69,13 @@ void GuiScriptNotifyCtrl::initPersistFields()
|
|||
{
|
||||
// Callbacks Group
|
||||
addGroup("Callbacks");
|
||||
addField("onChildAdded", TypeBool, Offset( mOnChildAdded, GuiScriptNotifyCtrl ), "Enables/disables onChildAdded callback" );
|
||||
addField("onChildRemoved", TypeBool, Offset( mOnChildRemoved, GuiScriptNotifyCtrl ), "Enables/disables onChildRemoved callback" );
|
||||
addField("onChildResized", TypeBool, Offset( mOnChildResized, GuiScriptNotifyCtrl ), "Enables/disables onChildResized callback" );
|
||||
addField("onParentResized", TypeBool, Offset( mOnParentResized, GuiScriptNotifyCtrl ), "Enables/disables onParentResized callback" );
|
||||
addField("onResize", TypeBool, Offset( mOnResize, GuiScriptNotifyCtrl ), "Enables/disables onResize callback" );
|
||||
addField("onLoseFirstResponder", TypeBool, Offset( mOnLoseFirstResponder, GuiScriptNotifyCtrl ), "Enables/disables onLoseFirstResponder callback" );
|
||||
addField("onGainFirstResponder", TypeBool, Offset( mOnGainFirstResponder, GuiScriptNotifyCtrl ), "Enables/disables onGainFirstResponder callback" );
|
||||
addField("notifyOnChildAdded", TypeBool, Offset( mOnChildAdded, GuiScriptNotifyCtrl ), "Enables/disables onChildAdded callback" );
|
||||
addField("notifyOnChildRemoved", TypeBool, Offset( mOnChildRemoved, GuiScriptNotifyCtrl ), "Enables/disables onChildRemoved callback" );
|
||||
addField("notifyOnChildResized", TypeBool, Offset( mOnChildResized, GuiScriptNotifyCtrl ), "Enables/disables onChildResized callback" );
|
||||
addField("notifyOnParentResized", TypeBool, Offset( mOnParentResized, GuiScriptNotifyCtrl ), "Enables/disables onParentResized callback" );
|
||||
addField("notifyOnResize", TypeBool, Offset( mOnResize, GuiScriptNotifyCtrl ), "Enables/disables onResize callback" );
|
||||
addField("notifyOnLoseFirstResponder", TypeBool, Offset( mOnLoseFirstResponder, GuiScriptNotifyCtrl ), "Enables/disables onLoseFirstResponder callback" );
|
||||
addField("notifyOnGainFirstResponder", TypeBool, Offset( mOnGainFirstResponder, GuiScriptNotifyCtrl ), "Enables/disables onGainFirstResponder callback" );
|
||||
endGroup("Callbacks");
|
||||
|
||||
Parent::initPersistFields();
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ DefineEngineStringlyVariadicMethod( GuiFilterCtrl, setValue, void, 3, 20, "(f1,
|
|||
object->set(filter);
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiFilterCtrl, identity, void, (), , "Reset the filtering."
|
||||
DefineEngineMethod( GuiFilterCtrl, resetFiltering, void, (), , "Reset the filtering."
|
||||
"@internal")
|
||||
{
|
||||
object->identity();
|
||||
|
|
|
|||
|
|
@ -306,8 +306,6 @@ void Material::initPersistFields()
|
|||
addField("metalChan", TypeF32, Offset(mMetalChan, Material), MAX_STAGES,
|
||||
"The input channel metalness maps use.");
|
||||
|
||||
addField("glowMul", TypeF32, Offset(mGlowMul, Material), MAX_STAGES,
|
||||
"The input channel metalness maps use.");
|
||||
addField("glow", TypeBool, Offset(mGlow, Material), MAX_STAGES,
|
||||
"Enables rendering as glowing.");
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#include "math/mMatrix.h"
|
||||
#include "console/console.h"
|
||||
|
||||
#include "console/enginePrimitives.h"
|
||||
#include "console/engineTypes.h"
|
||||
|
||||
const MatrixF MatrixF::Identity( true );
|
||||
|
||||
|
|
@ -192,4 +194,10 @@ void MatrixF::dumpMatrix(const char *caption /* =NULL */) const
|
|||
Con::printf("%s | %-8.4f %-8.4f %-8.4f %-8.4f |", spacerRef, m[idx(1,0)], m[idx(1, 1)], m[idx(1, 2)], m[idx(1, 3)]);
|
||||
Con::printf("%s | %-8.4f %-8.4f %-8.4f %-8.4f |", spacerRef, m[idx(2,0)], m[idx(2, 1)], m[idx(2, 2)], m[idx(2, 3)]);
|
||||
Con::printf("%s | %-8.4f %-8.4f %-8.4f %-8.4f |", spacerRef, m[idx(3,0)], m[idx(3, 1)], m[idx(3, 2)], m[idx(3, 3)]);
|
||||
}
|
||||
}
|
||||
|
||||
EngineFieldTable::Field MatrixFEngineExport::getMatrixField()
|
||||
{
|
||||
typedef MatrixF ThisType;
|
||||
return _FIELD_AS(F32, m, m, 16, "");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,12 +35,18 @@
|
|||
#include "math/mPoint4.h"
|
||||
#endif
|
||||
|
||||
#ifndef _ENGINETYPEINFO_H_
|
||||
#include "console/engineTypeInfo.h"
|
||||
#endif
|
||||
|
||||
|
||||
/// 4x4 Matrix Class
|
||||
///
|
||||
/// This runs at F32 precision.
|
||||
|
||||
class MatrixF
|
||||
{
|
||||
friend class MatrixFEngineExport;
|
||||
private:
|
||||
F32 m[16]; ///< Note: Torque uses row-major matrices
|
||||
|
||||
|
|
@ -224,6 +230,12 @@ public:
|
|||
const static MatrixF Identity;
|
||||
};
|
||||
|
||||
class MatrixFEngineExport
|
||||
{
|
||||
public:
|
||||
static EngineFieldTable::Field getMatrixField();
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------
|
||||
// Inline Functions
|
||||
|
|
|
|||
|
|
@ -88,30 +88,59 @@ END_IMPLEMENT_STRUCT;
|
|||
IMPLEMENT_STRUCT( RectI,
|
||||
RectI, MathTypes,
|
||||
"" )
|
||||
|
||||
FIELD( point, point, 1, "The XY coordinate of the Rect." )
|
||||
FIELD( extent, extent, 1, "The width and height of the Rect." )
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
IMPLEMENT_STRUCT( RectF,
|
||||
RectF, MathTypes,
|
||||
"" )
|
||||
|
||||
FIELD( point, point, 1, "The XY coordinate of the Rect.")
|
||||
FIELD( extent, extent, 1, "The width and height of the Rect.")
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
IMPLEMENT_STRUCT( MatrixF,
|
||||
MatrixF, MathTypes,
|
||||
"" )
|
||||
|
||||
MatrixFEngineExport::getMatrixField(),
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
IMPLEMENT_STRUCT( AngAxisF,
|
||||
AngAxisF, MathTypes,
|
||||
"" )
|
||||
|
||||
FIELD( axis, axis, 1, "")
|
||||
FIELD( angle, angle, 1, "")
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
IMPLEMENT_STRUCT( TransformF,
|
||||
TransformF, MathTypes,
|
||||
"" )
|
||||
|
||||
FIELD(mPosition, position, 1, "")
|
||||
FIELD(mOrientation, orientation, 1, "")
|
||||
FIELD(mHasRotation, hasRotation, 1, "")
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
IMPLEMENT_STRUCT( Box3F,
|
||||
Box3F, MathTypes,
|
||||
"" )
|
||||
|
||||
FIELD(minExtents, minExtents, 1, "Minimum extents of box")
|
||||
FIELD(maxExtents, maxExtents, 1, "Maximum extents of box")
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
IMPLEMENT_STRUCT( EaseF,
|
||||
EaseF, MathTypes,
|
||||
"" )
|
||||
|
||||
FIELD(mDir, dir, 1, "inout, in, out")
|
||||
FIELD(mType, type, 1, "linear, etc...")
|
||||
FIELD_AS(F32, mParam, param, 2, "optional params")
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
IMPLEMENT_STRUCT(RotationF,
|
||||
RotationF, MathTypes,
|
||||
|
|
@ -347,7 +376,7 @@ ConsoleSetType( TypeMatrixF )
|
|||
//-----------------------------------------------------------------------------
|
||||
// TypeMatrixPosition
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsoleType(MatrixPosition, TypeMatrixPosition, MatrixF, "")
|
||||
ConsoleMappedType(MatrixPosition, TypeMatrixPosition, Point3F, MatrixF, "")
|
||||
|
||||
ConsoleGetType( TypeMatrixPosition )
|
||||
{
|
||||
|
|
@ -382,7 +411,7 @@ ConsoleSetType( TypeMatrixPosition )
|
|||
//-----------------------------------------------------------------------------
|
||||
// TypeMatrixRotation
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsoleType(MatrixRotation, TypeMatrixRotation, MatrixF, "")
|
||||
ConsoleMappedType(MatrixRotation, TypeMatrixRotation, AngAxisF, MatrixF, "")
|
||||
|
||||
ConsoleGetType( TypeMatrixRotation )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -82,8 +82,6 @@ void ModuleDefinition::initPersistFields()
|
|||
// Call parent.
|
||||
Parent::initPersistFields();
|
||||
|
||||
addProtectedField("ModuleId", TypeString, Offset(mModuleId, ModuleDefinition), &defaultProtectedSetFn, &defaultProtectedGetFn, "");
|
||||
|
||||
/// Module configuration.
|
||||
addProtectedField( "ModuleId", TypeString, Offset(mModuleId, ModuleDefinition), &setModuleId, &defaultProtectedGetFn, "A unique string Id for the module. It can contain any characters except a comma or semi-colon (the asset scope character)." );
|
||||
addProtectedField( "VersionId", TypeS32, Offset(mVersionId, ModuleDefinition), &setVersionId, &defaultProtectedGetFn, "The version Id. Breaking changes to a module should use a higher version Id." );
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@
|
|||
#include "console/consoleTypes.h"
|
||||
#endif
|
||||
|
||||
#include "cinterface/cinterface.h"
|
||||
|
||||
#ifndef _MODULE_DEFINITION_H
|
||||
#include "module/moduleDefinition.h"
|
||||
#endif
|
||||
|
|
@ -837,16 +839,7 @@ bool ModuleManager::loadModuleExplicit( const char* pModuleId, const U32 version
|
|||
const bool scriptFileExecuted = dAtob( Con::executef("exec", pLoadReadyModuleDefinition->getModuleScriptFilePath() ) );
|
||||
|
||||
// Did we execute the script file?
|
||||
if ( scriptFileExecuted )
|
||||
{
|
||||
// Yes, so is the create method available?
|
||||
if ( pScopeSet->isMethod( pLoadReadyModuleDefinition->getCreateFunction() ) )
|
||||
{
|
||||
// Yes, so call the create method.
|
||||
Con::executef( pScopeSet, pLoadReadyModuleDefinition->getCreateFunction() );
|
||||
}
|
||||
}
|
||||
else
|
||||
if ( !scriptFileExecuted )
|
||||
{
|
||||
// No, so warn.
|
||||
Con::errorf( "Module Manager: Cannot load explicit module Id '%s' at version Id '%d' as it failed to have the script file '%s' loaded.",
|
||||
|
|
@ -854,6 +847,13 @@ bool ModuleManager::loadModuleExplicit( const char* pModuleId, const U32 version
|
|||
}
|
||||
}
|
||||
|
||||
// Is the create method available?
|
||||
if (pScopeSet->isMethod(pLoadReadyModuleDefinition->getCreateFunction()))
|
||||
{
|
||||
// Yes, so call the create method.
|
||||
Con::executef(pScopeSet, pLoadReadyModuleDefinition->getCreateFunction());
|
||||
}
|
||||
|
||||
// Raise notifications.
|
||||
raiseModulePostLoadNotifications( pLoadReadyModuleDefinition );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -567,7 +567,7 @@ void PostEffect::initPersistFields()
|
|||
addField( "allowReflectPass", TypeBool, Offset( mAllowReflectPass, PostEffect ),
|
||||
"Is this effect processed during reflection render passes." );
|
||||
|
||||
addProtectedField( "isEnabled", TypeBool, Offset( mEnabled, PostEffect),
|
||||
addProtectedField( "enabled", TypeBool, Offset( mEnabled, PostEffect),
|
||||
&PostEffect::_setIsEnabled, &defaultProtectedGetFn,
|
||||
"Is the effect on." );
|
||||
|
||||
|
|
|
|||
|
|
@ -425,8 +425,8 @@ void SFXDescription::initPersistFields()
|
|||
"Reverb echo depth.");
|
||||
addField("reverbModTime", TypeF32, Offset(mReverb.flModulationTime, SFXDescription),
|
||||
"Reverb Modulation time.");
|
||||
addField("reverbModTime", TypeF32, Offset(mReverb.flModulationDepth, SFXDescription),
|
||||
"Reverb Modulation time.");
|
||||
addField("reverbModDepth", TypeF32, Offset(mReverb.flModulationDepth, SFXDescription),
|
||||
"Reverb Modulation Depth.");
|
||||
addField("airAbsorbtionGainHF", TypeF32, Offset(mReverb.flAirAbsorptionGainHF, SFXDescription),
|
||||
"High Frequency air absorbtion");
|
||||
addField("reverbHFRef", TypeF32, Offset(mReverb.flHFReference, SFXDescription),
|
||||
|
|
|
|||
|
|
@ -1532,6 +1532,7 @@ DefineEngineMethod( SFXSource, setPitch, void, ( F32 pitch ),,
|
|||
// Need an overload here as we can't use a default parameter to signal omission of the direction argument
|
||||
// and we need to properly detect the omission to leave the currently set direction on the source as is.
|
||||
|
||||
/* LukasPJ: For now, just use the setTransform with strings as parameters.
|
||||
DEFINE_CALLIN( fnSFXSoure_setTransform1, setTransform, SFXSource, void, ( SFXSource* source, const VectorF& position ),,,
|
||||
"Set the position of the source's 3D sound.\n\n"
|
||||
"@param position The new position in world space.\n"
|
||||
|
|
@ -1551,6 +1552,7 @@ DEFINE_CALLIN( fnSFXSoure_setTransform2, setTransform, SFXSource, void, ( SFXSou
|
|||
mat.setColumn( 1, direction );
|
||||
source->setTransform( mat );
|
||||
}
|
||||
*/
|
||||
|
||||
// Console interop version.
|
||||
|
||||
|
|
|
|||
|
|
@ -565,7 +565,7 @@ DefineEngineMethod(UndoManager, getNextRedoName, const char *, (),, "UndoManager
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineMethod( UndoManager, pushCompound, const char*, ( String name ), ("\"\""), "( string name=\"\" ) - Push a CompoundUndoAction onto the compound stack for assembly." )
|
||||
DefineEngineMethod( UndoManager, pushCompound, const char*, ( String name ), (""), "( string name=\"\" ) - Push a CompoundUndoAction onto the compound stack for assembly." )
|
||||
{
|
||||
|
||||
CompoundUndoAction* action = object->pushCompound( name );
|
||||
|
|
|
|||
|
|
@ -27,11 +27,10 @@ function CoreModule::onCreate(%this)
|
|||
ModuleDatabase.LoadExplicit( "Core_PostFX" );
|
||||
ModuleDatabase.LoadExplicit( "Core_GameObjects" );
|
||||
|
||||
exec("data/defaults.cs");
|
||||
%prefPath = getPrefpath();
|
||||
if ( isFile( %prefPath @ "/clientPrefs.cs" ) )
|
||||
exec( %prefPath @ "/clientPrefs.cs" );
|
||||
else
|
||||
exec("data/defaults.cs");
|
||||
|
||||
// Seed the random number generator.
|
||||
setRandomSeed();
|
||||
|
|
|
|||
|
|
@ -15,11 +15,10 @@ function initClient()
|
|||
exec( "./levelLoad.cs" );
|
||||
|
||||
//load prefs
|
||||
exec( "data/defaults.cs" );
|
||||
%prefPath = getPrefpath();
|
||||
if ( isFile( %prefPath @ "/clientPrefs.cs" ) )
|
||||
exec( %prefPath @ "/clientPrefs.cs" );
|
||||
else
|
||||
exec( "data/defaults.cs" );
|
||||
|
||||
callOnModules("initClient");
|
||||
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ function configureCanvas()
|
|||
// It's formatted as AATypexAALevel
|
||||
// So, FXAAx4 or MLAAx2
|
||||
if ( isObject( FXAA_PostEffect ) )
|
||||
FXAA_PostEffect.isEnabled = ( %aa > 0 ) ? true : false;
|
||||
FXAA_PostEffect.Enabled = ( %aa > 0 ) ? true : false;
|
||||
}
|
||||
|
||||
function GuiCanvas::modeStrToPrefs(%this, %modeStr)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ singleton CustomMaterial( BL_ProjectedShadowMaterial )
|
|||
function onActivateBasicLM()
|
||||
{
|
||||
// If HDR is enabled... enable the special format token.
|
||||
if ( HDRPostFx.isEnabled )
|
||||
if ( HDRPostFx.Enabled )
|
||||
AL_FormatToken.enable();
|
||||
|
||||
// Create render pass for projected shadow.
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ function CameraMotionBlurPostFX::savePresetSettings(%this)
|
|||
//Our actual postFX
|
||||
singleton PostEffect( CameraMotionBlurPostFX )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
renderTime = "PFXAfterDiffuse";
|
||||
|
||||
shader = CameraMotionBlurPostFX_Shader;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ singleton ShaderData( PFX_CausticsShader )
|
|||
|
||||
singleton PostEffect( CausticsPFX )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
renderTime = "PFXAfterDiffuse";
|
||||
renderBin = "ObjTranslucentBin";
|
||||
//renderPriority = 0.1;
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ function ChromaticAberrationPostFX::savePresetSettings(%this)
|
|||
//Our actual postFX
|
||||
singleton PostEffect( ChromaticAberrationPostFX )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
allowReflectPass = false;
|
||||
|
||||
// Resolve the HDR before we render any editor stuff
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ function DepthOfFieldPostFX::setLerpDist( %this, %d0, %d1, %d2 )
|
|||
|
||||
singleton PostEffect( DepthOfFieldPostFX )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
|
||||
renderTime = "PFXAfterBin";
|
||||
renderBin = "GlowBin";
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ singleton PostEffect( EdgeDetectPostEffect )
|
|||
texture[0] = "#deferred";
|
||||
target = "#edge";
|
||||
|
||||
isEnabled = true;
|
||||
enabled = true;
|
||||
};
|
||||
|
||||
singleton PostEffect( EdgeAAPostEffect )
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ singleton ShaderData( FXAA_ShaderData )
|
|||
|
||||
singleton PostEffect( FXAAPostFX )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
|
||||
allowReflectPass = false;
|
||||
renderTime = "PFXAfterDiffuse";
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ singleton ShaderData( PFX_FlashShader )
|
|||
|
||||
singleton PostEffect( FlashFx )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
allowReflectPass = false;
|
||||
|
||||
renderTime = "PFXAfterDiffuse";
|
||||
|
|
|
|||
|
|
@ -63,5 +63,5 @@ singleton PostEffect( fogPostFX )
|
|||
renderPriority = 5;
|
||||
|
||||
targetFormat = getBestHDRFormat();
|
||||
isEnabled = true;
|
||||
enabled = true;
|
||||
};
|
||||
|
|
@ -43,7 +43,7 @@ singleton GFXStateBlockData( GammaStateBlock : PFX_DefaultStateBlock )
|
|||
|
||||
singleton PostEffect( GammaPostFX )
|
||||
{
|
||||
isEnabled = true;
|
||||
enabled = true;
|
||||
allowReflectPass = true;
|
||||
|
||||
renderTime = "PFXBeforeBin";
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ singleton PostEffect( GlowPostFX )
|
|||
target = "$outTex";
|
||||
targetScale = "0.5 0.5";
|
||||
|
||||
isEnabled = true;
|
||||
enabled = true;
|
||||
|
||||
// Blur vertically
|
||||
new PostEffect()
|
||||
|
|
@ -146,7 +146,7 @@ singleton PostEffect( VolFogGlowPostFx )
|
|||
texture[0] = "$backbuffer";
|
||||
target = "$outTex";
|
||||
targetScale = "0.5 0.5";
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
// Blur vertically
|
||||
new PostEffect()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ function HDRPostFX::savePresetSettings(%this)
|
|||
|
||||
singleton PostEffect( HDRPostFX )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
allowReflectPass = false;
|
||||
|
||||
// Resolve the HDR before we render any editor stuff
|
||||
|
|
@ -580,7 +580,7 @@ function LuminanceVisPostFX::setShaderConsts( %this )
|
|||
|
||||
singleton PostEffect( LuminanceVisPostFX )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
allowReflectPass = false;
|
||||
|
||||
// Render before we do any editor rendering.
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ function LUTColorGradePostFX::savePresetSettings(%this)
|
|||
//Our actual postFX
|
||||
singleton PostEffect( LUTColorGradePostFX )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
allowReflectPass = false;
|
||||
|
||||
// Resolve the HDR before we render any editor stuff
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ singleton GFXStateBlockData( LightRayStateBlock : PFX_DefaultStateBlock )
|
|||
|
||||
singleton PostEffect( LightRayPostFX )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
allowReflectPass = false;
|
||||
|
||||
renderTime = "PFXBeforeBin";
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ singleton ShaderData( MLAA_NeighborhoodBlendingShader )
|
|||
|
||||
singleton PostEffect( MLAAFx )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
|
||||
allowReflectPass = false;
|
||||
renderTime = "PFXAfterDiffuse";
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ singleton PostEffect( reflectionProbeArrayPostFX )
|
|||
renderTime = "PFXAfterBin";
|
||||
renderBin = "ProbeBin";
|
||||
renderPriority = 9999;
|
||||
isEnabled = true;
|
||||
enabled = true;
|
||||
|
||||
shader = PFX_ReflectionProbeArray;
|
||||
stateBlock = PFX_ReflectionProbeArrayStateBlock;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ function SharpenPostFX::savePresetSettings(%this)
|
|||
//Our actual postFX
|
||||
singleton PostEffect( SharpenPostFX )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
allowReflectPass = false;
|
||||
|
||||
// Resolve the HDR before we render any editor stuff
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ singleton ShaderData( PFX_TurbulenceShader )
|
|||
|
||||
singleton PostEffect( TurbulencePostFX )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
allowReflectPass = true;
|
||||
|
||||
renderTime = "PFXAfterDiffuse";
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ singleton PostEffect( underWaterFogPostFX )
|
|||
// Needs to happen after the FogPostFx
|
||||
renderPriority = 4;
|
||||
|
||||
isEnabled = true;
|
||||
enabled = true;
|
||||
};
|
||||
|
||||
function underWaterFogPostFX::onEnabled( %this )
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ singleton GFXStateBlockData( OVRBarrelDistortionStateBlock : PFX_DefaultStateBlo
|
|||
//-----------------------------------------------------------------------------
|
||||
singleton BarrelDistortionPostEffect( OVRBarrelDistortionPostFX )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
allowReflectPass = false;
|
||||
|
||||
renderTime = "PFXAfterDiffuse";
|
||||
|
|
@ -107,7 +107,7 @@ singleton BarrelDistortionPostEffect( OVRBarrelDistortionPostFX )
|
|||
//-----------------------------------------------------------------------------
|
||||
singleton BarrelDistortionPostEffect( OVRBarrelDistortionChromaPostFX )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
allowReflectPass = false;
|
||||
|
||||
renderTime = "PFXAfterDiffuse";
|
||||
|
|
@ -132,7 +132,7 @@ singleton BarrelDistortionPostEffect( OVRBarrelDistortionChromaPostFX )
|
|||
//-----------------------------------------------------------------------------
|
||||
singleton PostEffect( OVRBarrelDistortionMonoPostFX )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
allowReflectPass = false;
|
||||
|
||||
renderTime = "PFXAfterDiffuse";
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ function VignettePostFX::savePresetSettings(%this)
|
|||
//Our actual postFX
|
||||
singleton PostEffect( VignettePostFX )
|
||||
{
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
|
||||
renderTime = "PFXBeforeBin";
|
||||
renderBin = "EditorBin";
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ singleton PostEffect( afxHighlightPostFX )
|
|||
renderTime = "PFXAfterDiffuse";
|
||||
renderBin = "HighlightBin";
|
||||
renderPriority = 1;
|
||||
isEnabled = true;
|
||||
enabled = true;
|
||||
|
||||
shader = PFX_afxHighlightShader;
|
||||
stateBlock = PFX_afxDefaultHighlightStateBlock;
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ function PostFXManager::savePresetHandler( %filename )
|
|||
{
|
||||
%postEffect = PostFXManager.getKey(%i);
|
||||
|
||||
if(isObject(%postEffect) && %postEffect.isEnabled && %postEffect.isMethod("savePresetSettings"))
|
||||
if(isObject(%postEffect) && %postEffect.Enabled && %postEffect.isMethod("savePresetSettings"))
|
||||
{
|
||||
%postEffect.savePresetSettings();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,11 +33,10 @@ function Core_Rendering::initClient(%this)
|
|||
initLightingSystems("Advanced Lighting");
|
||||
|
||||
//load prefs
|
||||
exec("data/defaults.cs");
|
||||
%prefPath = getPrefpath();
|
||||
if ( isFile( %prefPath @ "/clientPrefs.cs" ) )
|
||||
exec( %prefPath @ "/clientPrefs.cs" );
|
||||
else
|
||||
exec("data/defaults.cs");
|
||||
|
||||
configureCanvas();
|
||||
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ singleton PostEffect( AL_FormatCopy )
|
|||
{
|
||||
// This PostEffect is used by 'AL_FormatToken' directly. It is never added to
|
||||
// the PostEffectManager. Do not call enable() on it.
|
||||
isEnabled = false;
|
||||
enabled = false;
|
||||
allowReflectPass = true;
|
||||
|
||||
shader = PFX_PassthruShader;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "./brdf.glsl"
|
||||
|
||||
#ifndef TORQUE_SHADERGEN
|
||||
#line 26
|
||||
#line 27
|
||||
// These are the uniforms used by most lighting shaders.
|
||||
|
||||
uniform vec4 inLightPos[4];
|
||||
|
|
@ -52,6 +52,18 @@ uniform vec4 albedo;
|
|||
|
||||
#define MAX_FORWARD_LIGHT 4
|
||||
|
||||
#ifndef CAPTURING
|
||||
#define CAPTURING 0
|
||||
#endif
|
||||
|
||||
#ifndef DEBUGVIZ_ATTENUATION
|
||||
#define DEBUGVIZ_ATTENUATION 0
|
||||
#endif
|
||||
|
||||
#ifndef DEBUGVIZ_CONTRIB
|
||||
#define DEBUGVIZ_CONTRIB 0
|
||||
#endif
|
||||
|
||||
vec3 getDistanceVectorToPlane( vec3 origin, vec3 direction, vec4 plane )
|
||||
{
|
||||
float denum = dot( plane.xyz, direction.xyz );
|
||||
|
|
@ -416,7 +428,7 @@ vec4 computeForwardProbes(Surface surface,
|
|||
}
|
||||
}
|
||||
|
||||
#if DEBUGVIZ_ATTENUATION == 1
|
||||
#if (DEBUGVIZ_ATTENUATION == 1)
|
||||
float contribAlpha = 1;
|
||||
for (i = 0; i < numProbes; ++i)
|
||||
{
|
||||
|
|
@ -426,7 +438,7 @@ vec4 computeForwardProbes(Surface surface,
|
|||
return vec4(1 - contribAlpha, 1 - contribAlpha, 1 - contribAlpha, 1);
|
||||
#endif
|
||||
|
||||
#if DEBUGVIZ_CONTRIB == 1
|
||||
#if (DEBUGVIZ_CONTRIB == 1)
|
||||
vec3 probeContribColors[4];
|
||||
probeContribColors[0] = vec3(1,0,0);
|
||||
probeContribColors[1] = vec3(0,1,0);
|
||||
|
|
@ -653,4 +665,4 @@ vec4 debugVizForwardProbes(Surface surface,
|
|||
horizon *= horizon;
|
||||
|
||||
return vec4((irradiance + specular) * horizon, 0);//alpha writes disabled
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,18 @@ uniform float4 albedo;
|
|||
|
||||
#define MAX_FORWARD_LIGHT 4
|
||||
|
||||
#ifndef CAPTURING
|
||||
#define CAPTURING 0
|
||||
#endif
|
||||
|
||||
#ifndef DEBUGVIZ_ATTENUATION
|
||||
#define DEBUGVIZ_ATTENUATION 0
|
||||
#endif
|
||||
|
||||
#ifndef DEBUGVIZ_CONTRIB
|
||||
#define DEBUGVIZ_CONTRIB 0
|
||||
#endif
|
||||
|
||||
inline float3 getDistanceVectorToPlane( float3 origin, float3 direction, float4 plane )
|
||||
{
|
||||
float denum = dot( plane.xyz, direction.xyz );
|
||||
|
|
|
|||
|
|
@ -59,13 +59,13 @@
|
|||
childMargin = "0 0";
|
||||
|
||||
new GuiScriptNotifyCtrl(VerveEditorGroupNotify) {
|
||||
onChildAdded = "0";
|
||||
onChildRemoved = "0";
|
||||
onChildResized = "0";
|
||||
onParentResized = "1";
|
||||
onResize = "1";
|
||||
onLoseFirstResponder = "0";
|
||||
onGainFirstResponder = "0";
|
||||
notifyOnChildAdded = "0";
|
||||
notifyOnChildRemoved = "0";
|
||||
notifyOnChildResized = "0";
|
||||
notifyOnParentResized = "1";
|
||||
notifyOnResize = "1";
|
||||
notifyOnLoseFirstResponder = "0";
|
||||
notifyOnGainFirstResponder = "0";
|
||||
canSaveDynamicFields = "0";
|
||||
class = "VerveEditorScrollNotifyV";
|
||||
className = "VerveEditorScrollNotifyV";
|
||||
|
|
@ -155,13 +155,13 @@
|
|||
childMargin = "0 0";
|
||||
|
||||
new GuiScriptNotifyCtrl(VerveEditorTrackNotify) {
|
||||
onChildAdded = "0";
|
||||
onChildRemoved = "0";
|
||||
onChildResized = "0";
|
||||
onParentResized = "1";
|
||||
onResize = "1";
|
||||
onLoseFirstResponder = "0";
|
||||
onGainFirstResponder = "0";
|
||||
notifyOnChildAdded = "0";
|
||||
notifyOnChildRemoved = "0";
|
||||
notifyOnChildResized = "0";
|
||||
notifyOnParentResized = "1";
|
||||
notifyOnResize = "1";
|
||||
notifyOnLoseFirstResponder = "0";
|
||||
notifyOnGainFirstResponder = "0";
|
||||
canSaveDynamicFields = "0";
|
||||
class = "VerveEditorScrollNotify";
|
||||
className = "VerveEditorScrollNotify";
|
||||
|
|
@ -406,13 +406,13 @@
|
|||
childMargin = "0 0";
|
||||
|
||||
new GuiScriptNotifyCtrl(VerveEditorTimeNotify) {
|
||||
onChildAdded = "0";
|
||||
onChildRemoved = "0";
|
||||
onChildResized = "0";
|
||||
onParentResized = "1";
|
||||
onResize = "1";
|
||||
onLoseFirstResponder = "0";
|
||||
onGainFirstResponder = "0";
|
||||
notifyOnChildAdded = "0";
|
||||
notifyOnChildRemoved = "0";
|
||||
notifyOnChildResized = "0";
|
||||
notifyOnParentResized = "1";
|
||||
notifyOnResize = "1";
|
||||
notifyOnLoseFirstResponder = "0";
|
||||
notifyOnGainFirstResponder = "0";
|
||||
canSaveDynamicFields = "0";
|
||||
class = "VerveEditorScrollNotifyH";
|
||||
className = "VerveEditorScrollNotifyH";
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ function GuiEdit( %val )
|
|||
//Temp fix to disable MLAA when in GUI editor
|
||||
if( isObject(MLAAFx) && MLAAFx.isEnabled==true )
|
||||
{
|
||||
MLAAFx.isEnabled = false;
|
||||
MLAAFx.Enabled = false;
|
||||
$MLAAFxGuiEditorTemp = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -544,7 +544,7 @@ function GuiEditCanvas::quit( %this )
|
|||
//Temp fix to disable MLAA when in GUI editor
|
||||
if( isObject(MLAAFx) && $MLAAFxGuiEditorTemp==true )
|
||||
{
|
||||
MLAAFx.isEnabled = true;
|
||||
MLAAFx.Enabled = true;
|
||||
$MLAAFxGuiEditorTemp = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue