Skip to content

Commit

Permalink
Added "frontface" to node flags
Browse files Browse the repository at this point in the history
Minor decrufting of renderModule and billboard node
Moved layerModule into own directory
  • Loading branch information
xeolabs committed Apr 22, 2011
1 parent 08c1ed6 commit 7eef77f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

<fileset dir="${SRC_DIR}" includes="scenejs/time/timeModule.js"/>

<fileset dir="${SRC_DIR}" includes="scenejs/node/layerModule.js"/>
<fileset dir="${SRC_DIR}" includes="scenejs/layers/layerModule.js"/>

<fileset dir="${SRC_DIR}" includes="scenejs/memory/memoryModule.js"/>

Expand Down
3 changes: 2 additions & 1 deletion src/scenejs/flags/flagsModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ SceneJS._flagsModule = new (function() {
enabled : true, // Node not culled from traversal
visible : true, // Node visible - when false, everything happens except geometry draw
transparent: false, // Node transparent - works in conjunction with matarial alpha properties
backfaces: true
backfaces: true, // Show backfaces
frontface: "ccw" // Default vertex winding for front face
};

this.flags = {}; // Flags at top of flag stack
Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions src/scenejs/shading/node-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ var SceneJS_NodeRenderer = function(cfg) {
}
}

if (!oldFlags || newFlags.frontface != oldFlags.frontface) {
if (newFlags.frontface == "cw") {
gl.frontFace(gl.CW);
} else {
gl.frontFace(gl.CCW);
}
}

if (!oldFlags || newFlags.blendFunc != oldFlags.blendFunc) {
if (newFlags.blendFunc) {
gl.blendFunc(glEnum(gl, newFlags.blendFunc.sfactor || "one"), glEnum(gl, newFlags.blendFunc.dfactor || "zero"));
Expand Down
18 changes: 3 additions & 15 deletions src/scenejs/shading/renderModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,6 @@ SceneJS._renderModule = new (function() {
var VIEW_TRANSFORM = 15;
var PICK_LISTENERS = 16;
var RENDER_LISTENERS = 17;
var SPRITE_TRANSFORM = 18;


/*----------------------------------------------------------------------
* State synch masks - TODO: expand on this
*--------------------------------------------------------------------*/

var STATE_MASKS = [];
STATE_MASKS[VIEW_TRANSFORM] = 0x01;

var DEPENDENTS = [];
DEPENDENTS[VIEW_TRANSFORM] = [SPRITE_TRANSFORM];
DEPENDENTS[MODEL_TRANSFORM] = [DEFORM, MORPH, LIGHTS, CLIPS];

/*----------------------------------------------------------------------
* Default state values
Expand Down Expand Up @@ -95,7 +82,8 @@ SceneJS._renderModule = new (function() {
enabled : true, // Node not culled from traversal
visible : true, // Node visible - when false, everything happens except geometry draw
transparent: false, // Node transparent - works in conjunction with matarial alpha properties
backfaces: true
backfaces: true, // Show backfaces
frontface: "ccw" // Default vertex winding for front face
};

var DEFAULT_FOG = {
Expand Down Expand Up @@ -1811,7 +1799,7 @@ SceneJS._renderModule = new (function() {

/* Render display list in pick mode
*/
states.nodeRenderer.init(true);
states.nodeRenderer.init(true); // TODO: Only re-render when nodes are known to have moved

renderBin(states.bin, true);

Expand Down
4 changes: 1 addition & 3 deletions src/scenejs/transformation/modelView/billboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ SceneJS.Billboard.prototype._preCompile = function(traversalContext) {
// 0. The base variable
var superViewXForm = SceneJS._viewTransformModule.getTransform();
var lookAt = superViewXForm.lookAt;
// var eye = superViewXForm.lookAt.eye;
// var look = superViewXForm.lookAt.look;
// var up = superViewXForm.lookAt.up;

var superModelXForm = SceneJS._modelTransformModule.getTransform();
var matrix = superModelXForm.matrix.slice(0);

Expand Down

0 comments on commit 7eef77f

Please sign in to comment.