Skip to content

Use composition instead of inheritance for different node types #5

@eikel

Description

@eikel

Initially reported by @ClaudiusJ as #596:

This is just a collection of crazy ideas that might be useful for MinSG 2.0. (I don't know if we should really consider this. Ralf came up with this interesting idea and I wanted a place to collect some thoughts on it.)

  • All nodes can contain children
  • To create a camera node, attach a camera attribute to a node; same for lights
  • Meshes are also attributes (perhaps with a flag for faster access NODE_CONTAINS_MESH)
  • Transformations could also be optional; only a world matrix and world bb should be contained for efficiency.
  • Dynamic data structures should be possible using the existing observer concept.

Problems:

  • bounding boxes: How are the bounding boxes of a mesh automatically used for the node, if the mesh is just an attribute?
  • bunch of work for only a small benefit

Benefits:

  • Slightly more flexible
  • Nicer concept (for my taste)
  • No virtual inheritance needed
  • Early stages are compatible with the existing implementation: One could easily just use the new concept inside of the existing nodes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions