PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: JointHandler.h * 00003 * 00004 * Copyright (C) 2002-2012 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_JOINTHANDLER_H__ 00024 #define __PLMESH_JOINTHANDLER_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLCore/Container/ElementHandler.h> 00032 #include "PLMesh/Joint.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Namespace ] 00037 //[-------------------------------------------------------] 00038 namespace PLMesh { 00039 00040 00041 //[-------------------------------------------------------] 00042 //[ Classes ] 00043 //[-------------------------------------------------------] 00044 /** 00045 * @brief 00046 * Joint handler class 00047 */ 00048 class JointHandler : public PLCore::ElementHandler<Joint>, public JointState { 00049 00050 00051 //[-------------------------------------------------------] 00052 //[ Public functions ] 00053 //[-------------------------------------------------------] 00054 public: 00055 /** 00056 * @brief 00057 * Constructor 00058 */ 00059 PLMESH_API JointHandler(); 00060 00061 /** 00062 * @brief 00063 * Destructor 00064 */ 00065 PLMESH_API virtual ~JointHandler(); 00066 00067 /** 00068 * @brief 00069 * Returns whether or not this joint is user controlled 00070 * 00071 * @return 00072 * 'true' if this joint is user controlled, else 'false' 00073 * 00074 * @remarks 00075 * By default, joints are NOT user controlled which means their absolute translation 00076 * and rotation is calculated automatically by the animation system by using their relative 00077 * states. This way, multiple 'offline' (predefined :) animations can be mixed together to get 00078 * a final animation where animations can only influence some parts of the skeleton. If a 00079 * joint is marked as 'used controlled', the animations system does not calculate the 00080 * absolute values by itself. In this case, this joints can be fully 'online' (dynamic) animated 00081 * by using for instance physics objects in the case of ragdoll animations. Normally only a 00082 * few joints are user controlled while others are still updated automatically relative to 00083 * their parents. 00084 */ 00085 PLMESH_API bool IsUserControlled() const; 00086 00087 /** 00088 * @brief 00089 * Sets whether or not this joint is user controlled 00090 * 00091 * @param[in] bUserControlled 00092 * 'true' if this joint is user controlled, else 'false' 00093 * 00094 * @see 00095 * - IsUserControlled() 00096 */ 00097 PLMESH_API void SetUserControlled(bool bUserControlled = false); 00098 00099 /** 00100 * @brief 00101 * Calculates the current absolute translation and rotation states and the 00102 * transform joint matrix 00103 * 00104 * @param[in] pJointHandler 00105 * Parent joint of this joint, if a null pointer there's no parent joint 00106 * 00107 * @return 00108 * 'true' if all went fine, else 'false' (maybe the handler has no joint or 00109 * the given parent joint is invalid) 00110 */ 00111 PLMESH_API bool CalculateStates(const JointHandler *pJointHandler = nullptr); 00112 00113 /** 00114 * @brief 00115 * Copy operator 00116 * 00117 * @param[in] cSource 00118 * Source to copy from 00119 * 00120 * @return 00121 * This joint state 00122 */ 00123 PLMESH_API JointHandler &operator =(const JointHandler &cSource); 00124 00125 /** 00126 * @brief 00127 * Compares two joint handlers 00128 * 00129 * @param[in] cJointHandler 00130 * Joint handler to compare with 00131 * 00132 * @return 00133 * 'true' if both joint handler are equal, else 'false' 00134 */ 00135 PLMESH_API bool operator ==(const JointHandler &cJointHandler) const; 00136 00137 00138 //[-------------------------------------------------------] 00139 //[ Private data ] 00140 //[-------------------------------------------------------] 00141 private: 00142 bool m_bUserControlled; /**< Is this joint user controlled? */ 00143 00144 00145 }; 00146 00147 00148 //[-------------------------------------------------------] 00149 //[ Namespace ] 00150 //[-------------------------------------------------------] 00151 } // PLMesh 00152 00153 00154 #endif // __PLMESH_JOINTHANDLER_H__
|