|
@@ -15,7 +15,7 @@ class Object {
|
|
public var scaleX(default,set) : Float;
|
|
public var scaleX(default,set) : Float;
|
|
public var scaleY(default, set) : Float;
|
|
public var scaleY(default, set) : Float;
|
|
public var scaleZ(default,set) : Float;
|
|
public var scaleZ(default,set) : Float;
|
|
- public var visible : Bool = true;
|
|
|
|
|
|
+ public var visible(default,set) : Bool = true;
|
|
|
|
|
|
/**
|
|
/**
|
|
Follow a given object or joint as if it was our parent. Ignore defaultTransform when set.
|
|
Follow a given object or joint as if it was our parent. Ignore defaultTransform when set.
|
|
@@ -29,6 +29,9 @@ class Object {
|
|
public var defaultTransform(default, set) : h3d.Matrix;
|
|
public var defaultTransform(default, set) : h3d.Matrix;
|
|
public var currentAnimation(default, null) : h3d.anim.Animation;
|
|
public var currentAnimation(default, null) : h3d.anim.Animation;
|
|
|
|
|
|
|
|
+ // internal flag to inform that the object is not to be displayed
|
|
|
|
+ var culled : Bool;
|
|
|
|
+
|
|
var absPos : h3d.Matrix;
|
|
var absPos : h3d.Matrix;
|
|
var invPos : h3d.Matrix;
|
|
var invPos : h3d.Matrix;
|
|
var qRot : h3d.Quat;
|
|
var qRot : h3d.Quat;
|
|
@@ -50,6 +53,11 @@ class Object {
|
|
return currentAnimation = a.createInstance(this);
|
|
return currentAnimation = a.createInstance(this);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function set_visible(v) {
|
|
|
|
+ culled = !v;
|
|
|
|
+ return visible = v;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
Changes the current animation. This animation should be an instance that was created by playAnimation!
|
|
Changes the current animation. This animation should be an instance that was created by playAnimation!
|
|
**/
|
|
**/
|
|
@@ -278,7 +286,7 @@ class Object {
|
|
}
|
|
}
|
|
|
|
|
|
function emitRec( ctx : RenderContext ) {
|
|
function emitRec( ctx : RenderContext ) {
|
|
- if( !visible ) return;
|
|
|
|
|
|
+ if( culled ) return;
|
|
// fallback in case the object was added during a sync() event and we somehow didn't update it
|
|
// fallback in case the object was added during a sync() event and we somehow didn't update it
|
|
if( posChanged ) {
|
|
if( posChanged ) {
|
|
// only sync anim, don't update() (prevent any event from occuring during draw())
|
|
// only sync anim, don't update() (prevent any event from occuring during draw())
|
|
@@ -335,14 +343,6 @@ class Object {
|
|
return v;
|
|
return v;
|
|
}
|
|
}
|
|
|
|
|
|
- /*
|
|
|
|
- Move along the current rotation axis
|
|
|
|
- */
|
|
|
|
- public function move( dx : Float, dy : Float, dz : Float ) {
|
|
|
|
- throw "TODO";
|
|
|
|
- posChanged = true;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
public inline function setPos( x : Float, y : Float, z : Float ) {
|
|
public inline function setPos( x : Float, y : Float, z : Float ) {
|
|
this.x = x;
|
|
this.x = x;
|
|
this.y = y;
|
|
this.y = y;
|