openframeworks / openframeworks/openFrameworks

ofNode global matrix caching

Open
#4,205 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core feature section-3D
Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

I went ahead and coded ofNode global matrix caching. Before PR-ing I wanted to discuss whether it's a good approach. You can see the changes here in a feature branch.

What this change does is computing the global matrix only if the local matrix changes. To do so every node keeps not only a parent ofNode* but also a set of children. This way we can flag all children as "dirty" whenever the node's matrix changes.

I've used a vector to make iteration faster, and a map to relate vector indices to the ofNode*. Tried first with an unordered_set<ofNode*> but access was slower.

Drawing, specially when we have a deep hierarchy of nodes is much faster than without caching. Updating (pan, tilt, etc) is a bit slower due to the flagging as dirty process.

I'll do a clean PR when it's polished!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with libs/openFrameworks/3d/ofNode.cpp and inspect the linked feature_node_caching branch to understand the proposed global-matrix cache and child tracking. Review the discussion before deciding whether the vector and map approach is acceptable; done means the approach is agreed, polished, and ready for a clean PR.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.