Skip to content

Fixes #428 #433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 11 additions & 27 deletions src/away3d/animators/AnimationSetBase.as
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package away3d.animators
import away3d.animators.nodes.*;
import away3d.errors.*;
import away3d.library.assets.*;
import away3d.materials.passes.MaterialPassBase;

import flash.utils.*;

Expand All @@ -21,12 +20,12 @@ package away3d.animators

/**
* Retrieves a temporary GPU register that's still free.
*
*
* @param exclude An array of non-free temporary registers.
* @param excludeAnother An additional register that's not free.
* @return A temporary register that can be used.
*/
protected function findTempReg(exclude : Vector.<String>, excludeAnother : String = null) : String
protected function findTempReg(exclude : Array, excludeAnother : String = null) : String
{
var i : uint;
var reg : String;
Expand Down Expand Up @@ -54,7 +53,7 @@ package away3d.animators
/**
* Called by the material to reset the GPU indicator before testing whether register space in the shader
* is available for running GPU-based animation code.
*
*
* @private
*/
public function resetGPUCompatibility() : void
Expand Down Expand Up @@ -93,7 +92,7 @@ package away3d.animators

/**
* Check to determine whether a state is registered in the animation set under the given name.
*
*
* @param stateName The name of the animation state object to be checked.
*/
public function hasAnimation(name:String):Boolean
Expand All @@ -103,7 +102,7 @@ package away3d.animators

/**
* Retrieves the animation state object registered in the animation data set under the given name.
*
*
* @param stateName The name of the animation state object to be retrieved.
*/
public function getAnimation(name:String):AnimationNodeBase
Expand All @@ -114,20 +113,20 @@ package away3d.animators

/**
* Adds an animation state object to the aniamtion data set under the given name.
*
*
* @param stateName The name under which the animation state object will be stored.
* @param animationState The animation state object to be staored in the set.
*/
public function addAnimation(node:AnimationNodeBase):void
public function addAnimation(name:String, node:AnimationNodeBase):void
{
if (_animationDictionary[node.name])
throw new AnimationSetError("root node name '" + node.name + "' already exists in the set");
if (_animationDictionary[name])
throw new AnimationSetError("root node name already exists in the set");

_animationDictionary[node.name] = node;
_animationDictionary[name] = node;

_animations.push(node);

_animationNames.push(node.name);
_animationNames.push(name);
}

/**
Expand All @@ -136,20 +135,5 @@ package away3d.animators
public function dispose() : void
{
}

public function getAGALFragmentCode(pass : MaterialPassBase, shadedTarget : String) : String
{
return "";
}

public function getAGALUVCode(pass : MaterialPassBase, UVSource : String, UVTarget:String) : String
{
return "mov " + UVTarget + "," + UVSource + "\n";
}

public function doneAGALCode(pass : MaterialPassBase):void
{

}
}
}
5 changes: 0 additions & 5 deletions src/away3d/animators/AnimatorBase.as
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ package away3d.animators
return _animationStates[node] ||= new className(this, node);
}

public function getAnimationStateByName(name:String):AnimationStateBase
{
return getAnimationState(_animationSet.getAnimation(name));
}

/**
* Returns the internal absolute time of the animator, calculated by the current time and the playback speed.
*
Expand Down
25 changes: 5 additions & 20 deletions src/away3d/animators/IAnimationSet.as
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ package away3d.animators
{
/**
* Check to determine whether a state is registered in the animation set under the given name.
*
*
* @param stateName The name of the animation state object to be checked.
*/
function hasAnimation(name:String):Boolean;

/**
* Retrieves the animation state object registered in the animation data set under the given name.
*
*
* @param stateName The name of the animation state object to be retrieved.
*/
function getAnimation(name:String):AnimationNodeBase;
Expand All @@ -35,7 +35,7 @@ package away3d.animators
/**
* Called by the material to reset the GPU indicator before testing whether register space in the shader
* is available for running GPU-based animation code.
*
*
* @private
*/
function resetGPUCompatibility() : void;
Expand All @@ -49,23 +49,8 @@ package away3d.animators
*
* @private
*/
function getAGALVertexCode(pass : MaterialPassBase, sourceRegisters : Vector.<String>, targetRegisters : Vector.<String>) : String;


/**
* Generates the AGAL Fragment code for the animation, tailored to the material pass's requirements.
* @param pass The MaterialPassBase object to whose vertex code the animation's code will be prepended.
* @return The AGAL Vertex code that animates the vertex data.
*
* @private
*/
function getAGALFragmentCode(pass : MaterialPassBase, shadedTarget : String) : String;


function getAGALUVCode(pass : MaterialPassBase, UVSource : String, UVTarget:String) : String;

function doneAGALCode(pass:MaterialPassBase):void;

function getAGALVertexCode(pass : MaterialPassBase, sourceRegisters : Array, targetRegisters : Array) : String;

/**
* Sets the GPU render state required by the animation that is independent of the rendered mesh.
* @param context The context which is currently performing the rendering.
Expand Down
13 changes: 5 additions & 8 deletions src/away3d/animators/IAnimator.as
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ package away3d.animators
{
import away3d.animators.nodes.*;
import away3d.animators.states.*;
import away3d.cameras.Camera3D;
import away3d.core.base.*;
import away3d.core.managers.*;
import away3d.entities.*;
import away3d.materials.passes.*;

/**
* Provides an interface for animator classes that control animation output from a data set subtype of <code>AnimationSetBase</code>.
*
*
* @see away3d.animators.IAnimationSet
*/
public interface IAnimator
Expand All @@ -22,13 +21,13 @@ package away3d.animators

/**
* Sets the GPU render state required by the animation that is dependent of the rendered object.
*
*
* @param stage3DProxy The Stage3DProxy object which is currently being used for rendering.
* @param renderable The object currently being rendered.
* @param vertexConstantOffset The first available vertex register to write data to if running on the gpu.
* @param vertexStreamOffset The first available vertex stream to write vertex data to if running on the gpu.
*/
function setRenderState(stage3DProxy : Stage3DProxy, renderable : IRenderable, vertexConstantOffset : int, vertexStreamOffset : int, camera:Camera3D) : void
function setRenderState(stage3DProxy : Stage3DProxy, renderable : IRenderable, vertexConstantOffset : int, vertexStreamOffset : int) : void

/**
* Verifies if the animation will be used on cpu. Needs to be true for all passes for a material to be able to use it on gpu.
Expand All @@ -38,20 +37,18 @@ package away3d.animators

/**
* Used by the mesh object to which the animator is applied, registers the owner for internal use.
*
*
* @private
*/
function addOwner(mesh : Mesh) : void

/**
* Used by the mesh object from which the animator is removed, unregisters the owner for internal use.
*
*
* @private
*/
function removeOwner(mesh : Mesh) : void

function getAnimationState(node:AnimationNodeBase):AnimationStateBase;

function getAnimationStateByName(name:String):AnimationStateBase;
}
}
18 changes: 7 additions & 11 deletions src/away3d/animators/SkeletonAnimationSet.as
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package away3d.animators
{
import away3d.arcane;
import away3d.core.managers.Stage3DProxy;
import away3d.materials.passes.MaterialPassBase;

import flash.display3D.Context3D;

use namespace arcane;
import away3d.animators.*;
import away3d.core.managers.*;
import away3d.materials.passes.*;

/**
* The animation data set used by skeleton-based animators, containing skeleton animation state data.
Expand Down Expand Up @@ -40,7 +36,7 @@ package away3d.animators
/**
* @inheritDoc
*/
public function getAGALVertexCode(pass : MaterialPassBase, sourceRegisters : Vector.<String>, targetRegisters : Vector.<String>) : String
public function getAGALVertexCode(pass : MaterialPassBase, sourceRegisters : Array, targetRegisters : Array) : String
{
var len : uint = sourceRegisters.length;

Expand Down Expand Up @@ -92,9 +88,9 @@ package away3d.animators
public function deactivate(stage3DProxy : Stage3DProxy, pass : MaterialPassBase) : void
{
var streamOffset : uint = pass.numUsedStreams;
var context : Context3D = stage3DProxy._context3D;
context.setVertexBufferAt(streamOffset, null);
context.setVertexBufferAt(streamOffset+1, null);

stage3DProxy.setSimpleVertexBuffer(streamOffset, null, null, 0);
stage3DProxy.setSimpleVertexBuffer(streamOffset + 1, null, null, 0);
}
}
}
Loading