mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-23 00:23:46 +00:00
Merge branch 'development' of https://github.com/GarageGames/Torque3D into memberMess
# Conflicts: # Engine/source/console/consoleFunctions.cpp
This commit is contained in:
commit
cbce2ee805
154 changed files with 2950 additions and 705 deletions
|
|
@ -547,8 +547,9 @@ const char * Component::getDescriptionText(const char *desc)
|
|||
// [tom, 1/12/2007] If it isn't a file, just do it the easy way
|
||||
if (!Platform::isFile(desc))
|
||||
{
|
||||
newDesc = new char[dStrlen(desc) + 1];
|
||||
dStrcpy(newDesc, desc);
|
||||
dsize_t newDescLen = dStrlen(desc) + 1;
|
||||
newDesc = new char[newDescLen];
|
||||
dStrcpy(newDesc, desc, newDescLen);
|
||||
|
||||
return newDesc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -695,6 +695,54 @@ bool ConvexShape::buildPolyList( PolyListContext context, AbstractPolyList *plis
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ConvexShape::buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &)
|
||||
{
|
||||
if (mGeometry.points.empty())
|
||||
return false;
|
||||
|
||||
//Get the collision mesh geometry
|
||||
{
|
||||
ColladaUtils::ExportData::colMesh* colMesh;
|
||||
exportData->colMeshes.increment();
|
||||
colMesh = &exportData->colMeshes.last();
|
||||
|
||||
colMesh->mesh.setTransform(&mObjToWorld, mObjScale);
|
||||
colMesh->mesh.setObject(this);
|
||||
|
||||
//Just get the visible
|
||||
buildPolyList(PLC_Export, &colMesh->mesh, getWorldBox(), getWorldSphere());
|
||||
|
||||
colMesh->colMeshName = String::ToString("ColMesh%d-1", exportData->colMeshes.size());
|
||||
}
|
||||
|
||||
//Next, process the geometry and materials.
|
||||
//Convex shapes only have the one 'level', so we'll just rely on the export post-process to back-fill
|
||||
if (isServerObject() && getClientObject())
|
||||
{
|
||||
ConvexShape* clientShape = dynamic_cast<ConvexShape*>(getClientObject());
|
||||
|
||||
exportData->meshData.increment();
|
||||
|
||||
//Prep a meshData for this shape in particular
|
||||
ColladaUtils::ExportData::meshLODData* meshData = &exportData->meshData.last();
|
||||
|
||||
//Fill out the info we'll need later to actually append our mesh data for the detail levels during the processing phase
|
||||
meshData->shapeInst = nullptr;
|
||||
meshData->originatingObject = this;
|
||||
meshData->meshTransform = mObjToWorld;
|
||||
meshData->scale = mObjScale;
|
||||
|
||||
meshData->meshDetailLevels.increment();
|
||||
|
||||
ColladaUtils::ExportData::detailLevel* curDetail = &meshData->meshDetailLevels.last();
|
||||
|
||||
//Make sure we denote the size this detail level has
|
||||
curDetail->size = 512;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ConvexShape::_export( OptimizedPolyList *plist, const Box3F &box, const SphereF &sphere )
|
||||
{
|
||||
BaseMatInstance *matInst = mMaterialInst;
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ public:
|
|||
virtual void prepRenderImage( SceneRenderState *state );
|
||||
virtual void buildConvex( const Box3F &box, Convex *convex );
|
||||
virtual bool buildPolyList( PolyListContext context, AbstractPolyList *polyList, const Box3F &box, const SphereF &sphere );
|
||||
virtual bool buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &);
|
||||
virtual bool castRay( const Point3F &start, const Point3F &end, RayInfo *info );
|
||||
virtual bool collideBox( const Point3F &start, const Point3F &end, RayInfo *info );
|
||||
|
||||
|
|
|
|||
|
|
@ -1495,7 +1495,7 @@ bool DecalManager::_createDataFile()
|
|||
|
||||
// See if we know our current mission name
|
||||
char missionName[1024];
|
||||
dStrcpy( missionName, Con::getVariable( "$Client::MissionFile" ) );
|
||||
dStrcpy( missionName, Con::getVariable( "$Client::MissionFile" ), 1024 );
|
||||
char *dot = dStrstr((const char*)missionName, ".mis");
|
||||
if(dot)
|
||||
*dot = '\0';
|
||||
|
|
|
|||
|
|
@ -594,8 +594,9 @@ bool ParticleData::preload(bool server, String &errorStr)
|
|||
|
||||
animTexFrames.clear();
|
||||
|
||||
char* tokCopy = new char[dStrlen(animTexFramesString) + 1];
|
||||
dStrcpy(tokCopy, animTexFramesString);
|
||||
dsize_t tokLen = dStrlen(animTexFramesString) + 1;
|
||||
char* tokCopy = new char[tokLen];
|
||||
dStrcpy(tokCopy, animTexFramesString, tokLen);
|
||||
|
||||
char* currTok = dStrtok(tokCopy, " \t");
|
||||
while (currTok != NULL)
|
||||
|
|
|
|||
|
|
@ -608,8 +608,9 @@ bool ParticleEmitterData::onAdd()
|
|||
|
||||
// First we parse particleString into a list of particle name tokens
|
||||
Vector<char*> dataBlocks(__FILE__, __LINE__);
|
||||
char* tokCopy = new char[dStrlen(particleString) + 1];
|
||||
dStrcpy(tokCopy, particleString);
|
||||
dsize_t tokLen = dStrlen(particleString) + 1;
|
||||
char* tokCopy = new char[tokLen];
|
||||
dStrcpy(tokCopy, particleString, tokLen);
|
||||
|
||||
char* currTok = dStrtok(tokCopy, " \t");
|
||||
while (currTok != NULL)
|
||||
|
|
|
|||
|
|
@ -1254,7 +1254,7 @@ DefineEngineMethod( Item, getLastStickyPos, const char*, (),,
|
|||
object->mStickyCollisionPos.y,
|
||||
object->mStickyCollisionPos.z);
|
||||
else
|
||||
dStrcpy(ret, "0 0 0");
|
||||
dStrcpy(ret, "0 0 0", bufSize);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1277,7 +1277,7 @@ DefineEngineMethod( Item, getLastStickyNormal, const char *, (),,
|
|||
object->mStickyCollisionNormal.y,
|
||||
object->mStickyCollisionNormal.z);
|
||||
else
|
||||
dStrcpy(ret, "0 0 0");
|
||||
dStrcpy(ret, "0 0 0", bufSize);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -538,6 +538,19 @@ bool Prefab::buildPolyList(PolyListContext context, AbstractPolyList* polyList,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Prefab::buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &sphere)
|
||||
{
|
||||
Vector<SceneObject*> foundObjects;
|
||||
mChildGroup->findObjectByType(foundObjects);
|
||||
|
||||
for (S32 i = 0; i < foundObjects.size(); i++)
|
||||
{
|
||||
foundObjects[i]->buildExportPolyList(exportData, box, sphere);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ExplodePrefabUndoAction::ExplodePrefabUndoAction( Prefab *prefab )
|
||||
: UndoAction( "Explode Prefab" )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -98,6 +98,8 @@ public:
|
|||
|
||||
bool buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF& sphere);
|
||||
|
||||
bool buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &);
|
||||
|
||||
protected:
|
||||
|
||||
void _closeFile( bool removeFileNotify );
|
||||
|
|
|
|||
|
|
@ -522,7 +522,7 @@ bool ShapeBaseImageData::preload(bool server, String &errorStr)
|
|||
if (stateSequence[j] && stateSequence[j][0] && stateSequenceRandomFlash[j]) {
|
||||
char bufferVis[128];
|
||||
dStrncpy(bufferVis, stateSequence[j], 100);
|
||||
dStrcat(bufferVis, "_vis");
|
||||
dStrcat(bufferVis, "_vis", 128);
|
||||
s.sequenceVis[i] = shape[i]->findSequence(bufferVis);
|
||||
}
|
||||
if (s.sequenceVis[i] != -1)
|
||||
|
|
|
|||
|
|
@ -1073,6 +1073,97 @@ bool TSStatic::buildPolyList(PolyListContext context, AbstractPolyList* polyList
|
|||
return true;
|
||||
}
|
||||
|
||||
bool TSStatic::buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &)
|
||||
{
|
||||
if (!mShapeInstance)
|
||||
return false;
|
||||
|
||||
if (mCollisionType == Bounds)
|
||||
{
|
||||
ColladaUtils::ExportData::colMesh* colMesh;
|
||||
exportData->colMeshes.increment();
|
||||
colMesh = &exportData->colMeshes.last();
|
||||
|
||||
colMesh->mesh.setTransform(&mObjToWorld, mObjScale);
|
||||
colMesh->mesh.setObject(this);
|
||||
|
||||
colMesh->mesh.addBox(mObjBox);
|
||||
|
||||
colMesh->colMeshName = String::ToString("ColBox%d-1", exportData->colMeshes.size());
|
||||
}
|
||||
else if (mCollisionType == VisibleMesh)
|
||||
{
|
||||
ColladaUtils::ExportData::colMesh* colMesh;
|
||||
exportData->colMeshes.increment();
|
||||
colMesh = &exportData->colMeshes.last();
|
||||
|
||||
colMesh->mesh.setTransform(&mObjToWorld, mObjScale);
|
||||
colMesh->mesh.setObject(this);
|
||||
|
||||
mShapeInstance->buildPolyList(&colMesh->mesh, 0);
|
||||
|
||||
colMesh->colMeshName = String::ToString("ColMesh%d-1", exportData->colMeshes.size());
|
||||
}
|
||||
else if (mCollisionType == CollisionMesh)
|
||||
{
|
||||
// Everything else is done from the collision meshes
|
||||
// which may be built from either the visual mesh or
|
||||
// special collision geometry.
|
||||
for (U32 i = 0; i < mCollisionDetails.size(); i++)
|
||||
{
|
||||
ColladaUtils::ExportData::colMesh* colMesh;
|
||||
exportData->colMeshes.increment();
|
||||
colMesh = &exportData->colMeshes.last();
|
||||
|
||||
colMesh->mesh.setTransform(&mObjToWorld, mObjScale);
|
||||
colMesh->mesh.setObject(this);
|
||||
|
||||
mShapeInstance->buildPolyListOpcode(mCollisionDetails[i], &colMesh->mesh, box);
|
||||
|
||||
colMesh->colMeshName = String::ToString("ColMesh%d-1", exportData->colMeshes.size());
|
||||
}
|
||||
}
|
||||
|
||||
//Next, process the LOD levels and materials.
|
||||
if (isServerObject() && getClientObject())
|
||||
{
|
||||
TSStatic* clientShape = dynamic_cast<TSStatic*>(getClientObject());
|
||||
U32 numDetails = clientShape->mShapeInstance->getNumDetails() - 1;
|
||||
|
||||
exportData->meshData.increment();
|
||||
|
||||
//Prep a meshData for this shape in particular
|
||||
ColladaUtils::ExportData::meshLODData* meshData = &exportData->meshData.last();
|
||||
|
||||
//Fill out the info we'll need later to actually append our mesh data for the detail levels during the processing phase
|
||||
meshData->shapeInst = clientShape->mShapeInstance;
|
||||
meshData->originatingObject = this;
|
||||
meshData->meshTransform = mObjToWorld;
|
||||
meshData->scale = mObjScale;
|
||||
|
||||
//Iterate over all our detail levels
|
||||
for (U32 i = 0; i < clientShape->mShapeInstance->getNumDetails(); i++)
|
||||
{
|
||||
TSShape::Detail detail = clientShape->mShapeInstance->getShape()->details[i];
|
||||
|
||||
String detailName = String::ToLower(clientShape->mShapeInstance->getShape()->getName(detail.nameIndex));
|
||||
|
||||
//Skip it if it's a collision or line of sight element
|
||||
if (detailName.startsWith("col") || detailName.startsWith("los"))
|
||||
continue;
|
||||
|
||||
meshData->meshDetailLevels.increment();
|
||||
|
||||
ColladaUtils::ExportData::detailLevel* curDetail = &meshData->meshDetailLevels.last();
|
||||
|
||||
//Make sure we denote the size this detail level has
|
||||
curDetail->size = detail.size;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TSStatic::buildConvex(const Box3F& box, Convex* convex)
|
||||
{
|
||||
if ( mCollisionType == None )
|
||||
|
|
@ -1279,6 +1370,16 @@ void TSStatic::onUnmount( SceneObject *obj, S32 node )
|
|||
_updateShouldTick();
|
||||
}
|
||||
|
||||
U32 TSStatic::getNumDetails()
|
||||
{
|
||||
if (isServerObject() && getClientObject())
|
||||
{
|
||||
TSStatic* clientShape = dynamic_cast<TSStatic*>(getClientObject());
|
||||
return clientShape->mShapeInstance->getNumDetails();
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//These functions are duplicated in tsStatic and shapeBase.
|
||||
//They each function a little differently; but achieve the same purpose of gathering
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ protected:
|
|||
bool castRay(const Point3F &start, const Point3F &end, RayInfo* info);
|
||||
bool castRayRendered(const Point3F &start, const Point3F &end, RayInfo* info);
|
||||
bool buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF& sphere);
|
||||
bool buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &);
|
||||
void buildConvex(const Box3F& box, Convex* convex);
|
||||
|
||||
bool _createShape();
|
||||
|
|
@ -237,6 +238,8 @@ public:
|
|||
|
||||
TSShapeInstance* getShapeInstance() const { return mShapeInstance; }
|
||||
|
||||
U32 getNumDetails();
|
||||
|
||||
const Vector<S32>& getCollisionDetails() const { return mCollisionDetails; }
|
||||
|
||||
const Vector<S32>& getLOSDetails() const { return mLOSDetails; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue