PixelLightAPI  .
Skeleton.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: Skeleton.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_SKELETON_H__
00024 #define __PLMESH_SKELETON_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLCore/Container/List.h>
00032 #include <PLCore/Container/Element.h>
00033 #include <PLCore/Container/ElementManager.h>
00034 #include <PLCore/Container/Resource.h>
00035 #include <PLCore/Container/ResourceHandler.h>
00036 #include <PLCore/Container/ResourceManager.h>
00037 #include "PLMesh/JointAni.h"
00038 #include "PLMesh/Joint.h"
00039 
00040 
00041 //[-------------------------------------------------------]
00042 //[ Namespace                                             ]
00043 //[-------------------------------------------------------]
00044 namespace PLMesh {
00045 
00046 
00047 //[-------------------------------------------------------]
00048 //[ Classes                                               ]
00049 //[-------------------------------------------------------]
00050 /**
00051 *  @brief
00052 *    Hierarchical skeleton class
00053 */
00054 class Skeleton : public PLCore::Resource<Skeleton>, public PLCore::ElementManager<Joint>, public JointAni {
00055 
00056 
00057     //[-------------------------------------------------------]
00058     //[ Friends                                               ]
00059     //[-------------------------------------------------------]
00060     friend class SkeletonManager;
00061 
00062 
00063     //[-------------------------------------------------------]
00064     //[ Public functions                                      ]
00065     //[-------------------------------------------------------]
00066     public:
00067         /**
00068         *  @brief
00069         *    Destructor
00070         */
00071         PLMESH_API virtual ~Skeleton();
00072 
00073         //[-------------------------------------------------------]
00074         //[ Joints                                                ]
00075         //[-------------------------------------------------------]
00076         /**
00077         *  @brief
00078         *    Returns the skeleton root joint indices
00079         *
00080         *  @return
00081         *    Skeleton root joint indices
00082         *
00083         *  @note
00084         *    Must be called after joint parent/child manipulation
00085         */
00086         PLMESH_API const PLCore::Array<PLCore::uint32> &GetRootJoints() const;
00087 
00088         /**
00089         *  @brief
00090         *    Updates the joint information
00091         *
00092         *  @see
00093         *    - GetRootJoints()
00094         */
00095         PLMESH_API void UpdateJointInformation();
00096 
00097 
00098     //[-------------------------------------------------------]
00099     //[ Private functions                                     ]
00100     //[-------------------------------------------------------]
00101     private:
00102         /**
00103         *  @brief
00104         *    Constructor
00105         *
00106         *  @param[in] cManager
00107         *    Skeleton manager using this resource
00108         *  @param[in] sName
00109         *    Resource name to set
00110         */
00111         Skeleton(PLCore::ResourceManager<Skeleton> &cManager, const PLCore::String &sName);
00112 
00113         /**
00114         *  @brief
00115         *    Recursive joint state calculations
00116         *
00117         *  @param[in] cJoint
00118         *    Current joint to process
00119         *  @param[in] pParentJoint
00120         *    Current parent joint to process, can be a null pointer
00121         */
00122         void RecCalculateStates(Joint &cJoint, Joint *pParentJoint = nullptr) const;
00123 
00124 
00125     //[-------------------------------------------------------]
00126     //[ Private data                                          ]
00127     //[-------------------------------------------------------]
00128     private:
00129         PLCore::Array<PLCore::uint32> m_lstRootJoints;  /**< Array of root joint indices */
00130 
00131 
00132     //[-------------------------------------------------------]
00133     //[ Private virtual PLCore::ElementManager functions      ]
00134     //[-------------------------------------------------------]
00135     private:
00136         virtual Joint *CreateElement(const PLCore::String &sName) override;
00137 
00138 
00139     //[-------------------------------------------------------]
00140     //[ Public virtual AnimationInfo functions                ]
00141     //[-------------------------------------------------------]
00142     public:
00143         PLMESH_API Skeleton &operator =(const Skeleton &cSource);
00144         PLMESH_API virtual PLCore::String GetSourceName() const override;
00145 
00146 
00147     //[-------------------------------------------------------]
00148     //[ Public virtual PLCore::Loadable functions             ]
00149     //[-------------------------------------------------------]
00150     public:
00151         PLMESH_API virtual bool Unload() override;
00152         PLMESH_API virtual PLCore::String GetLoadableTypeName() const override;
00153 
00154 
00155 };
00156 
00157 
00158 //[-------------------------------------------------------]
00159 //[ Namespace                                             ]
00160 //[-------------------------------------------------------]
00161 } // PLMesh
00162 
00163 
00164 #endif // __PLMESH_SKELETON_H__


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