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

Scene does not need to extend from Node (same with HTML interface). #44

Closed
2 tasks done
trusktr opened this issue Jul 6, 2016 · 2 comments
Closed
2 tasks done
Assignees

Comments

@trusktr
Copy link
Member

trusktr commented Jul 6, 2016

Scene can be a standalone thing that contains a single root Node within it, which is the top level Node of the world that the scene contains. Scene does not need transforms applied to it.

(This will also simplify module dependencies, reducing potential circular dependency problems.)

  • Refactor so that Scene does not extend from Node (possibly both Node and Scene might extend from a base class if any functionality should be shared, possibly not if that shared API surface area is small enough and would merit individual implementation for each class).
  • Do the same with motor-node/scene elements.

Work for #40 is waiting for this to be done first.

@trusktr
Copy link
Member Author

trusktr commented Jul 11, 2016

  • Make multiple() a multi-inheritance tool so that we can avoid making classes extend each other for no reason (i.e. when classes are not related and don't need to extend from each other). Used class-factory-style mixins for now

  • Nodes (the current Node class) will extend from ImperativeBase, TreeNode, and Transformable. (Node's name might possibly change, not sure yet). f.e.

    class Node extends multiple(ImperativeBase, TreeNode, Transformable) { /* ... */ }
  • Scene will extend from ImperativeBase and TreeNode, and Sizeable (a subset of Transformable which Transformable also extends). To move a scene around within another scene, simply mount the scene inside a MotorHTMLNode with scene.mount then transform the Node.

    class Scene extends multiple(ImperativeBase, TreeNode, Sizeable) { /* ... */ }

Transformable is what it sounds like, a class that handles the transformation matrix aspects, housing the getters and setters for position, rotation, etc.

ImperativeBase is the class that contain the imperative APIs stuff, relating to how the API ties with the HTML API, plus might contain some logic not yet categorized into a new class. MotorHTMLBase is the reciprocal class on the HTML side.

The TreeNode class makes it easy to construct a tree structure (and considers only how that tree structure is created).The root of our "scene graph" tree will be a Scene TreeNode and all other nodes will be Node TreeNodes.

These class names are all subject to change at the moment.

@trusktr
Copy link
Member Author

trusktr commented Aug 6, 2016

Completed in bf3a487 (for now, will revisit in the future with a better multiple-inheritance scheme when Proxy is widely supported, and am using a mixin pattern for now)

@trusktr trusktr closed this as completed Aug 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant