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

WIP: Adding dynamic Node support #2

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open

WIP: Adding dynamic Node support #2

wants to merge 28 commits into from

Conversation

ricmoo
Copy link
Member

@ricmoo ricmoo commented Jan 25, 2025

The existing Scene Nodes are all the exact same size, with a maximum of 2 properties allowed per Node.

This has led to rather complex AnimationNode structures, since they require 4 properties, so currently 2 Nodes are added per animation, with a careful balance of values split between them.

This also means things like TextNodes cannot have a font property as property A is used for internal state and property B as a link to the actual text data.

This PR adds support for Nodes of arbitrary size, currently using the system malloc and free, but designed around substituting in custom implementations, so that more efficient options can be added in the future.

This also adds support for destructors, which allow Nodes to clean-up after themselves when they are removed.

The Animation and Render passes also no longer depend on using the standard Node objects, allowing them to allocate and store custom state, which is cleaned up automatically when animations complete and render passes finish.

@yuetloo yuetloo self-requested a review January 26, 2025 01:33
src/color.c Outdated
if (c & COLOR_HSV) {
return snprintf(name, length, "HSV(%ld, %ld/63, %ld/63, %ld/32)",
_getS(c), _getS(c), _getV(c), _getA(c));
_getS(c), _getS(c), _getV(c), alpha);
Copy link

Choose a reason for hiding this comment

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

Is there _getH()?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. :)


BoxNode *state = ffx_sceneNode_getState(node);
state->size = size;

Copy link

Choose a reason for hiding this comment

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

Do we need to set color as well here?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, the default value is 0 (alloc zeros memory), so by default colours are fully-opaque black.

But this should definitely be mentioned in the docs. :)

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.

2 participants