-
Notifications
You must be signed in to change notification settings - Fork 1
Description
We need to start making decisions about the graphics system.
Multiple ideas were offered. The one I remember was a Scene(Node) system, where every drawable object is a node with a parent and with children.
When a node rotates, so do the children. This is very easy to do using matrices. I like it.
Using matrices, any node can have a number of properties, such as rotation, shear, scale, relative position. This can all be in JS. Then there is a function createMatrix() that creates a 3x3 matrix for all these properties. A simple render would look like this:
Queue<Node> queue;
queue.enqueue(getRootNode());
while(!queue.isEmpty()) {
Node *node;
node = queue.dequeue();
node.relativeMatrix = JavaScriptCall(node, "createMatrix");
node.matrix = node.super.matrix * node.relativeMatrix; // or matr*relMat, I dunno.
// use node.matrix to do transformation of node.vertices
// draw the stuff
queue.enqueue(node.children);
}JS could keep track of changing properties and only recreate the matrix if something actually changes. Now, when setting transformation properties, everything is in JS, and to get all these properties, only 1 JS call is needed.
I have no idea how this will actually work out with OGL3 shaders.
@FlyingJester proposed something else, where shapes are not relative to each other. Maybe he could elaborate.