PixelLightAPI  .
MeshAnimationManager.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: MeshAnimationManager.h                         *
00003  *
00004  *  Copyright (C) 2002-2011 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLMESH_MESHANIMATIONMANAGER_H__
00024 #define __PLMESH_MESHANIMATIONMANAGER_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLCore/Base/Object.h>
00032 #include <PLRenderer/Animation/AnimationManager.h>
00033 #include "PLMesh/PLMesh.h"
00034 
00035 
00036 //[-------------------------------------------------------]
00037 //[ Namespace                                             ]
00038 //[-------------------------------------------------------]
00039 namespace PLMesh {
00040 
00041 
00042 //[-------------------------------------------------------]
00043 //[ Forward declarations                                  ]
00044 //[-------------------------------------------------------]
00045 class MeshHandler;
00046 
00047 
00048 //[-------------------------------------------------------]
00049 //[ Classes                                               ]
00050 //[-------------------------------------------------------]
00051 /**
00052 *  @brief
00053 *    This is a manager for the mesh animation element
00054 */
00055 class MeshAnimationManager : public PLRenderer::AnimationManager, public PLCore::Object {
00056 
00057 
00058     //[-------------------------------------------------------]
00059     //[ RTTI interface                                        ]
00060     //[-------------------------------------------------------]
00061     pl_class(PLMESH_RTTI_EXPORT, MeshAnimationManager, "PLMesh", PLCore::Object, "This is a manager for the mesh animation element")
00062     pl_class_end
00063 
00064 
00065     //[-------------------------------------------------------]
00066     //[ Public functions                                      ]
00067     //[-------------------------------------------------------]
00068     public:
00069         /**
00070         *  @brief
00071         *    Returns whether the mesh animation manager will reset the current joint states
00072         *    within the Apply() function before the current animation states are applied
00073         *
00074         *  @return
00075         *    'true' if the mesh animation manager will reset the current joint states, else 'false'
00076         *
00077         *  @remarks
00078         *    Normally, the manager will reset the current states to the base settings
00079         *    before the animation states are 'added'. If this isn't done automatically,
00080         *    you have to do this by yourself - but this way, you can do more complex
00081         *    animations.
00082         */
00083         PLMESH_API bool GetResetJointStates() const;
00084 
00085         /**
00086         *  @brief
00087         *    Sets whether the mesh animation manager will reset the current joint states
00088         *    within the Apply() function before the current animation states are applied
00089         *
00090         *  @param[in] bReset
00091         *    Reset states?
00092         */
00093         PLMESH_API void SetResetJointStates(bool bReset = true);
00094 
00095         /**
00096         *  @brief
00097         *    Returns whether the mesh animation manager will reset the current morph weights
00098         *    within the Apply() function before the current animation weights are applied
00099         *
00100         *  @return
00101         *    'true' if the mesh animation manager will reset the current morph weights, else 'false'
00102         *
00103         *  @see
00104         *    - GetResetJointStates()
00105         */
00106         PLMESH_API bool GetResetMorphWeights() const;
00107 
00108         /**
00109         *  @brief
00110         *    Sets whether the mesh animation manager will reset the current morph weights
00111         *    within the Apply() function before the current animation weights are applied
00112         *
00113         *  @param[in] bReset
00114         *    Reset weights?
00115         */
00116         PLMESH_API void SetResetMorphWeights(bool bReset = true);
00117 
00118         /**
00119         *  @brief
00120         *    Returns whether the mesh animation manager will apply base joint states before calculating
00121         *    the current states
00122         *
00123         *  @return
00124         *    'true' if apply base joint states before calculating the current states, else 'false'
00125         */
00126         PLMESH_API bool GetApplyBaseJointStates() const;
00127 
00128         /**
00129         *  @brief
00130         *    Sets whether the mesh animation manager will apply base joint states before calculating
00131         *    the current states
00132         *
00133         *  @param[in] bApply
00134         *    Apply base joint states before calculating the current states?
00135         */
00136         PLMESH_API void SetApplyBaseJointStates(bool bApply = true);
00137 
00138 
00139     //[-------------------------------------------------------]
00140     //[ Protected functions                                   ]
00141     //[-------------------------------------------------------]
00142     public:
00143         /**
00144         *  @brief
00145         *    Default constructor
00146         */
00147         PLMESH_API MeshAnimationManager();
00148 
00149         /**
00150         *  @brief
00151         *    Destructor
00152         */
00153         PLMESH_API virtual ~MeshAnimationManager();
00154 
00155 
00156     //[-------------------------------------------------------]
00157     //[ Public virtual MeshAnimationManager functions         ]
00158     //[-------------------------------------------------------]
00159     public:
00160         /**
00161         *  @brief
00162         *    Updates the mesh animation manager
00163         *
00164         *  @param[in] fTimeDifference
00165         *    Past time since last frame (use e.g. PLCore::Timing::GetInstance()->GetTimeDifference())
00166         *
00167         *  @return
00168         *    'true' if all went fine, else 'false'
00169         */
00170         PLMESH_API virtual bool Update(float fTimeDifference);
00171 
00172         /**
00173         *  @brief
00174         *    Applies all animations to the given mesh handler
00175         *
00176         *  @param[in] cMeshHandler
00177         *    Mesh handler to apply the animations on
00178         *
00179         *  @return
00180         *    'true' if all went fine, else 'false'
00181         *
00182         *  @remarks
00183         *    This base implementation will only calculate the current skeleton handler
00184         *    joint states and morph target influences. Use a derived mesh animation manager
00185         *    to for instance manipulate the mesh, too.
00186         */
00187         PLMESH_API virtual bool Apply(MeshHandler &cMeshHandler) const;
00188 
00189 
00190     //[-------------------------------------------------------]
00191     //[ Private data                                          ]
00192     //[-------------------------------------------------------]
00193     private:
00194         bool m_bResetJointStates;       /**< Reset joint states? */
00195         bool m_bResetMorphWeights;      /**< Reset morph weights? */
00196         bool m_bApplyBaseJointStates;   /**< Apply base joint states? */
00197 
00198 
00199 };
00200 
00201 
00202 //[-------------------------------------------------------]
00203 //[ Namespace                                             ]
00204 //[-------------------------------------------------------]
00205 } // PLMesh
00206 
00207 
00208 #endif // __PLMESH_MESHANIMATIONMANAGER_H__


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:50:57
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported