openframeworks / openframeworks/openFrameworks
[idea] ofNodeMesh
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
I'm working on an idea to mix an ofMesh with ofNode, so we can have a matrix transformation to draw a mesh, or a way of getting transformed (like baked transformations).
I think it has great potential, works like a 3dPrimitives but only extending two already existing objects, useful for working with meshes intersections.
EDIT: updated code, working great.
class ofNodeMesh : public ofNode, ofMesh {
public:
void setMesh(const ofMesh & m) {
(*(ofMesh*)this) = m;
}
void setNode(const ofNode & n) {
(*(ofNode*)this) = n;
}
void operator=(const ofNode & n) {
(*(ofNode*)this) = n;
}
void operator=(const ofMesh & m) {
(*(ofMesh*)this) = m;
}
void draw() {
ofPushMatrix();
ofMultMatrix((*(ofNode*)this).getLocalTransformMatrix());
(*(ofMesh*)this).draw();
ofPopMatrix();
}
ofMesh getTransformedMesh() {
ofMesh transform = (*(ofMesh*)this);
for (auto & v : transform.getVertices()) {
v = (*(ofNode*)this).getLocalTransformMatrix() * glm::vec4{ v, 1.0f };
}
return transform;
}
};
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing ofNode and ofMesh APIs and the proposed ofNodeMesh code in the issue. No repository files, tests, or acceptance criteria are named; progress would require agreeing on the API, transformation behavior, and a concrete definition of done before implementation and tests can be scoped.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100