Skip to content

Commit

Permalink
Add StepExporter.cpp(stp) Export
Browse files Browse the repository at this point in the history
Fix XFile
  • Loading branch information
Madrich committed May 1, 2015
1 parent 492fee2 commit ca8a390
Show file tree
Hide file tree
Showing 9 changed files with 540 additions and 12 deletions.
4 changes: 3 additions & 1 deletion CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ Ogre Binary format support
Android JNI asset extraction support

- Richard Steffen
Contributed X File exporter
Contributed ExportProperties interface
Contributed X File exporter
Contributed Step (stp) exporter


7 changes: 7 additions & 0 deletions code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,12 @@ SET( XFile_SRCS
)
SOURCE_GROUP( XFile FILES ${XFile_SRCS})

SET( Step_SRCS
StepExporter.h
StepExporter.cpp
)
SOURCE_GROUP( Step FILES ${Step_SRCS})

SET( Exporter_SRCS
Exporter.cpp
AssimpCExport.cpp
Expand Down Expand Up @@ -716,6 +722,7 @@ SET( assimp_src
${Terragen_SRCS}
${Unreal_SRCS}
${XFile_SRCS}
${Step_SRCS}
${Extra_SRCS}
${MS3D_SRCS}
${COB_SRCS}
Expand Down
7 changes: 6 additions & 1 deletion code/Exporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ void GetPostProcessingStepInstanceList(std::vector< BaseProcess* >& out);
// Exporter worker function prototypes. Should not be necessary to #ifndef them, it's just a prototype
// do not use const, because some exporter need to convert the scene temporary
void ExportSceneCollada(const char*,IOSystem*, const aiScene*, const ExportProperties*);
void ExportSceneXFile(const char*,IOSystem*, const aiScene*, const ExportProperties*);
void ExportSceneXFile(const char*,IOSystem*, const aiScene*, const ExportProperties*);
void ExportSceneStep(const char*,IOSystem*, const aiScene*, const ExportProperties*);
void ExportSceneObj(const char*,IOSystem*, const aiScene*, const ExportProperties*);
void ExportSceneSTL(const char*,IOSystem*, const aiScene*, const ExportProperties*);
void ExportSceneSTLBinary(const char*,IOSystem*, const aiScene*, const ExportProperties*);
Expand All @@ -96,6 +97,10 @@ Exporter::ExportFormatEntry gExporters[] =
aiProcess_MakeLeftHanded | aiProcess_FlipWindingOrder | aiProcess_FlipUVs),
#endif

#ifndef ASSIMP_BUILD_NO_STEP_EXPORTER
Exporter::ExportFormatEntry( "stp", "Step Files", "stp", &ExportSceneStep, 0),
#endif

#ifndef ASSIMP_BUILD_NO_OBJ_EXPORTER
Exporter::ExportFormatEntry( "obj", "Wavefront OBJ format", "obj", &ExportSceneObj,
aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */),
Expand Down
20 changes: 20 additions & 0 deletions code/ProcessHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,26 @@ void FindMeshCenter (aiMesh* mesh, aiVector3D& out, aiVector3D& min, aiVector3D&
out = min + (max-min)*0.5f;
}

// -------------------------------------------------------------------------------
void FindSceneCenter (aiScene* scene, aiVector3D& out, aiVector3D& min, aiVector3D& max)
{
if (scene->mNumMeshes == 0) return;
FindMeshCenter(scene->mMeshes[0], out, min, max);
for (int i = 1; i < scene->mNumMeshes; ++i)
{
aiVector3D tout, tmin, tmax;
FindMeshCenter(scene->mMeshes[i], tout, tmin, tmax);
if (min[0] > tmin[0]) min[0] = tmin[0];
if (min[1] > tmin[1]) min[1] = tmin[1];
if (min[2] > tmin[2]) min[2] = tmin[2];
if (max[0] < tmax[0]) max[0] = tmax[0];
if (max[1] < tmax[1]) max[1] = tmax[1];
if (max[2] < tmax[2]) max[2] = tmax[2];
}
out = min + (max-min)*0.5f;
}


// -------------------------------------------------------------------------------
void FindMeshCenterTransformed (aiMesh* mesh, aiVector3D& out, aiVector3D& min,
aiVector3D& max, const aiMatrix4x4& m)
Expand Down
10 changes: 10 additions & 0 deletions code/ProcessHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,16 @@ void FindAABBTransformed (const aiMesh* mesh, aiVector3D& min, aiVector3D& max,
* @param[out] out Center point */
void FindMeshCenter (aiMesh* mesh, aiVector3D& out, aiVector3D& min, aiVector3D& max);

// -------------------------------------------------------------------------------
/** @brief Helper function to determine the 'real' center of a scene
*
* That is the center of its axis-aligned bounding box.
* @param scene Input scene
* @param[out] min Minimum vertex of the scene
* @param[out] max maximum vertex of the scene
* @param[out] out Center point */
void FindSceneCenter (aiScene* scene, aiVector3D& out, aiVector3D& min, aiVector3D& max);


// -------------------------------------------------------------------------------
// Helper function to determine the 'real' center of a mesh after applying a given transform
Expand Down
Loading

0 comments on commit ca8a390

Please sign in to comment.