mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Merge branch 'development' of https://github.com/TorqueGameEngines/Torque3D into TreeWork
This commit is contained in:
commit
1715b65d39
42 changed files with 719 additions and 213 deletions
|
|
@ -194,7 +194,9 @@ DefineEngineMethod(AIController, getAimObject, S32, (), ,
|
||||||
|
|
||||||
"@see setAimObject()\n")
|
"@see setAimObject()\n")
|
||||||
{
|
{
|
||||||
SceneObject* obj = dynamic_cast<GameBase*>(object->getAim()->mObj.getPointer());
|
SceneObject* obj = NULL;
|
||||||
|
if (object->getAim())
|
||||||
|
obj = dynamic_cast<GameBase*>(object->getAim()->mObj.getPointer());
|
||||||
return obj ? obj->getId() : -1;
|
return obj ? obj->getId() : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,12 @@ bool AIController::setControllerDataProperty(void* obj, const char* index, const
|
||||||
|
|
||||||
void AIController::setGoal(AIInfo* targ)
|
void AIController::setGoal(AIInfo* targ)
|
||||||
{
|
{
|
||||||
if (mGoal) { delete(mGoal); mGoal = NULL; }
|
if (mGoal)
|
||||||
|
{
|
||||||
|
if (mGoal->mObj.isValid() && targ->mObj.isValid() && mGoal->mObj == targ->mObj)
|
||||||
|
return;
|
||||||
|
delete(mGoal); mGoal = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (targ->mObj.isValid())
|
if (targ->mObj.isValid())
|
||||||
{
|
{
|
||||||
|
|
@ -86,26 +91,58 @@ void AIController::setGoal(AIInfo* targ)
|
||||||
|
|
||||||
void AIController::setGoal(Point3F loc, F32 rad)
|
void AIController::setGoal(Point3F loc, F32 rad)
|
||||||
{
|
{
|
||||||
if (mGoal) delete(mGoal);
|
if (mGoal)
|
||||||
|
{
|
||||||
|
if (mGoal->mPosSet && mGoal->getPosition() == loc)
|
||||||
|
{
|
||||||
|
mGoal->mRadius = rad;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
delete(mGoal);
|
||||||
|
}
|
||||||
mGoal = new AIGoal(this, loc, rad);
|
mGoal = new AIGoal(this, loc, rad);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AIController::setGoal(SimObjectPtr<SceneObject> objIn, F32 rad)
|
void AIController::setGoal(SimObjectPtr<SceneObject> objIn, F32 rad)
|
||||||
{
|
{
|
||||||
if (mGoal) delete(mGoal);
|
if (mGoal)
|
||||||
|
{
|
||||||
|
if (mGoal->mObj.isValid() && objIn.isValid() && mGoal->mObj == objIn)
|
||||||
|
{
|
||||||
|
mGoal->mRadius = rad;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
delete(mGoal);
|
||||||
|
}
|
||||||
mGoal = new AIGoal(this, objIn, rad);
|
mGoal = new AIGoal(this, objIn, rad);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AIController::setAim(Point3F loc, F32 rad, Point3F offset)
|
void AIController::setAim(Point3F loc, F32 rad, Point3F offset)
|
||||||
{
|
{
|
||||||
if (mAimTarget) delete(mAimTarget);
|
if (mAimTarget)
|
||||||
|
{
|
||||||
|
if (mAimTarget->mPosSet && mAimTarget->getPosition() == loc)
|
||||||
|
{
|
||||||
|
mAimTarget->mAimOffset = offset;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
delete(mAimTarget);
|
||||||
|
}
|
||||||
mAimTarget = new AIAimTarget(this, loc, rad);
|
mAimTarget = new AIAimTarget(this, loc, rad);
|
||||||
mAimTarget->mAimOffset = offset;
|
mAimTarget->mAimOffset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AIController::setAim(SimObjectPtr<SceneObject> objIn, F32 rad, Point3F offset)
|
void AIController::setAim(SimObjectPtr<SceneObject> objIn, F32 rad, Point3F offset)
|
||||||
{
|
{
|
||||||
if (mAimTarget) delete(mAimTarget);
|
if (mAimTarget)
|
||||||
|
{
|
||||||
|
if (mAimTarget->mObj.isValid() && objIn.isValid() && mAimTarget->mObj == objIn)
|
||||||
|
{
|
||||||
|
mAimTarget->mAimOffset = offset;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
delete(mAimTarget);
|
||||||
|
}
|
||||||
mAimTarget = new AIAimTarget(this, objIn, rad);
|
mAimTarget = new AIAimTarget(this, objIn, rad);
|
||||||
mAimTarget->mAimOffset = offset;
|
mAimTarget->mAimOffset = offset;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,24 @@ public:
|
||||||
private:
|
private:
|
||||||
AICover* mCover;
|
AICover* mCover;
|
||||||
public:
|
public:
|
||||||
void setCover(Point3F loc, F32 rad = 0.0f) { delete(mCover); mCover = new AICover(this, loc, rad); }
|
void setCover(Point3F loc, F32 rad = 0.0f)
|
||||||
void setCover(SimObjectPtr<SceneObject> objIn, F32 rad = 0.0f) { delete(mCover); mCover = new AICover(this, objIn, rad); }
|
{
|
||||||
|
if (mCover && mCover->mPosSet && mCover->getPosition() == loc)
|
||||||
|
{
|
||||||
|
mCover->mRadius = rad;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
delete(mCover); mCover = new AICover(this, loc, rad);
|
||||||
|
}
|
||||||
|
void setCover(SimObjectPtr<SceneObject> objIn, F32 rad = 0.0f)
|
||||||
|
{
|
||||||
|
if (mCover && mCover->mObj == objIn)
|
||||||
|
{
|
||||||
|
mCover->mRadius = rad;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
delete(mCover); mCover = new AICover(this, objIn, rad);
|
||||||
|
}
|
||||||
AICover* getCover() { return mCover; }
|
AICover* getCover() { return mCover; }
|
||||||
bool findCover(const Point3F& from, F32 radius);
|
bool findCover(const Point3F& from, F32 radius);
|
||||||
void clearCover();
|
void clearCover();
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,16 @@ bool SubScene::evaluateCondition()
|
||||||
Con::setBoolVariable(resVar.c_str(), false);
|
Con::setBoolVariable(resVar.c_str(), false);
|
||||||
String command = resVar + "=" + mLoadIf + ";";
|
String command = resVar + "=" + mLoadIf + ";";
|
||||||
|
|
||||||
Con::evaluatef(command.c_str());
|
StringTableEntry objectName = getName();
|
||||||
|
if (objectName != NULL)
|
||||||
|
objectName = getIdString();
|
||||||
|
|
||||||
|
StringTableEntry groupName = getGroup() ? getGroup()->getName() : NULL;
|
||||||
|
if (groupName != NULL)
|
||||||
|
groupName = getGroup()->getIdString();
|
||||||
|
|
||||||
|
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
|
||||||
|
Con::evaluate(command.c_str(), false, context.c_str());
|
||||||
return Con::getBoolVariable(resVar.c_str());
|
return Con::getBoolVariable(resVar.c_str());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -3003,7 +3003,7 @@ Torque::Path AssetImporter::importMaterialAsset(AssetImportObject* assetItem)
|
||||||
|
|
||||||
if (hasRoughness)
|
if (hasRoughness)
|
||||||
{
|
{
|
||||||
newMat->mInvertRoughness[0] = true;
|
newMat->mInvertRoughness[0] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
newAsset->addObject(newMat);
|
newAsset->addObject(newMat);
|
||||||
|
|
|
||||||
|
|
@ -367,7 +367,17 @@ bool SpawnSphere::testCondition()
|
||||||
String resVar = getIdString() + String(".result");
|
String resVar = getIdString() + String(".result");
|
||||||
Con::setBoolVariable(resVar.c_str(), false);
|
Con::setBoolVariable(resVar.c_str(), false);
|
||||||
String command = resVar + "=" + mSpawnIf + ";";
|
String command = resVar + "=" + mSpawnIf + ";";
|
||||||
Con::evaluatef(command.c_str());
|
|
||||||
|
StringTableEntry objectName = getName();
|
||||||
|
if (objectName != NULL)
|
||||||
|
objectName = getIdString();
|
||||||
|
|
||||||
|
StringTableEntry groupName = getGroup() ? getGroup()->getName() : NULL;
|
||||||
|
if (groupName != NULL)
|
||||||
|
groupName = getGroup()->getIdString();
|
||||||
|
|
||||||
|
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
|
||||||
|
Con::evaluate(command.c_str(), false, context.c_str());
|
||||||
if (Con::getBoolVariable(resVar.c_str()) == 1)
|
if (Con::getBoolVariable(resVar.c_str()) == 1)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -975,6 +975,7 @@ ShapeBase::ShapeBase()
|
||||||
mMoveMotion( false ),
|
mMoveMotion( false ),
|
||||||
mShapeBaseMount( NULL ),
|
mShapeBaseMount( NULL ),
|
||||||
mShapeInstance( NULL ),
|
mShapeInstance( NULL ),
|
||||||
|
mCubeReflector(NULL),
|
||||||
mConvexList( new Convex ),
|
mConvexList( new Convex ),
|
||||||
mEnergy( 0.0f ),
|
mEnergy( 0.0f ),
|
||||||
mRechargeRate( 0.0f ),
|
mRechargeRate( 0.0f ),
|
||||||
|
|
@ -1053,6 +1054,12 @@ ShapeBase::~ShapeBase()
|
||||||
mShapeInstance = NULL;
|
mShapeInstance = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mCubeReflector)
|
||||||
|
{
|
||||||
|
mCubeReflector->unregisterReflector();
|
||||||
|
SAFE_DELETE(mCubeReflector);
|
||||||
|
}
|
||||||
|
|
||||||
CollisionTimeout* ptr = mTimeoutList;
|
CollisionTimeout* ptr = mTimeoutList;
|
||||||
while (ptr) {
|
while (ptr) {
|
||||||
CollisionTimeout* cur = ptr;
|
CollisionTimeout* cur = ptr;
|
||||||
|
|
@ -1173,7 +1180,11 @@ void ShapeBase::onRemove()
|
||||||
|
|
||||||
if ( isClientObject() )
|
if ( isClientObject() )
|
||||||
{
|
{
|
||||||
mCubeReflector.unregisterReflector();
|
if (mCubeReflector)
|
||||||
|
{
|
||||||
|
mCubeReflector->unregisterReflector();
|
||||||
|
SAFE_DELETE(mCubeReflector);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1350,10 +1361,16 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload )
|
||||||
|
|
||||||
if ( isClientObject() )
|
if ( isClientObject() )
|
||||||
{
|
{
|
||||||
mCubeReflector.unregisterReflector();
|
if (mCubeReflector)
|
||||||
|
{
|
||||||
if ( mDataBlock->reflectorDesc )
|
mCubeReflector->unregisterReflector();
|
||||||
mCubeReflector.registerReflector( this, mDataBlock->reflectorDesc );
|
SAFE_DELETE(mCubeReflector);
|
||||||
|
}
|
||||||
|
if (mDataBlock->reflectorDesc)
|
||||||
|
{
|
||||||
|
mCubeReflector = new CubeReflector();
|
||||||
|
mCubeReflector->registerReflector(this, mDataBlock->reflectorDesc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -2681,7 +2698,7 @@ void ShapeBase::_prepRenderImage( SceneRenderState *state,
|
||||||
|
|
||||||
// If we're currently rendering our own reflection we
|
// If we're currently rendering our own reflection we
|
||||||
// don't want to render ourselves into it.
|
// don't want to render ourselves into it.
|
||||||
if ( mCubeReflector.isRendering() )
|
if (mCubeReflector && mCubeReflector->isRendering())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// We force all the shapes to use the highest detail
|
// We force all the shapes to use the highest detail
|
||||||
|
|
@ -2785,8 +2802,8 @@ void ShapeBase::prepBatchRender(SceneRenderState* state, S32 mountedImageIndex )
|
||||||
// Set up our TS render state.
|
// Set up our TS render state.
|
||||||
TSRenderState rdata;
|
TSRenderState rdata;
|
||||||
rdata.setSceneState( state );
|
rdata.setSceneState( state );
|
||||||
if ( mCubeReflector.isEnabled() )
|
if (mCubeReflector && mCubeReflector->isEnabled())
|
||||||
rdata.setCubemap( mCubeReflector.getCubemap() );
|
rdata.setCubemap( mCubeReflector->getCubemap() );
|
||||||
rdata.setFadeOverride( (1.0f - mCloakLevel) * mFadeVal );
|
rdata.setFadeOverride( (1.0f - mCloakLevel) * mFadeVal );
|
||||||
|
|
||||||
// We might have some forward lit materials
|
// We might have some forward lit materials
|
||||||
|
|
@ -2810,14 +2827,14 @@ void ShapeBase::prepBatchRender(SceneRenderState* state, S32 mountedImageIndex )
|
||||||
mat.scale( mObjScale );
|
mat.scale( mObjScale );
|
||||||
GFX->setWorldMatrix( mat );
|
GFX->setWorldMatrix( mat );
|
||||||
|
|
||||||
if ( state->isDiffusePass() && mCubeReflector.isEnabled() && mCubeReflector.getOcclusionQuery() )
|
if ( state->isDiffusePass() && mCubeReflector && mCubeReflector->isEnabled() && mCubeReflector->getOcclusionQuery() )
|
||||||
{
|
{
|
||||||
RenderPassManager *pass = state->getRenderPass();
|
RenderPassManager *pass = state->getRenderPass();
|
||||||
|
|
||||||
OccluderRenderInst *ri = pass->allocInst<OccluderRenderInst>();
|
OccluderRenderInst *ri = pass->allocInst<OccluderRenderInst>();
|
||||||
|
|
||||||
ri->type = RenderPassManager::RIT_Occluder;
|
ri->type = RenderPassManager::RIT_Occluder;
|
||||||
ri->query = mCubeReflector.getOcclusionQuery();
|
ri->query = mCubeReflector->getOcclusionQuery();
|
||||||
mObjToWorld.mulP( mObjBox.getCenter(), &ri->position );
|
mObjToWorld.mulP( mObjBox.getCenter(), &ri->position );
|
||||||
ri->scale.set( mObjBox.getExtents() );
|
ri->scale.set( mObjBox.getExtents() );
|
||||||
ri->orientation = pass->allocUniqueXform( mObjToWorld );
|
ri->orientation = pass->allocUniqueXform( mObjToWorld );
|
||||||
|
|
|
||||||
|
|
@ -1207,7 +1207,7 @@ public:
|
||||||
static F32 sFullCorrectionDistance;
|
static F32 sFullCorrectionDistance;
|
||||||
static F32 sCloakSpeed; // Time to cloak, in seconds
|
static F32 sCloakSpeed; // Time to cloak, in seconds
|
||||||
|
|
||||||
CubeReflector mCubeReflector;
|
CubeReflector* mCubeReflector;
|
||||||
|
|
||||||
/// @name Initialization
|
/// @name Initialization
|
||||||
/// @{
|
/// @{
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include "console/engineAPI.h"
|
#include "console/engineAPI.h"
|
||||||
#include "collision/boxConvex.h"
|
#include "collision/boxConvex.h"
|
||||||
#include "console/script.h"
|
#include "console/script.h"
|
||||||
|
#include "console/consoleInternal.h"
|
||||||
|
|
||||||
#include "core/stream/bitStream.h"
|
#include "core/stream/bitStream.h"
|
||||||
#include "math/mathIO.h"
|
#include "math/mathIO.h"
|
||||||
|
|
@ -172,8 +173,9 @@ Trigger::Trigger()
|
||||||
|
|
||||||
mPhysicsRep = NULL;
|
mPhysicsRep = NULL;
|
||||||
mTripOnce = false;
|
mTripOnce = false;
|
||||||
|
mTripped = false;
|
||||||
mTrippedBy = 0xFFFFFFFF;
|
mTrippedBy = 0xFFFFFFFF;
|
||||||
mTripIf = "";
|
mTripIf.clear();
|
||||||
|
|
||||||
//Default up a basic square
|
//Default up a basic square
|
||||||
Point3F vecs[3] = { Point3F(1.0, 0.0, 0.0),
|
Point3F vecs[3] = { Point3F(1.0, 0.0, 0.0),
|
||||||
|
|
@ -704,7 +706,17 @@ bool Trigger::testCondition()
|
||||||
String resVar = getIdString() + String(".result");
|
String resVar = getIdString() + String(".result");
|
||||||
Con::setBoolVariable(resVar.c_str(), false);
|
Con::setBoolVariable(resVar.c_str(), false);
|
||||||
String command = resVar + "=" + mTripIf + ";";
|
String command = resVar + "=" + mTripIf + ";";
|
||||||
Con::evaluatef(command.c_str());
|
|
||||||
|
StringTableEntry objectName = getName();
|
||||||
|
if (objectName != NULL)
|
||||||
|
objectName = getIdString();
|
||||||
|
|
||||||
|
StringTableEntry groupName = getGroup() ? getGroup()->getName() : NULL;
|
||||||
|
if (groupName != NULL)
|
||||||
|
groupName = getGroup()->getIdString();
|
||||||
|
|
||||||
|
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
|
||||||
|
Con::evaluate(command.c_str(), false, context.c_str());
|
||||||
if (Con::getBoolVariable(resVar.c_str()) == 1)
|
if (Con::getBoolVariable(resVar.c_str()) == 1)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -738,11 +750,11 @@ void Trigger::potentialEnterObject(GameBase* enter)
|
||||||
mObjects.push_back(enter);
|
mObjects.push_back(enter);
|
||||||
deleteNotify(enter);
|
deleteNotify(enter);
|
||||||
|
|
||||||
if(evalCmD(&mEnterCommand))
|
if(isServerObject() && evalCmD(&mEnterCommand))
|
||||||
{
|
{
|
||||||
String command = String("%obj = ") + enter->getIdString() + ";";
|
String command = String("%obj = ") + enter->getIdString() + ";";
|
||||||
command = command + String("%this = ") + getIdString() + ";" + mEnterCommand;
|
command = command + String("%this = ") + getIdString() + ";" + mEnterCommand;
|
||||||
Con::evaluate(command.c_str());
|
Con::evaluate(command.c_str(), false, Con::getCurrentScriptModulePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
if( mDataBlock && testTrippable() && testCondition())
|
if( mDataBlock && testTrippable() && testCondition())
|
||||||
|
|
@ -787,11 +799,11 @@ void Trigger::processTick(const Move* move)
|
||||||
mObjects.erase(i);
|
mObjects.erase(i);
|
||||||
clearNotify(remove);
|
clearNotify(remove);
|
||||||
|
|
||||||
if (evalCmD(&mLeaveCommand))
|
if (isServerObject() && evalCmD(&mLeaveCommand))
|
||||||
{
|
{
|
||||||
String command = String("%obj = ") + remove->getIdString() + ";";
|
String command = String("%obj = ") + remove->getIdString() + ";";
|
||||||
command = command + String("%this = ") + getIdString() + ";" + mLeaveCommand;
|
command = command + String("%this = ") + getIdString() + ";" + mLeaveCommand;
|
||||||
Con::evaluate(command.c_str());
|
Con::evaluate(command.c_str(), false, Con::getCurrentScriptModulePath());
|
||||||
}
|
}
|
||||||
if (testTrippable() && testCondition())
|
if (testTrippable() && testCondition())
|
||||||
mDataBlock->onLeaveTrigger_callback( this, remove );
|
mDataBlock->onLeaveTrigger_callback( this, remove );
|
||||||
|
|
@ -799,8 +811,19 @@ void Trigger::processTick(const Move* move)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evalCmD(&mTickCommand))
|
if (isServerObject() && evalCmD(&mTickCommand))
|
||||||
Con::evaluate(mTickCommand.c_str());
|
{
|
||||||
|
StringTableEntry objectName = getName();
|
||||||
|
if (objectName != NULL)
|
||||||
|
objectName = getIdString();
|
||||||
|
|
||||||
|
StringTableEntry groupName = getGroup() ? getGroup()->getName() : NULL;
|
||||||
|
if (groupName != NULL)
|
||||||
|
groupName = getGroup()->getIdString();
|
||||||
|
|
||||||
|
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
|
||||||
|
Con::evaluate(mTickCommand.c_str(), false, context);
|
||||||
|
}
|
||||||
|
|
||||||
if (mObjects.size() != 0 && testTrippable() && testCondition())
|
if (mObjects.size() != 0 && testTrippable() && testCondition())
|
||||||
mDataBlock->onTickTrigger_callback( this );
|
mDataBlock->onTickTrigger_callback( this );
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,8 @@ F32 TSStatic::smStaticObjectUnfadeableSize = 75;
|
||||||
TSStatic::TSStatic()
|
TSStatic::TSStatic()
|
||||||
:
|
:
|
||||||
cubeDescId(0),
|
cubeDescId(0),
|
||||||
reflectorDesc(NULL)
|
reflectorDesc(NULL),
|
||||||
|
mCubeReflector(NULL)
|
||||||
{
|
{
|
||||||
mNetFlags.set(Ghostable | ScopeAlways);
|
mNetFlags.set(Ghostable | ScopeAlways);
|
||||||
|
|
||||||
|
|
@ -159,6 +160,11 @@ TSStatic::~TSStatic()
|
||||||
delete mConvexList;
|
delete mConvexList;
|
||||||
mConvexList = NULL;
|
mConvexList = NULL;
|
||||||
mShapeAsset.unregisterRefreshNotify();
|
mShapeAsset.unregisterRefreshNotify();
|
||||||
|
if (mCubeReflector)
|
||||||
|
{
|
||||||
|
mCubeReflector->unregisterReflector();
|
||||||
|
SAFE_DELETE(mCubeReflector);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImplementEnumType(TSMeshType,
|
ImplementEnumType(TSMeshType,
|
||||||
|
|
@ -361,10 +367,17 @@ bool TSStatic::onAdd()
|
||||||
|
|
||||||
if (isClientObject())
|
if (isClientObject())
|
||||||
{
|
{
|
||||||
mCubeReflector.unregisterReflector();
|
if (mCubeReflector)
|
||||||
|
{
|
||||||
|
mCubeReflector->unregisterReflector();
|
||||||
|
SAFE_DELETE(mCubeReflector);
|
||||||
|
}
|
||||||
|
|
||||||
if (reflectorDesc)
|
if (reflectorDesc)
|
||||||
mCubeReflector.registerReflector(this, reflectorDesc);
|
{
|
||||||
|
mCubeReflector = new CubeReflector();
|
||||||
|
mCubeReflector->registerReflector(this, reflectorDesc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateShouldTick();
|
_updateShouldTick();
|
||||||
|
|
@ -594,8 +607,11 @@ void TSStatic::onRemove()
|
||||||
mShapeInstance = NULL;
|
mShapeInstance = NULL;
|
||||||
|
|
||||||
mAmbientThread = NULL;
|
mAmbientThread = NULL;
|
||||||
if (isClientObject())
|
if (isClientObject() && mCubeReflector)
|
||||||
mCubeReflector.unregisterReflector();
|
{
|
||||||
|
mCubeReflector->unregisterReflector();
|
||||||
|
SAFE_DELETE(mCubeReflector);
|
||||||
|
}
|
||||||
|
|
||||||
Parent::onRemove();
|
Parent::onRemove();
|
||||||
}
|
}
|
||||||
|
|
@ -780,7 +796,7 @@ void TSStatic::prepRenderImage(SceneRenderState* state)
|
||||||
|
|
||||||
// If we're currently rendering our own reflection we
|
// If we're currently rendering our own reflection we
|
||||||
// don't want to render ourselves into it.
|
// don't want to render ourselves into it.
|
||||||
if (mCubeReflector.isRendering())
|
if (mCubeReflector && mCubeReflector->isRendering())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -800,8 +816,8 @@ void TSStatic::prepRenderImage(SceneRenderState* state)
|
||||||
rdata.setFadeOverride(1.0f);
|
rdata.setFadeOverride(1.0f);
|
||||||
rdata.setOriginSort(mUseOriginSort);
|
rdata.setOriginSort(mUseOriginSort);
|
||||||
|
|
||||||
if (mCubeReflector.isEnabled())
|
if (mCubeReflector && mCubeReflector->isEnabled())
|
||||||
rdata.setCubemap(mCubeReflector.getCubemap());
|
rdata.setCubemap(mCubeReflector->getCubemap());
|
||||||
|
|
||||||
// Acculumation
|
// Acculumation
|
||||||
rdata.setAccuTex(mAccuTex);
|
rdata.setAccuTex(mAccuTex);
|
||||||
|
|
@ -830,13 +846,13 @@ void TSStatic::prepRenderImage(SceneRenderState* state)
|
||||||
mat.scale(mObjScale);
|
mat.scale(mObjScale);
|
||||||
GFX->setWorldMatrix(mat);
|
GFX->setWorldMatrix(mat);
|
||||||
|
|
||||||
if (state->isDiffusePass() && mCubeReflector.isEnabled() && mCubeReflector.getOcclusionQuery())
|
if (state->isDiffusePass() && mCubeReflector && mCubeReflector->isEnabled() && mCubeReflector->getOcclusionQuery())
|
||||||
{
|
{
|
||||||
RenderPassManager* pass = state->getRenderPass();
|
RenderPassManager* pass = state->getRenderPass();
|
||||||
OccluderRenderInst* ri = pass->allocInst<OccluderRenderInst>();
|
OccluderRenderInst* ri = pass->allocInst<OccluderRenderInst>();
|
||||||
|
|
||||||
ri->type = RenderPassManager::RIT_Occluder;
|
ri->type = RenderPassManager::RIT_Occluder;
|
||||||
ri->query = mCubeReflector.getOcclusionQuery();
|
ri->query = mCubeReflector->getOcclusionQuery();
|
||||||
mObjToWorld.mulP(mObjBox.getCenter(), &ri->position);
|
mObjToWorld.mulP(mObjBox.getCenter(), &ri->position);
|
||||||
ri->scale.set(mObjBox.getExtents());
|
ri->scale.set(mObjBox.getExtents());
|
||||||
ri->orientation = pass->allocUniqueXform(mObjToWorld);
|
ri->orientation = pass->allocUniqueXform(mObjToWorld);
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ protected:
|
||||||
String cubeDescName;
|
String cubeDescName;
|
||||||
U32 cubeDescId;
|
U32 cubeDescId;
|
||||||
ReflectorDesc* reflectorDesc;
|
ReflectorDesc* reflectorDesc;
|
||||||
CubeReflector mCubeReflector;
|
CubeReflector* mCubeReflector;
|
||||||
|
|
||||||
void onAssetRefreshed(AssetPtrBase* pAssetPtrBase) override
|
void onAssetRefreshed(AssetPtrBase* pAssetPtrBase) override
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2367,8 +2367,7 @@ DefineEngineFunction( exec, bool, ( const char* fileName, bool noCalls, bool jou
|
||||||
|
|
||||||
DefineEngineFunction( eval, const char*, ( const char* consoleString, bool echo ), (false), "eval(consoleString)")
|
DefineEngineFunction( eval, const char*, ( const char* consoleString, bool echo ), (false), "eval(consoleString)")
|
||||||
{
|
{
|
||||||
Con::EvalResult returnValue = Con::evaluate(consoleString, echo, NULL);
|
Con::EvalResult returnValue = Con::evaluate(consoleString, echo, Platform::makeRelativePathName(Con::getCurrentScriptModulePath(), NULL));
|
||||||
|
|
||||||
return Con::getReturnBuffer(returnValue.value.getString());
|
return Con::getReturnBuffer(returnValue.value.getString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,8 @@ inline FuncVars* getFuncVars(S32 lineNumber)
|
||||||
{
|
{
|
||||||
if (gFuncVars == &gGlobalScopeFuncVars)
|
if (gFuncVars == &gGlobalScopeFuncVars)
|
||||||
{
|
{
|
||||||
const char* str = avar("Attemping to use local variable in global scope. File: %s Line: %d", CodeBlock::smCurrentParser->getCurrentFile(), lineNumber);
|
const char* lineTxt = CodeBlock::smCurrentLineText;
|
||||||
|
const char* str = avar("Attemping to use local variable in global scope. File: %s\nLine Num: %d\nLine: \"%s\"", CodeBlock::smCurrentParser->getCurrentFile(), lineNumber, lineTxt);
|
||||||
scriptErrorHandler(str);
|
scriptErrorHandler(str);
|
||||||
}
|
}
|
||||||
return gFuncVars;
|
return gFuncVars;
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ using namespace Compiler;
|
||||||
|
|
||||||
bool CodeBlock::smInFunction = false;
|
bool CodeBlock::smInFunction = false;
|
||||||
CodeBlock * CodeBlock::smCodeBlockList = NULL;
|
CodeBlock * CodeBlock::smCodeBlockList = NULL;
|
||||||
|
const char* CodeBlock::smCurrentLineText = "\0";
|
||||||
TorqueScriptParser *CodeBlock::smCurrentParser = NULL;
|
TorqueScriptParser *CodeBlock::smCurrentParser = NULL;
|
||||||
|
|
||||||
extern FuncVars gEvalFuncVars;
|
extern FuncVars gEvalFuncVars;
|
||||||
|
|
@ -578,6 +579,7 @@ Con::EvalResult CodeBlock::compileExec(StringTableEntry fileName, const char *in
|
||||||
consoleAllocReset();
|
consoleAllocReset();
|
||||||
|
|
||||||
name = fileName;
|
name = fileName;
|
||||||
|
smCurrentLineText = inString;
|
||||||
|
|
||||||
if (fileName)
|
if (fileName)
|
||||||
{
|
{
|
||||||
|
|
@ -609,7 +611,7 @@ Con::EvalResult CodeBlock::compileExec(StringTableEntry fileName, const char *in
|
||||||
Script::gStatementList = NULL;
|
Script::gStatementList = NULL;
|
||||||
|
|
||||||
// we are an eval compile if we don't have a file name associated (no exec)
|
// we are an eval compile if we don't have a file name associated (no exec)
|
||||||
gIsEvalCompile = fileName == NULL;
|
gIsEvalCompile = fileName == NULL || setFrame == 0;
|
||||||
gFuncVars = gIsEvalCompile ? &gEvalFuncVars : &gGlobalScopeFuncVars;
|
gFuncVars = gIsEvalCompile ? &gEvalFuncVars : &gGlobalScopeFuncVars;
|
||||||
|
|
||||||
// Set up the parser.
|
// Set up the parser.
|
||||||
|
|
@ -623,6 +625,7 @@ Con::EvalResult CodeBlock::compileExec(StringTableEntry fileName, const char *in
|
||||||
|
|
||||||
if (!Script::gStatementList)
|
if (!Script::gStatementList)
|
||||||
{
|
{
|
||||||
|
smCurrentLineText = "\0";
|
||||||
delete this;
|
delete this;
|
||||||
return Con::EvalResult(Con::getVariable("$ScriptError"));
|
return Con::EvalResult(Con::getVariable("$ScriptError"));
|
||||||
}
|
}
|
||||||
|
|
@ -668,7 +671,10 @@ Con::EvalResult CodeBlock::compileExec(StringTableEntry fileName, const char *in
|
||||||
Con::warnf(ConsoleLogEntry::General, "precompile size mismatch, precompile: %d compile: %d", codeSize, lastIp);
|
Con::warnf(ConsoleLogEntry::General, "precompile size mismatch, precompile: %d compile: %d", codeSize, lastIp);
|
||||||
|
|
||||||
// repurpose argc as local register counter for global state
|
// repurpose argc as local register counter for global state
|
||||||
return (exec(0, fileName, NULL, localRegisterCount, 0, noCalls, NULL, setFrame));
|
Con::EvalResult execResult = (exec(0, fileName, NULL, localRegisterCount, 0, noCalls, NULL, setFrame));
|
||||||
|
|
||||||
|
smCurrentLineText = "\0";
|
||||||
|
return execResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ private:
|
||||||
public:
|
public:
|
||||||
static bool smInFunction;
|
static bool smInFunction;
|
||||||
static TorqueScriptParser * smCurrentParser;
|
static TorqueScriptParser * smCurrentParser;
|
||||||
|
static const char* smCurrentLineText;
|
||||||
|
|
||||||
static CodeBlock *getCodeBlockList()
|
static CodeBlock *getCodeBlockList()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,16 @@ S32 FuncVars::assign(StringTableEntry var, TypeReq currentType, S32 lineNumber,
|
||||||
|
|
||||||
if (found->second.isConstant)
|
if (found->second.isConstant)
|
||||||
{
|
{
|
||||||
const char* str = avar("Script Warning: Reassigning variable %s when it is a constant. File: %s Line : %d", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber);
|
const char* lineText = CodeBlock::smCurrentLineText;
|
||||||
|
|
||||||
|
String codeString = CodeBlock::smCurrentLineText;
|
||||||
|
Vector<String> splitLines;
|
||||||
|
codeString.split("\n", splitLines);
|
||||||
|
|
||||||
|
if (lineNumber > 0 && splitLines.size() > lineNumber)
|
||||||
|
lineText = splitLines[lineNumber - 1].c_str();
|
||||||
|
|
||||||
|
const char* str = avar("Script Warning: Reassigning variable %s when it is a constant. File: %s\nLine Num: %d\nLine: \"%s\"", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber, lineText);
|
||||||
scriptErrorHandler(str);
|
scriptErrorHandler(str);
|
||||||
}
|
}
|
||||||
return found->second.reg;
|
return found->second.reg;
|
||||||
|
|
@ -179,7 +188,16 @@ S32 FuncVars::lookup(StringTableEntry var, S32 lineNumber)
|
||||||
|
|
||||||
if (found == vars.end())
|
if (found == vars.end())
|
||||||
{
|
{
|
||||||
const char* str = avar("Script Warning: Variable %s referenced before used when compiling script. File: %s Line: %d", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber);
|
const char* lineText = CodeBlock::smCurrentLineText;
|
||||||
|
|
||||||
|
String codeString = CodeBlock::smCurrentLineText;
|
||||||
|
Vector<String> splitLines;
|
||||||
|
codeString.split("\n", splitLines);
|
||||||
|
|
||||||
|
if (lineNumber > 0 && splitLines.size() > lineNumber)
|
||||||
|
lineText = splitLines[lineNumber - 1].c_str();
|
||||||
|
|
||||||
|
const char* str = avar("Script Warning: Variable %s referenced before used when compiling script. File: %s\nLine Num: %d\nLine: \"%s\"", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber, lineText);
|
||||||
scriptErrorHandler(str);
|
scriptErrorHandler(str);
|
||||||
|
|
||||||
return assign(var, TypeReqString, lineNumber, false);
|
return assign(var, TypeReqString, lineNumber, false);
|
||||||
|
|
@ -194,7 +212,16 @@ TypeReq FuncVars::lookupType(StringTableEntry var, S32 lineNumber)
|
||||||
|
|
||||||
if (found == vars.end())
|
if (found == vars.end())
|
||||||
{
|
{
|
||||||
const char* str = avar("Script Warning: Variable %s referenced before used when compiling script. File: %s Line: %d", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber);
|
const char* lineText = CodeBlock::smCurrentLineText;
|
||||||
|
|
||||||
|
String codeString = CodeBlock::smCurrentLineText;
|
||||||
|
Vector<String> splitLines;
|
||||||
|
codeString.split("\n", splitLines);
|
||||||
|
|
||||||
|
if (lineNumber > 0 && splitLines.size() > lineNumber)
|
||||||
|
lineText = splitLines[lineNumber-1].c_str();
|
||||||
|
|
||||||
|
const char* str = avar("Script Warning: Variable %s referenced before used when compiling script. File: %s\nLine Num: %d\nLine: \"%s\"", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber, lineText);
|
||||||
scriptErrorHandler(str);
|
scriptErrorHandler(str);
|
||||||
|
|
||||||
assign(var, TypeReqString, lineNumber, false);
|
assign(var, TypeReqString, lineNumber, false);
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,10 @@ namespace TorqueScript
|
||||||
if (fileName)
|
if (fileName)
|
||||||
fileName = StringTable->insert(fileName);
|
fileName = StringTable->insert(fileName);
|
||||||
|
|
||||||
|
bool fileExec = Torque::FS::IsFile(fileName);
|
||||||
|
|
||||||
CodeBlock* newCodeBlock = new CodeBlock();
|
CodeBlock* newCodeBlock = new CodeBlock();
|
||||||
return (newCodeBlock->compileExec(fileName, string, false, fileName ? -1 : 0));
|
return (newCodeBlock->compileExec(fileName, string, false, fileExec ? -1 : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
Con::EvalResult TorqueScriptRuntime::evaluate(const char* script, S32 frame, bool echo, const char* fileName)
|
Con::EvalResult TorqueScriptRuntime::evaluate(const char* script, S32 frame, bool echo, const char* fileName)
|
||||||
|
|
|
||||||
|
|
@ -705,10 +705,8 @@ bool GFont::read(Stream& io_rStream)
|
||||||
delete bmp;
|
delete bmp;
|
||||||
return false;
|
return false;
|
||||||
}*/
|
}*/
|
||||||
U32 len;
|
|
||||||
io_rStream.read(&len);
|
|
||||||
|
|
||||||
if (!bmp->readBitmapStream("png", io_rStream, len))
|
if (!bmp->readBitmapStream("png", io_rStream, U32_MAX))
|
||||||
{
|
{
|
||||||
delete bmp;
|
delete bmp;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -91,19 +91,74 @@ void loadGLExtensions(void *context)
|
||||||
GL::gglPerformExtensionBinds(context);
|
GL::gglPerformExtensionBinds(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void STDCALL glDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length,
|
void APIENTRY glDebugCallback(
|
||||||
const GLchar *message, const void *userParam)
|
GLenum source,
|
||||||
|
GLenum type,
|
||||||
|
GLuint id,
|
||||||
|
GLenum severity,
|
||||||
|
GLsizei length,
|
||||||
|
const GLchar* message,
|
||||||
|
const void* userParam)
|
||||||
{
|
{
|
||||||
// JTH [11/24/2016]: This is a temporary fix so that we do not get spammed for redundant fbo changes.
|
// Ignore non-significant notifications (optional)
|
||||||
// This only happens on Intel cards. This should be looked into sometime in the near future.
|
if (severity == GL_DEBUG_SEVERITY_NOTIFICATION)
|
||||||
if (dStrStartsWith(message, "API_ID_REDUNDANT_FBO"))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const char* srcStr = "UNKNOWN";
|
||||||
|
const char* typeStr = "UNKNOWN";
|
||||||
|
const char* sevStr = "UNKNOWN";
|
||||||
|
|
||||||
|
switch (source)
|
||||||
|
{
|
||||||
|
case GL_DEBUG_SOURCE_API: srcStr = "API"; break;
|
||||||
|
case GL_DEBUG_SOURCE_WINDOW_SYSTEM: srcStr = "WINDOW"; break;
|
||||||
|
case GL_DEBUG_SOURCE_SHADER_COMPILER: srcStr = "SHADER"; break;
|
||||||
|
case GL_DEBUG_SOURCE_THIRD_PARTY: srcStr = "THIRD_PARTY"; break;
|
||||||
|
case GL_DEBUG_SOURCE_APPLICATION: srcStr = "APP"; break;
|
||||||
|
case GL_DEBUG_SOURCE_OTHER: srcStr = "OTHER"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case GL_DEBUG_TYPE_ERROR: typeStr = "ERROR"; break;
|
||||||
|
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: typeStr = "DEPRECATED"; break;
|
||||||
|
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: typeStr = "UNDEFINED"; break;
|
||||||
|
case GL_DEBUG_TYPE_PORTABILITY: typeStr = "PORTABILITY"; break;
|
||||||
|
case GL_DEBUG_TYPE_PERFORMANCE: typeStr = "PERFORMANCE"; break;
|
||||||
|
case GL_DEBUG_TYPE_MARKER: typeStr = "MARKER"; break;
|
||||||
|
case GL_DEBUG_TYPE_PUSH_GROUP: typeStr = "PUSH"; break;
|
||||||
|
case GL_DEBUG_TYPE_POP_GROUP: typeStr = "POP"; break;
|
||||||
|
case GL_DEBUG_TYPE_OTHER: typeStr = "OTHER"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (severity)
|
||||||
|
{
|
||||||
|
case GL_DEBUG_SEVERITY_HIGH: sevStr = "HIGH"; break;
|
||||||
|
case GL_DEBUG_SEVERITY_MEDIUM: sevStr = "MEDIUM"; break;
|
||||||
|
case GL_DEBUG_SEVERITY_LOW: sevStr = "LOW"; break;
|
||||||
|
case GL_DEBUG_SEVERITY_NOTIFICATION: sevStr = "NOTIFY"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter known noisy IDs here if needed
|
||||||
|
// Example:
|
||||||
|
// if (id == 131185) return;
|
||||||
|
|
||||||
if (severity == GL_DEBUG_SEVERITY_HIGH)
|
if (severity == GL_DEBUG_SEVERITY_HIGH)
|
||||||
Con::errorf("OPENGL: %s", message);
|
{
|
||||||
|
Con::errorf("OPENGL [%s][%s][%s][%u]: %s",
|
||||||
|
sevStr, srcStr, typeStr, id, message);
|
||||||
|
AssertFatal(false, "OpenGL HIGH severity error.");
|
||||||
|
}
|
||||||
else if (severity == GL_DEBUG_SEVERITY_MEDIUM)
|
else if (severity == GL_DEBUG_SEVERITY_MEDIUM)
|
||||||
Con::warnf("OPENGL: %s", message);
|
{
|
||||||
else if (severity == GL_DEBUG_SEVERITY_LOW)
|
Con::warnf("OPENGL [%s][%s][%s][%u]: %s",
|
||||||
Con::printf("OPENGL: %s", message);
|
sevStr, srcStr, typeStr, id, message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Con::printf("OPENGL [%s][%s][%s][%u]: %s",
|
||||||
|
sevStr, srcStr, typeStr, id, message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void STDCALL glAmdDebugCallback(GLuint id, GLenum category, GLenum severity, GLsizei length,
|
void STDCALL glAmdDebugCallback(GLuint id, GLenum category, GLenum severity, GLsizei length,
|
||||||
|
|
@ -157,27 +212,34 @@ void GFXGLDevice::initGLState()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TORQUE_DEBUG
|
#if TORQUE_DEBUG
|
||||||
if( gglHasExtension(ARB_debug_output) )
|
|
||||||
{
|
bool debugInitialized = false;
|
||||||
glEnable(GL_DEBUG_OUTPUT);
|
int flags;
|
||||||
glDebugMessageCallbackARB(glDebugCallback, NULL);
|
glGetIntegerv(GL_CONTEXT_FLAGS, &flags);
|
||||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
if (flags & GL_CONTEXT_FLAG_DEBUG_BIT)
|
||||||
GLuint unusedIds = 0;
|
{
|
||||||
glDebugMessageControlARB(GL_DONT_CARE,
|
glEnable(GL_DEBUG_OUTPUT);
|
||||||
GL_DONT_CARE,
|
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||||
GL_DONT_CARE,
|
|
||||||
0,
|
glDebugMessageCallback(glDebugCallback, nullptr);
|
||||||
&unusedIds,
|
|
||||||
GL_TRUE);
|
glDebugMessageControl(
|
||||||
}
|
GL_DONT_CARE,
|
||||||
else if(gglHasExtension(AMD_debug_output))
|
GL_DONT_CARE,
|
||||||
{
|
GL_DONT_CARE,
|
||||||
glEnable(GL_DEBUG_OUTPUT);
|
0,
|
||||||
glDebugMessageCallbackAMD(glAmdDebugCallback, NULL);
|
nullptr,
|
||||||
//glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
GL_TRUE);
|
||||||
GLuint unusedIds = 0;
|
|
||||||
glDebugMessageEnableAMD(GL_DONT_CARE, GL_DONT_CARE, 0,&unusedIds, GL_TRUE);
|
Con::printf("OpenGL debug output enabled.");
|
||||||
}
|
debugInitialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!debugInitialized)
|
||||||
|
{
|
||||||
|
Con::warnf("OpenGL debug output NOT available.");
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PlatformGL::setVSync(smEnableVSync);
|
PlatformGL::setVSync(smEnableVSync);
|
||||||
|
|
|
||||||
|
|
@ -364,34 +364,83 @@ void GFXGLTextureManager::innerCreateTexture( GFXGLTextureObject *retTex,
|
||||||
// loadTexture - GBitmap
|
// loadTexture - GBitmap
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void _textureUpload(const S32 width, const S32 height,const S32 bytesPerPixel,const GFXGLTextureObject* texture, const GFXFormat fmt, const U8* data,const S32 mip=0, const U32 face = 0, Swizzle<U8, 4> *pSwizzle = NULL)
|
static void _textureUpload(
|
||||||
|
const S32 width,
|
||||||
|
const S32 height,
|
||||||
|
const S32 bytesPerPixel,
|
||||||
|
const GFXGLTextureObject* texture,
|
||||||
|
const GFXFormat fmt,
|
||||||
|
const U8* data,
|
||||||
|
const S32 mip = 0,
|
||||||
|
const U32 face = 0,
|
||||||
|
Swizzle<U8, 4>* pSwizzle = NULL)
|
||||||
{
|
{
|
||||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, texture->getBuffer());
|
const GLenum target = texture->getBinding();
|
||||||
U32 bufSize = width * height * bytesPerPixel;
|
|
||||||
glBufferData(GL_PIXEL_UNPACK_BUFFER, bufSize, NULL, GL_STREAM_DRAW);
|
|
||||||
|
|
||||||
if(pSwizzle)
|
// Save pixel store state
|
||||||
{
|
GLint prevUnpackAlign;
|
||||||
PROFILE_SCOPE(Swizzle32_Upload);
|
glGetIntegerv(GL_UNPACK_ALIGNMENT, &prevUnpackAlign);
|
||||||
U8* pboMemory = (U8*)dMalloc(bufSize);
|
|
||||||
pSwizzle->ToBuffer(pboMemory, data, bufSize);
|
|
||||||
glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, bufSize, pboMemory);
|
|
||||||
dFree(pboMemory);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PROFILE_SCOPE(SwizzleNull_Upload);
|
|
||||||
glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, bufSize, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(texture->getBinding() == GL_TEXTURE_CUBE_MAP)
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
glTexSubImage2D(GFXGLFaceType[face], mip, 0, 0, width, height, GFXGLTextureFormat[fmt], GFXGLTextureType[fmt], NULL);
|
|
||||||
else if (texture->getBinding() == GL_TEXTURE_2D)
|
|
||||||
glTexSubImage2D(texture->getBinding(), mip, 0, 0, width, height, GFXGLTextureFormat[fmt], GFXGLTextureType[fmt], NULL);
|
|
||||||
else
|
|
||||||
glTexSubImage1D(texture->getBinding(), mip, 0, (width > 1 ? width : height), GFXGLTextureFormat[fmt], GFXGLTextureType[fmt], NULL);
|
|
||||||
|
|
||||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
const U32 bufSize = width * height * bytesPerPixel;
|
||||||
|
|
||||||
|
const U8* uploadPtr = data;
|
||||||
|
U8* tempBuffer = nullptr;
|
||||||
|
|
||||||
|
if (pSwizzle)
|
||||||
|
{
|
||||||
|
tempBuffer = (U8*)dMalloc(bufSize);
|
||||||
|
pSwizzle->ToBuffer(tempBuffer, data, bufSize);
|
||||||
|
uploadPtr = tempBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target == GL_TEXTURE_CUBE_MAP)
|
||||||
|
{
|
||||||
|
glTexSubImage2D(
|
||||||
|
GFXGLFaceType[face],
|
||||||
|
mip,
|
||||||
|
0, 0,
|
||||||
|
width, height,
|
||||||
|
GFXGLTextureFormat[fmt],
|
||||||
|
GFXGLTextureType[fmt],
|
||||||
|
uploadPtr
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (target == GL_TEXTURE_2D)
|
||||||
|
{
|
||||||
|
glTexSubImage2D(
|
||||||
|
GL_TEXTURE_2D,
|
||||||
|
mip,
|
||||||
|
0, 0,
|
||||||
|
width, height,
|
||||||
|
GFXGLTextureFormat[fmt],
|
||||||
|
GFXGLTextureType[fmt],
|
||||||
|
uploadPtr
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (target == GL_TEXTURE_1D)
|
||||||
|
{
|
||||||
|
glTexSubImage1D(
|
||||||
|
GL_TEXTURE_1D,
|
||||||
|
mip,
|
||||||
|
0,
|
||||||
|
width,
|
||||||
|
GFXGLTextureFormat[fmt],
|
||||||
|
GFXGLTextureType[fmt],
|
||||||
|
uploadPtr
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tempBuffer)
|
||||||
|
dFree(tempBuffer);
|
||||||
|
|
||||||
|
// Restore state
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT, prevUnpackAlign);
|
||||||
|
|
||||||
|
#ifdef TORQUE_DEBUG
|
||||||
|
glCheckErrors();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GFXGLTextureManager::_loadTexture(GFXTextureObject *aTexture, GBitmap *pDL)
|
bool GFXGLTextureManager::_loadTexture(GFXTextureObject *aTexture, GBitmap *pDL)
|
||||||
|
|
|
||||||
|
|
@ -102,36 +102,79 @@ GFXLockedRect* GFXGLTextureObject::lock(U32 mipLevel /*= 0*/, RectI* inRect /*=
|
||||||
|
|
||||||
void GFXGLTextureObject::unlock(U32 mipLevel /*= 0*/, U32 faceIndex /*= 0*/)
|
void GFXGLTextureObject::unlock(U32 mipLevel /*= 0*/, U32 faceIndex /*= 0*/)
|
||||||
{
|
{
|
||||||
if(!mLockedRect.bits)
|
if (!mLockedRect.bits)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// I know this is in unlock, but in GL we actually do our submission in unlock.
|
PROFILE_SCOPE(GFXGLTextureObject_unlock);
|
||||||
PROFILE_SCOPE(GFXGLTextureObject_lockRT);
|
|
||||||
|
|
||||||
PRESERVE_TEXTURE(mBinding);
|
PRESERVE_TEXTURE(mBinding);
|
||||||
glBindTexture(mBinding, mHandle);
|
glBindTexture(mBinding, mHandle);
|
||||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, mBuffer);
|
|
||||||
glBufferData(GL_PIXEL_UNPACK_BUFFER, (mLockedRectRect.extent.x + 1) * (mLockedRectRect.extent.y + 1) * mBytesPerTexel, mFrameAllocatorPtr, GL_STREAM_DRAW);
|
|
||||||
S32 z = getDepth();
|
|
||||||
if (mBinding == GL_TEXTURE_3D)
|
|
||||||
glTexSubImage3D(mBinding, mipLevel, mLockedRectRect.point.x, mLockedRectRect.point.y, z,
|
|
||||||
mLockedRectRect.extent.x, mLockedRectRect.extent.y, z, GFXGLTextureFormat[mFormat], GFXGLTextureType[mFormat], NULL);
|
|
||||||
else if(mBinding == GL_TEXTURE_2D)
|
|
||||||
glTexSubImage2D(mBinding, mipLevel, mLockedRectRect.point.x, mLockedRectRect.point.y,
|
|
||||||
mLockedRectRect.extent.x, mLockedRectRect.extent.y, GFXGLTextureFormat[mFormat], GFXGLTextureType[mFormat], NULL);
|
|
||||||
else if(mBinding == GL_TEXTURE_1D)
|
|
||||||
glTexSubImage1D(mBinding, mipLevel, (mLockedRectRect.point.x > 1 ? mLockedRectRect.point.x : mLockedRectRect.point.y),
|
|
||||||
(mLockedRectRect.extent.x > 1 ? mLockedRectRect.extent.x : mLockedRectRect.extent.y), GFXGLTextureFormat[mFormat], GFXGLTextureType[mFormat], NULL);
|
|
||||||
|
|
||||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
// --- Save pixel store state ---
|
||||||
|
GLint prevUnpackAlign;
|
||||||
|
glGetIntegerv(GL_UNPACK_ALIGNMENT, &prevUnpackAlign);
|
||||||
|
|
||||||
mLockedRect.bits = NULL;
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
#if TORQUE_DEBUG
|
|
||||||
AssertFatal(mFrameAllocatorMarkGuard == FrameAllocator::getWaterMark(), "");
|
const U32 width = mLockedRectRect.extent.x;
|
||||||
|
const U32 height = mLockedRectRect.extent.y;
|
||||||
|
const U32 depth = getDepth();
|
||||||
|
|
||||||
|
if (mBinding == GL_TEXTURE_3D)
|
||||||
|
{
|
||||||
|
glTexSubImage3D(
|
||||||
|
mBinding,
|
||||||
|
mipLevel,
|
||||||
|
mLockedRectRect.point.x,
|
||||||
|
mLockedRectRect.point.y,
|
||||||
|
0,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
depth,
|
||||||
|
GFXGLTextureFormat[mFormat],
|
||||||
|
GFXGLTextureType[mFormat],
|
||||||
|
mLockedRect.bits
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (mBinding == GL_TEXTURE_2D)
|
||||||
|
{
|
||||||
|
glTexSubImage2D(
|
||||||
|
mBinding,
|
||||||
|
mipLevel,
|
||||||
|
mLockedRectRect.point.x,
|
||||||
|
mLockedRectRect.point.y,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
GFXGLTextureFormat[mFormat],
|
||||||
|
GFXGLTextureType[mFormat],
|
||||||
|
mLockedRect.bits
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (mBinding == GL_TEXTURE_1D)
|
||||||
|
{
|
||||||
|
glTexSubImage1D(
|
||||||
|
mBinding,
|
||||||
|
mipLevel,
|
||||||
|
mLockedRectRect.point.x,
|
||||||
|
width,
|
||||||
|
GFXGLTextureFormat[mFormat],
|
||||||
|
GFXGLTextureType[mFormat],
|
||||||
|
mLockedRect.bits
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Restore state ---
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT, prevUnpackAlign);
|
||||||
|
|
||||||
|
mLockedRect.bits = NULL;
|
||||||
|
|
||||||
|
FrameAllocator::setWaterMark(mFrameAllocatorMark);
|
||||||
|
mFrameAllocatorMark = 0;
|
||||||
|
mFrameAllocatorPtr = NULL;
|
||||||
|
|
||||||
|
#ifdef TORQUE_DEBUG
|
||||||
|
glCheckErrors();
|
||||||
#endif
|
#endif
|
||||||
FrameAllocator::setWaterMark(mFrameAllocatorMark);
|
|
||||||
mFrameAllocatorMark = 0;
|
|
||||||
mFrameAllocatorPtr = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GFXGLTextureObject::release()
|
void GFXGLTextureObject::release()
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,32 @@
|
||||||
#include "gfx/gl/gfxGLStateCache.h"
|
#include "gfx/gl/gfxGLStateCache.h"
|
||||||
#include "gfx/bitmap/imageUtils.h"
|
#include "gfx/bitmap/imageUtils.h"
|
||||||
|
|
||||||
|
inline const char* glGetErrorString(GLenum error)
|
||||||
|
{
|
||||||
|
switch (error)
|
||||||
|
{
|
||||||
|
case GL_NO_ERROR: return "No Error";
|
||||||
|
case GL_INVALID_ENUM: return "Invalid Enum";
|
||||||
|
case GL_INVALID_VALUE: return "Invalid Value";
|
||||||
|
case GL_INVALID_OPERATION: return "Invalid Operation";
|
||||||
|
case GL_INVALID_FRAMEBUFFER_OPERATION: return "Invalid Framebuffer Operation";
|
||||||
|
case GL_OUT_OF_MEMORY: return "Out of Memory";
|
||||||
|
case GL_STACK_UNDERFLOW: return "Stack Underflow";
|
||||||
|
case GL_STACK_OVERFLOW: return "Stack Overflow";
|
||||||
|
case GL_CONTEXT_LOST: return "Context Lost";
|
||||||
|
default: return "Unknown Error";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void _glCheckErrors(const char *filename, int line)
|
||||||
|
{
|
||||||
|
GLenum err;
|
||||||
|
while ((err = glGetError()) != GL_NO_ERROR)
|
||||||
|
Con::printf("OpenGL Error: %s (%d) [%u] %s\n", filename, line, err, glGetErrorString(err));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define glCheckErrors() _glCheckErrors(__FILE__, __LINE__)
|
||||||
|
|
||||||
inline U32 getMaxMipmaps(U32 width, U32 height, U32 depth)
|
inline U32 getMaxMipmaps(U32 width, U32 height, U32 depth)
|
||||||
{
|
{
|
||||||
return getMax( getBinLog2(depth), getMax(getBinLog2(width), getBinLog2(height))) + 1;
|
return getMax( getBinLog2(depth), getMax(getBinLog2(width), getBinLog2(height))) + 1;
|
||||||
|
|
|
||||||
|
|
@ -103,9 +103,17 @@ void GFXGLDevice::enumerateAdapters( Vector<GFXAdapter*> &adapterList )
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_ClearError();
|
SDL_ClearError();
|
||||||
|
U32 debugFlag = 0;
|
||||||
|
#ifdef TORQUE_DEBUG
|
||||||
|
debugFlag |= SDL_GL_CONTEXT_DEBUG_FLAG;
|
||||||
|
#endif
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, debugFlag);
|
||||||
SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1);
|
SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
|
||||||
|
#ifdef TORQUE_GL_SOFTWARE
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 0);
|
||||||
|
#endif
|
||||||
SDL_GLContext tempContext = SDL_GL_CreateContext( tempWindow );
|
SDL_GLContext tempContext = SDL_GL_CreateContext( tempWindow );
|
||||||
if( !tempContext )
|
if( !tempContext )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -303,7 +303,10 @@ void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent& event)
|
||||||
SFX->playOnce(mProfile->getSoundButtonOverProfile());
|
SFX->playOnce(mProfile->getSoundButtonOverProfile());
|
||||||
|
|
||||||
mHighlighted = true;
|
mHighlighted = true;
|
||||||
messageSiblings(mRadioGroup);
|
|
||||||
|
if (mButtonType != ButtonTypeRadio)
|
||||||
|
messageSiblings(mRadioGroup);
|
||||||
|
|
||||||
onHighlighted_callback(mHighlighted);
|
onHighlighted_callback(mHighlighted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -320,7 +323,9 @@ void GuiButtonBaseCtrl::onMouseLeave(const GuiEvent&)
|
||||||
mDepressed = false;
|
mDepressed = false;
|
||||||
mHighlighted = false;
|
mHighlighted = false;
|
||||||
onHighlighted_callback(mHighlighted);
|
onHighlighted_callback(mHighlighted);
|
||||||
messageSiblings(mRadioGroup);
|
|
||||||
|
if (mButtonType != ButtonTypeRadio)
|
||||||
|
messageSiblings(mRadioGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ public:
|
||||||
bool getStateOn() const { return mStateOn; }
|
bool getStateOn() const { return mStateOn; }
|
||||||
|
|
||||||
void setDepressed(bool depressed) { mDepressed = depressed; }
|
void setDepressed(bool depressed) { mDepressed = depressed; }
|
||||||
|
bool isDepressed() { return mDepressed; }
|
||||||
void resetState() { mDepressed = false; mHighlighted = false; }
|
void resetState() { mDepressed = false; mHighlighted = false; }
|
||||||
|
|
||||||
void setHighlighted(bool highlighted);
|
void setHighlighted(bool highlighted);
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@
|
||||||
#include "console/engineAPI.h"
|
#include "console/engineAPI.h"
|
||||||
#include "gfx/gfxDevice.h"
|
#include "gfx/gfxDevice.h"
|
||||||
#include "gfx/gfxDrawUtil.h"
|
#include "gfx/gfxDrawUtil.h"
|
||||||
|
#include "gfx/gfxAPI.h"
|
||||||
|
#include "gui/buttons/guiButtonBaseCtrl.h"
|
||||||
|
|
||||||
#include "materials/matTextureTarget.h"
|
#include "materials/matTextureTarget.h"
|
||||||
|
|
||||||
|
|
@ -55,11 +57,26 @@ ConsoleDocClass(GuiBitmapCtrl,
|
||||||
"@ingroup GuiControls"
|
"@ingroup GuiControls"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ImplementEnumType(BitmapDrawMode,
|
||||||
|
"Draw Mode of the bitmap control.\n\n"
|
||||||
|
"@ingroup GuiControls")
|
||||||
|
{
|
||||||
|
GuiBitmapCtrl::BitmapMode_Stretch, "Stretch", "Stretches the bitmap to fill the control extents. Aspect ratio is not preserved."
|
||||||
|
},
|
||||||
|
{ GuiBitmapCtrl::BitmapMode_Tile, "Tile", "Repeats the bitmap to fill the control extents without scaling." },
|
||||||
|
{ GuiBitmapCtrl::BitmapMode_Fit, "Fit", "Scales the bitmap to fit entirely within the control while preserving aspect ratio. May result in letterboxing." },
|
||||||
|
{ GuiBitmapCtrl::BitmapMode_Fill, "Fill", "Scales the bitmap to completely fill the control while preserving aspect ratio. Portions of the bitmap may be cropped." },
|
||||||
|
{ GuiBitmapCtrl::BitmapMode_Center, "Center", "Draws the bitmap at its original size centered within the control. No scaling is applied." },
|
||||||
|
|
||||||
|
EndImplementEnumType;
|
||||||
|
|
||||||
GuiBitmapCtrl::GuiBitmapCtrl(void)
|
GuiBitmapCtrl::GuiBitmapCtrl(void)
|
||||||
: mStartPoint(0, 0),
|
: mStartPoint(0, 0),
|
||||||
mColor(ColorI::WHITE),
|
mColor(ColorI::WHITE),
|
||||||
mAngle(0),
|
mAngle(0),
|
||||||
mWrap(false),
|
mWrap(false),
|
||||||
|
mDrawMode(BitmapMode_Stretch),
|
||||||
|
mFilterType(GFXTextureFilterLinear),
|
||||||
mBitmap(NULL),
|
mBitmap(NULL),
|
||||||
mBitmapName(StringTable->EmptyString())
|
mBitmapName(StringTable->EmptyString())
|
||||||
{
|
{
|
||||||
|
|
@ -74,8 +91,10 @@ void GuiBitmapCtrl::initPersistFields()
|
||||||
|
|
||||||
addField("color", TypeColorI, Offset(mColor, GuiBitmapCtrl), "color mul");
|
addField("color", TypeColorI, Offset(mColor, GuiBitmapCtrl), "color mul");
|
||||||
addField("wrap", TypeBool, Offset(mWrap, GuiBitmapCtrl), "If true, the bitmap is tiled inside the control rather than stretched to fit.");
|
addField("wrap", TypeBool, Offset(mWrap, GuiBitmapCtrl), "If true, the bitmap is tiled inside the control rather than stretched to fit.");
|
||||||
|
addField("drawMode", TYPEID<BitmapMode>(), Offset(mDrawMode, GuiBitmapCtrl), "Sets the mode to draw this bitmap in this control (wrap forces Tile mode).");
|
||||||
|
addField("filterType", TYPEID<GFXTextureFilterType>(), Offset(mFilterType, GuiBitmapCtrl), "Sets the bitmap texture filter mode.");
|
||||||
addFieldV("angle", TypeRangedF32, Offset(mAngle, GuiBitmapCtrl), &CommonValidators::DegreeRange, "rotation");
|
addFieldV("angle", TypeRangedF32, Offset(mAngle, GuiBitmapCtrl), &CommonValidators::DegreeRange, "rotation");
|
||||||
endGroup( "Bitmap" );
|
endGroup("Bitmap");
|
||||||
|
|
||||||
Parent::initPersistFields();
|
Parent::initPersistFields();
|
||||||
}
|
}
|
||||||
|
|
@ -91,6 +110,7 @@ bool GuiBitmapCtrl::onWake()
|
||||||
|
|
||||||
void GuiBitmapCtrl::onSleep()
|
void GuiBitmapCtrl::onSleep()
|
||||||
{
|
{
|
||||||
|
mBitmap = NULL;
|
||||||
Parent::onSleep();
|
Parent::onSleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,36 +191,108 @@ void GuiBitmapCtrl::onRender(Point2I offset, const RectI& updateRect)
|
||||||
{
|
{
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
GFX->getDrawUtil()->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->setBitmapModulation(mColor);
|
GFX->getDrawUtil()->setBitmapModulation(mColor);
|
||||||
if (mWrap)
|
|
||||||
{
|
|
||||||
// We manually draw each repeat because non power of two textures will
|
|
||||||
// not tile correctly when rendered with GFX->drawBitmapTile(). The non POT
|
|
||||||
// bitmap will be padded by the hardware, and we'll see lots of slack
|
|
||||||
// in the texture. So... lets do what we must: draw each repeat by itself:
|
|
||||||
GFXTextureObject* texture = mBitmap;
|
|
||||||
RectI srcRegion;
|
|
||||||
RectI dstRegion;
|
|
||||||
F32 xdone = ((F32)getExtent().x / (F32)texture->mBitmapSize.x) + 1;
|
|
||||||
F32 ydone = ((F32)getExtent().y / (F32)texture->mBitmapSize.y) + 1;
|
|
||||||
|
|
||||||
S32 xshift = mStartPoint.x % texture->mBitmapSize.x;
|
if (dynamic_cast<GuiButtonBaseCtrl*>(getParent()))
|
||||||
S32 yshift = mStartPoint.y % texture->mBitmapSize.y;
|
{
|
||||||
for (S32 y = 0; y < ydone; ++y)
|
GuiButtonBaseCtrl* parent = static_cast<GuiButtonBaseCtrl*>(getParent());
|
||||||
for (S32 x = 0; x < xdone; ++x)
|
|
||||||
{
|
GFX->getDrawUtil()->setBitmapModulation(mProfile->mFillColor);
|
||||||
srcRegion.set(0, 0, texture->mBitmapSize.x, texture->mBitmapSize.y);
|
|
||||||
dstRegion.set(((texture->mBitmapSize.x * x) + offset.x) - xshift,
|
if (parent->isHighlighted())
|
||||||
((texture->mBitmapSize.y * y) + offset.y) - yshift,
|
GFX->getDrawUtil()->setBitmapModulation(mProfile->mFillColorHL);
|
||||||
texture->mBitmapSize.x,
|
if (parent->isDepressed() || parent->getStateOn())
|
||||||
texture->mBitmapSize.y);
|
GFX->getDrawUtil()->setBitmapModulation(mProfile->mFillColorSEL);
|
||||||
GFX->getDrawUtil()->drawBitmapStretchSR(texture, dstRegion, srcRegion, GFXBitmapFlip_None, GFXTextureFilterLinear, mAngle);
|
if (!parent->isActive())
|
||||||
}
|
GFX->getDrawUtil()->setBitmapModulation(mProfile->mFillColorNA);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (mWrap && mDrawMode != BitmapMode_Tile)
|
||||||
|
mDrawMode = BitmapMode_Tile;
|
||||||
|
|
||||||
|
RectI ctrlRect(offset, getExtent());
|
||||||
|
GFXTextureObject* texture = mBitmap;
|
||||||
|
|
||||||
|
F32 texW = (F32)texture->getWidth();
|
||||||
|
F32 texH = (F32)texture->getHeight();
|
||||||
|
F32 ctrlW = (F32)getExtent().x;
|
||||||
|
F32 ctrlH = (F32)getExtent().y;
|
||||||
|
|
||||||
|
switch (mDrawMode)
|
||||||
{
|
{
|
||||||
RectI rect(offset, getExtent());
|
case BitmapMode_Tile:
|
||||||
GFX->getDrawUtil()->drawBitmapStretch(mBitmap, rect, GFXBitmapFlip_None, GFXTextureFilterLinear, false, mAngle);
|
{
|
||||||
|
// How many repetitions needed (+1 ensures full coverage)
|
||||||
|
const S32 xCount = (ctrlW / texW) + 1;
|
||||||
|
const S32 yCount = (ctrlH / texH) + 1;
|
||||||
|
|
||||||
|
// Scroll offset (wrap-safe)
|
||||||
|
const S32 xShift = mStartPoint.x % (S32)texW;
|
||||||
|
const S32 yShift = mStartPoint.y % (S32)texH;
|
||||||
|
|
||||||
|
RectI srcRegion(0, 0, (S32)texW, (S32)texH);
|
||||||
|
RectI dstRegion;
|
||||||
|
|
||||||
|
for (S32 y = 0; y < yCount; ++y)
|
||||||
|
{
|
||||||
|
for (S32 x = 0; x < xCount; ++x)
|
||||||
|
{
|
||||||
|
dstRegion.set(
|
||||||
|
offset.x + (x * texW) - xShift,
|
||||||
|
offset.y + (y * texH) - yShift,
|
||||||
|
texW,
|
||||||
|
texH
|
||||||
|
);
|
||||||
|
|
||||||
|
GFX->getDrawUtil()->drawBitmapStretchSR(texture, dstRegion, srcRegion, GFXBitmapFlip_None, mFilterType, true, mAngle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GuiBitmapCtrl::BitmapMode_Fit:
|
||||||
|
{
|
||||||
|
F32 scale = getMin(ctrlW / texW, ctrlH / texH);
|
||||||
|
|
||||||
|
S32 drawW = (S32)(texW * scale);
|
||||||
|
S32 drawH = (S32)(texH * scale);
|
||||||
|
|
||||||
|
S32 x = offset.x + (ctrlW - drawW) * 0.5f;
|
||||||
|
S32 y = offset.y + (ctrlH - drawH) * 0.5f;
|
||||||
|
|
||||||
|
RectI dst(x, y, drawW, drawH);
|
||||||
|
GFX->getDrawUtil()->drawBitmapStretch(texture, dst, GFXBitmapFlip_None, mFilterType, false, mAngle);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GuiBitmapCtrl::BitmapMode_Fill:
|
||||||
|
{
|
||||||
|
F32 scale = getMax(ctrlW / texW, ctrlH / texH);
|
||||||
|
|
||||||
|
S32 drawW = (S32)(texW * scale);
|
||||||
|
S32 drawH = (S32)(texH * scale);
|
||||||
|
|
||||||
|
S32 x = offset.x + (ctrlW - drawW) * 0.5f;
|
||||||
|
S32 y = offset.y + (ctrlH - drawH) * 0.5f;
|
||||||
|
|
||||||
|
RectI dst(x, y, drawW, drawH);
|
||||||
|
GFX->getDrawUtil()->drawBitmapStretch(texture, dst, GFXBitmapFlip_None, mFilterType, false, mAngle);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GuiBitmapCtrl::BitmapMode_Center:
|
||||||
|
{
|
||||||
|
S32 x = offset.x + (ctrlW - texW) * 0.5f;
|
||||||
|
S32 y = offset.y + (ctrlH - texH) * 0.5f;
|
||||||
|
|
||||||
|
RectI dst(x, y, texW, texH);
|
||||||
|
|
||||||
|
GFX->getDrawUtil()->drawBitmapStretch(texture, dst, GFXBitmapFlip_None, mFilterType, false, mAngle);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
GFX->getDrawUtil()->drawBitmapStretch(texture, ctrlRect, GFXBitmapFlip_None, mFilterType, false, mAngle);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,15 @@ public:
|
||||||
|
|
||||||
typedef GuiControl Parent;
|
typedef GuiControl Parent;
|
||||||
|
|
||||||
|
enum BitmapMode
|
||||||
|
{
|
||||||
|
BitmapMode_Stretch,
|
||||||
|
BitmapMode_Tile,
|
||||||
|
BitmapMode_Fit,
|
||||||
|
BitmapMode_Fill,
|
||||||
|
BitmapMode_Center
|
||||||
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/// Name of the bitmap file. If this is 'texhandle' the bitmap is not loaded
|
/// Name of the bitmap file. If this is 'texhandle' the bitmap is not loaded
|
||||||
|
|
@ -47,6 +56,8 @@ protected:
|
||||||
|
|
||||||
/// If true, bitmap tiles inside control. Otherwise stretches.
|
/// If true, bitmap tiles inside control. Otherwise stretches.
|
||||||
bool mWrap;
|
bool mWrap;
|
||||||
|
BitmapMode mDrawMode;
|
||||||
|
GFXTextureFilterType mFilterType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GFXTexHandle mBitmap;
|
GFXTexHandle mBitmap;
|
||||||
|
|
@ -74,4 +85,7 @@ public:
|
||||||
"The bitmap can either be tiled or stretched inside the control.");
|
"The bitmap can either be tiled or stretched inside the control.");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef GuiBitmapCtrl::BitmapMode BitmapDrawMode;
|
||||||
|
DefineEnumType(BitmapDrawMode);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -974,7 +974,9 @@ void GuiGameListMenuCtrl::doScriptCommand(StringTableEntry command)
|
||||||
if (command && command[0])
|
if (command && command[0])
|
||||||
{
|
{
|
||||||
setThisControl();
|
setThisControl();
|
||||||
Con::evaluate(command, false, __FILE__);
|
StringTableEntry objectName = getName() != StringTable->EmptyString() ? getName() : getInternalName();
|
||||||
|
String context = String::ToString("%s\nObject: %s", Platform::makeRelativePathName(getFilename(), NULL), objectName);
|
||||||
|
Con::evaluate(command, false, context.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -494,7 +494,9 @@ void GuiGameSettingsCtrl::doScriptCommand(StringTableEntry command)
|
||||||
if (command && command[0])
|
if (command && command[0])
|
||||||
{
|
{
|
||||||
setThisControl();
|
setThisControl();
|
||||||
Con::evaluate(command, false, __FILE__);
|
StringTableEntry objectName = getName() != StringTable->EmptyString() ? getName() : getInternalName();
|
||||||
|
String context = String::ToString("%s\nObject: %s", Platform::makeRelativePathName(getFilename(), NULL), objectName);
|
||||||
|
Con::evaluate(command, false, context.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1539,7 +1539,9 @@ StringTableEntry GuiListBoxCtrl::_makeMirrorItemName( SimObject *inObj )
|
||||||
Con::setIntVariable( "$ThisControl", getId() );
|
Con::setIntVariable( "$ThisControl", getId() );
|
||||||
Con::setIntVariable( "$ThisObject", inObj->getId() );
|
Con::setIntVariable( "$ThisObject", inObj->getId() );
|
||||||
|
|
||||||
outName = StringTable->insert( Con::evaluate( mMakeNameCallback ).value, true );
|
StringTableEntry objectName = getName() != StringTable->EmptyString() ? getName() : getInternalName();
|
||||||
|
String context = String::ToString("%s, Object: %s", Platform::makeRelativePathName(getFilename(), NULL), objectName);
|
||||||
|
outName = StringTable->insert( Con::evaluate( mMakeNameCallback, false, context.c_str()).value, true );
|
||||||
}
|
}
|
||||||
else if ( inObj->getName() )
|
else if ( inObj->getName() )
|
||||||
outName = StringTable->insert( inObj->getName() );
|
outName = StringTable->insert( inObj->getName() );
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,9 @@ bool GuiMLTextEditCtrl::onKeyDown(const GuiEvent& event)
|
||||||
case KEY_ESCAPE:
|
case KEY_ESCAPE:
|
||||||
if ( mEscapeCommand[0] )
|
if ( mEscapeCommand[0] )
|
||||||
{
|
{
|
||||||
Con::evaluate( mEscapeCommand );
|
StringTableEntry objectName = getName() != StringTable->EmptyString() ? getName() : getInternalName();
|
||||||
|
String context = String::ToString("%s, Object: %s", Platform::makeRelativePathName(getFilename(), NULL), objectName);
|
||||||
|
Con::evaluate( mEscapeCommand, false, context.c_str());
|
||||||
return( true );
|
return( true );
|
||||||
}
|
}
|
||||||
return( Parent::onKeyDown( event ) );
|
return( Parent::onKeyDown( event ) );
|
||||||
|
|
|
||||||
|
|
@ -2495,7 +2495,16 @@ void GuiControl::getCursor(GuiCursor *&cursor, bool &showCursor, const GuiEvent
|
||||||
const char* GuiControl::evaluate( const char* str )
|
const char* GuiControl::evaluate( const char* str )
|
||||||
{
|
{
|
||||||
smThisControl = this;
|
smThisControl = this;
|
||||||
const char* result = Con::evaluate(str, false).value;
|
StringTableEntry objectName = getName();
|
||||||
|
if (objectName != NULL)
|
||||||
|
objectName = getIdString();
|
||||||
|
|
||||||
|
StringTableEntry groupName = getGroup() ? getGroup()->getName() : NULL;
|
||||||
|
if (groupName != NULL)
|
||||||
|
groupName = getGroup()->getIdString();
|
||||||
|
|
||||||
|
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
|
||||||
|
const char* result = Con::evaluate(str, false, context.c_str()).value;
|
||||||
smThisControl = NULL;
|
smThisControl = NULL;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,10 @@ namespace PlatformGL
|
||||||
#ifdef TORQUE_DEBUG
|
#ifdef TORQUE_DEBUG
|
||||||
debugFlag |= SDL_GL_CONTEXT_DEBUG_FLAG;
|
debugFlag |= SDL_GL_CONTEXT_DEBUG_FLAG;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, majorOGL);
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, minorOGL);
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, debugFlag);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, debugFlag);
|
||||||
SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1);
|
SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
|
||||||
#ifdef TORQUE_GL_SOFTWARE
|
#ifdef TORQUE_GL_SOFTWARE
|
||||||
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 0);
|
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1482,8 +1482,12 @@ bool ActionMap::processAction(const InputEventInfo* pEvent)
|
||||||
if(pNode->flags & Node::BindCmd)
|
if(pNode->flags & Node::BindCmd)
|
||||||
{
|
{
|
||||||
// it's a bind command
|
// it's a bind command
|
||||||
if(pNode->makeConsoleCommand)
|
if (pNode->makeConsoleCommand)
|
||||||
Con::evaluate(pNode->makeConsoleCommand);
|
{
|
||||||
|
StringTableEntry objectName = getName() != StringTable->EmptyString() ? getName() : getInternalName();
|
||||||
|
String context = String::ToString("%s\nObject: %s", Platform::makeRelativePathName(getFilename(), NULL), objectName);
|
||||||
|
Con::evaluate(pNode->makeConsoleCommand, false, context.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (pNode->flags & Node::Held)
|
else if (pNode->flags & Node::Held)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -206,15 +206,15 @@ void AssimpAppMaterial::initMaterial(const Torque::Path& path, Material* mat) co
|
||||||
if (rmName.isNotEmpty())
|
if (rmName.isNotEmpty())
|
||||||
{
|
{
|
||||||
mat->_setRoughMap(cleanTextureName(rmName, cleanFile, path, false), 0); // Roughness
|
mat->_setRoughMap(cleanTextureName(rmName, cleanFile, path, false), 0); // Roughness
|
||||||
mat->mRoughnessChan[0] = 1.0f;
|
mat->mRoughnessChan[0] = 1;
|
||||||
mat->mInvertRoughness[0] = (floatVal == 1.0f);
|
mat->mInvertRoughness[0] = false;
|
||||||
mat->_setMetalMap(cleanTextureName(rmName, cleanFile, path, false), 0); // Metallic
|
mat->_setMetalMap(cleanTextureName(rmName, cleanFile, path, false), 0); // Metallic
|
||||||
mat->mMetalChan[0] = 2.0f;
|
mat->mMetalChan[0] = 2;
|
||||||
}
|
}
|
||||||
if (aoName.isNotEmpty())
|
if (aoName.isNotEmpty())
|
||||||
{
|
{
|
||||||
mat->_setAOMap(cleanTextureName(aoName, cleanFile, path, false), 0); // occlusion
|
mat->_setAOMap(cleanTextureName(aoName, cleanFile, path, false), 0); // occlusion
|
||||||
mat->mAOChan[0] = 0.0f;
|
mat->mAOChan[0] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -178,9 +178,9 @@ SurfaceToLight createSurfaceToLight(in Surface surface, in vec3 L)
|
||||||
surfaceToLight.Lu = L;
|
surfaceToLight.Lu = L;
|
||||||
surfaceToLight.L = normalize(L);
|
surfaceToLight.L = normalize(L);
|
||||||
surfaceToLight.H = normalize(surface.V + surfaceToLight.L);
|
surfaceToLight.H = normalize(surface.V + surfaceToLight.L);
|
||||||
surfaceToLight.NdotL = saturate(dot(surfaceToLight.L, surface.N));
|
surfaceToLight.NdotL = saturate(dot(surface.N,surfaceToLight.L));
|
||||||
surfaceToLight.HdotV = saturate(dot(surfaceToLight.H, surface.V));
|
surfaceToLight.HdotV = saturate(dot(surfaceToLight.H,surface.V));
|
||||||
surfaceToLight.NdotH = saturate(dot(surfaceToLight.H, surface.N));
|
surfaceToLight.NdotH = saturate(dot(surface.N,surfaceToLight.H));
|
||||||
return surfaceToLight;
|
return surfaceToLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -243,12 +243,12 @@ vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
|
||||||
float denominator = 4.0 * max(surface.NdotV, 0.0) * max(surfaceToLight.NdotL, 0.0) + 0.0001;
|
float denominator = 4.0 * max(surface.NdotV, 0.0) * max(surfaceToLight.NdotL, 0.0) + 0.0001;
|
||||||
vec3 specularBRDF = numerator / denominator;
|
vec3 specularBRDF = numerator / denominator;
|
||||||
|
|
||||||
vec3 diffuseBRDF = surface.baseColor.rgb * M_1OVER_PI_F * surface.ao;
|
vec3 diffuseBRDF = surface.baseColor.rgb * surface.ao * M_HALFPI_F;
|
||||||
|
|
||||||
// Final output combining all terms
|
// Final output combining all terms
|
||||||
vec3 kS = F; // Specular reflectance
|
vec3 kS = F; // Specular reflectance
|
||||||
vec3 kD = (1.0 - kS) * (1.0 - surface.metalness); // Diffuse reflectance
|
vec3 kD = (1.0 - kS) * (1.0 - surface.metalness); // Diffuse reflectance
|
||||||
vec3 returnBRDF = kD * (diffuseBRDF) + specularBRDF;
|
vec3 returnBRDF = kD * diffuseBRDF + specularBRDF;
|
||||||
|
|
||||||
if(isCapturing == 1)
|
if(isCapturing == 1)
|
||||||
return lerp(returnBRDF ,surface.albedo.rgb,surface.metalness);
|
return lerp(returnBRDF ,surface.albedo.rgb,surface.metalness);
|
||||||
|
|
|
||||||
|
|
@ -177,9 +177,9 @@ inline SurfaceToLight createSurfaceToLight(in Surface surface, in float3 L)
|
||||||
surfaceToLight.Lu = L;
|
surfaceToLight.Lu = L;
|
||||||
surfaceToLight.L = normalize(L);
|
surfaceToLight.L = normalize(L);
|
||||||
surfaceToLight.H = normalize(surface.V + surfaceToLight.L);
|
surfaceToLight.H = normalize(surface.V + surfaceToLight.L);
|
||||||
surfaceToLight.NdotL = saturate(dot(surfaceToLight.L, surface.N));
|
surfaceToLight.NdotL = saturate(dot(surface.N, surfaceToLight.L));
|
||||||
surfaceToLight.HdotV = saturate(dot(surfaceToLight.H, surface.V));
|
surfaceToLight.HdotV = saturate(dot(surfaceToLight.H, surface.V));
|
||||||
surfaceToLight.NdotH = saturate(dot(surfaceToLight.H, surface.N));
|
surfaceToLight.NdotH = saturate(dot(surface.N, surfaceToLight.H));
|
||||||
|
|
||||||
return surfaceToLight;
|
return surfaceToLight;
|
||||||
}
|
}
|
||||||
|
|
@ -243,12 +243,12 @@ float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
|
||||||
float denominator = 4.0 * max(surface.NdotV, 0.0) * max(surfaceToLight.NdotL, 0.0) + 0.0001;
|
float denominator = 4.0 * max(surface.NdotV, 0.0) * max(surfaceToLight.NdotL, 0.0) + 0.0001;
|
||||||
float3 specularBRDF = numerator / denominator;
|
float3 specularBRDF = numerator / denominator;
|
||||||
|
|
||||||
float3 diffuseBRDF = surface.baseColor.rgb * M_1OVER_PI_F * surface.ao;
|
float3 diffuseBRDF = surface.baseColor.rgb * surface.ao* M_HALFPI_F;
|
||||||
|
|
||||||
// Final output combining all terms
|
// Final output combining all terms
|
||||||
float3 kS = F; // Specular reflectance
|
float3 kS = F; // Specular reflectance
|
||||||
float3 kD = (1.0 - kS) * (1.0 - surface.metalness); // Diffuse reflectance
|
float3 kD = (1.0 - kS) * (1.0 - surface.metalness); // Diffuse reflectance
|
||||||
float3 returnBRDF = kD * (diffuseBRDF) + specularBRDF;
|
float3 returnBRDF = kD*diffuseBRDF + specularBRDF;
|
||||||
|
|
||||||
if(isCapturing == 1)
|
if(isCapturing == 1)
|
||||||
return lerp(returnBRDF ,surface.albedo.rgb,surface.metalness);
|
return lerp(returnBRDF ,surface.albedo.rgb,surface.metalness);
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,10 @@ function ConvexEditorGui::onWake( %this )
|
||||||
%this.releaseSidePanel();
|
%this.releaseSidePanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
EWorldEditor.UseGridSnap = EditorSettings.value("WorldEditor/Tools/UseGridSnap");
|
EWorldEditor.gridSnap = EditorSettings.value("WorldEditor/Tools/gridSnap");
|
||||||
CESnapOptions-->objectGridSnapBtn.setStateOn( EWorldEditor.UseGridSnap );
|
CESnapOptions-->objectGridSnapBtn.setStateOn( EWorldEditor.gridSnap );
|
||||||
%this.setGridSnap( EWorldEditor.UseGridSnap );
|
%this.setGridSnap( EWorldEditor.gridSnap );
|
||||||
EWorldEditor.setGridSnap( EWorldEditor.UseGridSnap );
|
EWorldEditor.setGridSnap( EWorldEditor.gridSnap );
|
||||||
}
|
}
|
||||||
|
|
||||||
function ConvexEditorGui::onSleep( %this )
|
function ConvexEditorGui::onSleep( %this )
|
||||||
|
|
@ -217,11 +217,11 @@ function ConvexEditorMaterialResetBtn::onClick(%this)
|
||||||
|
|
||||||
function ConvexEditorGui::toggleGridSnap(%this)
|
function ConvexEditorGui::toggleGridSnap(%this)
|
||||||
{
|
{
|
||||||
EWorldEditor.UseGridSnap = !EWorldEditor.UseGridSnap;
|
EWorldEditor.gridSnap = !EWorldEditor.gridSnap;
|
||||||
EditorSettings.setValue("WorldEditor/Tools/UseGridSnap", EWorldEditor.UseGridSnap );
|
EditorSettings.setValue("WorldEditor/Tools/gridSnap", EWorldEditor.gridSnap );
|
||||||
CESnapOptions-->objectGridSnapBtn.setStateOn( EWorldEditor.UseGridSnap );
|
CESnapOptions-->objectGridSnapBtn.setStateOn( EWorldEditor.gridSnap );
|
||||||
%this.setGridSnap( EWorldEditor.UseGridSnap );
|
%this.setGridSnap( EWorldEditor.gridSnap );
|
||||||
EWorldEditor.setGridSnap( EWorldEditor.UseGridSnap );
|
EWorldEditor.setGridSnap( EWorldEditor.gridSnap );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,9 +130,9 @@ function ConvexEditorPlugin::onActivated( %this )
|
||||||
ConvexEditorScaleModeBtn.performClick();
|
ConvexEditorScaleModeBtn.performClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
EWorldEditor.UseGridSnap = EditorSettings.value("WorldEditor/Tools/UseGridSnap");
|
EWorldEditor.gridSnap = EditorSettings.value("WorldEditor/Tools/gridSnap");
|
||||||
CESnapOptions-->objectGridSnapBtn.setStateOn( EWorldEditor.UseGridSnap );
|
CESnapOptions-->objectGridSnapBtn.setStateOn( EWorldEditor.gridSnap );
|
||||||
%this.setGridSnap( EWorldEditor.UseGridSnap );
|
%this.setGridSnap( EWorldEditor.gridSnap );
|
||||||
|
|
||||||
Parent::onActivated( %this );
|
Parent::onActivated( %this );
|
||||||
EditorGui.SetStandardPalletBar();
|
EditorGui.SetStandardPalletBar();
|
||||||
|
|
|
||||||
|
|
@ -1411,6 +1411,25 @@ $guiContent = new GuiControl(GuiEditorGui, EditorGuiGroup) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
new GuiBitmapButtonCtrl() {
|
||||||
|
bitmapAsset = "ToolsModule:reset_icon_n_image";
|
||||||
|
groupNum = "-1";
|
||||||
|
buttonType = "PushButton";
|
||||||
|
useMouseEvents = "0";
|
||||||
|
isContainer = "0";
|
||||||
|
Profile = "ToolsGuiDefaultProfile";
|
||||||
|
HorizSizing = "left";
|
||||||
|
VertSizing = "bottom";
|
||||||
|
position = "138 12";
|
||||||
|
Extent = "17 17";
|
||||||
|
MinExtent = "8 2";
|
||||||
|
canSave = "1";
|
||||||
|
Visible = "1";
|
||||||
|
tooltipprofile = "ToolsGuiToolTipProfile";
|
||||||
|
hovertime = "1000";
|
||||||
|
internalName = "button0";
|
||||||
|
canSaveDynamicFields = "0";
|
||||||
|
};
|
||||||
new GuiBitmapButtonCtrl() {
|
new GuiBitmapButtonCtrl() {
|
||||||
bitmapAsset = "ToolsModule:reset_icon_n_image";
|
bitmapAsset = "ToolsModule:reset_icon_n_image";
|
||||||
groupNum = "-1";
|
groupNum = "-1";
|
||||||
|
|
|
||||||
|
|
@ -907,7 +907,7 @@ function GuiEditorTabBook::onTabSelected( %this, %text, %index )
|
||||||
switch$( %name )
|
switch$( %name )
|
||||||
{
|
{
|
||||||
case "guiPage":
|
case "guiPage":
|
||||||
|
%sidebar-->button0.setVisible( false );
|
||||||
%sidebar-->button1.setVisible( false );
|
%sidebar-->button1.setVisible( false );
|
||||||
%sidebar-->button2.setVisible( false );
|
%sidebar-->button2.setVisible( false );
|
||||||
%sidebar-->button3.setVisible( true );
|
%sidebar-->button3.setVisible( true );
|
||||||
|
|
@ -922,7 +922,7 @@ function GuiEditorTabBook::onTabSelected( %this, %text, %index )
|
||||||
%sidebar-->button3.tooltip = "Hide Selected Control(s)";
|
%sidebar-->button3.tooltip = "Hide Selected Control(s)";
|
||||||
|
|
||||||
case "profilesPage":
|
case "profilesPage":
|
||||||
|
%sidebar-->button0.setVisible( true );
|
||||||
%sidebar-->button1.setVisible( true );
|
%sidebar-->button1.setVisible( true );
|
||||||
%sidebar-->button2.setVisible( true );
|
%sidebar-->button2.setVisible( true );
|
||||||
%sidebar-->button3.setVisible( true );
|
%sidebar-->button3.setVisible( true );
|
||||||
|
|
@ -944,6 +944,10 @@ function GuiEditorTabBook::onTabSelected( %this, %text, %index )
|
||||||
%sidebar-->button1.command = "GuiEditor.revertProfile( GuiEditorProfilesTree.getSelectedProfile() );";
|
%sidebar-->button1.command = "GuiEditor.revertProfile( GuiEditorProfilesTree.getSelectedProfile() );";
|
||||||
%sidebar-->button1.tooltip = "Revert Changes to the Selected Profile";
|
%sidebar-->button1.tooltip = "Revert Changes to the Selected Profile";
|
||||||
|
|
||||||
|
%sidebar-->button0.setBitmap( "ToolsModule:iconSave_image" );
|
||||||
|
%sidebar-->button0.command = "populateAllFonts();";
|
||||||
|
%sidebar-->button0.tooltip = "(Re)Generate font cache";
|
||||||
|
|
||||||
case "toolboxPage":
|
case "toolboxPage":
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
|
|
||||||
|
|
@ -1051,9 +1051,9 @@ function WorldEditorPlugin::onActivated( %this )
|
||||||
ETransformSelection.setVisible(true);
|
ETransformSelection.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
EWorldEditor.UseGridSnap = EditorSettings.value("WorldEditor/Tools/UseGridSnap");
|
EWorldEditor.gridSnap = EditorSettings.value("WorldEditor/Tools/gridSnap");
|
||||||
ESnapOptions-->GridSnapButton.setStateOn( EWorldEditor.UseGridSnap );
|
ESnapOptions-->GridSnapButton.setStateOn( EWorldEditor.gridSnap );
|
||||||
SnapToBar-->objectGridSnapBtn.setStateOn( EWorldEditor.UseGridSnap );
|
SnapToBar-->objectGridSnapBtn.setStateOn( EWorldEditor.gridSnap );
|
||||||
|
|
||||||
Parent::onActivated(%this);
|
Parent::onActivated(%this);
|
||||||
|
|
||||||
|
|
@ -2615,8 +2615,8 @@ function EWorldEditor::syncGui( %this )
|
||||||
ESnapOptions-->SnapSize.setText( EWorldEditor.getSoftSnapSize() );
|
ESnapOptions-->SnapSize.setText( EWorldEditor.getSoftSnapSize() );
|
||||||
ESnapOptions-->GridSize.setText( EWorldEditor.getGridSize() );
|
ESnapOptions-->GridSize.setText( EWorldEditor.getGridSize() );
|
||||||
|
|
||||||
%this.UseGridSnap = EditorSettings.value("WorldEditor/Tools/UseGridSnap");
|
%this.gridSnap = EditorSettings.value("WorldEditor/Tools/gridSnap");
|
||||||
ESnapOptions-->GridSnapButton.setStateOn( %this.UseGridSnap );
|
ESnapOptions-->GridSnapButton.setStateOn( %this.gridSnap );
|
||||||
|
|
||||||
%this.UseGroupCenter = EditorSettings.value("WorldEditor/Tools/UseGroupCenter");
|
%this.UseGroupCenter = EditorSettings.value("WorldEditor/Tools/UseGroupCenter");
|
||||||
|
|
||||||
|
|
@ -2961,9 +2961,9 @@ function toggleSnappingOptions( %var )
|
||||||
}
|
}
|
||||||
else if( %var $= "grid" )
|
else if( %var $= "grid" )
|
||||||
{
|
{
|
||||||
EWorldEditor.UseGridSnap = !EWorldEditor.UseGridSnap;
|
EWorldEditor.gridSnap = !EWorldEditor.gridSnap;
|
||||||
EditorSettings.setValue("WorldEditor/Tools/UseGridSnap", EWorldEditor.UseGridSnap );
|
EditorSettings.setValue("WorldEditor/Tools/gridSnap", EWorldEditor.gridSnap );
|
||||||
EWorldEditor.setGridSnap( EWorldEditor.UseGridSnap );
|
EWorldEditor.setGridSnap( EWorldEditor.gridSnap );
|
||||||
}
|
}
|
||||||
else if( %var $= "byGroup" )
|
else if( %var $= "byGroup" )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue