فهرست منبع

Merge branch 'master' into makeInternalErrorsAccessible

Kim Kulling 5 سال پیش
والد
کامیت
23defc275a

+ 4 - 1
code/AssetLib/FBX/FBXImporter.cpp

@@ -141,7 +141,10 @@ void FBXImporter::SetupProperties(const Importer *pImp) {
 // ------------------------------------------------------------------------------------------------
 // Imports the given file into the given scene structure.
 void FBXImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
-	std::unique_ptr<IOStream> stream(pIOHandler->Open(pFile, "rb"));
+	auto streamCloser = [&](IOStream *pStream) {
+		pIOHandler->Close(pStream);
+	};
+	std::unique_ptr<IOStream, decltype(streamCloser)> stream(pIOHandler->Open(pFile, "rb"), streamCloser);
 	if (!stream) {
 		ThrowException("Could not open file for reading");
 	}

+ 4 - 1
code/AssetLib/Obj/ObjFileImporter.cpp

@@ -107,7 +107,10 @@ const aiImporterDesc *ObjFileImporter::GetInfo() const {
 void ObjFileImporter::InternReadFile(const std::string &file, aiScene *pScene, IOSystem *pIOHandler) {
     // Read file into memory
     static const std::string mode = "rb";
-    std::unique_ptr<IOStream> fileStream(pIOHandler->Open(file, mode));
+    auto streamCloser = [&](IOStream *pStream) {
+        pIOHandler->Close(pStream);
+    };
+    std::unique_ptr<IOStream, decltype(streamCloser)> fileStream(pIOHandler->Open(file, mode), streamCloser);
     if (!fileStream.get()) {
         throw DeadlyImportError("Failed to open file ", file, ".");
     }

+ 4 - 0
code/AssetLib/glTF/glTFCommon.cpp

@@ -38,6 +38,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 ----------------------------------------------------------------------
 */
+#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
+
 #include "AssetLib/glTF/glTFCommon.h"
 
 namespace glTFCommon {
@@ -187,3 +189,5 @@ bool ParseDataURI(const char *const_uri, size_t uriLen, DataURI &out) {
 
 } // namespace Util
 } // namespace glTFCommon
+
+#endif

+ 2 - 0
code/Common/Exporter.cpp

@@ -140,6 +140,8 @@ void ExportAssimp2Json(const char* , IOSystem*, const aiScene* , const Assimp::E
 #endif
 
 static void setupExporterArray(std::vector<Exporter::ExportFormatEntry> &exporters) {
+	(void)exporters;
+
 #ifndef ASSIMP_BUILD_NO_COLLADA_EXPORTER
 	exporters.push_back(Exporter::ExportFormatEntry("collada", "COLLADA - Digital Asset Exchange Schema", "dae", &ExportSceneCollada));
 #endif

+ 100 - 94
port/jassimp/jassimp/src/jassimp/AiTextureType.java

@@ -56,109 +56,115 @@ package jassimp;
  * regardless which 3D tool they're using.
  */
 public enum AiTextureType {
-   /** 
-    * The texture is combined with the result of the diffuse
-    * lighting equation.
+    /** Dummy value.
+     *
+     *  No texture, but the value to be used as 'texture semantic'
+     *  (#aiMaterialProperty::mSemantic) for all material properties
+     *  *not* related to textures.
+     */
+    NONE(0),
+
+    /** LEGACY API MATERIALS 
+     * Legacy refers to materials which 
+     * Were originally implemented in the specifications around 2000.
+     * These must never be removed, as most engines support them.
+     */
+
+    /** The texture is combined with the result of the diffuse
+     *  lighting equation.
+     */
+    DIFFUSE(1),
+
+    /** The texture is combined with the result of the specular
+     *  lighting equation.
+     */
+    SPECULAR(2),
+
+    /** The texture is combined with the result of the ambient
+     *  lighting equation.
+     */
+    AMBIENT(3),
+
+    /** The texture is added to the result of the lighting
+     *  calculation. It isn't influenced by incoming light.
+     */
+    EMISSIVE(4),
+
+    /** The texture is a height map.
+     *
+     *  By convention, higher gray-scale values stand for
+     *  higher elevations from the base height.
+     */
+    HEIGHT(5),
+
+    /** The texture is a (tangent space) normal-map.
+     *
+     *  Again, there are several conventions for tangent-space
+     *  normal maps. Assimp does (intentionally) not
+     *  distinguish here.
+     */
+    NORMALS(6),
+
+    /** The texture defines the glossiness of the material.
+     *
+     *  The glossiness is in fact the exponent of the specular
+     *  (phong) lighting equation. Usually there is a conversion
+     *  function defined to map the linear color values in the
+     *  texture to a suitable exponent. Have fun.
     */
-   DIFFUSE(0x1),
+    SHININESS(7),
 
-           
-   /** 
-    * The texture is combined with the result of the specular
-    * lighting equation.
+    /** The texture defines per-pixel opacity.
+     *
+     *  Usually 'white' means opaque and 'black' means
+     *  'transparency'. Or quite the opposite. Have fun.
     */
-   SPECULAR(0x2),
+    OPACITY(8),
 
-   
-   /** 
-    * The texture is combined with the result of the ambient
-    * lighting equation.
+    /** Displacement texture
+     *
+     *  The exact purpose and format is application-dependent.
+     *  Higher color values stand for higher vertex displacements.
     */
-   AMBIENT(0x3),
-
-   
-   /** 
-    * The texture is added to the result of the lighting
-    * calculation. It isn't influenced by incoming light.
+    DISPLACEMENT(9),
+
+    /** Lightmap texture (aka Ambient Occlusion)
+     *
+     *  Both 'Lightmaps' and dedicated 'ambient occlusion maps' are
+     *  covered by this material property. The texture contains a
+     *  scaling value for the final color value of a pixel. Its
+     *  intensity is not affected by incoming light.
     */
-   EMISSIVE(0x4),
+    LIGHTMAP(10),
 
-   
-   /** 
-    * The texture is a height map.<p>
-    *
-    * By convention, higher gray-scale values stand for
-    * higher elevations from the base height.
+    /** Reflection texture
+     *
+     * Contains the color of a perfect mirror reflection.
+     * Rarely used, almost never for real-time applications.
     */
-   HEIGHT(0x5),
-
-   
-   /**
-    * The texture is a (tangent space) normal-map.<p>
-    *
-    * Again, there are several conventions for tangent-space
-    * normal maps. Assimp does (intentionally) not distinguish here.
+    REFLECTION(11),
+
+    /** PBR Materials
+     * PBR definitions from maya and other modelling packages now use this standard.
+     * This was originally introduced around 2012.
+     * Support for this is in game engines like Godot, Unreal or Unity3D.
+     * Modelling packages which use this are very common now.
+     */
+
+    BASE_COLOR(12),
+    NORMAL_CAMERA(13),
+    EMISSION_COLOR(14),
+    METALNESS(15),
+    DIFFUSE_ROUGHNESS(16),
+    AMBIENT_OCCLUSION(17),
+
+    /** Unknown texture
+     *
+     *  A texture reference that does not match any of the definitions
+     *  above is considered to be 'unknown'. It is still imported,
+     *  but is excluded from any further post-processing.
     */
-   NORMALS(0x6),
-
-   
-   /** 
-    * The texture defines the glossiness of the material.<p>
-    *
-    * The glossiness is in fact the exponent of the specular
-    * (phong) lighting equation. Usually there is a conversion
-    * function defined to map the linear color values in the
-    * texture to a suitable exponent. Have fun.
-   */
-   SHININESS(0x7),
-
-   
-   /** 
-    * The texture defines per-pixel opacity.<p>
-    *
-    * Usually 'white' means opaque and 'black' means 
-    * 'transparency'. Or quite the opposite. Have fun.
-   */
-   OPACITY(0x8),
-
-   
-   /** 
-    * Displacement texture.<p>
-    *
-    * The exact purpose and format is application-dependent.
-    * Higher color values stand for higher vertex displacements.
-   */
-   DISPLACEMENT(0x9),
-
-   
-   /** 
-    * Lightmap texture (aka Ambient Occlusion).<p>
-    *
-    * Both 'Lightmaps' and dedicated 'ambient occlusion maps' are
-    * covered by this material property. The texture contains a
-    * scaling value for the final color value of a pixel. Its
-    * intensity is not affected by incoming light.
-   */
-   LIGHTMAP(0xA),
-
-   
-   /**
-    * Reflection texture.<p>
-    *
-    * Contains the color of a perfect mirror reflection.
-    * Rarely used, almost never for real-time applications.
-   */
-   REFLECTION(0xB),
-
-   
-   /** 
-    * Unknown texture.<p>
-    *
-    * A texture reference that does not match any of the definitions 
-    * above is considered to be 'unknown'. It is still imported,
-    * but is excluded from any further postprocessing.
-   */
-   UNKNOWN(0xC);
+    UNKNOWN(18);
    
    
    /**