mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +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
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue