[AMF] Fix texture mapping (#5949)

* Fix texture mapping

---------

Co-authored-by: Steve M <praktique-tellypresence@yahoo.com>
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
This commit is contained in:
Steve M
2025-01-12 14:04:10 -08:00
committed by GitHub
parent 5aa38fe3cd
commit 8e44b40df4
4 changed files with 12 additions and 8 deletions

View File

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

View File

@@ -1,8 +1,12 @@
# 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 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,
may be useful for developers looking to test their assimp embedded texture implementations)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB