Skip to content

Commit

Permalink
renamed animation library to animation set
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-bateman committed Jul 6, 2012
1 parent d7f0702 commit b73cf62
Show file tree
Hide file tree
Showing 22 changed files with 89 additions and 89 deletions.
@@ -1,6 +1,6 @@
package away3d.animators
{
import away3d.errors.AnimationLibraryError;
import away3d.errors.AnimationSetError;
import flash.utils.Dictionary;
import away3d.library.assets.AssetType;
import away3d.library.assets.NamedAssetBase;
Expand All @@ -12,7 +12,7 @@ package away3d.animators
/**
* @author robbateman
*/
public class AnimationLibraryBase extends NamedAssetBase implements IAsset
public class AnimationSetBase extends NamedAssetBase implements IAsset
{
arcane var _usesCPU:Boolean;
private var _states:Vector.<IAnimationState> = new Vector.<IAnimationState>();
Expand Down Expand Up @@ -68,7 +68,7 @@ package away3d.animators
public function addState(stateName:String, animationState:IAnimationState):void
{
if (_stateDictionary[stateName])
throw new AnimationLibraryError("Animation state name already exists");
throw new AnimationSetError("Animation state name already exists");

_stateDictionary[stateName] = animationState;

Expand Down
4 changes: 2 additions & 2 deletions src/away3d/animators/AnimationStateBase.as
Expand Up @@ -11,7 +11,7 @@ package away3d.animators
public class AnimationStateBase extends NamedAssetBase implements IAsset
{
private var _rootNode:IAnimationNode;
private var _owner:IAnimationLibrary;
private var _owner:IAnimationSet;
private var _stateName:String;

public function get rootNode():IAnimationNode
Expand All @@ -38,7 +38,7 @@ package away3d.animators
return AssetType.ANIMATION_STATE;
}

public function addOwner(owner:IAnimationLibrary, stateName:String):void
public function addOwner(owner:IAnimationSet, stateName:String):void
{
_owner = owner;
_stateName = stateName;
Expand Down
10 changes: 5 additions & 5 deletions src/away3d/animators/AnimatorBase.as
Expand Up @@ -20,7 +20,7 @@ package away3d.animators
public class AnimatorBase extends EventDispatcher
{
private var _broadcaster : Sprite = new Sprite();
private var _animationLibrary : IAnimationLibrary;
private var _animationSet : IAnimationSet;
private var _isPlaying : Boolean;
private var _startEvent : AnimatorEvent;
private var _stopEvent : AnimatorEvent;
Expand All @@ -30,14 +30,14 @@ package away3d.animators
protected var _stateInvalid:Boolean;
protected var _owners : Vector.<Mesh> = new Vector.<Mesh>();

public function get animationLibrary() : IAnimationLibrary
public function get animationSet() : IAnimationSet
{
return _animationLibrary;
return _animationSet;
}

public function AnimatorBase(animationLibrary:IAnimationLibrary)
public function AnimatorBase(animationSet:IAnimationSet)
{
_animationLibrary = animationLibrary;
_animationSet = animationSet;
// start();
}

Expand Down
4 changes: 2 additions & 2 deletions src/away3d/animators/BlendingSkeletonAnimator.as
Expand Up @@ -28,9 +28,9 @@ package away3d.animators
/**
* Creates a new AnimationSequenceController object.
*/
public function BlendingSkeletonAnimator(skeletonAnimationLibrary:SkeletonAnimationLibrary, skeleton : Skeleton, forceCPU : Boolean = false)
public function BlendingSkeletonAnimator(skeletonAnimationSet:SkeletonAnimationSet, skeleton : Skeleton, forceCPU : Boolean = false)
{
super(skeletonAnimationLibrary, skeleton, forceCPU);
super(skeletonAnimationSet, skeleton, forceCPU);
_clips = [];
_activeAbsClips = new Vector.<int>();
_blendWeights = new Vector.<Number>();
Expand Down
Expand Up @@ -7,7 +7,7 @@ package away3d.animators
/**
* @author robbateman
*/
public interface IAnimationLibrary
public interface IAnimationSet
{
function get states():Vector.<IAnimationState>;

Expand Down
2 changes: 1 addition & 1 deletion src/away3d/animators/IAnimationState.as
Expand Up @@ -10,6 +10,6 @@ package away3d.animators

function get stateName():String;

function addOwner(owner:IAnimationLibrary, stateName:String):void;
function addOwner(owner:IAnimationSet, stateName:String):void;
}
}
2 changes: 1 addition & 1 deletion src/away3d/animators/IAnimator.as
Expand Up @@ -9,7 +9,7 @@ package away3d.animators
*/
public interface IAnimator
{
function get animationLibrary() : IAnimationLibrary
function get animationSet() : IAnimationSet

/**
* Sets the GPU render state required by the animation that is dependent of the rendered object.
Expand Down
Expand Up @@ -7,7 +7,7 @@ package away3d.animators
/**
* @author robbateman
*/
public class SkeletonAnimationLibrary extends AnimationLibraryBase implements IAnimationLibrary
public class SkeletonAnimationSet extends AnimationSetBase implements IAnimationSet
{
private var _jointsPerVertex : uint;

Expand All @@ -17,7 +17,7 @@ package away3d.animators
return _jointsPerVertex;
}

public function SkeletonAnimationLibrary(jointsPerVertex : uint = 4)
public function SkeletonAnimationSet(jointsPerVertex : uint = 4)
{
_jointsPerVertex = jointsPerVertex;
}
Expand Down
14 changes: 7 additions & 7 deletions src/away3d/animators/SkeletonAnimator.as
Expand Up @@ -37,7 +37,7 @@ package away3d.animators
private var _animationStates : Dictionary = new Dictionary();
private var _condensedMatrices : Vector.<Number>;

private var _skeletonAnimationLibrary:SkeletonAnimationLibrary;
private var _skeletonAnimationSet:SkeletonAnimationSet;
private var _skeleton : Skeleton;
private var _forceCPU : Boolean;
private var _useCondensedIndices : Boolean;
Expand All @@ -48,14 +48,14 @@ package away3d.animators
/**
* Creates a new AnimationSequenceController object.
*/
public function SkeletonAnimator(skeletonAnimationLibrary:SkeletonAnimationLibrary, skeleton : Skeleton, forceCPU : Boolean = false)
public function SkeletonAnimator(skeletonAnimationSet:SkeletonAnimationSet, skeleton : Skeleton, forceCPU : Boolean = false)
{
super(skeletonAnimationLibrary);
super(skeletonAnimationSet);

_skeletonAnimationLibrary = skeletonAnimationLibrary;
_skeletonAnimationSet = skeletonAnimationSet;
_skeleton = skeleton;
_forceCPU = forceCPU;
_jointsPerVertex = _skeletonAnimationLibrary.jointsPerVertex;
_jointsPerVertex = _skeletonAnimationSet.jointsPerVertex;

_numJoints = _skeleton.numJoints;
_globalMatrices = new Vector.<Number>(_numJoints*12, true);
Expand Down Expand Up @@ -125,7 +125,7 @@ package away3d.animators
stage3DProxy._context3D.setProgramConstantsFromVector(Context3DProgramType.VERTEX, vertexConstantOffset, _condensedMatrices, numCondensedJoints*3);
}
else {
if (_skeletonAnimationLibrary.usesCPU) {
if (_skeletonAnimationSet.usesCPU) {
var subGeomAnimState : SubGeomAnimationState = _animationStates[skinnedGeom] ||= new SubGeomAnimationState(skinnedGeom);

if (!subGeomAnimState.valid) {
Expand Down Expand Up @@ -343,7 +343,7 @@ package away3d.animators
public function testGPUCompatibility(pass : MaterialPassBase) : void
{
if (!_useCondensedIndices && (_forceCPU || _jointsPerVertex > 4 || pass.numUsedVertexConstants + _numJoints * 3 > 128)) {
_skeletonAnimationLibrary._usesCPU = true;
_skeletonAnimationSet._usesCPU = true;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/away3d/animators/SmoothSkeletonAnimator.as
Expand Up @@ -27,9 +27,9 @@ package away3d.animators
/**
* Creates a new AnimationSequenceController object.
*/
public function SmoothSkeletonAnimator(skeletonAnimationLibrary:SkeletonAnimationLibrary, skeleton : Skeleton, forceCPU : Boolean = false)
public function SmoothSkeletonAnimator(skeletonAnimationSet:SkeletonAnimationSet, skeleton : Skeleton, forceCPU : Boolean = false)
{
super(skeletonAnimationLibrary, skeleton, forceCPU);
super(skeletonAnimationSet, skeleton, forceCPU);
_clips = [];
_fadeOutClips = new Vector.<int>();
_fadeOutSpeeds = new Vector.<Number>();
Expand Down
@@ -1,13 +1,13 @@
package away3d.animators
{
import away3d.animators.IAnimationLibrary;
import away3d.animators.IAnimationSet;
import away3d.materials.passes.MaterialPassBase;
import away3d.core.managers.Stage3DProxy;

/**
* @author robbateman
*/
public class UVAnimationLibrary extends AnimationLibraryBase implements IAnimationLibrary
public class UVAnimationSet extends AnimationSetBase implements IAnimationSet
{
public function getAGALVertexCode(pass:MaterialPassBase, sourceRegisters:Array, targetRegisters:Array):String
{
Expand Down
Expand Up @@ -8,7 +8,7 @@ package away3d.animators
/**
* @author robbateman
*/
public class VertexAnimationLibrary extends AnimationLibraryBase implements IAnimationLibrary
public class VertexAnimationSet extends AnimationSetBase implements IAnimationSet
{

private var _numPoses : uint;
Expand Down Expand Up @@ -40,7 +40,7 @@ package away3d.animators
/**
* Creates a new AnimationSequenceController object.
*/
public function VertexAnimationLibrary(numPoses : uint = 2, blendMode : String = "absolute" )
public function VertexAnimationSet(numPoses : uint = 2, blendMode : String = "absolute" )
{
super();
_numPoses = numPoses;
Expand Down
20 changes: 10 additions & 10 deletions src/away3d/animators/VertexAnimator.as
Expand Up @@ -19,7 +19,7 @@ package away3d.animators
private var _activeNode : VertexClipNode;
private var _absoluteTime : Number;

private var _vertexAnimationLibrary:VertexAnimationLibrary;
private var _vertexAnimationSet:VertexAnimationSet;
private var _poses : Vector.<Geometry> = new Vector.<Geometry>();
private var _weights : Vector.<Number> = Vector.<Number>([1, 0, 0, 0]);
private var _numPoses : uint;
Expand All @@ -29,13 +29,13 @@ package away3d.animators
/**
* Creates a new AnimationSequenceController object.
*/
public function VertexAnimator(vertexAnimationLibrary:VertexAnimationLibrary )
public function VertexAnimator(vertexAnimationSet:VertexAnimationSet )
{
super(vertexAnimationLibrary);
super(vertexAnimationSet);

_vertexAnimationLibrary = vertexAnimationLibrary;
_numPoses = vertexAnimationLibrary.numPoses;
_blendMode = vertexAnimationLibrary.blendMode;
_vertexAnimationSet = vertexAnimationSet;
_numPoses = vertexAnimationSet.numPoses;
_blendMode = vertexAnimationSet.blendMode;
}

/**
Expand All @@ -44,7 +44,7 @@ package away3d.animators
*/
public function play(stateName : String) : void
{
_activeNode = (_vertexAnimationLibrary.getState(stateName) as VertexAnimationState).rootNode as VertexClipNode;
_activeNode = (_vertexAnimationSet.getState(stateName) as VertexAnimationState).rootNode as VertexClipNode;

if (!_activeNode)
throw new Error("Clip not found!");
Expand Down Expand Up @@ -81,7 +81,7 @@ package away3d.animators
// todo: add code for when running on cpu
var i : uint;
var len : uint = _numPoses;
var index : uint = _vertexAnimationLibrary.streamIndex;
var index : uint = _vertexAnimationSet.streamIndex;
var context : Context3D = stage3DProxy._context3D;

// if no poses defined, set temp data
Expand All @@ -91,7 +91,7 @@ package away3d.animators
stage3DProxy.setSimpleVertexBuffer(index + (j++), renderable.getVertexBuffer(stage3DProxy), Context3DVertexBufferFormat.FLOAT_3, renderable.vertexBufferOffset);
context.setProgramConstantsFromVector(Context3DProgramType.VERTEX, vertexConstantOffset, _weights, 1);

if (_vertexAnimationLibrary.useNormals)
if (_vertexAnimationSet.useNormals)
stage3DProxy.setSimpleVertexBuffer(index + (j++), renderable.getVertexNormalBuffer(stage3DProxy), Context3DVertexBufferFormat.FLOAT_3, renderable.normalBufferOffset);
}
}
Expand Down Expand Up @@ -119,7 +119,7 @@ package away3d.animators
stage3DProxy.setSimpleVertexBuffer(index + (j++), subGeom.getVertexBuffer(stage3DProxy), Context3DVertexBufferFormat.FLOAT_3, subGeom.vertexBufferOffset);
context.setProgramConstantsFromVector(Context3DProgramType.VERTEX, vertexConstantOffset, _weights, 1);

if (_vertexAnimationLibrary.useNormals)
if (_vertexAnimationSet.useNormals)
stage3DProxy.setSimpleVertexBuffer(index + (j++), subGeom.getVertexNormalBuffer(stage3DProxy), Context3DVertexBufferFormat.FLOAT_3, subGeom.normalBufferOffset);

}
Expand Down
10 changes: 0 additions & 10 deletions src/away3d/errors/AnimationLibraryError.as

This file was deleted.

10 changes: 10 additions & 0 deletions src/away3d/errors/AnimationSetError.as
@@ -0,0 +1,10 @@
package away3d.errors
{
public class AnimationSetError extends Error
{
public function AnimationSetError(message:String)
{
super(message);
}
}
}
2 changes: 1 addition & 1 deletion src/away3d/events/AssetEvent.as
Expand Up @@ -16,7 +16,7 @@ package away3d.events
public static const ANIMATION_COMPLETE : String = "animationComplete";
public static const TEXTURE_COMPLETE : String = "textureComplete";
public static const MATERIAL_COMPLETE : String = "materialComplete";
public static const ANIMATION_LIBRARY_COMPLETE : String = "animationLibraryComplete";
public static const ANIMATION_LIBRARY_COMPLETE : String = "animationSetComplete";
public static const ANIMATION_STATE_COMPLETE : String = "animationStateComplete";
public static const ANIMATION_NODE_COMPLETE : String = "animationNodeComplete";

Expand Down
2 changes: 1 addition & 1 deletion src/away3d/library/assets/AssetType.as
Expand Up @@ -11,7 +11,7 @@ package away3d.library.assets
public static const ANIMATION : String = 'animation';
public static const TEXTURE : String = 'texture';
public static const MATERIAL : String = 'material';
public static const ANIMATION_LIBRARY : String = 'animationLibrary';
public static const ANIMATION_LIBRARY : String = 'animationSet';
public static const ANIMATION_STATE : String = 'animationState';
public static const ANIMATION_NODE : String = 'animationNode';
}
Expand Down
8 changes: 4 additions & 4 deletions src/away3d/loaders/parsers/MD2Parser.as
Expand Up @@ -2,7 +2,7 @@ package away3d.loaders.parsers
{
import away3d.animators.nodes.VertexClipNode;
import away3d.animators.VertexAnimationState;
import away3d.animators.VertexAnimationLibrary;
import away3d.animators.VertexAnimationSet;
import flash.utils.Dictionary;
import away3d.arcane;
import away3d.core.base.Geometry;
Expand Down Expand Up @@ -58,7 +58,7 @@ package away3d.loaders.parsers
private var _vertIndices : Vector.<Number>;

// the current subgeom being built
private var _animationLibrary : VertexAnimationLibrary = new VertexAnimationLibrary();
private var _animationSet : VertexAnimationSet = new VertexAnimationSet();
private var _firstSubGeom : SubGeometry;
private var _uvs : Vector.<Number>;
private var _finalUV : Vector.<Number>;
Expand Down Expand Up @@ -431,7 +431,7 @@ package away3d.loaders.parsers
clip = new VertexClipNode();
var state : VertexAnimationState = new VertexAnimationState(clip);

_animationLibrary.addState(name, state);
_animationSet.addState(name, state);
_clipNodes[name] = clip;
// If another sequence was parsed before this one, starting
// a new sequence measn the previuos one is complete and can
Expand All @@ -450,7 +450,7 @@ package away3d.loaders.parsers

// Force finalizeAsset() to decide name
//_animator.name = "";
finalizeAsset(_animationLibrary);
finalizeAsset(_animationSet);

_parsedFrames = true;
}
Expand Down
8 changes: 4 additions & 4 deletions src/away3d/loaders/parsers/MD5MeshParser.as
@@ -1,7 +1,7 @@
package away3d.loaders.parsers
{
import away3d.animators.SkeletonAnimator;
import away3d.animators.SkeletonAnimationLibrary;
import away3d.animators.SkeletonAnimationSet;
import away3d.animators.skeleton.Skeleton;
import away3d.animators.skeleton.SkeletonJoint;
import away3d.arcane;
Expand Down Expand Up @@ -59,7 +59,7 @@ package away3d.loaders.parsers
private var _geometry : Geometry;

private var _skeleton : Skeleton;
private var _animationLibrary : SkeletonAnimationLibrary;
private var _animationSet : SkeletonAnimationSet;

private var _rotationQuat : Quaternion;

Expand Down Expand Up @@ -157,7 +157,7 @@ package away3d.loaders.parsers

if (_reachedEOF) {
calculateMaxJointCount();
_animationLibrary = new SkeletonAnimationLibrary(_maxJointCount);
_animationSet = new SkeletonAnimationSet(_maxJointCount);

_mesh = new Mesh();
_geometry = _mesh.geometry;
Expand All @@ -171,7 +171,7 @@ package away3d.loaders.parsers

finalizeAsset(_mesh);
finalizeAsset(_skeleton);
finalizeAsset(_animationLibrary);
finalizeAsset(_animationSet);
return ParserBase.PARSING_DONE;
}
}
Expand Down

0 comments on commit b73cf62

Please sign in to comment.