#139 ✓invalid
lindsay.kay (at xeolabs)

Node dynamic config callbacks should execute on Node's scope

Reported by lindsay.kay (at xeolabs) | August 7th, 2010 @ 02:50 AM | in V0.7.7

Nodes can be configured with callbacks, like this Rotate node that gets it's angle property off the data scope:

    SceneJS.rotate(function(data) {
        return { angle: data.get('pitch'), 1.0 };
    }

The mechanism within the nodes for converting the callback's result into properties is actually a bit of a runtime bottleneck on each node. Plus, it's no quite clear that whats going on in terms of what properties are actually being set on the node.

We could just call the callback on the Node scope, then just drive the node's setters inside of it, like this:

    SceneJS.rotate(function(data) {
         this.setAngle(data.get('pitch'));
         this.setX(1.0);
    },

Here we can see exactly where on the node each element of the data is going. Plus, we can flag node state updates inside node setters.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

SceneJS provides easy access to WebGL through a simple and declarative JavaScript API. The SceneJS API is functional, which enables its scene definitions to be really compact and expressive, while hooking into other JavaScript code just that little bit more smoothly.

Shared Ticket Bins

People watching this ticket

Pages