Skip to content

Feature/model node animation#136

Open
Roxeena wants to merge 6 commits into
masterfrom
feature/model-node-animation
Open

Feature/model node animation#136
Roxeena wants to merge 6 commits into
masterfrom
feature/model-node-animation

Conversation

@Roxeena

@Roxeena Roxeena commented May 27, 2026

Copy link
Copy Markdown
Member

This makes it possible to add a transformation to an internal model node for a 3D model. This also requires all nodes to store the name, therefor the caching format has been updated. The user can choose to either replace the existing transformation with the custom one or add it on top of the existing one with a parameter.

EDIT:
There is also a new function to print the model tree to help with finding the correct names for nodes to apply a custom transformation to.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for addressing model nodes by name and applying custom transforms to internal nodes, including cache/binary format updates to persist node names.

Changes:

  • Bumps model/cache versions and serializes/deserializes node names.
  • Stores Assimp node names in ModelNode.
  • Adds custom node transform APIs and applies them during rendering.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/io/model/modelreaderbinary.cpp Reads node names from updated binary model files while retaining older format support.
src/io/model/modelreaderassimp.cpp Populates ModelNode names from Assimp nodes.
src/io/model/modelnode.cpp Stores node names and custom transforms on model nodes.
src/io/model/modelgeometry.cpp Persists node names in cache files and applies custom node transforms during rendering.
include/ghoul/io/model/modelnode.h Exposes node name and custom transform accessors/mutators.
include/ghoul/io/model/modelgeometry.h Adds public APIs for updating custom node transforms and override behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/io/model/modelgeometry.cpp
Comment thread src/io/model/modelgeometry.cpp
Comment thread include/ghoul/io/model/modelgeometry.h Outdated
Comment thread src/io/model/modelgeometry.cpp Outdated
Comment thread src/io/model/modelgeometry.cpp Outdated
Comment thread src/io/model/modelgeometry.cpp Outdated
Comment thread src/io/model/modelgeometry.cpp Outdated
Comment on lines 38 to 56
_transform[0] = transform[0][0];
_transform[1] = transform[0][1];
_transform[2] = transform[0][2];
_transform[3] = transform[0][3];

_transform[4] = transform[1][0];
_transform[5] = transform[1][1];
_transform[6] = transform[1][2];
_transform[7] = transform[1][3];

_transform[8] = transform[2][0];
_transform[9] = transform[2][1];
_transform[10] = transform[2][2];
_transform[11] = transform[2][3];

_transform[12] = transform[3][0];
_transform[13] = transform[3][1];
_transform[14] = transform[3][2];
_transform[15] = transform[3][3];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::memcpy(_transform.data(), glm::value_ptr(transform), sizeof(glm::mat4));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried to use this, but it did not work. The objects were not in their expected places.

Comment on lines +98 to +116
_customTransform[0] = customTransform[0][0];
_customTransform[1] = customTransform[0][1];
_customTransform[2] = customTransform[0][2];
_customTransform[3] = customTransform[0][3];

_customTransform[4] = customTransform[1][0];
_customTransform[5] = customTransform[1][1];
_customTransform[6] = customTransform[1][2];
_customTransform[7] = customTransform[1][3];

_customTransform[8] = customTransform[2][0];
_customTransform[9] = customTransform[2][1];
_customTransform[10] = customTransform[2][2];
_customTransform[11] = customTransform[2][3];

_customTransform[12] = customTransform[3][0];
_customTransform[13] = customTransform[3][1];
_customTransform[14] = customTransform[3][2];
_customTransform[15] = customTransform[3][3];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_customTransform[0] = customTransform[0][0];
_customTransform[1] = customTransform[0][1];
_customTransform[2] = customTransform[0][2];
_customTransform[3] = customTransform[0][3];
_customTransform[4] = customTransform[1][0];
_customTransform[5] = customTransform[1][1];
_customTransform[6] = customTransform[1][2];
_customTransform[7] = customTransform[1][3];
_customTransform[8] = customTransform[2][0];
_customTransform[9] = customTransform[2][1];
_customTransform[10] = customTransform[2][2];
_customTransform[11] = customTransform[2][3];
_customTransform[12] = customTransform[3][0];
_customTransform[13] = customTransform[3][1];
_customTransform[14] = customTransform[3][2];
_customTransform[15] = customTransform[3][3];
std::memcpy(
_customTransform.data(),
glm::value_ptr(customTransform),
sizeof(glm::mat4)
);

Comment on lines 73 to 91
_animationTransform[0] = animation[0][0];
_animationTransform[1] = animation[0][1];
_animationTransform[2] = animation[0][2];
_animationTransform[3] = animation[0][3];

_animationTransform[4] = animation[1][0];
_animationTransform[5] = animation[1][1];
_animationTransform[6] = animation[1][2];
_animationTransform[7] = animation[1][3];

_animationTransform[8] = animation[2][0];
_animationTransform[9] = animation[2][1];
_animationTransform[10] = animation[2][2];
_animationTransform[11] = animation[2][3];

_animationTransform[12] = animation[3][0];
_animationTransform[13] = animation[3][1];
_animationTransform[14] = animation[3][2];
_animationTransform[15] = animation[3][3];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::memcpy(_animationTransform.data(), glm::value_ptr(animation), sizeof(glm::mat4));

Comment thread src/io/model/modelreaderbinary.cpp Outdated
Comment thread src/io/model/modelreaderbinary.cpp Outdated
Comment thread src/io/model/modelreaderassimp.cpp Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants