Checkpoint improvements to pbrt exporter

pull/3580/head
Matt Pharr 2021-01-08 16:57:22 -08:00
parent a0aa067b5f
commit 938537c884
4 changed files with 8389 additions and 466 deletions

View File

@ -189,7 +189,7 @@ static void setupExporterArray(std::vector<Exporter::ExportFormatEntry> &exporte
#endif #endif
#ifndef ASSIMP_BUILD_NO_PBRT_EXPORTER #ifndef ASSIMP_BUILD_NO_PBRT_EXPORTER
exporters.push_back(Exporter::ExportFormatEntry("pbrt", "Pbrt scene description file", "pbrt", &ExportScenePbrt, aiProcess_Triangulate | aiProcess_SortByPType)); exporters.push_back(Exporter::ExportFormatEntry("pbrt", "pbrt-v4 scene description file", "pbrt", &ExportScenePbrt, aiProcess_Triangulate | aiProcess_SortByPType));
#endif #endif
#ifndef ASSIMP_BUILD_NO_ASSJSON_EXPORTER #ifndef ASSIMP_BUILD_NO_ASSJSON_EXPORTER

File diff suppressed because it is too large Load Diff

View File

@ -49,19 +49,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/types.h> #include <assimp/types.h>
//#include <assimp/material.h> //#include <assimp/material.h>
#include <assimp/StreamWriter.h> // StreamWriterLE #include <assimp/StreamWriter.h>
#include <assimp/Exceptional.h> // DeadlyExportError #include <assimp/Exceptional.h>
#include <vector>
#include <map> #include <map>
#include <set> #include <set>
#include <unordered_set> #include <string>
#include <memory> // shared_ptr #include <sstream>
#include <sstream> // stringstream
struct aiScene; struct aiScene;
struct aiNode; struct aiNode;
struct aiMaterial; struct aiMaterial;
struct aiMesh;
namespace Assimp namespace Assimp
{ {
@ -79,14 +78,14 @@ public:
/// Constructor for a specific scene to export /// Constructor for a specific scene to export
PbrtExporter(const aiScene* pScene, IOSystem* pIOSystem, PbrtExporter(const aiScene* pScene, IOSystem* pIOSystem,
const std::string path, const std::string file); const std::string path, const std::string file);
/// Destructor /// Destructor
virtual ~PbrtExporter(); virtual ~PbrtExporter();
private: private:
// the scene to export // the scene to export
const aiScene* mScene; const aiScene* mScene;
/// Stringstream to write all output into /// Stringstream to write all output into
std::stringstream mOutput; std::stringstream mOutput;
@ -103,49 +102,31 @@ private:
// A private set to keep track of which textures have been declared // A private set to keep track of which textures have been declared
std::set<std::string> mTextureSet; std::set<std::string> mTextureSet;
private: aiMatrix4x4 GetNodeTransform(const aiString& name) const;
// Writing the comment header static std::string TransformString(const aiMatrix4x4& m);
void WriteHeader();
static std::string CleanTextureFilename(const aiString &f, bool rewriteExtension = true);
// Writing the metadata into a comment
void WriteMetaData(); void WriteMetaData();
// Writing the pbrt scene-wide rendering options
void WriteSceneWide();
// Writing the shapes to distinct files
void WriteShapes();
// Writing the pbrt world defintion
void WriteWorldDefinition(); void WriteWorldDefinition();
// Writing the Camera data
void WriteCameras(); void WriteCameras();
void WriteCamera(int i); void WriteCamera(int i);
// Check for Embedded Texture data
void CheckEmbeddedTextures();
// Writing the Texture data void WriteLights();
void WriteTextures(); void WriteTextures();
std::string GetTextureName(std::string path, unsigned int textureType); static bool TextureHasAlphaMask(const std::string &filename);
// Writing the Material data
void WriteMaterials(); void WriteMaterials();
void WriteMaterial(int i); void WriteMaterial(int i);
void WriteDisneyMaterial(aiMaterial* material);
void WriteUberMaterial(aiMaterial* material);
// Writing the Light data void WriteMesh(aiMesh* mesh);
void WriteLights();
// Writing the Object data
void WriteObjects();
void WriteObject(int i);
// Writing the Object Instances void WriteInstanceDefinition(int i);
void WriteObjectInstances(); void WriteGeometricObjects(aiNode* node, aiMatrix4x4 parentTransform,
void WriteObjectInstance(aiNode* node, aiMatrix4x4 parentTransform); std::map<int, int> &meshUses);
}; };
} // namespace Assimp } // namespace Assimp

7762
code/Pbrt/stb_image.h 100644

File diff suppressed because it is too large Load Diff