From dbfc1863e0dd69d76dc93c979e125c421bc1bf08 Mon Sep 17 00:00:00 2001 From: Yaski Date: Fri, 13 Jul 2012 14:31:31 +0600 Subject: [PATCH] Object3D:: added hierarchical parameter in exclude light system --- src/alternativa/engine3d/core/Camera3D.as | 6 ++-- src/alternativa/engine3d/core/Object3D.as | 35 +++++++++++++++++------ src/alternativa/engine3d/objects/LOD.as | 4 +-- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/alternativa/engine3d/core/Camera3D.as b/src/alternativa/engine3d/core/Camera3D.as index 9e299db..9b75688 100644 --- a/src/alternativa/engine3d/core/Camera3D.as +++ b/src/alternativa/engine3d/core/Camera3D.as @@ -343,7 +343,7 @@ public class Camera3D extends Object3D { root.listening = globalMouseHandlingType > 0; } // Check if object needs in lightning - var excludedLightLength:int = root.excludedLights.length; + var excludedLightLength:int = root._excludedLights.length; if (lightsLength > 0 && root.useLights) { // Pass the lights to children and calculate appropriate transformations var childLightsLength:int = 0; @@ -352,7 +352,7 @@ public class Camera3D extends Object3D { light = lights[i]; // Checking light source for existing in excludedLights j = 0; - while (j = new Vector.(); + alternativa3d var _excludedLights:Vector. = new Vector.(); /** * @private @@ -1433,7 +1433,7 @@ package alternativa.engine3d.core { child.listening = true; } // Check if object needs in lightning - var excludedLightLength:int = child.excludedLights.length; + var excludedLightLength:int = child._excludedLights.length; if (lightsLength > 0 && child.useLights) { // Pass the lights to children and calculate appropriate transformations var childLightsLength:int = 0; @@ -1443,7 +1443,7 @@ package alternativa.engine3d.core { light = lights[i]; // Checking object for existing in excludedLights j = 0; - while (j { + return _excludedLights.slice(); } /** * Resets list of lights excluded from litting this object */ - public function resetLights():void{ - excludedLights.length = 0; + public function clearExcludedLights(updateChildren:Boolean = false):void { + _excludedLights.length = 0; + if (updateChildren) { + for (var child:Object3D = childrenList; child != null; child = child.next) { + child.clearExcludedLights(true); + } + } } /** diff --git a/src/alternativa/engine3d/objects/LOD.as b/src/alternativa/engine3d/objects/LOD.as index 089943e..27af29f 100644 --- a/src/alternativa/engine3d/objects/LOD.as +++ b/src/alternativa/engine3d/objects/LOD.as @@ -225,12 +225,12 @@ package alternativa.engine3d.objects { // If object needs on light sources. if (lightsLength > 0 && child.useLights) { // Calculation of transfer matrices from sources to object. - var excludedLightLength:int = this.excludedLights.length; + var excludedLightLength:int = this._excludedLights.length; var childLightsLength:int = 0; for (var i:int = 0; i < lightsLength; i++) { var light:Light3D = lights[i]; var j:int = 0; - while (j