Skip to content

Commit e5e687e

Browse files
committed
Merge branch 'development' of https://github.com/TorqueGameEngines/Torque3D into development
2 parents 58632d0 + e56b23e commit e5e687e

15 files changed

Lines changed: 368 additions & 187 deletions

File tree

Engine/source/CMakeLists.txt

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -501,12 +501,23 @@ string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ARCH)
501501
set(IS_X86 FALSE)
502502
set(IS_ARM FALSE)
503503

504-
if(ARCH MATCHES "x86_64|amd64|i[3-6]86")
505-
set(IS_X86 TRUE)
506-
endif()
507-
508-
if(ARCH MATCHES "arm64|aarch64")
509-
set(IS_ARM TRUE)
504+
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
505+
# Use the CMAKE_OSX_ARCHITECTURES list for universal builds
506+
foreach(arch IN LISTS CMAKE_OSX_ARCHITECTURES)
507+
if(arch STREQUAL "x86_64")
508+
set(IS_X86 TRUE)
509+
elseif(arch STREQUAL "arm64")
510+
set(IS_ARM TRUE)
511+
endif()
512+
endforeach()
513+
else()
514+
# Non-macOS detection
515+
if(ARCH MATCHES "arm64|aarch64")
516+
set(IS_ARM TRUE)
517+
endif()
518+
if(ARCH MATCHES "x86_64|amd64|i[3-6]86")
519+
set(IS_X86 TRUE)
520+
endif()
510521
endif()
511522

512523
# always available

Engine/source/T3D/decal/decalManager.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -660,12 +660,14 @@ DecalInstance* DecalManager::raycast( const Point3F &start, const Point3F &end,
660660
RayInfo ri;
661661
bool containsPoint = false;
662662
if ( gServerContainer.castRayRendered( start, end, STATIC_COLLISION_TYPEMASK, &ri ) )
663-
{
663+
{
664+
RectF rect = inst->mDataBlock->texRect[inst->mTextureRectIdx];
665+
rect.extent *= inst->mSize * 0.5f;
664666
Point2F poly[4];
665-
poly[0].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2));
666-
poly[1].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y - (inst->mSize / 2));
667-
poly[2].set( inst->mPosition.x + (inst->mSize / 2), inst->mPosition.y - (inst->mSize / 2));
668-
poly[3].set( inst->mPosition.x + (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2));
667+
poly[0].set(inst->mPosition.x - rect.extent.x, inst->mPosition.y + rect.extent.y);
668+
poly[1].set( inst->mPosition.x - rect.extent.x, inst->mPosition.y - rect.extent.y);
669+
poly[2].set( inst->mPosition.x + rect.extent.x, inst->mPosition.y - rect.extent.y);
670+
poly[3].set( inst->mPosition.x + rect.extent.x, inst->mPosition.y + rect.extent.y);
669671

670672
if ( MathUtils::pointInPolygon( poly, 4, Point2F(ri.point.x, ri.point.y) ) )
671673
containsPoint = true;

Engine/source/T3D/player.cpp

Lines changed: 68 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ IMPLEMENT_CALLBACK( PlayerData, onLeaveLiquid, void, ( Player* obj, const char*
264264
"@param obj The Player object\n"
265265
"@param type The type of liquid the player has left\n" );
266266

267-
IMPLEMENT_CALLBACK( PlayerData, animationDone, void, ( Player* obj, const char * animName), ( obj, animName),
267+
IMPLEMENT_CALLBACK( PlayerData, animationDone, void, ( Player* obj,const char * animName), ( obj, animName),
268268
"@brief Called on the server when a scripted animation completes.\n\n"
269269
"@param obj The Player object\n"
270270
"@see Player::setActionThread() for setting a scripted animation and its 'hold' parameter to "
@@ -4805,7 +4805,7 @@ Point3F Player::_move( const F32 travelTime, Collision *outCol )
48054805
static Polyhedron sBoxPolyhedron;
48064806
static ExtrudedPolyList sExtrudedPolyList;
48074807
static ExtrudedPolyList sPhysZonePolyList;
4808-
4808+
Vector<VectorF> norms;
48094809
for (; count < sMoveRetryCount; count++) {
48104810
F32 speed = mVelocity.len();
48114811
if (!speed && !mDeath.haveVelocity())
@@ -4931,7 +4931,7 @@ Point3F Player::_move( const F32 travelTime, Collision *outCol )
49314931
mFalling = false;
49324932

49334933
// Back off...
4934-
if ( velLen > 0.f ) {
4934+
if ( velLen > POINT_EPSILON) {
49354935
F32 newT = getMin(0.01f / velLen, dt);
49364936
start -= mVelocity * newT;
49374937
totalMotion -= velLen * newT;
@@ -4983,31 +4983,83 @@ Point3F Player::_move( const F32 travelTime, Collision *outCol )
49834983
// Subtract out velocity
49844984
VectorF dv = collision->normal * (bd + sNormalElasticity);
49854985
mVelocity += dv;
4986+
4987+
bool blocked = false;
49864988
if (count == 0)
49874989
{
49884990
firstNormal = collision->normal;
49894991
}
49904992
else
49914993
{
4992-
if (count == 1)
4994+
bool uniqueNorm = true;
4995+
for (U32 norm = 0; norm < norms.size(); norm++)
49934996
{
4994-
// Re-orient velocity along the crease.
4995-
if (mDot(dv,firstNormal) < 0.0f &&
4996-
mDot(collision->normal,firstNormal) < 0.0f)
4997+
if (mFabs(mDot(collision->normal, norms[norm])) > (1.0f - POINT_EPSILON))
49974998
{
4998-
VectorF nv;
4999-
mCross(collision->normal,firstNormal,&nv);
5000-
F32 nvl = nv.len();
5001-
if (nvl)
4999+
uniqueNorm = false;
5000+
break;
5001+
}
5002+
}
5003+
if (uniqueNorm)
5004+
{
5005+
VectorF n = collision->normal;
5006+
n.normalizeSafe();
5007+
norms.push_back(n);
5008+
}
5009+
// Use the number of unique normals to determine how to project velocity
5010+
if (norms.size() == 1)
5011+
{
5012+
VectorF n = norms[0];
5013+
mVelocity -= mDot(mVelocity, n) * n;
5014+
if (mVelocity.lenSquared() < POINT_EPSILON)
5015+
blocked = true;
5016+
}
5017+
else if (norms.size() == 2)
5018+
{
5019+
VectorF nv;
5020+
mCross(norms[0], norms[1], &nv);
5021+
F32 nvl = nv.len();
5022+
if (nvl > POINT_EPSILON)
5023+
{
5024+
nv /= nvl;
5025+
F32 vel = mClampF(mDot(mVelocity, nv), -speed, speed);
5026+
mVelocity = nv * vel;
5027+
if (mVelocity.lenSquared() < POINT_EPSILON)
5028+
blocked = true;
5029+
}
5030+
else blocked = true;
5031+
}
5032+
else // 3 or more unique normals: project off all using a Gram-Schmidt variant
5033+
{
5034+
Vector<VectorF> orthoNorms;
5035+
for (U32 i = 0; i < norms.size(); ++i)
5036+
{
5037+
VectorF n = norms[i];
5038+
for (U32 j = 0; j < orthoNorms.size(); ++j)
5039+
n -= mDot(n, orthoNorms[j]) * orthoNorms[j];
5040+
if (n.lenSquared() > POINT_EPSILON)
50025041
{
5003-
if (mDot(nv,mVelocity) < 0.0f)
5004-
nvl = -nvl;
5005-
nv *= mVelocity.len() / nvl;
5006-
mVelocity = nv;
5042+
n.normalize();
5043+
orthoNorms.push_back(n);
50075044
}
50085045
}
5046+
for (U32 i = 0; i < orthoNorms.size(); ++i)
5047+
mVelocity -= mDot(mVelocity, orthoNorms[i]) * orthoNorms[i];
5048+
if (mVelocity.lenSquared() < POINT_EPSILON)
5049+
blocked = true;
50095050
}
50105051
}
5052+
if (blocked)
5053+
{
5054+
mVelocity.zero();
5055+
return start;
5056+
}
5057+
F32 newSpeed = mVelocity.len();
5058+
if (newSpeed > speed)
5059+
{
5060+
mVelocity.normalize();
5061+
mVelocity *= speed;
5062+
}
50115063
}
50125064
else
50135065
{
@@ -5017,7 +5069,7 @@ Point3F Player::_move( const F32 travelTime, Collision *outCol )
50175069
}
50185070
}
50195071

5020-
if (count == sMoveRetryCount)
5072+
if (count == sMoveRetryCount || mVelocity.lenSquared() < POINT_EPSILON)
50215073
{
50225074
// Failed to move
50235075
start = initialPosition;

Engine/source/T3D/projectile.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,8 +873,11 @@ bool Projectile::onAdd()
873873
}
874874
}
875875
if (mSourceObject.isValid())
876+
{
876877
processAfter(mSourceObject);
877-
878+
if (isClientObject())
879+
mSourceObject->getRenderMuzzlePoint(mSourceObjectSlot, &mCurrPosition);
880+
}
878881
// Setup our bounding box
879882
if (bool(mDataBlock->getProjectileShape()) == true)
880883
mObjBox = mDataBlock->getProjectileShape()->mBounds;

Engine/source/T3D/shapeBase.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,20 +1164,20 @@ void ShapeBase::onRemove()
11641164
{
11651165
mConvexList->nukeList();
11661166

1167-
Parent::onRemove();
1168-
1169-
// Stop any running sounds on the client
1170-
if (isGhost())
1171-
for (S32 i = 0; i < MaxSoundThreads; i++)
1172-
stopAudio(i);
1173-
11741167
// Accumulation and environment mapping
11751168
if (isClientObject() && mShapeInstance)
11761169
{
11771170
if (mShapeInstance->hasAccumulation())
11781171
AccumulationVolume::removeObject(this);
11791172
}
11801173

1174+
Parent::onRemove();
1175+
1176+
// Stop any running sounds on the client
1177+
if (isGhost())
1178+
for (S32 i = 0; i < MaxSoundThreads; i++)
1179+
stopAudio(i);
1180+
11811181
if ( isClientObject() )
11821182
{
11831183
if (mCubeReflector)

Engine/source/gui/buttons/guiBitmapButtonCtrl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class GuiBitmapButtonCtrl : public GuiButtonCtrl, protected AssetPtrCallback
123123
String mBitmapFile;
124124
public:
125125
void _setBitmap(StringTableEntry _in) {
126-
if (_in == NULL || _in == StringTable->EmptyString() || _in == "")
126+
if (_in == NULL || _in == StringTable->EmptyString() || _in[0] == '\0')
127127
{
128128
mBitmapAsset = NULL;
129129
mBitmapFile = "";

Engine/source/gui/worldEditor/guiDecalEditorCtrl.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,11 +516,12 @@ void GuiDecalEditorCtrl::renderScene(const RectI & updateRect)
516516
if ( gDecalManager->clipDecal( mSELDecal, &mSELEdgeVerts ) )
517517
_renderDecalEdge( mSELEdgeVerts, ColorI( 255, 255, 255, 255 ) );
518518

519-
const F32 &decalSize = mSELDecal->mSize;
519+
const F32 &decalSize = mSELDecal->mSize * 0.5;
520520
Point3F boxSize( decalSize, decalSize, decalSize );
521-
522521
MatrixF worldMat( true );
523-
mSELDecal->getWorldMatrix( &worldMat, true );
522+
mSELDecal->getWorldMatrix( &worldMat, true );
523+
RectF rect = mSELDecal->mDataBlock->texRect[mSELDecal->mTextureRectIdx];
524+
worldMat.scale(Point3F(rect.extent.x, rect.extent.y, 0.25f));
524525

525526
drawUtil->drawObjectBox( desc, boxSize, mSELDecal->mPosition, worldMat, ColorI( 255, 255, 255, 255 ) );
526527
}
@@ -531,11 +532,13 @@ void GuiDecalEditorCtrl::renderScene(const RectI & updateRect)
531532
if ( gDecalManager->clipDecal( mHLDecal, &mHLEdgeVerts ) )
532533
_renderDecalEdge( mHLEdgeVerts, ColorI( 255, 255, 255, 255 ) );
533534

534-
const F32 &decalSize = mHLDecal->mSize;
535+
const F32 &decalSize = mHLDecal->mSize * 0.5;
535536
Point3F boxSize( decalSize, decalSize, decalSize );
536537

537538
MatrixF worldMat( true );
538539
mHLDecal->getWorldMatrix( &worldMat, true );
540+
RectF rect = mHLDecal->mDataBlock->texRect[mHLDecal->mTextureRectIdx];
541+
worldMat.scale(Point3F(rect.extent.x, rect.extent.y, 0.25f));
539542

540543
drawUtil->drawObjectBox( desc, boxSize, mHLDecal->mPosition, worldMat, ColorI( 255, 255, 255, 255 ) );
541544
}

0 commit comments

Comments
 (0)