mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-09 23:40:42 +00:00
Merge branch 'development' into EngineAPI-Refactor
This commit is contained in:
commit
3a71c75596
1937 changed files with 102332 additions and 70549 deletions
|
|
@ -206,11 +206,11 @@ void AccumulationVolume::buildSilhouette( const SceneCameraState& cameraState, V
|
|||
|
||||
if( mTransformDirty )
|
||||
{
|
||||
const U32 numPoints = mPolyhedron.getNumPoints();
|
||||
const U32 numPolyPoints = mPolyhedron.getNumPoints();
|
||||
const PolyhedronType::PointType* points = getPolyhedron().getPoints();
|
||||
|
||||
mWSPoints.setSize( numPoints );
|
||||
for( U32 i = 0; i < numPoints; ++ i )
|
||||
mWSPoints.setSize(numPolyPoints);
|
||||
for( U32 i = 0; i < numPolyPoints; ++ i )
|
||||
{
|
||||
Point3F p = points[ i ];
|
||||
p.convolve( getScale() );
|
||||
|
|
|
|||
|
|
@ -645,12 +645,12 @@ void AnimationComponent::advanceThreads(F32 dt)
|
|||
|
||||
if (mOwnerShapeInstance && !isClientObject())
|
||||
{
|
||||
for (U32 i = 1; i < 32; i++)
|
||||
for (U32 stateIDx = 1; stateIDx < 32; stateIDx++)
|
||||
{
|
||||
if (mOwnerShapeInstance->getTriggerState(i))
|
||||
if (mOwnerShapeInstance->getTriggerState(stateIDx))
|
||||
{
|
||||
const char* animName = st.thread->getSequenceName().c_str();
|
||||
onAnimationTrigger_callback(this, animName, i);
|
||||
onAnimationTrigger_callback(this, animName, stateIDx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -357,12 +357,12 @@ void CollisionTrigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
|
|||
{
|
||||
mCollisionTriggerPolyhedron = rPolyhedron;
|
||||
|
||||
if (mCollisionTriggerPolyhedron.pointList.size() != 0) {
|
||||
if (mCollisionTriggerPolyhedron.mPointList.size() != 0) {
|
||||
mObjBox.minExtents.set(1e10, 1e10, 1e10);
|
||||
mObjBox.maxExtents.set(-1e10, -1e10, -1e10);
|
||||
for (U32 i = 0; i < mCollisionTriggerPolyhedron.pointList.size(); i++) {
|
||||
mObjBox.minExtents.setMin(mCollisionTriggerPolyhedron.pointList[i]);
|
||||
mObjBox.maxExtents.setMax(mCollisionTriggerPolyhedron.pointList[i]);
|
||||
for (U32 i = 0; i < mCollisionTriggerPolyhedron.mPointList.size(); i++) {
|
||||
mObjBox.minExtents.setMin(mCollisionTriggerPolyhedron.mPointList[i]);
|
||||
mObjBox.maxExtents.setMax(mCollisionTriggerPolyhedron.mPointList[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -374,7 +374,7 @@ void CollisionTrigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
|
|||
setTransform(xform);
|
||||
|
||||
mClippedList.clear();
|
||||
mClippedList.mPlaneList = mCollisionTriggerPolyhedron.planeList;
|
||||
mClippedList.mPlaneList = mCollisionTriggerPolyhedron.mPlaneList;
|
||||
// for (U32 i = 0; i < mClippedList.mPlaneList.size(); i++)
|
||||
// mClippedList.mPlaneList[i].neg();
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ void CollisionTrigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
|
|||
|
||||
bool CollisionTrigger::testObject(GameBase* enter)
|
||||
{
|
||||
if (mCollisionTriggerPolyhedron.pointList.size() == 0)
|
||||
if (mCollisionTriggerPolyhedron.mPointList.size() == 0)
|
||||
return false;
|
||||
|
||||
mClippedList.clear();
|
||||
|
|
@ -507,17 +507,17 @@ U32 CollisionTrigger::packUpdate(NetConnection* con, U32 mask, BitStream* stream
|
|||
// Write the polyhedron
|
||||
if (stream->writeFlag(mask & PolyMask))
|
||||
{
|
||||
stream->write(mCollisionTriggerPolyhedron.pointList.size());
|
||||
for (i = 0; i < mCollisionTriggerPolyhedron.pointList.size(); i++)
|
||||
mathWrite(*stream, mCollisionTriggerPolyhedron.pointList[i]);
|
||||
stream->write(mCollisionTriggerPolyhedron.mPointList.size());
|
||||
for (i = 0; i < mCollisionTriggerPolyhedron.mPointList.size(); i++)
|
||||
mathWrite(*stream, mCollisionTriggerPolyhedron.mPointList[i]);
|
||||
|
||||
stream->write(mCollisionTriggerPolyhedron.planeList.size());
|
||||
for (i = 0; i < mCollisionTriggerPolyhedron.planeList.size(); i++)
|
||||
mathWrite(*stream, mCollisionTriggerPolyhedron.planeList[i]);
|
||||
stream->write(mCollisionTriggerPolyhedron.mPlaneList.size());
|
||||
for (i = 0; i < mCollisionTriggerPolyhedron.mPlaneList.size(); i++)
|
||||
mathWrite(*stream, mCollisionTriggerPolyhedron.mPlaneList[i]);
|
||||
|
||||
stream->write(mCollisionTriggerPolyhedron.edgeList.size());
|
||||
for (i = 0; i < mCollisionTriggerPolyhedron.edgeList.size(); i++) {
|
||||
const Polyhedron::Edge& rEdge = mCollisionTriggerPolyhedron.edgeList[i];
|
||||
stream->write(mCollisionTriggerPolyhedron.mEdgeList.size());
|
||||
for (i = 0; i < mCollisionTriggerPolyhedron.mEdgeList.size(); i++) {
|
||||
const Polyhedron::Edge& rEdge = mCollisionTriggerPolyhedron.mEdgeList[i];
|
||||
|
||||
stream->write(rEdge.face[0]);
|
||||
stream->write(rEdge.face[1]);
|
||||
|
|
@ -555,19 +555,19 @@ void CollisionTrigger::unpackUpdate(NetConnection* con, BitStream* stream)
|
|||
{
|
||||
Polyhedron tempPH;
|
||||
stream->read(&size);
|
||||
tempPH.pointList.setSize(size);
|
||||
for (i = 0; i < tempPH.pointList.size(); i++)
|
||||
mathRead(*stream, &tempPH.pointList[i]);
|
||||
tempPH.mPointList.setSize(size);
|
||||
for (i = 0; i < tempPH.mPointList.size(); i++)
|
||||
mathRead(*stream, &tempPH.mPointList[i]);
|
||||
|
||||
stream->read(&size);
|
||||
tempPH.planeList.setSize(size);
|
||||
for (i = 0; i < tempPH.planeList.size(); i++)
|
||||
mathRead(*stream, &tempPH.planeList[i]);
|
||||
tempPH.mPlaneList.setSize(size);
|
||||
for (i = 0; i < tempPH.mPlaneList.size(); i++)
|
||||
mathRead(*stream, &tempPH.mPlaneList[i]);
|
||||
|
||||
stream->read(&size);
|
||||
tempPH.edgeList.setSize(size);
|
||||
for (i = 0; i < tempPH.edgeList.size(); i++) {
|
||||
Polyhedron::Edge& rEdge = tempPH.edgeList[i];
|
||||
tempPH.mEdgeList.setSize(size);
|
||||
for (i = 0; i < tempPH.mEdgeList.size(); i++) {
|
||||
Polyhedron::Edge& rEdge = tempPH.mEdgeList[i];
|
||||
|
||||
stream->read(&rEdge.face[0]);
|
||||
stream->read(&rEdge.face[1]);
|
||||
|
|
|
|||
|
|
@ -441,16 +441,15 @@ void PlayerControllerComponent::updateMove()
|
|||
|
||||
// get the head pitch and add it to the moveVec
|
||||
// This more accurate swim vector calc comes from Matt Fairfax
|
||||
MatrixF xRot, zRot;
|
||||
MatrixF xRot;
|
||||
xRot.set(EulerF(mOwner->getRotation().asEulerF().x, 0, 0));
|
||||
zRot.set(EulerF(0, 0, mOwner->getRotation().asEulerF().z));
|
||||
zRot.set(EulerF(0, 0, mOwner->getRotation().asEulerF().z));//reset prior uses
|
||||
MatrixF rot;
|
||||
rot.mul(zRot, xRot);
|
||||
rot.getColumn(0, &moveVec);
|
||||
|
||||
moveVec *= move->x;
|
||||
VectorF tv;
|
||||
rot.getColumn(1, &tv);
|
||||
rot.getColumn(1, &tv);//reset prior uses
|
||||
moveVec += tv * move->y;
|
||||
rot.getColumn(2, &tv);
|
||||
moveVec += tv * move->z;
|
||||
|
|
|
|||
|
|
@ -254,8 +254,8 @@ void MeshComponent::updateShape()
|
|||
|
||||
mOwner->getWorldToObj().mulP(pos);
|
||||
|
||||
min = mMeshAsset->getShape()->bounds.minExtents;
|
||||
max = mMeshAsset->getShape()->bounds.maxExtents;
|
||||
min = mMeshAsset->getShape()->mBounds.minExtents;
|
||||
max = mMeshAsset->getShape()->mBounds.maxExtents;
|
||||
|
||||
if (mInterfaceData)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -492,7 +492,6 @@ void ConvexShape::unpackUpdate( NetConnection *conn, BitStream *stream )
|
|||
|
||||
void ConvexShape::prepRenderImage( SceneRenderState *state )
|
||||
{
|
||||
/*
|
||||
if ( state->isDiffusePass() )
|
||||
{
|
||||
ObjectRenderInst *ri2 = state->getRenderPass()->allocInst<ObjectRenderInst>();
|
||||
|
|
@ -500,8 +499,7 @@ void ConvexShape::prepRenderImage( SceneRenderState *state )
|
|||
ri2->type = RenderPassManager::RIT_Editor;
|
||||
state->getRenderPass()->addInst( ri2 );
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
if ( mVertexBuffer.isNull() || !state)
|
||||
return;
|
||||
|
||||
|
|
@ -795,21 +793,10 @@ bool ConvexShape::castRay( const Point3F &start, const Point3F &end, RayInfo *in
|
|||
F32 t;
|
||||
F32 tmin = F32_MAX;
|
||||
S32 hitFace = -1;
|
||||
Point3F hitPnt, pnt;
|
||||
Point3F pnt;
|
||||
VectorF rayDir( end - start );
|
||||
rayDir.normalizeSafe();
|
||||
|
||||
if ( false )
|
||||
{
|
||||
PlaneF plane( Point3F(0,0,0), Point3F(0,0,1) );
|
||||
Point3F sp( 0,0,-1 );
|
||||
Point3F ep( 0,0,1 );
|
||||
|
||||
F32 t = plane.intersect( sp, ep );
|
||||
Point3F hitPnt;
|
||||
hitPnt.interpolate( sp, ep, t );
|
||||
}
|
||||
|
||||
|
||||
for ( S32 i = 0; i < planeCount; i++ )
|
||||
{
|
||||
// Don't hit the back-side of planes.
|
||||
|
|
@ -1228,11 +1215,11 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B
|
|||
GFX->setTexture( 0, NULL );
|
||||
|
||||
// Render world box.
|
||||
if ( false )
|
||||
if (Con::getBoolVariable("$pref::convexDBG::ShowWorldBox", false))
|
||||
{
|
||||
Box3F wbox( mWorldBox );
|
||||
//if ( getServerObject() )
|
||||
// Box3F wbox = static_cast<ConvexShape*>( getServerObject() )->mWorldBox;
|
||||
if ( getServerObject() )
|
||||
wbox = static_cast<ConvexShape*>( getServerObject() )->mWorldBox;
|
||||
GFXStateBlockDesc desc;
|
||||
desc.setCullMode( GFXCullNone );
|
||||
desc.setFillModeWireframe();
|
||||
|
|
@ -1244,7 +1231,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B
|
|||
const Vector< ConvexShape::Face > &faceList = mGeometry.faces;
|
||||
|
||||
// Render Edges.
|
||||
if ( false )
|
||||
if (Con::getBoolVariable("$pref::convexDBG::ShowEdges", false))
|
||||
{
|
||||
GFXTransformSaver saver;
|
||||
//GFXFrustumSaver fsaver;
|
||||
|
|
@ -1298,7 +1285,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B
|
|||
objToWorld.scale( mObjScale );
|
||||
|
||||
// Render faces centers/colors.
|
||||
if ( false )
|
||||
if (Con::getBoolVariable("$pref::convexDBG::ShowFaceColors", false))
|
||||
{
|
||||
GFXStateBlockDesc desc;
|
||||
desc.setCullMode( GFXCullNone );
|
||||
|
|
@ -1322,7 +1309,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B
|
|||
}
|
||||
|
||||
// Render winding order.
|
||||
if ( false )
|
||||
if (Con::getBoolVariable("$pref::convexDBG::ShowWinding", false))
|
||||
{
|
||||
GFXStateBlockDesc desc;
|
||||
desc.setCullMode( GFXCullNone );
|
||||
|
|
@ -1379,7 +1366,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B
|
|||
}
|
||||
|
||||
// Render surface transforms.
|
||||
if ( false )
|
||||
if (Con::getBoolVariable("$pref::convexDBG::ShowSurfaceTransforms", false))
|
||||
{
|
||||
GFXStateBlockDesc desc;
|
||||
desc.setBlend( false );
|
||||
|
|
@ -1389,7 +1376,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B
|
|||
|
||||
for ( S32 i = 0; i < mSurfaces.size(); i++ )
|
||||
{
|
||||
MatrixF objToWorld( mObjToWorld );
|
||||
objToWorld = mObjToWorld;
|
||||
objToWorld.scale( mObjScale );
|
||||
|
||||
MatrixF renderMat;
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ void DebrisData::packData(BitStream* stream)
|
|||
|
||||
if( stream->writeFlag( explosion ) )
|
||||
{
|
||||
stream->writeRangedU32(packed? SimObjectId((uintptr_t)explosion):
|
||||
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)explosion):
|
||||
explosion->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
|
||||
}
|
||||
|
||||
|
|
@ -669,7 +669,7 @@ bool Debris::onAdd()
|
|||
// Setup our bounding box
|
||||
if( mDataBlock->shape )
|
||||
{
|
||||
mObjBox = mDataBlock->shape->bounds;
|
||||
mObjBox = mDataBlock->shape->mBounds;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1302,14 +1302,14 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|||
// Loop through batches allocating buffers and submitting render instances.
|
||||
for ( U32 i = 0; i < batches.size(); i++ )
|
||||
{
|
||||
DecalBatch ¤tBatch = batches[i];
|
||||
currentBatch = &batches[i];
|
||||
|
||||
// Copy data into the system memory arrays, from all decals in this batch...
|
||||
|
||||
DecalVertex *vpPtr = vertData;
|
||||
U16 *pbPtr = indexData;
|
||||
|
||||
U32 lastDecal = currentBatch.startDecal + currentBatch.decalCount;
|
||||
U32 lastDecal = currentBatch->startDecal + currentBatch->decalCount;
|
||||
|
||||
U32 voffset = 0;
|
||||
U32 ioffset = 0;
|
||||
|
|
@ -1317,13 +1317,13 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|||
// This is an ugly hack for ProjectedShadow!
|
||||
GFXTextureObject *customTex = NULL;
|
||||
|
||||
for ( U32 j = currentBatch.startDecal; j < lastDecal; j++ )
|
||||
for ( U32 j = currentBatch->startDecal; j < lastDecal; j++ )
|
||||
{
|
||||
DecalInstance *dinst = mDecalQueue[j];
|
||||
dinst = mDecalQueue[j];
|
||||
|
||||
const U32 indxCount =
|
||||
(dinst->mIndxCount > currentBatch.iCount) ?
|
||||
currentBatch.iCount : dinst->mIndxCount;
|
||||
(dinst->mIndxCount > currentBatch->iCount) ?
|
||||
currentBatch->iCount : dinst->mIndxCount;
|
||||
for ( U32 k = 0; k < indxCount; k++ )
|
||||
{
|
||||
*( pbPtr + ioffset + k ) = dinst->mIndices[k] + voffset;
|
||||
|
|
@ -1332,8 +1332,8 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|||
ioffset += indxCount;
|
||||
|
||||
const U32 vertCount =
|
||||
(dinst->mVertCount > currentBatch.vCount) ?
|
||||
currentBatch.vCount : dinst->mVertCount;
|
||||
(dinst->mVertCount > currentBatch->vCount) ?
|
||||
currentBatch->vCount : dinst->mVertCount;
|
||||
dMemcpy( vpPtr + voffset, dinst->mVerts, sizeof( DecalVertex ) * vertCount );
|
||||
voffset += vertCount;
|
||||
|
||||
|
|
@ -1342,8 +1342,8 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|||
customTex = *dinst->mCustomTex;
|
||||
}
|
||||
|
||||
AssertFatal( ioffset == currentBatch.iCount, "bad" );
|
||||
AssertFatal( voffset == currentBatch.vCount, "bad" );
|
||||
AssertFatal( ioffset == currentBatch->iCount, "bad" );
|
||||
AssertFatal( voffset == currentBatch->vCount, "bad" );
|
||||
|
||||
// Get handles to video memory buffers we will be filling...
|
||||
|
||||
|
|
@ -1385,9 +1385,9 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|||
pb->lock( &pbPtr );
|
||||
|
||||
// Memcpy from system to video memory.
|
||||
const U32 vpCount = sizeof( DecalVertex ) * currentBatch.vCount;
|
||||
const U32 vpCount = sizeof( DecalVertex ) * currentBatch->vCount;
|
||||
dMemcpy( vpPtr, vertData, vpCount );
|
||||
const U32 pbCount = sizeof( U16 ) * currentBatch.iCount;
|
||||
const U32 pbCount = sizeof( U16 ) * currentBatch->iCount;
|
||||
dMemcpy( pbPtr, indexData, pbCount );
|
||||
|
||||
pb->unlock();
|
||||
|
|
@ -1400,7 +1400,7 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|||
|
||||
// Get the best lights for the current camera position
|
||||
// if the materail is forward lit and we haven't got them yet.
|
||||
if ( currentBatch.matInst->isForwardLit() && !baseRenderInst.lights[0] )
|
||||
if ( currentBatch->matInst->isForwardLit() && !baseRenderInst.lights[0] )
|
||||
{
|
||||
LightQuery query;
|
||||
query.init( rootFrustum.getPosition(),
|
||||
|
|
@ -1416,15 +1416,15 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|||
ri->primBuff = pb;
|
||||
ri->vertBuff = vb;
|
||||
|
||||
ri->matInst = currentBatch.matInst;
|
||||
ri->matInst = currentBatch->matInst;
|
||||
|
||||
ri->prim = renderPass->allocPrim();
|
||||
ri->prim->type = GFXTriangleList;
|
||||
ri->prim->minIndex = 0;
|
||||
ri->prim->startIndex = 0;
|
||||
ri->prim->numPrimitives = currentBatch.iCount / 3;
|
||||
ri->prim->numPrimitives = currentBatch->iCount / 3;
|
||||
ri->prim->startVertex = 0;
|
||||
ri->prim->numVertices = currentBatch.vCount;
|
||||
ri->prim->numVertices = currentBatch->vCount;
|
||||
|
||||
// Ugly hack for ProjectedShadow!
|
||||
if ( customTex )
|
||||
|
|
@ -1433,7 +1433,7 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|||
// The decal bin will contain render instances for both decals and decalRoad's.
|
||||
// Dynamic decals render last, then editor decals and roads in priority order.
|
||||
// DefaultKey is sorted in descending order.
|
||||
ri->defaultKey = currentBatch.dynamic ? 0xFFFFFFFF : (U32)currentBatch.priority;
|
||||
ri->defaultKey = currentBatch->dynamic ? 0xFFFFFFFF : (U32)currentBatch->priority;
|
||||
ri->defaultKey2 = 1;//(U32)lastDecal->mDataBlock;
|
||||
|
||||
renderPass->addInst( ri );
|
||||
|
|
|
|||
|
|
@ -1542,11 +1542,9 @@ void Entity::write(Stream &stream, U32 tabStop, U32 flags)
|
|||
if (mComponents.size() > 0)
|
||||
{
|
||||
// Pack out the behaviors into fields
|
||||
U32 i = 0;
|
||||
for (U32 i = 0; i < mComponents.size(); i++)
|
||||
{
|
||||
writeTabs(stream, tabStop + 1);
|
||||
char buffer[1024];
|
||||
dSprintf(buffer, sizeof(buffer), "new %s() {\r\n", mComponents[i]->getClassName());
|
||||
stream.write(dStrlen(buffer), buffer);
|
||||
//bi->writeFields( stream, tabStop + 2 );
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ void RenderShapeExample::createShape()
|
|||
}
|
||||
|
||||
// Update the bounding box
|
||||
mObjBox = mShape->bounds;
|
||||
mObjBox = mShape->mBounds;
|
||||
resetWorldBox();
|
||||
setRenderTransform(mObjToWorld);
|
||||
|
||||
|
|
|
|||
|
|
@ -1384,7 +1384,7 @@ bool Explosion::explode()
|
|||
mEndingMS = U32(mExplosionInstance->getScaledDuration(mExplosionThread) * 1000.0f);
|
||||
|
||||
mObjScale.convolve(mDataBlock->explosionScale);
|
||||
mObjBox = mDataBlock->explosionShape->bounds;
|
||||
mObjBox = mDataBlock->explosionShape->mBounds;
|
||||
resetWorldBox();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1142,7 +1142,7 @@ GroundCoverCell* GroundCover::_generateCell( const Point2I& index,
|
|||
const F32 typeMaxElevation = mMaxElevation[type];
|
||||
const F32 typeMinElevation = mMinElevation[type];
|
||||
const bool typeIsShape = mShapeInstances[ type ] != NULL;
|
||||
const Box3F typeShapeBounds = typeIsShape ? mShapeInstances[ type ]->getShape()->bounds : Box3F();
|
||||
const Box3F typeShapeBounds = typeIsShape ? mShapeInstances[ type ]->getShape()->mBounds : Box3F();
|
||||
const F32 typeWindScale = mWindScale[type];
|
||||
StringTableEntry typeLayer = mLayer[type];
|
||||
const bool typeInvertLayer = mInvertLayer[type];
|
||||
|
|
@ -1184,9 +1184,9 @@ GroundCoverCell* GroundCover::_generateCell( const Point2I& index,
|
|||
terrainBlock = dynamic_cast< TerrainBlock* >( terrainBlocks.first() );
|
||||
else
|
||||
{
|
||||
for ( U32 i = 0; i < terrainBlocks.size(); i++ )
|
||||
for ( U32 blockIDx = 0; blockIDx < terrainBlocks.size(); blockIDx++ )
|
||||
{
|
||||
TerrainBlock *terrain = dynamic_cast< TerrainBlock* >( terrainBlocks[ i ] );
|
||||
TerrainBlock *terrain = dynamic_cast< TerrainBlock* >( terrainBlocks[ blockIDx ] );
|
||||
if( !terrain )
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ void ParticleEmitterData::packData(BitStream* stream)
|
|||
#if defined(AFX_CAP_PARTICLE_POOLS)
|
||||
if (stream->writeFlag(pool_datablock))
|
||||
{
|
||||
stream->writeRangedU32(packed ? SimObjectId((uintptr_t)pool_datablock) : pool_datablock->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast);
|
||||
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)pool_datablock) : pool_datablock->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast);
|
||||
stream->write(pool_index);
|
||||
stream->writeFlag(pool_depth_fade);
|
||||
stream->writeFlag(pool_radial_fade);
|
||||
|
|
@ -1390,7 +1390,7 @@ void ParticleEmitter::emitParticles(const Point3F& start,
|
|||
|
||||
Point3F a = last_part->acc;
|
||||
a -= last_part->vel * last_part->dataBlock->dragCoefficient;
|
||||
a -= mWindVelocity * last_part->dataBlock->windCoefficient;
|
||||
a += mWindVelocity * last_part->dataBlock->windCoefficient;
|
||||
//a += Point3F(0.0f, 0.0f, -9.81f) * last_part->dataBlock->gravityCoefficient;
|
||||
a.z += -9.81f*last_part->dataBlock->gravityCoefficient; // as long as gravity is a constant, this is faster
|
||||
|
||||
|
|
@ -1750,7 +1750,7 @@ void ParticleEmitter::update( U32 ms )
|
|||
{
|
||||
Point3F a = part->acc;
|
||||
a -= part->vel * part->dataBlock->dragCoefficient;
|
||||
a -= mWindVelocity * part->dataBlock->windCoefficient;
|
||||
a += mWindVelocity * part->dataBlock->windCoefficient;
|
||||
a.z += -9.81f*part->dataBlock->gravityCoefficient; // AFX -- as long as gravity is a constant, this is faster
|
||||
|
||||
part->vel += a * t;
|
||||
|
|
|
|||
|
|
@ -508,10 +508,10 @@ void Ribbon::prepRenderImage(SceneRenderState *state)
|
|||
|
||||
// Set up our vertex buffer and primitive buffer
|
||||
if(mUpdateBuffers)
|
||||
createBuffers(state, verts, primBuffer, segments);
|
||||
createBuffers(state, mVerts, mPrimBuffer, segments);
|
||||
|
||||
ri->vertBuff = &verts;
|
||||
ri->primBuff = &primBuffer;
|
||||
ri->vertBuff = &mVerts;
|
||||
ri->primBuff = &mPrimBuffer;
|
||||
ri->visibility = 1.0f;
|
||||
|
||||
ri->prim = renderPass->allocPrim();
|
||||
|
|
|
|||
|
|
@ -99,8 +99,8 @@ class Ribbon : public GameBase
|
|||
BaseMatInstance *mRibbonMat;
|
||||
MaterialParameterHandle* mRadiusSC;
|
||||
MaterialParameterHandle* mRibbonProjSC;
|
||||
GFXPrimitiveBufferHandle primBuffer;
|
||||
GFXVertexBufferHandle<GFXVertexPCNTT> verts;
|
||||
GFXPrimitiveBufferHandle mPrimBuffer;
|
||||
GFXVertexBufferHandle<GFXVertexPCNTT> mVerts;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
|||
|
|
@ -127,13 +127,13 @@ IMPLEMENT_CALLBACK( GameBase, setControl, void, ( bool controlled ), ( controlle
|
|||
|
||||
GameBaseData::GameBaseData()
|
||||
{
|
||||
category = "";
|
||||
packed = false;
|
||||
mCategory = "";
|
||||
mPacked = false;
|
||||
}
|
||||
GameBaseData::GameBaseData(const GameBaseData& other, bool temp_clone) : SimDataBlock(other, temp_clone)
|
||||
{
|
||||
packed = other.packed;
|
||||
category = other.category;
|
||||
mPacked = other.mPacked;
|
||||
mCategory = other.mCategory;
|
||||
//mReloadSignal = other.mReloadSignal; // DO NOT copy the mReloadSignal member.
|
||||
}
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ void GameBaseData::initPersistFields()
|
|||
{
|
||||
addGroup("Scripting");
|
||||
|
||||
addField( "category", TypeCaseString, Offset( category, GameBaseData ),
|
||||
addField( "category", TypeCaseString, Offset(mCategory, GameBaseData ),
|
||||
"The group that this datablock will show up in under the \"Scripted\" "
|
||||
"tab in the World Editor Library." );
|
||||
|
||||
|
|
@ -171,14 +171,14 @@ bool GameBaseData::preload(bool server, String &errorStr)
|
|||
{
|
||||
if (!Parent::preload(server, errorStr))
|
||||
return false;
|
||||
packed = false;
|
||||
mPacked = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void GameBaseData::unpackData(BitStream* stream)
|
||||
{
|
||||
Parent::unpackData(stream);
|
||||
packed = true;
|
||||
mPacked = true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
@ -259,7 +259,7 @@ GameBase::GameBase()
|
|||
GameBase::~GameBase()
|
||||
{
|
||||
#ifdef TORQUE_AFX_ENABLED
|
||||
if (scope_registered)
|
||||
if (mScope_registered)
|
||||
arcaneFX::unregisterScopedObject(this);
|
||||
#endif
|
||||
}
|
||||
|
|
@ -277,7 +277,7 @@ bool GameBase::onAdd()
|
|||
#ifdef TORQUE_AFX_ENABLED
|
||||
if (isClientObject())
|
||||
{
|
||||
if (scope_id > 0 && !scope_registered)
|
||||
if (mScope_id > 0 && !mScope_registered)
|
||||
arcaneFX::registerScopedObject(this);
|
||||
}
|
||||
else
|
||||
|
|
@ -298,7 +298,7 @@ bool GameBase::onAdd()
|
|||
void GameBase::onRemove()
|
||||
{
|
||||
#ifdef TORQUE_AFX_ENABLED
|
||||
if (scope_registered)
|
||||
if (mScope_registered)
|
||||
arcaneFX::unregisterScopedObject(this);
|
||||
#endif
|
||||
// EDITOR FEATURE: Remove us from the reload signal of our datablock.
|
||||
|
|
@ -455,7 +455,7 @@ F32 GameBase::getUpdatePriority(CameraScopeQuery *camInfo, U32 updateMask, S32 u
|
|||
// Projectiles are more interesting if they
|
||||
// are heading for us.
|
||||
wInterest = 0.30f;
|
||||
F32 dot = -mDot(pos,getVelocity());
|
||||
dot = -mDot(pos,getVelocity());
|
||||
if (dot > 0.0f)
|
||||
wInterest += 0.20 * dot;
|
||||
}
|
||||
|
|
@ -586,8 +586,8 @@ U32 GameBase::packUpdate( NetConnection *connection, U32 mask, BitStream *stream
|
|||
#ifdef TORQUE_AFX_ENABLED
|
||||
if (stream->writeFlag(mask & ScopeIdMask))
|
||||
{
|
||||
if (stream->writeFlag(scope_refs > 0))
|
||||
stream->writeInt(scope_id, SCOPE_ID_BITS);
|
||||
if (stream->writeFlag(mScope_refs > 0))
|
||||
stream->writeInt(mScope_id, SCOPE_ID_BITS);
|
||||
}
|
||||
#endif
|
||||
return retMask;
|
||||
|
|
@ -631,8 +631,8 @@ void GameBase::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
#ifdef TORQUE_AFX_ENABLED
|
||||
if (stream->readFlag())
|
||||
{
|
||||
scope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0;
|
||||
scope_refs = 0;
|
||||
mScope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0;
|
||||
mScope_refs = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,8 +91,8 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
bool packed;
|
||||
StringTableEntry category;
|
||||
bool mPacked;
|
||||
StringTableEntry mCategory;
|
||||
|
||||
// Signal triggered when this datablock is modified.
|
||||
// GameBase objects referencing this datablock notify with this signal.
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ void GuiMaterialPreview::setObjectModel(const char* modelName)
|
|||
|
||||
// Initialize camera values:
|
||||
mOrbitPos = mModel->getShape()->center;
|
||||
mMinOrbitDist = mModel->getShape()->radius;
|
||||
mMinOrbitDist = mModel->getShape()->mRadius;
|
||||
|
||||
lastRenderTime = Platform::getVirtualMilliseconds();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ void GuiObjectView::setObjectModel( const String& modelName )
|
|||
// Initialize camera values.
|
||||
|
||||
mOrbitPos = mModel->getShape()->center;
|
||||
mMinOrbitDist = mModel->getShape()->radius;
|
||||
mMinOrbitDist = mModel->getShape()->mRadius;
|
||||
|
||||
// Initialize animation.
|
||||
|
||||
|
|
|
|||
|
|
@ -320,8 +320,8 @@ Item::Item()
|
|||
mAtRest = true;
|
||||
mAtRestCounter = 0;
|
||||
mInLiquid = false;
|
||||
delta.warpTicks = 0;
|
||||
delta.dt = 1;
|
||||
mDelta.warpTicks = 0;
|
||||
mDelta.dt = 1;
|
||||
mCollisionObject = 0;
|
||||
mCollisionTimeout = 0;
|
||||
mPhysicsRep = NULL;
|
||||
|
|
@ -350,7 +350,7 @@ bool Item::onAdd()
|
|||
|
||||
if (mStatic)
|
||||
mAtRest = true;
|
||||
mObjToWorld.getColumn(3,&delta.pos);
|
||||
mObjToWorld.getColumn(3,&mDelta.pos);
|
||||
|
||||
// Setup the box for our convex object...
|
||||
mObjBox.getCenter(&mConvex.mCenter);
|
||||
|
|
@ -564,21 +564,21 @@ void Item::processTick(const Move* move)
|
|||
mCollisionObject = 0;
|
||||
|
||||
// Warp to catch up to server
|
||||
if (delta.warpTicks > 0)
|
||||
if (mDelta.warpTicks > 0)
|
||||
{
|
||||
delta.warpTicks--;
|
||||
mDelta.warpTicks--;
|
||||
|
||||
// Set new pos.
|
||||
MatrixF mat = mObjToWorld;
|
||||
mat.getColumn(3,&delta.pos);
|
||||
delta.pos += delta.warpOffset;
|
||||
mat.setColumn(3,delta.pos);
|
||||
mat.getColumn(3,&mDelta.pos);
|
||||
mDelta.pos += mDelta.warpOffset;
|
||||
mat.setColumn(3, mDelta.pos);
|
||||
Parent::setTransform(mat);
|
||||
|
||||
// Backstepping
|
||||
delta.posVec.x = -delta.warpOffset.x;
|
||||
delta.posVec.y = -delta.warpOffset.y;
|
||||
delta.posVec.z = -delta.warpOffset.z;
|
||||
mDelta.posVec.x = -mDelta.warpOffset.x;
|
||||
mDelta.posVec.y = -mDelta.warpOffset.y;
|
||||
mDelta.posVec.z = -mDelta.warpOffset.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -601,7 +601,7 @@ void Item::processTick(const Move* move)
|
|||
else
|
||||
{
|
||||
// Need to clear out last updatePos or warp interpolation
|
||||
delta.posVec.set(0,0,0);
|
||||
mDelta.posVec.set(0,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -613,11 +613,11 @@ void Item::interpolateTick(F32 dt)
|
|||
return;
|
||||
|
||||
// Client side interpolation
|
||||
Point3F pos = delta.pos + delta.posVec * dt;
|
||||
Point3F pos = mDelta.pos + mDelta.posVec * dt;
|
||||
MatrixF mat = mRenderObjToWorld;
|
||||
mat.setColumn(3,pos);
|
||||
setRenderTransform(mat);
|
||||
delta.dt = dt;
|
||||
mDelta.dt = dt;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -733,7 +733,7 @@ void Item::updatePos(const U32 /*mask*/, const F32 dt)
|
|||
// Try and move
|
||||
Point3F pos;
|
||||
mObjToWorld.getColumn(3,&pos);
|
||||
delta.posVec = pos;
|
||||
mDelta.posVec = pos;
|
||||
|
||||
bool contact = false;
|
||||
bool nonStatic = false;
|
||||
|
|
@ -891,9 +891,9 @@ void Item::updatePos(const U32 /*mask*/, const F32 dt)
|
|||
if (collisionList.getTime() < 1.0)
|
||||
{
|
||||
// Set to collision point
|
||||
F32 dt = time * collisionList.getTime();
|
||||
pos += mVelocity * dt;
|
||||
time -= dt;
|
||||
F32 cdt = time * collisionList.getTime();
|
||||
pos += mVelocity * cdt;
|
||||
time -= cdt;
|
||||
|
||||
// Pick the most resistant surface
|
||||
F32 bd = 0;
|
||||
|
|
@ -959,9 +959,9 @@ void Item::updatePos(const U32 /*mask*/, const F32 dt)
|
|||
|
||||
// If on the client, calculate delta for backstepping
|
||||
if (isGhost()) {
|
||||
delta.pos = pos;
|
||||
delta.posVec -= pos;
|
||||
delta.dt = 1;
|
||||
mDelta.pos = pos;
|
||||
mDelta.posVec -= pos;
|
||||
mDelta.dt = 1;
|
||||
}
|
||||
|
||||
// Update transform
|
||||
|
|
@ -1131,40 +1131,40 @@ void Item::unpackUpdate(NetConnection *connection, BitStream *stream)
|
|||
if (stream->readFlag() && isProperlyAdded()) {
|
||||
// Determin number of ticks to warp based on the average
|
||||
// of the client and server velocities.
|
||||
delta.warpOffset = pos - delta.pos;
|
||||
mDelta.warpOffset = pos - mDelta.pos;
|
||||
F32 as = (speed + mVelocity.len()) * 0.5f * TickSec;
|
||||
F32 dt = (as > 0.00001f) ? delta.warpOffset.len() / as: sMaxWarpTicks;
|
||||
delta.warpTicks = (S32)((dt > sMinWarpTicks)? getMax(mFloor(dt + 0.5f), 1.0f): 0.0f);
|
||||
F32 dt = (as > 0.00001f) ? mDelta.warpOffset.len() / as: sMaxWarpTicks;
|
||||
mDelta.warpTicks = (S32)((dt > sMinWarpTicks)? getMax(mFloor(dt + 0.5f), 1.0f): 0.0f);
|
||||
|
||||
if (delta.warpTicks)
|
||||
if (mDelta.warpTicks)
|
||||
{
|
||||
// Setup the warp to start on the next tick, only the
|
||||
// object's position is warped.
|
||||
if (delta.warpTicks > sMaxWarpTicks)
|
||||
delta.warpTicks = sMaxWarpTicks;
|
||||
delta.warpOffset /= (F32)delta.warpTicks;
|
||||
if (mDelta.warpTicks > sMaxWarpTicks)
|
||||
mDelta.warpTicks = sMaxWarpTicks;
|
||||
mDelta.warpOffset /= (F32)mDelta.warpTicks;
|
||||
}
|
||||
else {
|
||||
// Going to skip the warp, server and client are real close.
|
||||
// Adjust the frame interpolation to move smoothly to the
|
||||
// new position within the current tick.
|
||||
Point3F cp = delta.pos + delta.posVec * delta.dt;
|
||||
VectorF vec = delta.pos - cp;
|
||||
Point3F cp = mDelta.pos + mDelta.posVec * mDelta.dt;
|
||||
VectorF vec = mDelta.pos - cp;
|
||||
F32 vl = vec.len();
|
||||
if (vl) {
|
||||
F32 s = delta.posVec.len() / vl;
|
||||
delta.posVec = (cp - pos) * s;
|
||||
F32 s = mDelta.posVec.len() / vl;
|
||||
mDelta.posVec = (cp - pos) * s;
|
||||
}
|
||||
delta.pos = pos;
|
||||
mDelta.pos = pos;
|
||||
mat.setColumn(3,pos);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Set the item to the server position
|
||||
delta.warpTicks = 0;
|
||||
delta.posVec.set(0,0,0);
|
||||
delta.pos = pos;
|
||||
delta.dt = 0;
|
||||
mDelta.warpTicks = 0;
|
||||
mDelta.posVec.set(0,0,0);
|
||||
mDelta.pos = pos;
|
||||
mDelta.dt = 0;
|
||||
mat.setColumn(3,pos);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class Item: public ShapeBase
|
|||
Point3F warpOffset;
|
||||
F32 dt;
|
||||
};
|
||||
StateDelta delta;
|
||||
StateDelta mDelta;
|
||||
|
||||
// Static attributes
|
||||
ItemData* mDataBlock;
|
||||
|
|
|
|||
|
|
@ -167,11 +167,11 @@ void OcclusionVolume::buildSilhouette( const SceneCameraState& cameraState, Vect
|
|||
|
||||
if( mTransformDirty )
|
||||
{
|
||||
const U32 numPoints = mPolyhedron.getNumPoints();
|
||||
const U32 numPolyPoints = mPolyhedron.getNumPoints();
|
||||
const PolyhedronType::PointType* points = getPolyhedron().getPoints();
|
||||
|
||||
mWSPoints.setSize( numPoints );
|
||||
for( U32 i = 0; i < numPoints; ++ i )
|
||||
mWSPoints.setSize(numPolyPoints);
|
||||
for( U32 i = 0; i < numPolyPoints; ++ i )
|
||||
{
|
||||
Point3F p = points[ i ];
|
||||
p.convolve( getScale() );
|
||||
|
|
|
|||
|
|
@ -212,8 +212,10 @@ void PhysicalZone::onRemove()
|
|||
|
||||
void PhysicalZone::inspectPostApply()
|
||||
{
|
||||
setPolyhedron(mPolyhedron);
|
||||
Parent::inspectPostApply();
|
||||
|
||||
setPolyhedron(mPolyhedron);
|
||||
setMaskBits(PolyhedronMask | MoveMask | SettingsMask | FadeMask);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -248,30 +250,87 @@ void PhysicalZone::prepRenderImage( SceneRenderState *state )
|
|||
}
|
||||
|
||||
|
||||
void PhysicalZone::renderObject( ObjectRenderInst *ri,
|
||||
SceneRenderState *state,
|
||||
BaseMatInstance *overrideMat )
|
||||
void PhysicalZone::renderObject(ObjectRenderInst *ri,
|
||||
SceneRenderState *state,
|
||||
BaseMatInstance *overrideMat)
|
||||
{
|
||||
if (overrideMat)
|
||||
return;
|
||||
|
||||
|
||||
GFXStateBlockDesc desc;
|
||||
desc.setZReadWrite( true, false );
|
||||
desc.setBlend( true );
|
||||
desc.setCullMode( GFXCullNone );
|
||||
|
||||
desc.setZReadWrite(true, false);
|
||||
desc.setBlend(true);
|
||||
desc.setCullMode(GFXCullNone);
|
||||
|
||||
GFXTransformSaver saver;
|
||||
|
||||
GFXDrawUtil *drawer = GFX->getDrawUtil();
|
||||
|
||||
Point3F start = getBoxCenter();
|
||||
Box3F obb = mObjBox; //object bounding box
|
||||
|
||||
F32 baseForce = 10000; //roughly the ammount of force needed to push a player back as it walks into a zone. (used for visual scaling)
|
||||
|
||||
Point3F forceDir = getForce(&start);
|
||||
F32 forceLen = forceDir.len()/ baseForce;
|
||||
forceDir.normalizeSafe();
|
||||
ColorI guideCol = LinearColorF(mFabs(forceDir.x), mFabs(forceDir.y), mFabs(forceDir.z), 0.125).toColorI();
|
||||
|
||||
if (force_type == VECTOR)
|
||||
{
|
||||
Point3F endPos = start + (forceDir * mMax(forceLen,0.75f));
|
||||
drawer->drawArrow(desc, start, endPos, guideCol, 0.05f);
|
||||
}
|
||||
|
||||
MatrixF mat = getRenderTransform();
|
||||
mat.scale( getScale() );
|
||||
mat.scale(getScale());
|
||||
|
||||
GFX->multWorld(mat);
|
||||
start = obb.getCenter();
|
||||
|
||||
if (force_type == VECTOR)
|
||||
{
|
||||
drawer->drawPolyhedron(desc, mPolyhedron, ColorI(0, 255, 0, 45));
|
||||
}
|
||||
else if (force_type == SPHERICAL)
|
||||
{
|
||||
F32 rad = obb.getBoundingSphere().radius/ 2;
|
||||
drawer->drawSphere(desc, rad, start, ColorI(0, 255, 0, 45));
|
||||
|
||||
GFX->multWorld( mat );
|
||||
rad = (rad + (mAppliedForce.most() / baseForce))/2;
|
||||
desc.setFillModeWireframe();
|
||||
drawer->drawSphere(desc, rad, start, ColorI(0, 0, 255, 255));
|
||||
}
|
||||
else
|
||||
{
|
||||
Point3F bottomPos = start;
|
||||
bottomPos.z -= obb.len_z() / 2;
|
||||
|
||||
Point3F topPos = start;
|
||||
topPos.z += obb.len_z() / 2;
|
||||
F32 rad = obb.len_x() / 2;
|
||||
drawer->drawCylinder(desc, bottomPos, topPos, rad, ColorI(0, 255, 0, 45));
|
||||
|
||||
GFXDrawUtil *drawer = GFX->getDrawUtil();
|
||||
drawer->drawPolyhedron( desc, mPolyhedron, ColorI( 0, 255, 0, 45 ) );
|
||||
Point3F force_vec = mAppliedForce; //raw relative-applied force here as oposed to derived
|
||||
F32 hieght = (force_vec.z / baseForce);
|
||||
|
||||
if (force_vec.z<0)
|
||||
bottomPos.z = (bottomPos.z + hieght)/2;
|
||||
else
|
||||
topPos.z = (topPos.z + hieght) / 2;
|
||||
|
||||
if (force_vec.x > force_vec.y)
|
||||
rad = (rad + (force_vec.x / baseForce)) / 2;
|
||||
else
|
||||
rad = (rad + (force_vec.y / baseForce)) / 2;
|
||||
|
||||
|
||||
desc.setFillModeWireframe();
|
||||
drawer->drawCylinder(desc, bottomPos, topPos, rad, guideCol);
|
||||
}
|
||||
|
||||
desc.setFillModeWireframe();
|
||||
drawer->drawPolyhedron( desc, mPolyhedron, ColorI::BLACK );
|
||||
drawer->drawPolyhedron(desc, mPolyhedron, ColorI::BLACK);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
|
@ -283,17 +342,17 @@ U32 PhysicalZone::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
|
|||
if (stream->writeFlag(mask & PolyhedronMask))
|
||||
{
|
||||
// Write the polyhedron
|
||||
stream->write(mPolyhedron.pointList.size());
|
||||
for (i = 0; i < mPolyhedron.pointList.size(); i++)
|
||||
mathWrite(*stream, mPolyhedron.pointList[i]);
|
||||
stream->write(mPolyhedron.mPointList.size());
|
||||
for (i = 0; i < mPolyhedron.mPointList.size(); i++)
|
||||
mathWrite(*stream, mPolyhedron.mPointList[i]);
|
||||
|
||||
stream->write(mPolyhedron.planeList.size());
|
||||
for (i = 0; i < mPolyhedron.planeList.size(); i++)
|
||||
mathWrite(*stream, mPolyhedron.planeList[i]);
|
||||
stream->write(mPolyhedron.mPlaneList.size());
|
||||
for (i = 0; i < mPolyhedron.mPlaneList.size(); i++)
|
||||
mathWrite(*stream, mPolyhedron.mPlaneList[i]);
|
||||
|
||||
stream->write(mPolyhedron.edgeList.size());
|
||||
for (i = 0; i < mPolyhedron.edgeList.size(); i++) {
|
||||
const Polyhedron::Edge& rEdge = mPolyhedron.edgeList[i];
|
||||
stream->write(mPolyhedron.mEdgeList.size());
|
||||
for (i = 0; i < mPolyhedron.mEdgeList.size(); i++) {
|
||||
const Polyhedron::Edge& rEdge = mPolyhedron.mEdgeList[i];
|
||||
|
||||
stream->write(rEdge.face[0]);
|
||||
stream->write(rEdge.face[1]);
|
||||
|
|
@ -325,7 +384,7 @@ U32 PhysicalZone::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
|
|||
|
||||
stream->writeFlag(mActive);
|
||||
|
||||
return retMask;
|
||||
return retMask;
|
||||
}
|
||||
|
||||
void PhysicalZone::unpackUpdate(NetConnection* con, BitStream* stream)
|
||||
|
|
@ -340,19 +399,19 @@ void PhysicalZone::unpackUpdate(NetConnection* con, BitStream* stream)
|
|||
|
||||
// Read the polyhedron
|
||||
stream->read(&size);
|
||||
tempPH.pointList.setSize(size);
|
||||
for (i = 0; i < tempPH.pointList.size(); i++)
|
||||
mathRead(*stream, &tempPH.pointList[i]);
|
||||
tempPH.mPointList.setSize(size);
|
||||
for (i = 0; i < tempPH.mPointList.size(); i++)
|
||||
mathRead(*stream, &tempPH.mPointList[i]);
|
||||
|
||||
stream->read(&size);
|
||||
tempPH.planeList.setSize(size);
|
||||
for (i = 0; i < tempPH.planeList.size(); i++)
|
||||
mathRead(*stream, &tempPH.planeList[i]);
|
||||
tempPH.mPlaneList.setSize(size);
|
||||
for (i = 0; i < tempPH.mPlaneList.size(); i++)
|
||||
mathRead(*stream, &tempPH.mPlaneList[i]);
|
||||
|
||||
stream->read(&size);
|
||||
tempPH.edgeList.setSize(size);
|
||||
for (i = 0; i < tempPH.edgeList.size(); i++) {
|
||||
Polyhedron::Edge& rEdge = tempPH.edgeList[i];
|
||||
tempPH.mEdgeList.setSize(size);
|
||||
for (i = 0; i < tempPH.mEdgeList.size(); i++) {
|
||||
Polyhedron::Edge& rEdge = tempPH.mEdgeList[i];
|
||||
|
||||
stream->read(&rEdge.face[0]);
|
||||
stream->read(&rEdge.face[1]);
|
||||
|
|
@ -408,12 +467,12 @@ void PhysicalZone::setPolyhedron(const Polyhedron& rPolyhedron)
|
|||
{
|
||||
mPolyhedron = rPolyhedron;
|
||||
|
||||
if (mPolyhedron.pointList.size() != 0) {
|
||||
if (mPolyhedron.mPointList.size() != 0) {
|
||||
mObjBox.minExtents.set(1e10, 1e10, 1e10);
|
||||
mObjBox.maxExtents.set(-1e10, -1e10, -1e10);
|
||||
for (U32 i = 0; i < mPolyhedron.pointList.size(); i++) {
|
||||
mObjBox.minExtents.setMin(mPolyhedron.pointList[i]);
|
||||
mObjBox.maxExtents.setMax(mPolyhedron.pointList[i]);
|
||||
for (U32 i = 0; i < mPolyhedron.mPointList.size(); i++) {
|
||||
mObjBox.minExtents.setMin(mPolyhedron.mPointList[i]);
|
||||
mObjBox.maxExtents.setMax(mPolyhedron.mPointList[i]);
|
||||
}
|
||||
} else {
|
||||
mObjBox.minExtents.set(-0.5, -0.5, -0.5);
|
||||
|
|
@ -424,7 +483,7 @@ void PhysicalZone::setPolyhedron(const Polyhedron& rPolyhedron)
|
|||
setTransform(xform);
|
||||
|
||||
mClippedList.clear();
|
||||
mClippedList.mPlaneList = mPolyhedron.planeList;
|
||||
mClippedList.mPlaneList = mPolyhedron.mPlaneList;
|
||||
|
||||
MatrixF base(true);
|
||||
base.scale(Point3F(1.0/mObjScale.x,
|
||||
|
|
@ -481,7 +540,7 @@ bool PhysicalZone::testObject(SceneObject* enter)
|
|||
// all. And whats the point of building a convex if no collision methods
|
||||
// are implemented?
|
||||
|
||||
if (mPolyhedron.pointList.size() == 0)
|
||||
if (mPolyhedron.mPointList.size() == 0)
|
||||
return false;
|
||||
|
||||
mClippedList.clear();
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ bool PhysicsDebris::onAdd()
|
|||
}
|
||||
|
||||
// Setup our bounding box
|
||||
mObjBox = mDataBlock->shape->bounds;
|
||||
mObjBox = mDataBlock->shape->mBounds;
|
||||
resetWorldBox();
|
||||
|
||||
// Add it to the client scene.
|
||||
|
|
|
|||
|
|
@ -308,10 +308,10 @@ bool PhysicsShapeData::preload( bool server, String &errorBuffer )
|
|||
{
|
||||
//no collision so we create a simple box collision shape from the shapes bounds and alert the user
|
||||
Con::warnf( "PhysicsShapeData::preload - No collision found for shape '%s', auto-creating one", shapeName );
|
||||
Point3F halfWidth = shape->bounds.getExtents() * 0.5f;
|
||||
Point3F halfWidth = shape->mBounds.getExtents() * 0.5f;
|
||||
colShape = PHYSICSMGR->createCollision();
|
||||
MatrixF centerXfm(true);
|
||||
centerXfm.setPosition(shape->bounds.getCenter());
|
||||
centerXfm.setPosition(shape->mBounds.getCenter());
|
||||
colShape->addBox(halfWidth, centerXfm);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -707,7 +707,7 @@ bool PhysicsShape::_createShape()
|
|||
return false;
|
||||
|
||||
// Set the world box.
|
||||
mObjBox = db->shape->bounds;
|
||||
mObjBox = db->shape->mBounds;
|
||||
resetWorldBox();
|
||||
|
||||
// If this is the server and its a client only simulation
|
||||
|
|
|
|||
|
|
@ -1577,20 +1577,20 @@ Player::Player()
|
|||
{
|
||||
mTypeMask |= PlayerObjectType | DynamicShapeObjectType;
|
||||
|
||||
delta.pos = mAnchorPoint = Point3F(0,0,100);
|
||||
delta.rot = delta.head = Point3F(0,0,0);
|
||||
delta.rotOffset.set(0.0f,0.0f,0.0f);
|
||||
delta.warpOffset.set(0.0f,0.0f,0.0f);
|
||||
delta.posVec.set(0.0f,0.0f,0.0f);
|
||||
delta.rotVec.set(0.0f,0.0f,0.0f);
|
||||
delta.headVec.set(0.0f,0.0f,0.0f);
|
||||
delta.warpTicks = 0;
|
||||
delta.dt = 1.0f;
|
||||
delta.move = NullMove;
|
||||
mDelta.pos = mAnchorPoint = Point3F(0,0,100);
|
||||
mDelta.rot = mDelta.head = Point3F(0,0,0);
|
||||
mDelta.rotOffset.set(0.0f,0.0f,0.0f);
|
||||
mDelta.warpOffset.set(0.0f,0.0f,0.0f);
|
||||
mDelta.posVec.set(0.0f,0.0f,0.0f);
|
||||
mDelta.rotVec.set(0.0f,0.0f,0.0f);
|
||||
mDelta.headVec.set(0.0f,0.0f,0.0f);
|
||||
mDelta.warpTicks = 0;
|
||||
mDelta.dt = 1.0f;
|
||||
mDelta.move = NullMove;
|
||||
mPredictionCount = sMaxPredictionTicks;
|
||||
mObjToWorld.setColumn(3,delta.pos);
|
||||
mRot = delta.rot;
|
||||
mHead = delta.head;
|
||||
mObjToWorld.setColumn(3, mDelta.pos);
|
||||
mRot = mDelta.rot;
|
||||
mHead = mDelta.head;
|
||||
mVelocity.set(0.0f, 0.0f, 0.0f);
|
||||
mDataBlock = 0;
|
||||
mHeadHThread = mHeadVThread = mRecoilThread = mImageStateThread = 0;
|
||||
|
|
@ -1953,6 +1953,7 @@ void Player::reSkin()
|
|||
{
|
||||
if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() )
|
||||
{
|
||||
mShapeInstance->resetMaterialList();
|
||||
Vector<String> skins;
|
||||
String(mSkinNameHandle.getString()).split( ";", skins );
|
||||
|
||||
|
|
@ -2103,30 +2104,30 @@ void Player::processTick(const Move* move)
|
|||
}
|
||||
}
|
||||
// Warp to catch up to server
|
||||
if (delta.warpTicks > 0) {
|
||||
delta.warpTicks--;
|
||||
if (mDelta.warpTicks > 0) {
|
||||
mDelta.warpTicks--;
|
||||
|
||||
// Set new pos
|
||||
getTransform().getColumn(3, &delta.pos);
|
||||
delta.pos += delta.warpOffset;
|
||||
delta.rot += delta.rotOffset;
|
||||
getTransform().getColumn(3, &mDelta.pos);
|
||||
mDelta.pos += mDelta.warpOffset;
|
||||
mDelta.rot += mDelta.rotOffset;
|
||||
|
||||
// Wrap yaw to +/-PI
|
||||
if (delta.rot.z < - M_PI_F)
|
||||
delta.rot.z += M_2PI_F;
|
||||
else if (delta.rot.z > M_PI_F)
|
||||
delta.rot.z -= M_2PI_F;
|
||||
if (mDelta.rot.z < - M_PI_F)
|
||||
mDelta.rot.z += M_2PI_F;
|
||||
else if (mDelta.rot.z > M_PI_F)
|
||||
mDelta.rot.z -= M_2PI_F;
|
||||
|
||||
if (!ignore_updates)
|
||||
{
|
||||
setPosition(delta.pos,delta.rot);
|
||||
setPosition(mDelta.pos, mDelta.rot);
|
||||
}
|
||||
updateDeathOffsets();
|
||||
updateLookAnimation();
|
||||
|
||||
// Backstepping
|
||||
delta.posVec = -delta.warpOffset;
|
||||
delta.rotVec = -delta.rotOffset;
|
||||
mDelta.posVec = -mDelta.warpOffset;
|
||||
mDelta.rotVec = -mDelta.rotOffset;
|
||||
}
|
||||
else {
|
||||
// If there is no move, the player is either an
|
||||
|
|
@ -2139,7 +2140,7 @@ void Player::processTick(const Move* move)
|
|||
if (mPredictionCount-- <= 0)
|
||||
return;
|
||||
|
||||
move = &delta.move;
|
||||
move = &mDelta.move;
|
||||
}
|
||||
else
|
||||
move = &NullMove;
|
||||
|
|
@ -2215,8 +2216,8 @@ void Player::interpolateTick(F32 dt)
|
|||
// Client side interpolation
|
||||
Parent::interpolateTick(dt);
|
||||
|
||||
Point3F pos = delta.pos + delta.posVec * dt;
|
||||
Point3F rot = delta.rot + delta.rotVec * dt;
|
||||
Point3F pos = mDelta.pos + mDelta.posVec * dt;
|
||||
Point3F rot = mDelta.rot + mDelta.rotVec * dt;
|
||||
|
||||
if (!ignore_updates)
|
||||
setRenderPosition(pos,rot,dt);
|
||||
|
|
@ -2237,7 +2238,7 @@ void Player::interpolateTick(F32 dt)
|
|||
*/
|
||||
|
||||
updateLookAnimation(dt);
|
||||
delta.dt = dt;
|
||||
mDelta.dt = dt;
|
||||
}
|
||||
|
||||
void Player::advanceTime(F32 dt)
|
||||
|
|
@ -2561,7 +2562,7 @@ void Player::updateMove(const Move* move)
|
|||
}
|
||||
move = &my_move;
|
||||
}
|
||||
delta.move = *move;
|
||||
mDelta.move = *move;
|
||||
|
||||
#ifdef TORQUE_OPENVR
|
||||
if (mControllers[0])
|
||||
|
|
@ -2611,7 +2612,7 @@ void Player::updateMove(const Move* move)
|
|||
// Update current orientation
|
||||
if (mDamageState == Enabled) {
|
||||
F32 prevZRot = mRot.z;
|
||||
delta.headVec = mHead;
|
||||
mDelta.headVec = mHead;
|
||||
|
||||
bool doStandardMove = true;
|
||||
bool absoluteDelta = false;
|
||||
|
|
@ -2772,29 +2773,29 @@ void Player::updateMove(const Move* move)
|
|||
mRot.z -= M_2PI_F;
|
||||
}
|
||||
|
||||
delta.rot = mRot;
|
||||
delta.rotVec.x = delta.rotVec.y = 0.0f;
|
||||
delta.rotVec.z = prevZRot - mRot.z;
|
||||
if (delta.rotVec.z > M_PI_F)
|
||||
delta.rotVec.z -= M_2PI_F;
|
||||
else if (delta.rotVec.z < -M_PI_F)
|
||||
delta.rotVec.z += M_2PI_F;
|
||||
mDelta.rot = mRot;
|
||||
mDelta.rotVec.x = mDelta.rotVec.y = 0.0f;
|
||||
mDelta.rotVec.z = prevZRot - mRot.z;
|
||||
if (mDelta.rotVec.z > M_PI_F)
|
||||
mDelta.rotVec.z -= M_2PI_F;
|
||||
else if (mDelta.rotVec.z < -M_PI_F)
|
||||
mDelta.rotVec.z += M_2PI_F;
|
||||
|
||||
delta.head = mHead;
|
||||
delta.headVec -= mHead;
|
||||
mDelta.head = mHead;
|
||||
mDelta.headVec -= mHead;
|
||||
|
||||
if (absoluteDelta)
|
||||
{
|
||||
delta.headVec = Point3F(0, 0, 0);
|
||||
delta.rotVec = Point3F(0, 0, 0);
|
||||
mDelta.headVec = Point3F(0, 0, 0);
|
||||
mDelta.rotVec = Point3F(0, 0, 0);
|
||||
}
|
||||
|
||||
for(U32 i=0; i<3; ++i)
|
||||
{
|
||||
if (delta.headVec[i] > M_PI_F)
|
||||
delta.headVec[i] -= M_2PI_F;
|
||||
else if (delta.headVec[i] < -M_PI_F)
|
||||
delta.headVec[i] += M_2PI_F;
|
||||
if (mDelta.headVec[i] > M_PI_F)
|
||||
mDelta.headVec[i] -= M_2PI_F;
|
||||
else if (mDelta.headVec[i] < -M_PI_F)
|
||||
mDelta.headVec[i] += M_2PI_F;
|
||||
}
|
||||
}
|
||||
MatrixF zRot;
|
||||
|
|
@ -3028,7 +3029,7 @@ void Player::updateMove(const Move* move)
|
|||
|
||||
// get the head pitch and add it to the moveVec
|
||||
// This more accurate swim vector calc comes from Matt Fairfax
|
||||
MatrixF xRot, zRot;
|
||||
MatrixF xRot;
|
||||
xRot.set(EulerF(mHead.x, 0, 0));
|
||||
zRot.set(EulerF(0, 0, mRot.z));
|
||||
MatrixF rot;
|
||||
|
|
@ -3583,7 +3584,7 @@ void Player::updateLookAnimation(F32 dt)
|
|||
return;
|
||||
}
|
||||
// Calculate our interpolated head position.
|
||||
Point3F renderHead = delta.head + delta.headVec * dt;
|
||||
Point3F renderHead = mDelta.head + mDelta.headVec * dt;
|
||||
|
||||
// Adjust look pos. This assumes that the animations match
|
||||
// the min and max look angles provided in the datablock.
|
||||
|
|
@ -4421,8 +4422,8 @@ void Player::onImageStateAnimation(U32 imageSlot, const char* seqName, bool dire
|
|||
|
||||
if (!found && hasImageBasePrefix && hasScriptPrefix)
|
||||
{
|
||||
String seqName = String(imageBasePrefix) + String("_") + String(scriptPrefix) + String("_") + baseSeqName;
|
||||
S32 index = mShapeInstance->getShape()->findSequence(seqName);
|
||||
String comboSeqName = String(imageBasePrefix) + String("_") + String(scriptPrefix) + String("_") + baseSeqName;
|
||||
S32 index = mShapeInstance->getShape()->findSequence(comboSeqName);
|
||||
if (index != -1)
|
||||
{
|
||||
seqIndex = index;
|
||||
|
|
@ -4432,8 +4433,8 @@ void Player::onImageStateAnimation(U32 imageSlot, const char* seqName, bool dire
|
|||
|
||||
if (!found && hasImageBasePrefix)
|
||||
{
|
||||
String seqName = String(imageBasePrefix) + String("_") + baseSeqName;
|
||||
S32 index = mShapeInstance->getShape()->findSequence(seqName);
|
||||
String imgSeqName = String(imageBasePrefix) + String("_") + baseSeqName;
|
||||
S32 index = mShapeInstance->getShape()->findSequence(imgSeqName);
|
||||
if (index != -1)
|
||||
{
|
||||
seqIndex = index;
|
||||
|
|
@ -4443,8 +4444,8 @@ void Player::onImageStateAnimation(U32 imageSlot, const char* seqName, bool dire
|
|||
|
||||
if (!found && hasScriptPrefix)
|
||||
{
|
||||
String seqName = String(scriptPrefix) + String("_") + baseSeqName;
|
||||
S32 index = mShapeInstance->getShape()->findSequence(seqName);
|
||||
String scriptSeqName = String(scriptPrefix) + String("_") + baseSeqName;
|
||||
S32 index = mShapeInstance->getShape()->findSequence(scriptSeqName);
|
||||
if (index != -1)
|
||||
{
|
||||
seqIndex = index;
|
||||
|
|
@ -5113,7 +5114,7 @@ void Player::_handleCollision( const Collision &collision )
|
|||
bool Player::updatePos(const F32 travelTime)
|
||||
{
|
||||
PROFILE_SCOPE(Player_UpdatePos);
|
||||
getTransform().getColumn(3,&delta.posVec);
|
||||
getTransform().getColumn(3,&mDelta.posVec);
|
||||
|
||||
// When mounted to another object, only Z rotation used.
|
||||
if (isMounted()) {
|
||||
|
|
@ -5205,7 +5206,7 @@ bool Player::updatePos(const F32 travelTime)
|
|||
else
|
||||
{
|
||||
if ( mVelocity.isZero() )
|
||||
newPos = delta.posVec;
|
||||
newPos = mDelta.posVec;
|
||||
else
|
||||
newPos = _move( travelTime, &col );
|
||||
|
||||
|
|
@ -5222,9 +5223,9 @@ bool Player::updatePos(const F32 travelTime)
|
|||
// If on the client, calc delta for backstepping
|
||||
if (isClientObject())
|
||||
{
|
||||
delta.pos = newPos;
|
||||
delta.posVec = delta.posVec - delta.pos;
|
||||
delta.dt = 1.0f;
|
||||
mDelta.pos = newPos;
|
||||
mDelta.posVec = mDelta.posVec - mDelta.pos;
|
||||
mDelta.dt = 1.0f;
|
||||
}
|
||||
|
||||
setPosition( newPos, mRot );
|
||||
|
|
@ -5460,8 +5461,8 @@ bool Player::displaceObject(const Point3F& displacement)
|
|||
|
||||
sBalance--;
|
||||
|
||||
getTransform().getColumn(3, &delta.pos);
|
||||
delta.posVec.set(0.0f, 0.0f, 0.0f);
|
||||
getTransform().getColumn(3, &mDelta.pos);
|
||||
mDelta.posVec.set(0.0f, 0.0f, 0.0f);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -5480,8 +5481,8 @@ bool Player::displaceObject(const Point3F& displacement)
|
|||
|
||||
bool result = updatePos(dt);
|
||||
|
||||
mObjToWorld.getColumn(3, &delta.pos);
|
||||
delta.posVec.set(0.0f, 0.0f, 0.0f);
|
||||
mObjToWorld.getColumn(3, &mDelta.pos);
|
||||
mDelta.posVec.set(0.0f, 0.0f, 0.0f);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -5684,10 +5685,10 @@ void Player::getRenderEyeBaseTransform(MatrixF* mat, bool includeBank)
|
|||
// Eye transform in world space. We only use the eye position
|
||||
// from the animation and supply our own rotation.
|
||||
MatrixF pmat,xmat,zmat;
|
||||
xmat.set(EulerF(delta.head.x + delta.headVec.x * delta.dt, 0.0f, 0.0f));
|
||||
xmat.set(EulerF(mDelta.head.x + mDelta.headVec.x * mDelta.dt, 0.0f, 0.0f));
|
||||
|
||||
if (mUseHeadZCalc)
|
||||
zmat.set(EulerF(0.0f, 0.0f, delta.head.z + delta.headVec.z * delta.dt));
|
||||
zmat.set(EulerF(0.0f, 0.0f, mDelta.head.z + mDelta.headVec.z * mDelta.dt));
|
||||
else
|
||||
zmat.identity();
|
||||
|
||||
|
|
@ -5697,7 +5698,7 @@ void Player::getRenderEyeBaseTransform(MatrixF* mat, bool includeBank)
|
|||
MatrixF imat;
|
||||
imat.mul(zmat, xmat);
|
||||
MatrixF ymat;
|
||||
ymat.set(EulerF(0.0f, delta.head.y + delta.headVec.y * delta.dt, 0.0f));
|
||||
ymat.set(EulerF(0.0f, mDelta.head.y + mDelta.headVec.y * mDelta.dt, 0.0f));
|
||||
pmat.mul(imat, ymat);
|
||||
}
|
||||
else
|
||||
|
|
@ -6234,7 +6235,7 @@ void Player::readPacketData(GameConnection *connection, BitStream *stream)
|
|||
stream->read(&mVelocity.y);
|
||||
stream->read(&mVelocity.z);
|
||||
stream->setCompressionPoint(pos);
|
||||
delta.pos = pos;
|
||||
mDelta.pos = pos;
|
||||
mJumpSurfaceLastContact = stream->readInt(4);
|
||||
|
||||
if (stream->readFlag())
|
||||
|
|
@ -6257,7 +6258,7 @@ void Player::readPacketData(GameConnection *connection, BitStream *stream)
|
|||
}
|
||||
}
|
||||
else
|
||||
pos = delta.pos;
|
||||
pos = mDelta.pos;
|
||||
stream->read(&mHead.x);
|
||||
if(stream->readFlag())
|
||||
{
|
||||
|
|
@ -6269,8 +6270,8 @@ void Player::readPacketData(GameConnection *connection, BitStream *stream)
|
|||
rot.x = rot.y = 0;
|
||||
if (!ignore_updates)
|
||||
setPosition(pos,rot);
|
||||
delta.head = mHead;
|
||||
delta.rot = rot;
|
||||
mDelta.head = mHead;
|
||||
mDelta.rot = rot;
|
||||
|
||||
if (stream->readFlag()) {
|
||||
S32 gIndex = stream->readInt(NetConnection::GhostIdBitSize);
|
||||
|
|
@ -6348,7 +6349,7 @@ U32 Player::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
stream->writeFloat(mRot.z / M_2PI_F, 7);
|
||||
stream->writeSignedFloat(mHead.x / (mDataBlock->maxLookAngle - mDataBlock->minLookAngle), 6);
|
||||
stream->writeSignedFloat(mHead.z / mDataBlock->maxFreelookAngle, 6);
|
||||
delta.move.pack(stream);
|
||||
mDelta.move.pack(stream);
|
||||
stream->writeFlag(!(mask & NoWarpMask));
|
||||
}
|
||||
// Ghost need energy to predict reliably
|
||||
|
|
@ -6454,67 +6455,67 @@ void Player::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
rot.z = stream->readFloat(7) * M_2PI_F;
|
||||
mHead.x = stream->readSignedFloat(6) * (mDataBlock->maxLookAngle - mDataBlock->minLookAngle);
|
||||
mHead.z = stream->readSignedFloat(6) * mDataBlock->maxFreelookAngle;
|
||||
delta.move.unpack(stream);
|
||||
mDelta.move.unpack(stream);
|
||||
|
||||
delta.head = mHead;
|
||||
delta.headVec.set(0.0f, 0.0f, 0.0f);
|
||||
mDelta.head = mHead;
|
||||
mDelta.headVec.set(0.0f, 0.0f, 0.0f);
|
||||
|
||||
if (stream->readFlag() && isProperlyAdded())
|
||||
{
|
||||
// Determine number of ticks to warp based on the average
|
||||
// of the client and server velocities.
|
||||
delta.warpOffset = pos - delta.pos;
|
||||
mDelta.warpOffset = pos - mDelta.pos;
|
||||
F32 as = (speed + mVelocity.len()) * 0.5f * TickSec;
|
||||
F32 dt = (as > 0.00001f) ? delta.warpOffset.len() / as: sMaxWarpTicks;
|
||||
delta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f);
|
||||
F32 dt = (as > 0.00001f) ? mDelta.warpOffset.len() / as: sMaxWarpTicks;
|
||||
mDelta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f);
|
||||
|
||||
if (delta.warpTicks)
|
||||
if (mDelta.warpTicks)
|
||||
{
|
||||
// Setup the warp to start on the next tick.
|
||||
if (delta.warpTicks > sMaxWarpTicks)
|
||||
delta.warpTicks = sMaxWarpTicks;
|
||||
delta.warpOffset /= (F32)delta.warpTicks;
|
||||
if (mDelta.warpTicks > sMaxWarpTicks)
|
||||
mDelta.warpTicks = sMaxWarpTicks;
|
||||
mDelta.warpOffset /= (F32)mDelta.warpTicks;
|
||||
|
||||
delta.rotOffset = rot - delta.rot;
|
||||
mDelta.rotOffset = rot - mDelta.rot;
|
||||
|
||||
// Ignore small rotation differences
|
||||
if (mFabs(delta.rotOffset.z) < 0.001f)
|
||||
delta.rotOffset.z = 0;
|
||||
if (mFabs(mDelta.rotOffset.z) < 0.001f)
|
||||
mDelta.rotOffset.z = 0;
|
||||
|
||||
// Wrap rotation to +/-PI
|
||||
if(delta.rotOffset.z < - M_PI_F)
|
||||
delta.rotOffset.z += M_2PI_F;
|
||||
else if(delta.rotOffset.z > M_PI_F)
|
||||
delta.rotOffset.z -= M_2PI_F;
|
||||
if(mDelta.rotOffset.z < - M_PI_F)
|
||||
mDelta.rotOffset.z += M_2PI_F;
|
||||
else if(mDelta.rotOffset.z > M_PI_F)
|
||||
mDelta.rotOffset.z -= M_2PI_F;
|
||||
|
||||
delta.rotOffset /= (F32)delta.warpTicks;
|
||||
mDelta.rotOffset /= (F32)mDelta.warpTicks;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Going to skip the warp, server and client are real close.
|
||||
// Adjust the frame interpolation to move smoothly to the
|
||||
// new position within the current tick.
|
||||
Point3F cp = delta.pos + delta.posVec * delta.dt;
|
||||
if (delta.dt == 0)
|
||||
Point3F cp = mDelta.pos + mDelta.posVec * mDelta.dt;
|
||||
if (mDelta.dt == 0)
|
||||
{
|
||||
delta.posVec.set(0.0f, 0.0f, 0.0f);
|
||||
delta.rotVec.set(0.0f, 0.0f, 0.0f);
|
||||
mDelta.posVec.set(0.0f, 0.0f, 0.0f);
|
||||
mDelta.rotVec.set(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
F32 dti = 1.0f / delta.dt;
|
||||
delta.posVec = (cp - pos) * dti;
|
||||
delta.rotVec.z = mRot.z - rot.z;
|
||||
F32 dti = 1.0f / mDelta.dt;
|
||||
mDelta.posVec = (cp - pos) * dti;
|
||||
mDelta.rotVec.z = mRot.z - rot.z;
|
||||
|
||||
if(delta.rotVec.z > M_PI_F)
|
||||
delta.rotVec.z -= M_2PI_F;
|
||||
else if(delta.rotVec.z < -M_PI_F)
|
||||
delta.rotVec.z += M_2PI_F;
|
||||
if(mDelta.rotVec.z > M_PI_F)
|
||||
mDelta.rotVec.z -= M_2PI_F;
|
||||
else if(mDelta.rotVec.z < -M_PI_F)
|
||||
mDelta.rotVec.z += M_2PI_F;
|
||||
|
||||
delta.rotVec.z *= dti;
|
||||
mDelta.rotVec.z *= dti;
|
||||
}
|
||||
delta.pos = pos;
|
||||
delta.rot = rot;
|
||||
mDelta.pos = pos;
|
||||
mDelta.rot = rot;
|
||||
if (!ignore_updates)
|
||||
setPosition(pos,rot);
|
||||
}
|
||||
|
|
@ -6522,12 +6523,12 @@ void Player::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
else
|
||||
{
|
||||
// Set the player to the server position
|
||||
delta.pos = pos;
|
||||
delta.rot = rot;
|
||||
delta.posVec.set(0.0f, 0.0f, 0.0f);
|
||||
delta.rotVec.set(0.0f, 0.0f, 0.0f);
|
||||
delta.warpTicks = 0;
|
||||
delta.dt = 0.0f;
|
||||
mDelta.pos = pos;
|
||||
mDelta.rot = rot;
|
||||
mDelta.posVec.set(0.0f, 0.0f, 0.0f);
|
||||
mDelta.rotVec.set(0.0f, 0.0f, 0.0f);
|
||||
mDelta.warpTicks = 0;
|
||||
mDelta.dt = 0.0f;
|
||||
if (!ignore_updates)
|
||||
setPosition(pos,rot);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -436,7 +436,7 @@ protected:
|
|||
Point3F rotOffset;
|
||||
/// @}
|
||||
};
|
||||
StateDelta delta; ///< Used for interpolation on the client. @see StateDelta
|
||||
StateDelta mDelta; ///< Used for interpolation on the client. @see StateDelta
|
||||
S32 mPredictionCount; ///< Number of ticks to predict
|
||||
|
||||
// Current pos, vel etc.
|
||||
|
|
|
|||
|
|
@ -528,6 +528,11 @@ bool Prefab::isValidChild( SimObject *simobj, bool logWarnings )
|
|||
bool Prefab::buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF& sphere)
|
||||
{
|
||||
Vector<SceneObject*> foundObjects;
|
||||
if (mChildGroup.isNull() || mChildGroup->empty())
|
||||
{
|
||||
Con::warnf("Bad Prefab Config! %s has no valid entries!", getName());
|
||||
return false;
|
||||
}
|
||||
mChildGroup->findObjectByType(foundObjects);
|
||||
|
||||
for (S32 i = 0; i < foundObjects.size(); i++)
|
||||
|
|
|
|||
|
|
@ -828,7 +828,7 @@ bool Projectile::onAdd()
|
|||
|
||||
// Setup our bounding box
|
||||
if (bool(mDataBlock->projectileShape) == true)
|
||||
mObjBox = mDataBlock->projectileShape->bounds;
|
||||
mObjBox = mDataBlock->projectileShape->mBounds;
|
||||
else
|
||||
mObjBox = Box3F(Point3F(0, 0, 0), Point3F(0, 0, 0));
|
||||
|
||||
|
|
|
|||
|
|
@ -386,8 +386,8 @@ void ProximityMine::setDeployedPos( const Point3F& pos, const Point3F& normal )
|
|||
MathUtils::getMatrixFromUpVector( normal, &mat );
|
||||
mat.setPosition( pos + normal * mObjBox.minExtents.z );
|
||||
|
||||
delta.pos = pos;
|
||||
delta.posVec.set(0, 0, 0);
|
||||
mDelta.pos = pos;
|
||||
mDelta.posVec.set(0, 0, 0);
|
||||
|
||||
ShapeBase::setTransform( mat );
|
||||
if ( mPhysicsRep )
|
||||
|
|
|
|||
|
|
@ -1194,7 +1194,7 @@ bool RigidShape::updateCollision(F32 dt)
|
|||
|
||||
mCollisionList.clear();
|
||||
CollisionState *state = mConvex.findClosestState(cmat, getScale(), mDataBlock->collisionTol);
|
||||
if (state && state->dist <= mDataBlock->collisionTol)
|
||||
if (state && state->mDist <= mDataBlock->collisionTol)
|
||||
{
|
||||
//resolveDisplacement(ns,state,dt);
|
||||
mConvex.getCollisionInfo(cmat, getScale(), &mCollisionList, mDataBlock->collisionTol);
|
||||
|
|
@ -1326,8 +1326,8 @@ bool RigidShape::resolveContacts(Rigid& ns,CollisionList& cList,F32 dt)
|
|||
|
||||
bool RigidShape::resolveDisplacement(Rigid& ns,CollisionState *state, F32 dt)
|
||||
{
|
||||
SceneObject* obj = (state->a->getObject() == this)?
|
||||
state->b->getObject(): state->a->getObject();
|
||||
SceneObject* obj = (state->mA->getObject() == this)?
|
||||
state->mB->getObject(): state->mA->getObject();
|
||||
|
||||
if (obj->isDisplacable() && ((obj->getTypeMask() & ShapeBaseObjectType) != 0))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -405,17 +405,17 @@ bool ShapeBaseData::preload(bool server, String &errorStr)
|
|||
mShape->computeBounds(collisionDetails.last(), collisionBounds.last());
|
||||
mShape->getAccelerator(collisionDetails.last());
|
||||
|
||||
if (!mShape->bounds.isContained(collisionBounds.last()))
|
||||
if (!mShape->mBounds.isContained(collisionBounds.last()))
|
||||
{
|
||||
if (!silent_bbox_check)
|
||||
Con::warnf("Warning: shape %s collision detail %d (Collision-%d) bounds exceed that of shape.", shapeName, collisionDetails.size() - 1, collisionDetails.last());
|
||||
collisionBounds.last() = mShape->bounds;
|
||||
collisionBounds.last() = mShape->mBounds;
|
||||
}
|
||||
else if (collisionBounds.last().isValidBox() == false)
|
||||
{
|
||||
if (!silent_bbox_check)
|
||||
Con::errorf("Error: shape %s-collision detail %d (Collision-%d) bounds box invalid!", shapeName, collisionDetails.size() - 1, collisionDetails.last());
|
||||
collisionBounds.last() = mShape->bounds;
|
||||
collisionBounds.last() = mShape->mBounds;
|
||||
}
|
||||
|
||||
// The way LOS works is that it will check to see if there is a LOS detail that matches
|
||||
|
|
@ -482,7 +482,7 @@ bool ShapeBaseData::preload(bool server, String &errorStr)
|
|||
damageSequence = mShape->findSequence("Damage");
|
||||
|
||||
//
|
||||
F32 w = mShape->bounds.len_y() / 2;
|
||||
F32 w = mShape->mBounds.len_y() / 2;
|
||||
if (cameraMaxDist < w)
|
||||
cameraMaxDist = w;
|
||||
// just parse up the string and collect the remappings in txr_tag_remappings.
|
||||
|
|
@ -707,7 +707,7 @@ DefineEngineMethod( ShapeBaseData, checkDeployPos, bool, ( TransformF txfm ),,
|
|||
|
||||
MatrixF mat = txfm.getMatrix();
|
||||
|
||||
Box3F objBox = object->mShape->bounds;
|
||||
Box3F objBox = object->mShape->mBounds;
|
||||
Point3F boxCenter = (objBox.minExtents + objBox.maxExtents) * 0.5f;
|
||||
objBox.minExtents = boxCenter + (objBox.minExtents - boxCenter) * 0.9f;
|
||||
objBox.maxExtents = boxCenter + (objBox.maxExtents - boxCenter) * 0.9f;
|
||||
|
|
@ -808,7 +808,7 @@ void ShapeBaseData::packData(BitStream* stream)
|
|||
|
||||
if( stream->writeFlag( debris != NULL ) )
|
||||
{
|
||||
stream->writeRangedU32(packed? SimObjectId((uintptr_t)debris):
|
||||
stream->writeRangedU32(mPacked? SimObjectId((uintptr_t)debris):
|
||||
debris->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
|
||||
}
|
||||
|
||||
|
|
@ -1275,7 +1275,7 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload )
|
|||
}
|
||||
}
|
||||
|
||||
mObjBox = mDataBlock->mShape->bounds;
|
||||
mObjBox = mDataBlock->mShape->mBounds;
|
||||
resetWorldBox();
|
||||
|
||||
// Set the initial mesh hidden state.
|
||||
|
|
@ -2801,7 +2801,7 @@ void ShapeBase::_renderBoundingBox( ObjectRenderInst *ri, SceneRenderState *stat
|
|||
MatrixF mat;
|
||||
getRenderImageTransform( ri->objectIndex, &mat );
|
||||
|
||||
const Box3F &objBox = image.shapeInstance[getImageShapeIndex(image)]->getShape()->bounds;
|
||||
const Box3F &objBox = image.shapeInstance[getImageShapeIndex(image)]->getShape()->mBounds;
|
||||
|
||||
drawer->drawCube( desc, objBox, ColorI( 255, 255, 255 ), &mat );
|
||||
}
|
||||
|
|
@ -3315,23 +3315,23 @@ void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
bool datablockChange = image.dataBlock != imageData;
|
||||
if (datablockChange || (image.skinNameHandle != skinDesiredNameHandle))
|
||||
{
|
||||
MountedImage& image = mMountedImageList[i];
|
||||
image.scriptAnimPrefix = scriptDesiredAnimPrefix;
|
||||
MountedImage& neoImage = mMountedImageList[i];
|
||||
neoImage.scriptAnimPrefix = scriptDesiredAnimPrefix;
|
||||
|
||||
setImage( i, imageData,
|
||||
skinDesiredNameHandle, image.loaded,
|
||||
image.ammo, image.triggerDown, image.altTriggerDown,
|
||||
image.motion, image.genericTrigger[0], image.genericTrigger[1], image.genericTrigger[2], image.genericTrigger[3],
|
||||
image.target);
|
||||
skinDesiredNameHandle, neoImage.loaded,
|
||||
neoImage.ammo, neoImage.triggerDown, neoImage.altTriggerDown,
|
||||
neoImage.motion, neoImage.genericTrigger[0], neoImage.genericTrigger[1], neoImage.genericTrigger[2], neoImage.genericTrigger[3],
|
||||
neoImage.target);
|
||||
}
|
||||
|
||||
if (!datablockChange && image.scriptAnimPrefix != scriptDesiredAnimPrefix)
|
||||
{
|
||||
// We don't have a new image, but we do have a new script anim prefix to work with.
|
||||
// Notify the image of this change.
|
||||
MountedImage& image = mMountedImageList[i];
|
||||
image.scriptAnimPrefix = scriptDesiredAnimPrefix;
|
||||
updateAnimThread(i, getImageShapeIndex(image));
|
||||
MountedImage& animImage = mMountedImageList[i];
|
||||
animImage.scriptAnimPrefix = scriptDesiredAnimPrefix;
|
||||
updateAnimThread(i, getImageShapeIndex(animImage));
|
||||
}
|
||||
|
||||
bool isFiring = stream->readFlag();
|
||||
|
|
@ -3586,8 +3586,8 @@ void ShapeBaseConvex::getFeatures(const MatrixF& mat, const VectorF& n, ConvexFe
|
|||
U32 numVerts = emitString[currPos++];
|
||||
for (i = 0; i < numVerts; i++) {
|
||||
cf->mVertexList.increment();
|
||||
U32 index = emitString[currPos++];
|
||||
mat.mulP(pAccel->vertexList[index], &cf->mVertexList.last());
|
||||
U32 vListIDx = emitString[currPos++];
|
||||
mat.mulP(pAccel->vertexList[vListIDx], &cf->mVertexList.last());
|
||||
}
|
||||
|
||||
U32 numEdges = emitString[currPos++];
|
||||
|
|
@ -3689,6 +3689,7 @@ void ShapeBase::reSkin()
|
|||
{
|
||||
if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() )
|
||||
{
|
||||
mShapeInstance->resetMaterialList();
|
||||
Vector<String> skins;
|
||||
String(mSkinNameHandle.getString()).split( ";", skins );
|
||||
|
||||
|
|
|
|||
|
|
@ -1019,7 +1019,7 @@ void ShapeBaseImageData::packData(BitStream* stream)
|
|||
|
||||
// Write the projectile datablock
|
||||
if (stream->writeFlag(projectile))
|
||||
stream->writeRangedU32(packed? SimObjectId((uintptr_t)projectile):
|
||||
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)projectile):
|
||||
projectile->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
|
||||
|
||||
stream->writeFlag(cloakable);
|
||||
|
|
@ -1050,7 +1050,7 @@ void ShapeBaseImageData::packData(BitStream* stream)
|
|||
|
||||
if( stream->writeFlag( casing ) )
|
||||
{
|
||||
stream->writeRangedU32(packed? SimObjectId((uintptr_t)casing):
|
||||
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)casing):
|
||||
casing->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
|
||||
}
|
||||
|
||||
|
|
@ -1139,7 +1139,7 @@ void ShapeBaseImageData::packData(BitStream* stream)
|
|||
|
||||
if (stream->writeFlag(s.emitter))
|
||||
{
|
||||
stream->writeRangedU32(packed? SimObjectId((uintptr_t)s.emitter):
|
||||
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)s.emitter):
|
||||
s.emitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
|
||||
stream->write(s.emitterTime);
|
||||
|
||||
|
|
|
|||
|
|
@ -350,9 +350,9 @@ void MeshRenderSystem::rebuildBuffers()
|
|||
U16 *pIndex;
|
||||
buffers.primitiveBuffer.lock(&pIndex);
|
||||
|
||||
for (U16 i = 0; i < buffers.primData.size(); i++)
|
||||
for (U16 primDataIDx = 0; primDataIDx < buffers.primData.size(); primDataIDx++)
|
||||
{
|
||||
*pIndex = i;
|
||||
*pIndex = primDataIDx;
|
||||
pIndex++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -245,16 +245,16 @@ ConsoleGetType( TypeTriggerPolyhedron )
|
|||
Polyhedron* pPoly = reinterpret_cast<Polyhedron*>(dptr);
|
||||
|
||||
// First point is corner, need to find the three vectors...`
|
||||
Point3F origin = pPoly->pointList[0];
|
||||
Point3F origin = pPoly->mPointList[0];
|
||||
U32 currVec = 0;
|
||||
Point3F vecs[3];
|
||||
for (i = 0; i < pPoly->edgeList.size(); i++) {
|
||||
const U32 *vertex = pPoly->edgeList[i].vertex;
|
||||
for (i = 0; i < pPoly->mEdgeList.size(); i++) {
|
||||
const U32 *vertex = pPoly->mEdgeList[i].vertex;
|
||||
if (vertex[0] == 0)
|
||||
vecs[currVec++] = pPoly->pointList[vertex[1]] - origin;
|
||||
vecs[currVec++] = pPoly->mPointList[vertex[1]] - origin;
|
||||
else
|
||||
if (vertex[1] == 0)
|
||||
vecs[currVec++] = pPoly->pointList[vertex[0]] - origin;
|
||||
vecs[currVec++] = pPoly->mPointList[vertex[0]] - origin;
|
||||
}
|
||||
AssertFatal(currVec == 3, "Internal error: Bad trigger polyhedron");
|
||||
|
||||
|
|
@ -302,45 +302,45 @@ ConsoleSetType( TypeTriggerPolyhedron )
|
|||
// edges with CCW instead of CW order for face[0] and that it b) lets plane
|
||||
// normals face outwards rather than inwards.
|
||||
|
||||
pPoly->pointList.setSize(8);
|
||||
pPoly->pointList[0] = origin;
|
||||
pPoly->pointList[1] = origin + vecs[0];
|
||||
pPoly->pointList[2] = origin + vecs[1];
|
||||
pPoly->pointList[3] = origin + vecs[2];
|
||||
pPoly->pointList[4] = origin + vecs[0] + vecs[1];
|
||||
pPoly->pointList[5] = origin + vecs[0] + vecs[2];
|
||||
pPoly->pointList[6] = origin + vecs[1] + vecs[2];
|
||||
pPoly->pointList[7] = origin + vecs[0] + vecs[1] + vecs[2];
|
||||
pPoly->mPointList.setSize(8);
|
||||
pPoly->mPointList[0] = origin;
|
||||
pPoly->mPointList[1] = origin + vecs[0];
|
||||
pPoly->mPointList[2] = origin + vecs[1];
|
||||
pPoly->mPointList[3] = origin + vecs[2];
|
||||
pPoly->mPointList[4] = origin + vecs[0] + vecs[1];
|
||||
pPoly->mPointList[5] = origin + vecs[0] + vecs[2];
|
||||
pPoly->mPointList[6] = origin + vecs[1] + vecs[2];
|
||||
pPoly->mPointList[7] = origin + vecs[0] + vecs[1] + vecs[2];
|
||||
|
||||
Point3F normal;
|
||||
pPoly->planeList.setSize(6);
|
||||
pPoly->mPlaneList.setSize(6);
|
||||
|
||||
mCross(vecs[2], vecs[0], &normal);
|
||||
pPoly->planeList[0].set(origin, normal);
|
||||
pPoly->mPlaneList[0].set(origin, normal);
|
||||
mCross(vecs[0], vecs[1], &normal);
|
||||
pPoly->planeList[1].set(origin, normal);
|
||||
pPoly->mPlaneList[1].set(origin, normal);
|
||||
mCross(vecs[1], vecs[2], &normal);
|
||||
pPoly->planeList[2].set(origin, normal);
|
||||
pPoly->mPlaneList[2].set(origin, normal);
|
||||
mCross(vecs[1], vecs[0], &normal);
|
||||
pPoly->planeList[3].set(pPoly->pointList[7], normal);
|
||||
pPoly->mPlaneList[3].set(pPoly->mPointList[7], normal);
|
||||
mCross(vecs[2], vecs[1], &normal);
|
||||
pPoly->planeList[4].set(pPoly->pointList[7], normal);
|
||||
pPoly->mPlaneList[4].set(pPoly->mPointList[7], normal);
|
||||
mCross(vecs[0], vecs[2], &normal);
|
||||
pPoly->planeList[5].set(pPoly->pointList[7], normal);
|
||||
pPoly->mPlaneList[5].set(pPoly->mPointList[7], normal);
|
||||
|
||||
pPoly->edgeList.setSize(12);
|
||||
pPoly->edgeList[0].vertex[0] = 0; pPoly->edgeList[0].vertex[1] = 1; pPoly->edgeList[0].face[0] = 0; pPoly->edgeList[0].face[1] = 1;
|
||||
pPoly->edgeList[1].vertex[0] = 1; pPoly->edgeList[1].vertex[1] = 5; pPoly->edgeList[1].face[0] = 0; pPoly->edgeList[1].face[1] = 4;
|
||||
pPoly->edgeList[2].vertex[0] = 5; pPoly->edgeList[2].vertex[1] = 3; pPoly->edgeList[2].face[0] = 0; pPoly->edgeList[2].face[1] = 3;
|
||||
pPoly->edgeList[3].vertex[0] = 3; pPoly->edgeList[3].vertex[1] = 0; pPoly->edgeList[3].face[0] = 0; pPoly->edgeList[3].face[1] = 2;
|
||||
pPoly->edgeList[4].vertex[0] = 3; pPoly->edgeList[4].vertex[1] = 6; pPoly->edgeList[4].face[0] = 3; pPoly->edgeList[4].face[1] = 2;
|
||||
pPoly->edgeList[5].vertex[0] = 6; pPoly->edgeList[5].vertex[1] = 2; pPoly->edgeList[5].face[0] = 2; pPoly->edgeList[5].face[1] = 5;
|
||||
pPoly->edgeList[6].vertex[0] = 2; pPoly->edgeList[6].vertex[1] = 0; pPoly->edgeList[6].face[0] = 2; pPoly->edgeList[6].face[1] = 1;
|
||||
pPoly->edgeList[7].vertex[0] = 1; pPoly->edgeList[7].vertex[1] = 4; pPoly->edgeList[7].face[0] = 4; pPoly->edgeList[7].face[1] = 1;
|
||||
pPoly->edgeList[8].vertex[0] = 4; pPoly->edgeList[8].vertex[1] = 2; pPoly->edgeList[8].face[0] = 1; pPoly->edgeList[8].face[1] = 5;
|
||||
pPoly->edgeList[9].vertex[0] = 4; pPoly->edgeList[9].vertex[1] = 7; pPoly->edgeList[9].face[0] = 4; pPoly->edgeList[9].face[1] = 5;
|
||||
pPoly->edgeList[10].vertex[0] = 5; pPoly->edgeList[10].vertex[1] = 7; pPoly->edgeList[10].face[0] = 3; pPoly->edgeList[10].face[1] = 4;
|
||||
pPoly->edgeList[11].vertex[0] = 7; pPoly->edgeList[11].vertex[1] = 6; pPoly->edgeList[11].face[0] = 3; pPoly->edgeList[11].face[1] = 5;
|
||||
pPoly->mEdgeList.setSize(12);
|
||||
pPoly->mEdgeList[0].vertex[0] = 0; pPoly->mEdgeList[0].vertex[1] = 1; pPoly->mEdgeList[0].face[0] = 0; pPoly->mEdgeList[0].face[1] = 1;
|
||||
pPoly->mEdgeList[1].vertex[0] = 1; pPoly->mEdgeList[1].vertex[1] = 5; pPoly->mEdgeList[1].face[0] = 0; pPoly->mEdgeList[1].face[1] = 4;
|
||||
pPoly->mEdgeList[2].vertex[0] = 5; pPoly->mEdgeList[2].vertex[1] = 3; pPoly->mEdgeList[2].face[0] = 0; pPoly->mEdgeList[2].face[1] = 3;
|
||||
pPoly->mEdgeList[3].vertex[0] = 3; pPoly->mEdgeList[3].vertex[1] = 0; pPoly->mEdgeList[3].face[0] = 0; pPoly->mEdgeList[3].face[1] = 2;
|
||||
pPoly->mEdgeList[4].vertex[0] = 3; pPoly->mEdgeList[4].vertex[1] = 6; pPoly->mEdgeList[4].face[0] = 3; pPoly->mEdgeList[4].face[1] = 2;
|
||||
pPoly->mEdgeList[5].vertex[0] = 6; pPoly->mEdgeList[5].vertex[1] = 2; pPoly->mEdgeList[5].face[0] = 2; pPoly->mEdgeList[5].face[1] = 5;
|
||||
pPoly->mEdgeList[6].vertex[0] = 2; pPoly->mEdgeList[6].vertex[1] = 0; pPoly->mEdgeList[6].face[0] = 2; pPoly->mEdgeList[6].face[1] = 1;
|
||||
pPoly->mEdgeList[7].vertex[0] = 1; pPoly->mEdgeList[7].vertex[1] = 4; pPoly->mEdgeList[7].face[0] = 4; pPoly->mEdgeList[7].face[1] = 1;
|
||||
pPoly->mEdgeList[8].vertex[0] = 4; pPoly->mEdgeList[8].vertex[1] = 2; pPoly->mEdgeList[8].face[0] = 1; pPoly->mEdgeList[8].face[1] = 5;
|
||||
pPoly->mEdgeList[9].vertex[0] = 4; pPoly->mEdgeList[9].vertex[1] = 7; pPoly->mEdgeList[9].face[0] = 4; pPoly->mEdgeList[9].face[1] = 5;
|
||||
pPoly->mEdgeList[10].vertex[0] = 5; pPoly->mEdgeList[10].vertex[1] = 7; pPoly->mEdgeList[10].face[0] = 3; pPoly->mEdgeList[10].face[1] = 4;
|
||||
pPoly->mEdgeList[11].vertex[0] = 7; pPoly->mEdgeList[11].vertex[1] = 6; pPoly->mEdgeList[11].face[0] = 3; pPoly->mEdgeList[11].face[1] = 5;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -569,12 +569,12 @@ void Trigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
|
|||
{
|
||||
mTriggerPolyhedron = rPolyhedron;
|
||||
|
||||
if (mTriggerPolyhedron.pointList.size() != 0) {
|
||||
if (mTriggerPolyhedron.mPointList.size() != 0) {
|
||||
mObjBox.minExtents.set(1e10, 1e10, 1e10);
|
||||
mObjBox.maxExtents.set(-1e10, -1e10, -1e10);
|
||||
for (U32 i = 0; i < mTriggerPolyhedron.pointList.size(); i++) {
|
||||
mObjBox.minExtents.setMin(mTriggerPolyhedron.pointList[i]);
|
||||
mObjBox.maxExtents.setMax(mTriggerPolyhedron.pointList[i]);
|
||||
for (U32 i = 0; i < mTriggerPolyhedron.mPointList.size(); i++) {
|
||||
mObjBox.minExtents.setMin(mTriggerPolyhedron.mPointList[i]);
|
||||
mObjBox.maxExtents.setMax(mTriggerPolyhedron.mPointList[i]);
|
||||
}
|
||||
} else {
|
||||
mObjBox.minExtents.set(-0.5, -0.5, -0.5);
|
||||
|
|
@ -585,7 +585,7 @@ void Trigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
|
|||
setTransform(xform);
|
||||
|
||||
mClippedList.clear();
|
||||
mClippedList.mPlaneList = mTriggerPolyhedron.planeList;
|
||||
mClippedList.mPlaneList = mTriggerPolyhedron.mPlaneList;
|
||||
// for (U32 i = 0; i < mClippedList.mPlaneList.size(); i++)
|
||||
// mClippedList.mPlaneList[i].neg();
|
||||
|
||||
|
|
@ -623,7 +623,7 @@ void Trigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
|
|||
|
||||
bool Trigger::testObject(GameBase* enter)
|
||||
{
|
||||
if (mTriggerPolyhedron.pointList.size() == 0)
|
||||
if (mTriggerPolyhedron.mPointList.size() == 0)
|
||||
return false;
|
||||
|
||||
mClippedList.clear();
|
||||
|
|
@ -731,17 +731,17 @@ U32 Trigger::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
|
|||
// Write the polyhedron
|
||||
if( stream->writeFlag( mask & PolyMask ) )
|
||||
{
|
||||
stream->write(mTriggerPolyhedron.pointList.size());
|
||||
for (i = 0; i < mTriggerPolyhedron.pointList.size(); i++)
|
||||
mathWrite(*stream, mTriggerPolyhedron.pointList[i]);
|
||||
stream->write(mTriggerPolyhedron.mPointList.size());
|
||||
for (i = 0; i < mTriggerPolyhedron.mPointList.size(); i++)
|
||||
mathWrite(*stream, mTriggerPolyhedron.mPointList[i]);
|
||||
|
||||
stream->write(mTriggerPolyhedron.planeList.size());
|
||||
for (i = 0; i < mTriggerPolyhedron.planeList.size(); i++)
|
||||
mathWrite(*stream, mTriggerPolyhedron.planeList[i]);
|
||||
stream->write(mTriggerPolyhedron.mPlaneList.size());
|
||||
for (i = 0; i < mTriggerPolyhedron.mPlaneList.size(); i++)
|
||||
mathWrite(*stream, mTriggerPolyhedron.mPlaneList[i]);
|
||||
|
||||
stream->write(mTriggerPolyhedron.edgeList.size());
|
||||
for (i = 0; i < mTriggerPolyhedron.edgeList.size(); i++) {
|
||||
const Polyhedron::Edge& rEdge = mTriggerPolyhedron.edgeList[i];
|
||||
stream->write(mTriggerPolyhedron.mEdgeList.size());
|
||||
for (i = 0; i < mTriggerPolyhedron.mEdgeList.size(); i++) {
|
||||
const Polyhedron::Edge& rEdge = mTriggerPolyhedron.mEdgeList[i];
|
||||
|
||||
stream->write(rEdge.face[0]);
|
||||
stream->write(rEdge.face[1]);
|
||||
|
|
@ -779,19 +779,19 @@ void Trigger::unpackUpdate(NetConnection* con, BitStream* stream)
|
|||
{
|
||||
Polyhedron tempPH;
|
||||
stream->read(&size);
|
||||
tempPH.pointList.setSize(size);
|
||||
for (i = 0; i < tempPH.pointList.size(); i++)
|
||||
mathRead(*stream, &tempPH.pointList[i]);
|
||||
tempPH.mPointList.setSize(size);
|
||||
for (i = 0; i < tempPH.mPointList.size(); i++)
|
||||
mathRead(*stream, &tempPH.mPointList[i]);
|
||||
|
||||
stream->read(&size);
|
||||
tempPH.planeList.setSize(size);
|
||||
for (i = 0; i < tempPH.planeList.size(); i++)
|
||||
mathRead(*stream, &tempPH.planeList[i]);
|
||||
tempPH.mPlaneList.setSize(size);
|
||||
for (i = 0; i < tempPH.mPlaneList.size(); i++)
|
||||
mathRead(*stream, &tempPH.mPlaneList[i]);
|
||||
|
||||
stream->read(&size);
|
||||
tempPH.edgeList.setSize(size);
|
||||
for (i = 0; i < tempPH.edgeList.size(); i++) {
|
||||
Polyhedron::Edge& rEdge = tempPH.edgeList[i];
|
||||
tempPH.mEdgeList.setSize(size);
|
||||
for (i = 0; i < tempPH.mEdgeList.size(); i++) {
|
||||
Polyhedron::Edge& rEdge = tempPH.mEdgeList[i];
|
||||
|
||||
stream->read(&rEdge.face[0]);
|
||||
stream->read(&rEdge.face[1]);
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ bool TSStatic::_createShape()
|
|||
NetConnection::filesWereDownloaded() )
|
||||
return false;
|
||||
|
||||
mObjBox = mShape->bounds;
|
||||
mObjBox = mShape->mBounds;
|
||||
resetWorldBox();
|
||||
|
||||
mShapeInstance = new TSShapeInstance( mShape, isClientObject() );
|
||||
|
|
@ -537,6 +537,7 @@ void TSStatic::reSkin()
|
|||
{
|
||||
if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() )
|
||||
{
|
||||
mShapeInstance->resetMaterialList();
|
||||
Vector<String> skins;
|
||||
String(mSkinNameHandle.getString()).split( ";", skins );
|
||||
|
||||
|
|
@ -1006,6 +1007,8 @@ bool TSStatic::castRayRendered(const Point3F &start, const Point3F &end, RayInfo
|
|||
|
||||
// Cast the ray against the currently visible detail
|
||||
RayInfo localInfo;
|
||||
if (info && info->generateTexCoord)
|
||||
localInfo.generateTexCoord = true;
|
||||
bool res = mShapeInstance->castRayOpcode( mShapeInstance->getCurrentDetail(), start, end, &localInfo );
|
||||
|
||||
if ( res )
|
||||
|
|
|
|||
|
|
@ -249,14 +249,11 @@ bool AITurretShapeData::preload(bool server, String &errorStr)
|
|||
// We have mShape at this point. Resolve nodes.
|
||||
scanNode = mShape->findNode("scanPoint");
|
||||
aimNode = mShape->findNode("aimPoint");
|
||||
if (aimNode == -1)
|
||||
{
|
||||
aimNode = pitchNode;
|
||||
}
|
||||
if (aimNode == -1)
|
||||
{
|
||||
aimNode = headingNode;
|
||||
}
|
||||
|
||||
if (scanNode == -1) scanNode = pitchNode;
|
||||
if (scanNode == -1) scanNode = headingNode;
|
||||
if (aimNode == -1) aimNode = pitchNode;
|
||||
if (aimNode == -1) aimNode = headingNode;
|
||||
|
||||
// Resolve state sequence names & emitter nodes
|
||||
isAnimated = false;
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ void FlyingVehicleData::packData(BitStream* stream)
|
|||
{
|
||||
if (stream->writeFlag(sound[i]))
|
||||
{
|
||||
SimObjectId writtenId = packed ? SimObjectId((uintptr_t)sound[i]) : sound[i]->getId();
|
||||
SimObjectId writtenId = mPacked ? SimObjectId((uintptr_t)sound[i]) : sound[i]->getId();
|
||||
stream->writeRangedU32(writtenId, DataBlockObjectIdFirst, DataBlockObjectIdLast);
|
||||
}
|
||||
}
|
||||
|
|
@ -253,7 +253,7 @@ void FlyingVehicleData::packData(BitStream* stream)
|
|||
{
|
||||
if (stream->writeFlag(jetEmitter[j]))
|
||||
{
|
||||
SimObjectId writtenId = packed ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId();
|
||||
SimObjectId writtenId = mPacked ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId();
|
||||
stream->writeRangedU32(writtenId, DataBlockObjectIdFirst,DataBlockObjectIdLast);
|
||||
}
|
||||
}
|
||||
|
|
@ -731,10 +731,10 @@ void FlyingVehicle::updateEmitter(bool active,F32 dt,ParticleEmitterData *emitte
|
|||
}
|
||||
}
|
||||
else {
|
||||
for (S32 j = idx; j < idx + count; j++)
|
||||
if (bool(mJetEmitter[j])) {
|
||||
mJetEmitter[j]->deleteWhenEmpty();
|
||||
mJetEmitter[j] = 0;
|
||||
for (S32 k = idx; k < idx + count; k++)
|
||||
if (bool(mJetEmitter[k])) {
|
||||
mJetEmitter[k]->deleteWhenEmpty();
|
||||
mJetEmitter[k] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -362,14 +362,14 @@ void HoverVehicleData::packData(BitStream* stream)
|
|||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
if (stream->writeFlag(sound[i]))
|
||||
stream->writeRangedU32(packed? SimObjectId((uintptr_t)sound[i]):
|
||||
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)sound[i]):
|
||||
sound[i]->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
|
||||
|
||||
for (S32 j = 0; j < MaxJetEmitters; j++)
|
||||
{
|
||||
if (stream->writeFlag(jetEmitter[j]))
|
||||
{
|
||||
SimObjectId writtenId = packed ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId();
|
||||
SimObjectId writtenId = mPacked ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId();
|
||||
stream->writeRangedU32(writtenId, DataBlockObjectIdFirst,DataBlockObjectIdLast);
|
||||
}
|
||||
}
|
||||
|
|
@ -965,10 +965,10 @@ void HoverVehicle::updateEmitter(bool active,F32 dt,ParticleEmitterData *emitter
|
|||
}
|
||||
}
|
||||
else {
|
||||
for (S32 j = idx; j < idx + count; j++)
|
||||
if (bool(mJetEmitter[j])) {
|
||||
mJetEmitter[j]->deleteWhenEmpty();
|
||||
mJetEmitter[j] = 0;
|
||||
for (S32 k = idx; k < idx + count; k++)
|
||||
if (bool(mJetEmitter[k])) {
|
||||
mJetEmitter[k]->deleteWhenEmpty();
|
||||
mJetEmitter[k] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ void VehicleData::packData(BitStream* stream)
|
|||
stream->write(body.friction);
|
||||
for (i = 0; i < Body::MaxSounds; i++)
|
||||
if (stream->writeFlag(body.sound[i]))
|
||||
stream->writeRangedU32(packed? SimObjectId((uintptr_t)body.sound[i]):
|
||||
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)body.sound[i]):
|
||||
body.sound[i]->getId(),DataBlockObjectIdFirst,
|
||||
DataBlockObjectIdLast);
|
||||
|
||||
|
|
@ -1364,7 +1364,7 @@ bool Vehicle::updateCollision(F32 dt)
|
|||
|
||||
mCollisionList.clear();
|
||||
CollisionState *state = mConvex.findClosestState(cmat, getScale(), mDataBlock->collisionTol);
|
||||
if (state && state->dist <= mDataBlock->collisionTol)
|
||||
if (state && state->mDist <= mDataBlock->collisionTol)
|
||||
{
|
||||
//resolveDisplacement(ns,state,dt);
|
||||
mConvex.getCollisionInfo(cmat, getScale(), &mCollisionList, mDataBlock->collisionTol);
|
||||
|
|
@ -1497,8 +1497,8 @@ bool Vehicle::resolveDisplacement(Rigid& ns,CollisionState *state, F32 dt)
|
|||
{
|
||||
PROFILE_SCOPE( Vehicle_ResolveDisplacement );
|
||||
|
||||
SceneObject* obj = (state->a->getObject() == this)?
|
||||
state->b->getObject(): state->a->getObject();
|
||||
SceneObject* obj = (state->mA->getObject() == this)?
|
||||
state->mB->getObject(): state->mA->getObject();
|
||||
|
||||
if (obj->isDisplacable() && ((obj->getTypeMask() & ShapeBaseObjectType) != 0))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ bool WheeledVehicleTire::preload(bool server, String &errorStr)
|
|||
// Determinw wheel radius from the shape's bounding box.
|
||||
// The tire should be built with it's hub axis along the
|
||||
// object's Y axis.
|
||||
radius = shape->bounds.len_z() / 2;
|
||||
radius = shape->mBounds.len_z() / 2;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -400,7 +400,7 @@ bool WheeledVehicleData::preload(bool server, String &errorStr)
|
|||
MatrixF imat(1);
|
||||
SphereF sphere;
|
||||
sphere.center = mShape->center;
|
||||
sphere.radius = mShape->radius;
|
||||
sphere.radius = mShape->mRadius;
|
||||
PlaneExtractorPolyList polyList;
|
||||
polyList.mPlaneList = &rigidBody.mPlaneList;
|
||||
polyList.setTransform(&imat, Point3F(1,1,1));
|
||||
|
|
@ -477,7 +477,7 @@ void WheeledVehicleData::packData(BitStream* stream)
|
|||
Parent::packData(stream);
|
||||
|
||||
if (stream->writeFlag(tireEmitter))
|
||||
stream->writeRangedU32(packed? SimObjectId((uintptr_t)tireEmitter):
|
||||
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)tireEmitter):
|
||||
tireEmitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue