Pārlūkot izejas kodu

[AMF] Fix texture mapping (#5949)

* Fix texture mapping

---------

Co-authored-by: Steve M <[email protected]>
Co-authored-by: Kim Kulling <[email protected]>
Steve M 8 mēneši atpakaļ
vecāks
revīzija
8e44b40df4

+ 6 - 6
code/AssetLib/AMF/AMFImporter_Material.cpp

@@ -263,22 +263,22 @@ void AMFImporter::ParseNode_TexMap(XmlNode &node, const bool pUseOldName) {
             const std::string &name = currentNode.name();
             const std::string &name = currentNode.name();
             if (name == "utex1") {
             if (name == "utex1") {
 				read_flag[0] = true;
 				read_flag[0] = true;
-                XmlParser::getValueAsReal(node, als.TextureCoordinate[0].x);
+                XmlParser::getValueAsReal(currentNode, als.TextureCoordinate[0].x);
             } else if (name == "utex2") {
             } else if (name == "utex2") {
 				read_flag[1] = true;
 				read_flag[1] = true;
-                XmlParser::getValueAsReal(node, als.TextureCoordinate[1].x);
+                XmlParser::getValueAsReal(currentNode, als.TextureCoordinate[1].x);
             } else if (name == "utex3") {
             } else if (name == "utex3") {
 				read_flag[2] = true;
 				read_flag[2] = true;
-                XmlParser::getValueAsReal(node, als.TextureCoordinate[2].x);
+                XmlParser::getValueAsReal(currentNode, als.TextureCoordinate[2].x);
             } else if (name == "vtex1") {
             } else if (name == "vtex1") {
 				read_flag[3] = true;
 				read_flag[3] = true;
-                XmlParser::getValueAsReal(node, als.TextureCoordinate[0].y);
+                XmlParser::getValueAsReal(currentNode, als.TextureCoordinate[0].y);
             } else if (name == "vtex2") {
             } else if (name == "vtex2") {
 				read_flag[4] = true;
 				read_flag[4] = true;
-                XmlParser::getValueAsReal(node, als.TextureCoordinate[1].y);
+                XmlParser::getValueAsReal(currentNode, als.TextureCoordinate[1].y);
             } else if (name == "vtex3") {
             } else if (name == "vtex3") {
 				read_flag[5] = true;
 				read_flag[5] = true;
-                XmlParser::getValueAsReal(node, als.TextureCoordinate[2].y);
+                XmlParser::getValueAsReal(currentNode, als.TextureCoordinate[2].y);
 			}
 			}
 		}
 		}
         ParseHelper_Node_Exit();
         ParseHelper_Node_Exit();

+ 6 - 2
test/models-nonbsd/AMF/ref/README.md

@@ -1,8 +1,12 @@
 # AMF 3D model reference images
 # AMF 3D model reference images
 
 
+## 3_bananas.amf
+(Note: need to flip UVs when rendering)
+
+<img alt="3_bananas.amf" src="screenshots/3bananas_amf_uvs_flipped_01.png" width=180 /><img alt="3_bananas.amf" src="screenshots/screenshot_3_bananas.jpeg" width=360 />
+
 ## 3_bananas.amf embedded texture
 ## 3_bananas.amf embedded texture
-3_bananas.amf embeds a strange-looking texture, but believe when applied to the model it ends up
-rendering correctly.
+3_bananas.amf embeds a strange-looking but valid texture, which when applied to the model renders correctly.
 
 
 (Note that this is a relatively rare example of a 3D model with an "uncompressed" embedded texture,
 (Note that this is a relatively rare example of a 3D model with an "uncompressed" embedded texture,
 may be useful for developers looking to test their assimp embedded texture implementations)
 may be useful for developers looking to test their assimp embedded texture implementations)

BIN
test/models-nonbsd/AMF/ref/screenshots/3bananas_amf_uvs_flipped_01.png


+ 0 - 0
test/models-nonbsd/AMF/screenshot_3_bananas.jpeg → test/models-nonbsd/AMF/ref/screenshots/screenshot_3_bananas.jpeg