/******************************************************************************
libx42.net - skinned vertex animation library (.NET API)
Copyright (C) 2007 HermitWorks Entertainment Corporation
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the
Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301, USA.
******************************************************************************/
#pragma once
#include "DataStream.h"
#include "Vector.h"
#include "Quaternion.h"
#include "Affine.h"
namespace Libx42
{
ref class Model;
ref class TempMem;
generic< typename T >
where T : value class
ref class DataStream;
public ref class Pose
{
public:
property Model^ Owner { Model^ get( void ) { return owner; } }
///
/// Builds the pose data at a specific point in time.
///
///
/// The relative animation time to build the pose
/// at (in the range [0, 1]).
///
///
/// This method is equivalent to calling ,
/// , and in that order.
///
void Build( float time );
///
/// Builds the local bone data values
/// at a specific point in time.
///
///
/// The relative animation time to build the pose
/// at (in the range [0, 1]).
///
///
/// This function only updates the data in ,
/// , and . It
/// has no affect on , ,
/// or the internal ready-for-animation data buffer.
///
void GeneratePoseValues( float time );
///
/// Updates the values in and
/// to reflect the values in ,
/// , and .
///
void GenerateMatrices( void );
///
/// Updates the internal ready-for-animation data buffer to reflect the
/// values in .
///
void GeneratePoseData( void );
property DataStream< Math::Vector3 >^ BonePositionValues
{
DataStream< Math::Vector3 >^ get( void ) { return posStream; }
}
property DataStream< Math::Quaternion >^ BoneRotationValues
{
DataStream< Math::Quaternion >^ get( void ) { return rotStream; }
}
property DataStream< Math::Vector3 >^ BoneScaleValues
{
DataStream< Math::Vector3 >^ get( void ) { return scaleStream; }
}
property DataStream< Math::Affine >^ BoneMatrices { DataStream< Math::Affine >^ get( void ) { return boneMatsColl; } }
property DataStream< Math::Affine >^ TagMatrices { DataStream< Math::Affine >^ get( void ) { return tagMatsColl; } }
internal:
Pose( Model ^owner );
affine_t *boneMats;
private:
Model ^owner;
x42animFrames_t *animFrames;
x42animLerp_t *animLerp;
DataStream< Math::Vector3 >^ posStream;
DataStream< Math::Quaternion >^ rotStream;
DataStream< Math::Vector3 >^ scaleStream;
DataStream< Math::Affine > ^boneMatsColl;
affine_t *tagMats;
DataStream< Math::Affine > ^tagMatsColl;
void *poseDataBuf;
~Pose();
!Pose();
};
};