Skip to content

Commit

Permalink
Merge remote branch 'origin/v0.8' into v0.8-disk-primitive
Browse files Browse the repository at this point in the history
Conflicts:
  build.xml

converted back to unix newlines
  • Loading branch information
stepheneb committed Mar 1, 2011
2 parents 98a583a + d8439d4 commit 1ebe1a1
Show file tree
Hide file tree
Showing 7 changed files with 1,607 additions and 1,020 deletions.
418 changes: 418 additions & 0 deletions build.xml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/examples/morphing/morphing-scene.js
Expand Up @@ -139,6 +139,8 @@ SceneJS.createNode({
*/
factor: 0.0,

keys: [0, 2],

/* Minimum of two morph targets required
*/
targets: [
Expand Down
5 changes: 2 additions & 3 deletions src/plugins/clip/scenejs-clipbox-plugin.js
Expand Up @@ -17,7 +17,7 @@
execute: function(params) {
var target = params.target;
if (!target) {
throw "Attribute 'target' expected on command 'clip.clipbox.create'";
throw "Attribute 'target' for command 'clip.clipbox.create' is null or undefined";
}
clipbox(target, params);
}
Expand Down Expand Up @@ -118,7 +118,6 @@
]
}
]

},
{
type: "clip",
Expand Down Expand Up @@ -228,7 +227,7 @@
var xmax = ((params.xmax != undefined) ? params.xmax : 1) + (translate.x || 0);
var ymin = ((params.ymin != undefined) ? params.ymin : -1) + (translate.y || 0);
var ymax = ((params.ymax != undefined) ? params.ymax : 1) + (translate.y || 0);

var rotate = params.rotate || {};
var xrot = rotate.x || 0;
var yrot = rotate.y || 0;
Expand Down
34 changes: 10 additions & 24 deletions src/scenejs/clip/clip.js
Expand Up @@ -19,7 +19,7 @@ SceneJS.Clip.prototype._init = function(params) {
@since Version 0.7.9
*/
SceneJS.Clip.prototype.setMode = function(mode) {
mode = mode || "disabled";
mode = mode || "outside";
if (mode != "disabled" && mode != "inside" && mode != "outside") {
throw SceneJS._errorModule.fatalError(new SceneJS.errors.InvalidNodeConfigException(
"SceneJS.clip has a mode of unsupported type: '" + mode + " - should be 'disabled', 'inside' or 'outside'"));
Expand Down Expand Up @@ -182,9 +182,9 @@ SceneJS.Clip.prototype._compile = function(traversalContext) {
// @private
SceneJS.Clip.prototype._preCompile = function(traversalContext) {
if (this._memoLevel == 0) {
this._makePlane();
this._makeClip();
}
SceneJS._clipModule.pushClip(this._attr.id, this._attr);
SceneJS._clipModule.pushClip(this._attr.id, this._clip);
};

// @private
Expand All @@ -195,28 +195,14 @@ SceneJS.Clip.prototype._postCompile = function(traversalContext) {
/** Create succinct plane representation from points A, B & C
*
*/
SceneJS.Clip.prototype._makePlane = function() {
SceneJS.Clip.prototype._makeClip = function() {
var modelMat = SceneJS._modelTransformModule.getTransform().matrix;
var viewMat = SceneJS._viewTransformModule.getTransform().matrix;

var a = SceneJS._math_transformPoint3(viewMat, SceneJS._math_transformPoint3(modelMat, this._attr.a));
var b = SceneJS._math_transformPoint3(viewMat, SceneJS._math_transformPoint3(modelMat, this._attr.b));
var c = SceneJS._math_transformPoint3(viewMat, SceneJS._math_transformPoint3(modelMat, this._attr.c));

var q = [
b[0] - a[0],
b[1] - a[1],
b[2] - a[2]
];
var v = [
b[0] - c[0],
b[1] - c[1],
b[2] - c[2]
];

this._attr.normal = SceneJS._math_normalizeVec3(SceneJS._math_cross3Vec3(q, v));
this._attr.dist = SceneJS._math_dotVector3(this._attr.normal, [a[0], a[1], a[2]]); // dist from origin

// this._memoLevel = 1;
this._clip = {
mode: this._attr.mode,
a : SceneJS._math_transformPoint3(modelMat, this._attr.a),
b : SceneJS._math_transformPoint3(modelMat, this._attr.b),
c : SceneJS._math_transformPoint3(modelMat, this._attr.c)
}
};

0 comments on commit 1ebe1a1

Please sign in to comment.