blendstate

This commit is contained in:
yangxiao 2014-06-13 09:12:29 +08:00
parent ae0b850d89
commit 09fe7e13b7
2 changed files with 15 additions and 7 deletions

View File

@ -87,7 +87,7 @@ const Mat4& Bone::getWorldMat()
/**
* Set AnimationValue. set to its transform
*/
void Bone::setAnimationValueTranslation(float* value)
void Bone::setAnimationValueTranslation(float* value, float weight)
{
static const int bytes = 3 * sizeof(float);
if (memcmp(&_localTranslate.x, value, bytes) != 0)
@ -96,7 +96,7 @@ void Bone::setAnimationValueTranslation(float* value)
_localTranslate.set(value);
}
}
void Bone::setAnimationValueRotation(float* value)
void Bone::setAnimationValueRotation(float* value, float weight)
{
static const int bytes = 4 * sizeof(float);
if (memcmp(&_localRot.x, value, bytes) != 0)
@ -105,7 +105,7 @@ void Bone::setAnimationValueRotation(float* value)
_localRot.set(value);
}
}
void Bone::setAnimationValueScale(float* value)
void Bone::setAnimationValueScale(float* value, float weight)
{
static const int bytes = 3 * sizeof(float);
if (memcmp(&_localScale.x, value, bytes) != 0)
@ -220,6 +220,11 @@ void Bone::updateLocalMat()
_dirtyFlag = 0;
}
void Bone::clearBlendState()
{
_blendStates.clear();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static int PALETTE_ROWS = 3;

View File

@ -62,9 +62,9 @@ public:
/**
* Set AnimationValue. set to its transform
*/
void setAnimationValueTranslation(float* value);
void setAnimationValueRotation(float* value);
void setAnimationValueScale(float* value);
void setAnimationValueTranslation(float* value, float weight = 1.0f);
void setAnimationValueRotation(float* value, float weight = 1.0f);
void setAnimationValueScale(float* value, float weight = 1.0f);
/**
* Creates C3DBone.
@ -98,6 +98,7 @@ public:
protected:
enum DirtyFlag
{
Dirty_Translate = 1,
@ -126,6 +127,8 @@ protected:
*/
void updateLocalMat();
void clearBlendState();
std::string _name;
/**
* The Mat4 representation of the Joint's bind pose.
@ -151,7 +154,7 @@ protected:
Mat4 _world;
Mat4 _local;
BoneBlendState _blendState;
std::vector<BoneBlendState> _blendStates;
Vec3 _localTranslate;
Quaternion _localRot;
Vec3 _localScale;