Cleanup of export function to remove redundant arg

Removed unused var
Cleaned up collision export on convexShape
Added prefab export functionality
This commit is contained in:
Areloch 2018-03-04 16:03:39 -06:00
parent 501a322435
commit 43ca2c5bc2
9 changed files with 23 additions and 13 deletions

View file

@ -697,7 +697,7 @@ bool ConvexShape::buildPolyList( PolyListContext context, AbstractPolyList *plis
return true; return true;
} }
bool ConvexShape::buildExportPolyList(PolyListContext context, ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &) bool ConvexShape::buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &)
{ {
if (mGeometry.points.empty()) if (mGeometry.points.empty())
return false; return false;
@ -740,9 +740,7 @@ bool ConvexShape::buildExportPolyList(PolyListContext context, ColladaUtils::Exp
ColladaUtils::ExportData::detailLevel* curDetail = &meshData->meshDetailLevels.last(); ColladaUtils::ExportData::detailLevel* curDetail = &meshData->meshDetailLevels.last();
//Make sure we denote the size this detail level has //Make sure we denote the size this detail level has
curDetail->size = getNextPow2(getObjBox().len()); curDetail->size = 512;
bool t = true;
} }
return true; return true;

View file

@ -172,7 +172,7 @@ public:
virtual void prepRenderImage( SceneRenderState *state ); virtual void prepRenderImage( SceneRenderState *state );
virtual void buildConvex( const Box3F &box, Convex *convex ); virtual void buildConvex( const Box3F &box, Convex *convex );
virtual bool buildPolyList( PolyListContext context, AbstractPolyList *polyList, const Box3F &box, const SphereF &sphere ); virtual bool buildPolyList( PolyListContext context, AbstractPolyList *polyList, const Box3F &box, const SphereF &sphere );
virtual bool buildExportPolyList(PolyListContext context, ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &); virtual bool buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &);
virtual bool castRay( const Point3F &start, const Point3F &end, RayInfo *info ); virtual bool castRay( const Point3F &start, const Point3F &end, RayInfo *info );
virtual bool collideBox( const Point3F &start, const Point3F &end, RayInfo *info ); virtual bool collideBox( const Point3F &start, const Point3F &end, RayInfo *info );

View file

@ -538,6 +538,19 @@ bool Prefab::buildPolyList(PolyListContext context, AbstractPolyList* polyList,
return true; 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 ) ExplodePrefabUndoAction::ExplodePrefabUndoAction( Prefab *prefab )
: UndoAction( "Explode Prefab" ) : UndoAction( "Explode Prefab" )
{ {

View file

@ -98,6 +98,8 @@ public:
bool buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF& sphere); bool buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF& sphere);
bool buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &);
protected: protected:
void _closeFile( bool removeFileNotify ); void _closeFile( bool removeFileNotify );

View file

@ -1073,7 +1073,7 @@ bool TSStatic::buildPolyList(PolyListContext context, AbstractPolyList* polyList
return true; return true;
} }
bool TSStatic::buildExportPolyList(PolyListContext context, ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &) bool TSStatic::buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &)
{ {
if (!mShapeInstance) if (!mShapeInstance)
return false; return false;

View file

@ -138,7 +138,7 @@ protected:
bool castRay(const Point3F &start, const Point3F &end, RayInfo* info); bool castRay(const Point3F &start, const Point3F &end, RayInfo* info);
bool castRayRendered(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 buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF& sphere);
bool buildExportPolyList(PolyListContext context, ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &); bool buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &);
void buildConvex(const Box3F& box, Convex* convex); void buildConvex(const Box3F& box, Convex* convex);
bool _createShape(); bool _createShape();

View file

@ -3932,7 +3932,7 @@ void WorldEditor::makeSelectionAMesh(const char *filename)
for (S32 i = 0; i < objectList.size(); i++) for (S32 i = 0; i < objectList.size(); i++)
{ {
SceneObject *pObj = objectList[i]; SceneObject *pObj = objectList[i];
if (!pObj->buildExportPolyList(PLC_Export, &exportData, pObj->getWorldBox(), pObj->getWorldSphere())) if (!pObj->buildExportPolyList(&exportData, pObj->getWorldBox(), pObj->getWorldSphere()))
Con::warnf("colladaExportObjectList() - object %i returned no geometry.", pObj->getId()); Con::warnf("colladaExportObjectList() - object %i returned no geometry.", pObj->getId());
} }

View file

@ -564,8 +564,7 @@ class SceneObject : public NetObject, private SceneContainer::Link, public Proce
/// @param box Box bounding volume /// @param box Box bounding volume
/// @param sphere Sphere bounding volume /// @param sphere Sphere bounding volume
/// ///
virtual bool buildExportPolyList(PolyListContext context, virtual bool buildExportPolyList(ColladaUtils::ExportData *exportData,
ColladaUtils::ExportData *exportData,
const Box3F& box, const Box3F& box,
const SphereF& sphere) { const SphereF& sphere) {
return false; return false;

View file

@ -140,8 +140,6 @@ namespace ColladaUtils
Point3F scale; Point3F scale;
bool fillWithSingleDetail;
S32 hasDetailLevel(S32 size) S32 hasDetailLevel(S32 size)
{ {
for (U32 i = 0; i < meshDetailLevels.size(); ++i) for (U32 i = 0; i < meshDetailLevels.size(); ++i)
@ -155,7 +153,7 @@ namespace ColladaUtils
return -1; return -1;
} }
meshLODData() : shapeInst(nullptr), meshTransform(true), originatingObject(nullptr), scale(0), fillWithSingleDetail(false) meshLODData() : shapeInst(nullptr), meshTransform(true), originatingObject(nullptr), scale(0)
{} {}
}; };