Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AMF] Fix texture mapping #5949

Merged
merged 9 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions code/AssetLib/AMF/AMFImporter_Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 6 additions & 2 deletions test/models-nonbsd/AMF/ref/README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading