PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: MeshHandler.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_MESHHANDLER_H__ 00024 #define __PLMESH_MESHHANDLER_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLCore/Base/Event/EventHandler.h> 00032 #include <PLCore/Container/Bitset.h> 00033 #include <PLCore/Container/ResourceManager.h> 00034 #include <PLCore/Container/ResourceHandler.h> 00035 #include <PLMath/Plane.h> 00036 #include "PLMesh/Mesh.h" 00037 00038 00039 //[-------------------------------------------------------] 00040 //[ Forward declarations ] 00041 //[-------------------------------------------------------] 00042 namespace PLMath { 00043 class Vector3; 00044 class PlaneSet; 00045 class AABoundingBox; 00046 } 00047 namespace PLGraphics { 00048 class Color4; 00049 } 00050 namespace PLRenderer { 00051 class Font; 00052 class Material; 00053 class Renderer; 00054 class Animation; 00055 class IndexBuffer; 00056 class VertexBuffer; 00057 class AnimationInfo; 00058 class MaterialHandler; 00059 } 00060 namespace PLMesh { 00061 class Mesh; 00062 class MeshEdge; 00063 class JointHandler; 00064 class MeshTriangle; 00065 class MeshLODLevel; 00066 class SkeletonHandler; 00067 class MeshAnimationManager; 00068 } 00069 00070 00071 //[-------------------------------------------------------] 00072 //[ Namespace ] 00073 //[-------------------------------------------------------] 00074 namespace PLMesh { 00075 00076 00077 //[-------------------------------------------------------] 00078 //[ Classes ] 00079 //[-------------------------------------------------------] 00080 /** 00081 * @brief 00082 * Mesh handler 00083 * 00084 * @remarks 00085 * A mesh handler will use a mesh and is able to use own materials and an own 00086 * vertex buffer for e.g. animations. Whenever working with meshes you should use 00087 * a mesh handler!\n 00088 * Animation example\n 00089 * pMH->CreateMeshAnimationManager(); // Create a mesh animation manager first!\n 00090 * Animation *pAnimation = pMH->GetMeshAnimationManager()->Create("attack");\n 00091 * pAnimation->Start(pMH->GetAnimationInfo(pAnimation->GetName())); 00092 * 00093 * @note 00094 * - Whenever you manipulated mesh data "from outside" you need to call "MeshUpdateRequired()" to set a "dirty"-flag 00095 * - Animation frame changes automatically set the internal 'mesh update required'-flag 00096 */ 00097 class MeshHandler : public PLCore::ResourceHandler<Mesh> { 00098 00099 00100 //[-------------------------------------------------------] 00101 //[ Public functions ] 00102 //[-------------------------------------------------------] 00103 public: 00104 //[-------------------------------------------------------] 00105 //[ Main functions ] 00106 //[-------------------------------------------------------] 00107 /** 00108 * @brief 00109 * Constructor 00110 */ 00111 PLMESH_API MeshHandler(); 00112 00113 /** 00114 * @brief 00115 * Destructor 00116 */ 00117 PLMESH_API virtual ~MeshHandler(); 00118 00119 /** 00120 * @brief 00121 * Returns the used renderer 00122 * 00123 * @return 00124 * Pointer to the renderer that is used, can be a null pointer 00125 */ 00126 PLMESH_API PLRenderer::Renderer *GetRenderer() const; 00127 00128 /** 00129 * @brief 00130 * Whenever you manipulated mesh data "from outside" you need to call this function to set a "dirty"-flag 00131 */ 00132 PLMESH_API void MeshUpdateRequired(); 00133 00134 /** 00135 * @brief 00136 * Returns the used mesh 00137 * 00138 * @return 00139 * Pointer to the used mesh, can be a null pointer 00140 * 00141 * @note 00142 * - Call "MeshUpdateRequired()" to set a "dirty"-flag if you manipulated the mesh 00143 */ 00144 PLMESH_API Mesh *GetMesh() const; 00145 00146 /** 00147 * @brief 00148 * Sets the used mesh 00149 * 00150 * @param[in] pMesh 00151 * Pointer to the mesh which should be used, can be a null pointer 00152 * 00153 * @return 00154 * 'true' if all went fine, else 'false' 00155 * 00156 * @note 00157 * - The mesh handler materials are set to the mesh materials, therefore 00158 * first load/setup a mesh and then use this function! 00159 * - After a mesh itself was manipulated, for instance the material list was 00160 * changed you should reset the mesh in your mesh handler! 00161 */ 00162 PLMESH_API bool SetMesh(Mesh *pMesh = nullptr); 00163 00164 /** 00165 * @brief 00166 * Updates the mesh handler 00167 * 00168 * @param[in] fTimeDifference 00169 * Past time since last frame (use e.g. PLCore::Timing::GetInstance()->GetTimeDifference()) 00170 * @param[in] nLODLevel 00171 * LOD level to use 00172 * 00173 * @remarks 00174 * This function for instance updates the animations but will also setup 00175 * individual mesh data required for drawing the mesh the mesh handler is 00176 * using. 00177 */ 00178 PLMESH_API void Update(float fTimeDifference, PLCore::uint32 nLODLevel = 0); 00179 00180 //[-------------------------------------------------------] 00181 //[ Draw functions ] 00182 //[-------------------------------------------------------] 00183 /** 00184 * @brief 00185 * Draws the mesh 00186 * 00187 * @param[in] bBlend 00188 * Draw only mesh parts which use a blended material? 00189 * @param[in] bUseMaterials 00190 * Use the mesh materials? If 'false' no material is bound. 00191 * 00192 * @note 00193 * - Update() must have been called before the mesh can be drawn because 00194 * this function setup the individual mesh data 00195 */ 00196 PLMESH_API void Draw(bool bBlend = false, bool bUseMaterials = true) const; 00197 00198 /** 00199 * @brief 00200 * Draws the vertices of the mesh (for debugging) 00201 * @param[in] cColor 00202 * Color to use 00203 * 00204 * @note 00205 * - Ensure that correct render states are set... 00206 */ 00207 PLMESH_API void DrawVertices(const PLGraphics::Color4 &cColor) const; 00208 00209 /** 00210 * @brief 00211 * Draws the normals of the mesh (for debugging) 00212 * 00213 * @param[in] cColor 00214 * Color to use 00215 * @param[in] mWorldViewProjection 00216 * World view projection matrix to use 00217 * @param[in] fScale 00218 * Normal scale 00219 * @param[in] fLineWidth 00220 * Line width 00221 * 00222 * @see 00223 * - DrawVertices() 00224 */ 00225 PLMESH_API void DrawNormals(const PLGraphics::Color4 &cColor, const PLMath::Matrix4x4 &mWorldViewProjection, float fScale = 1.0f, float fLineWidth = 1.0f) const; 00226 00227 /** 00228 * @brief 00229 * Draws the tangents of the mesh (for debugging) 00230 * 00231 * @param[in] cColor 00232 * Color to use 00233 * @param[in] mWorldViewProjection 00234 * World view projection matrix to use 00235 * @param[in] fScale 00236 * Tangent scale 00237 * @param[in] fLineWidth 00238 * Line width 00239 * 00240 * @see 00241 * - DrawVertices() 00242 */ 00243 PLMESH_API void DrawTangents(const PLGraphics::Color4 &cColor, const PLMath::Matrix4x4 &mWorldViewProjection, float fScale = 1.0f, float fLineWidth = 1.0f) const; 00244 00245 /** 00246 * @brief 00247 * Draws the binormals of the mesh (for debugging) 00248 * 00249 * @param[in] cColor 00250 * Color to use 00251 * @param[in] mWorldViewProjection 00252 * World view projection matrix to use 00253 * @param[in] fScale 00254 * Binormals scale 00255 * @param[in] fLineWidth 00256 * Line width 00257 * 00258 * @see 00259 * - DrawVertices() 00260 */ 00261 PLMESH_API void DrawBinormals(const PLGraphics::Color4 &cColor, const PLMath::Matrix4x4 &mWorldViewProjection, float fScale = 1.0f, float fLineWidth = 1.0f) const; 00262 00263 /** 00264 * @brief 00265 * Draws the vertex numbers of the mesh (for debugging) 00266 * 00267 * @param[in] cFont 00268 * Font to use 00269 * @param[in] cColor 00270 * Color to use 00271 * @param[in] mWorldViewProjection 00272 * World view projection matrix to use 00273 * 00274 * @see 00275 * - DrawVertices() 00276 */ 00277 PLMESH_API void DrawVertexNumbers(PLRenderer::Font &cFont, const PLGraphics::Color4 &cColor, const PLMath::Matrix4x4 &mWorldViewProjection) const; 00278 00279 /** 00280 * @brief 00281 * Draws the anchor points of the mesh (for debugging) 00282 * 00283 * @param[in] cFont 00284 * Font to use 00285 * @param[in] cColor 00286 * Color to use 00287 * @param[in] mWorldViewProjection 00288 * World view projection matrix to use 00289 * 00290 * @see 00291 * - DrawVertices() 00292 */ 00293 PLMESH_API void DrawAnchorPoints(PLRenderer::Font &cFont, const PLGraphics::Color4 &cColor, const PLMath::Matrix4x4 &mWorldViewProjection) const; 00294 00295 //[-------------------------------------------------------] 00296 //[ Material functions ] 00297 //[-------------------------------------------------------] 00298 /** 00299 * @brief 00300 * Returns the number of materials 00301 * 00302 * @return 00303 * Number of materials 00304 */ 00305 PLMESH_API PLCore::uint32 GetNumOfMaterials() const; 00306 00307 /** 00308 * @brief 00309 * Gets one of the mesh handler's materials 00310 * 00311 * @param[in] nMaterial 00312 * Number of the material to get 00313 * 00314 * @return 00315 * Pointer to the material, or a null pointer 00316 */ 00317 PLMESH_API PLRenderer::Material *GetMaterial(PLCore::uint32 nMaterial = 0) const; 00318 00319 /** 00320 * @brief 00321 * Sets one of the mesh handler's materials 00322 * 00323 * @param[in] nMaterial 00324 * Number of the material to set 00325 * @param[in] pMaterial 00326 * Pointer to the material to set, can be a null pointer 00327 * 00328 * @return 00329 * 'true' if all went fine, else 'false' 00330 */ 00331 PLMESH_API bool SetMaterial(PLCore::uint32 nMaterial, PLRenderer::Material *pMaterial); 00332 00333 //[-------------------------------------------------------] 00334 //[ Morph target functions ] 00335 //[-------------------------------------------------------] 00336 /** 00337 * @brief 00338 * Returns an array holding the the base weight of each morph target 00339 * 00340 * @return 00341 * Morph target base weights 00342 * 00343 * @see 00344 * - Have a look at the mesh class Mesh for more morph target stuff 00345 * 00346 * @note 00347 * - Use whenever possible the 'const' version of this function (performance) 00348 * - The none 'const' version automatically sets the internal 'mesh update required'-flag 00349 */ 00350 PLMESH_API PLCore::Array<float> &GetBaseMorphTargetWeights(); 00351 PLMESH_API const PLCore::Array<float> &GetBaseMorphTargetWeights() const; 00352 00353 /** 00354 * @brief 00355 * Returns an array holding the the current weight of each morph target 00356 * 00357 * @return 00358 * Current morph target weights 00359 * 00360 * @note 00361 * - This current weights are changed automatically through animations, use 00362 * the base weights to set the 'general' base weight 00363 * 00364 * @see 00365 * - GetBaseMorphTargetWeights() 00366 * 00367 * @note 00368 * - Use whenever possible the 'const' version of this function (performance) 00369 * - The none 'const' version automatically sets the internal 'mesh update required'-flag 00370 */ 00371 PLMESH_API PLCore::Array<float> &GetMorphTargetWeights(); 00372 PLMESH_API const PLCore::Array<float> &GetMorphTargetWeights() const; 00373 00374 //[-------------------------------------------------------] 00375 //[ Animation functions ] 00376 //[-------------------------------------------------------] 00377 /** 00378 * @brief 00379 * Returns the skeleton handler 00380 * 00381 * @return 00382 * The mesh handlers skeleton handler, a null pointer if there's no such handler 00383 * 00384 * @note 00385 * - Call "MeshUpdateRequired()" to set a "dirty"-flag if you manipulated the skeleton 00386 */ 00387 PLMESH_API SkeletonHandler *GetSkeletonHandler() const; 00388 00389 /** 00390 * @brief 00391 * Returns the mesh animation manager 00392 * 00393 * @return 00394 * The mesh handlers animation manager, a null pointer if there's no such manager 00395 * 00396 * @note 00397 * - By default the mesh handler has no animation manager, you have 00398 * to create a manager using CreateMeshAnimationManager() by yourself! 00399 */ 00400 PLMESH_API MeshAnimationManager *GetMeshAnimationManager() const; 00401 00402 /** 00403 * @brief 00404 * Creates the mesh animation manager 00405 * 00406 * @param[in] sName 00407 * Name of the mesh animation manager class to use, empty to 00408 * destroy the actual manager without creating a new one 00409 * 00410 * @return 00411 * The created mesh handlers animation manager, a null pointer on error 00412 * (maybe unknown class or the class is not derived from 'PLMesh::MeshAnimationManager') 00413 */ 00414 PLMESH_API MeshAnimationManager *CreateMeshAnimationManager(const PLCore::String &sName = "PLMesh::MeshAnimationManagerSoftware"); 00415 00416 /** 00417 * @brief 00418 * Returns a list of all currently available animations 00419 * 00420 * @param[out] lstAnimations 00421 * Receives a list of all currently available animations (list is cleared automatically before it's filled) 00422 * 00423 * @see 00424 * - GetAnimationInfo() 00425 */ 00426 PLMESH_API void GetAnimationsList(PLCore::Array<PLCore::String> &lstAnimations) const; 00427 00428 /** 00429 * @brief 00430 * Returns a pointer to the requested animation information 00431 * 00432 * @param[in] sName 00433 * Name of the animation information 00434 * @param[in] nLogMessage 00435 * Should a warning message be written into the log if the requested 00436 * animation information wasn't found? If < 0, write no log message, 00437 * else the integer indicates the debug mode where the message should be written. 00438 * 00439 * @return 00440 * Pointer to the requested animation information, a null pointer if there was an error 00441 * 00442 * @remarks 00443 * Using this function you are e.g. able to backup pointers to the animation information\n 00444 * in a quit comfortable way for instance in an scene node:\n 00445 * m_pStandAnimation = GetMeshHandler()->GetAnimationInfo("Stand"); 00446 * 00447 * @note 00448 * - This function will search for the requested animation information within the skeleton 00449 * manager and the morph targets of the mesh the mesh handler is using. 00450 */ 00451 PLMESH_API PLRenderer::AnimationInfo *GetAnimationInfo(const PLCore::String &sName, int nLogMessage = 1) const; 00452 00453 /** 00454 * @brief 00455 * Returns a current joint handler 00456 * 00457 * @param[in] sJointName 00458 * Name of the joint 00459 * 00460 * @return 00461 * The requested current joint handler, a null pointer on error 00462 * 00463 * @note 00464 * - Call "MeshUpdateRequired()" to set a "dirty"-flag if you manipulated the skeleton 00465 */ 00466 PLMESH_API JointHandler *GetJointHandler(const PLCore::String &sJointName) const; 00467 00468 /** 00469 * @brief 00470 * Returns a base joint handler 00471 * 00472 * @param[in] sJointName 00473 * Name of the joint 00474 * 00475 * @return 00476 * The requested base joint handler, a null pointer on error 00477 * 00478 * @note 00479 * - Using this base joint handler you can for instance change the initial joint 00480 * settings 00481 * - Call "MeshUpdateRequired()" to set a "dirty"-flag if you manipulated the skeleton 00482 */ 00483 PLMESH_API JointHandler *GetBaseJointHandler(const PLCore::String &sJointName) const; 00484 00485 //[-------------------------------------------------------] 00486 //[ Visibility functions ] 00487 //[-------------------------------------------------------] 00488 /** 00489 * @brief 00490 * Updates the mesh visibility 00491 * 00492 * @param[in] cPlaneSet 00493 * Plane set we want to check against - the planes must be in the object space 00494 * @param[in] bFirst 00495 * First visibility determination or add visible things? 00496 * 00497 * @note 00498 * - Current LOD level is used (see Update()) 00499 * - Use GetGeometryVisibility() to get the visibility of each mesh geometry 00500 */ 00501 PLMESH_API void UpdateVisibility(const PLMath::PlaneSet &cPlaneSet, bool bFirst = true); 00502 00503 /** 00504 * @brief 00505 * Returns the bit set holding the geometry visibility state 00506 * 00507 * @return 00508 * Bitset holding the geometry visibility state 00509 * 00510 * @note 00511 * - Call UpdateVisibility() to update the visibility stuff 00512 */ 00513 PLMESH_API PLCore::Bitset &GetGeometryVisibility(); 00514 00515 //[-------------------------------------------------------] 00516 //[ LOD functions ] 00517 //[-------------------------------------------------------] 00518 /** 00519 * @brief 00520 * Returns the number of mesh LOD levels 00521 * 00522 * @return 00523 * The number of mesh LOD levels 00524 * 00525 * @see 00526 * - Update() 00527 */ 00528 PLMESH_API PLCore::uint32 GetNumOfLODLevels() const; 00529 00530 /** 00531 * @brief 00532 * Returns the current used mesh LOD level index 00533 * 00534 * @return 00535 * The current used LOD level index 00536 * 00537 * @see 00538 * - Update() 00539 */ 00540 PLMESH_API PLCore::uint32 GetLODLevelIndex() const; 00541 00542 /** 00543 * @brief 00544 * Returns the current used mesh LOD level 00545 * 00546 * @return 00547 * The current used LOD level, a null pointer on error 00548 * 00549 * @note 00550 * - Don't manipulate the LOD level! 00551 * 00552 * @see 00553 * - Update() 00554 */ 00555 PLMESH_API MeshLODLevel *GetLODLevel() const; 00556 00557 //[-------------------------------------------------------] 00558 //[ Tool functions ] 00559 //[-------------------------------------------------------] 00560 /** 00561 * @brief 00562 * Calculates the current axis aligned joint bounding box 00563 * 00564 * @param[out] cAAB 00565 * Will receive the current axis aligned joint bounding box 00566 * 00567 * @return 00568 * 'true' if all went fine, else 'false' 00569 */ 00570 PLMESH_API bool CalculateJointBoundingBox(PLMath::AABoundingBox &cAAB) const; 00571 00572 /** 00573 * @brief 00574 * Returns the current used vertex buffer of the mesh 00575 * 00576 * @return 00577 * Current used vertex buffer of the mesh, can be a null pointer 00578 * 00579 * @note 00580 * - You shouldn't manipulate this vertex buffer - use it for read only! 00581 * Internally the mesh handler will use the meshes vertex buffer directly 00582 * whenever possible, but if there are e.g. animations the mesh handler has 00583 * it's own vertex buffer with the current individual data. 00584 * 00585 * @see 00586 * - Update() 00587 */ 00588 PLMESH_API PLRenderer::VertexBuffer *GetVertexBuffer() const; 00589 00590 /** 00591 * @brief 00592 * Returns the total number of current triangles 00593 * 00594 * @return 00595 * Total number of current triangles 00596 */ 00597 PLMESH_API PLCore::uint32 GetNumOfTriangles() const; 00598 00599 /** 00600 * @brief 00601 * Returns the first mesh triangle intersecting the line 00602 * 00603 * @param[in] vLineStartPos 00604 * Line start position 00605 * @param[in] vLineEndPos 00606 * Line end position 00607 * @param[out] nTriangle 00608 * Will receive the ID of the found triangle 00609 * @param[out] pnGeometry 00610 * Receives the owner geometry ID of the found triangle if not a null pointer 00611 * @param[out] pvCollisionPoint 00612 * Will receive the collision point if not a null pointer 00613 * @param[in] plstGeometries 00614 * List of geometry indices to use, if a null pointer all geometries are used 00615 * 00616 * @return 00617 * 'true' if a triangle was found, else 'false' 00618 * 00619 * @note 00620 * - The line is assumed to be in the object space of the mesh handlers mesh 00621 */ 00622 PLMESH_API bool FindTriangle(const PLMath::Vector3 &vLineStartPos, 00623 const PLMath::Vector3 &vLineEndPos, 00624 PLCore::uint32 &nTriangle, PLCore::uint32 *pnGeometry = nullptr, 00625 PLMath::Vector3 *pvCollisionPoint = nullptr, PLCore::Array<PLCore::uint32> *plstGeometries = nullptr) const; 00626 00627 /** 00628 * @brief 00629 * Returns a list of mesh geometries intersecting the plane set 00630 * 00631 * @param[in] cPlaneSet 00632 * Plane set we want to check against 00633 * @param[out] ppnGeometries 00634 * If not a null pointer, receives the geometries intersecting the plane set. 00635 * You have to delete this list by self after usage! (delete [] ...) 00636 * @param[in] pvCamDir 00637 * Camera direction vector, if not null faces where the normal is 00638 * facing away from the given camera direction are ignored 00639 * 00640 * @return 00641 * Number of found geometries if all went fine, else 0 00642 * 00643 * @note 00644 * - The the planes must be in the object space 00645 */ 00646 PLMESH_API PLCore::uint32 FindGeometries(const PLMath::PlaneSet &cPlaneSet, PLCore::uint32 **ppnGeometries = nullptr, PLMath::Vector3 *pvCamDir = nullptr) const; 00647 00648 /** 00649 * @brief 00650 * Gets the triangle list 00651 * 00652 * @return 00653 * Triangle list, a null pointer on error 00654 * 00655 * @see 00656 * - MeshLODLevel::BuildTriangleList() 00657 */ 00658 PLMESH_API PLCore::Array<MeshTriangle> *GetTriangleList(); 00659 00660 /** 00661 * @brief 00662 * Gets the edge list 00663 * 00664 * @return 00665 * Edge list, a null pointer on error 00666 * 00667 * @see 00668 * - MeshLODLevel::BuildEdgeList() 00669 */ 00670 PLMESH_API PLCore::Array<MeshEdge> *GetEdgeList(); 00671 00672 /** 00673 * @brief 00674 * Builds the current triangle planes 00675 * 00676 * @note 00677 * - The triangle planes must be updated after manipulating 00678 * geometries or vertices! 00679 * - If the triangle list is available (MeshLODLevel::GetTriangleList()) 00680 * it will be used for faster triangle plane calculation, else the slower 00681 * GetTriangle() is used instead. 00682 */ 00683 PLMESH_API void BuildTrianglePlaneList(); 00684 00685 /** 00686 * @brief 00687 * Gets the triangle plane list 00688 * 00689 * @return 00690 * Triangle plane list, a null pointer on error 00691 * 00692 * @note 00693 * - If the mesh handler currently is using the original morph target vertex 00694 * data the triangle planes of this morph target will be returned. But 00695 * if the mesh handler is using an animated mesh it will need it's individual 00696 * triangle planes! 00697 * 00698 * @see 00699 * - See BuildTrianglePlaneList() 00700 */ 00701 PLMESH_API PLCore::Array<PLMath::Plane> *GetTrianglePlaneList(); 00702 00703 00704 //[-------------------------------------------------------] 00705 //[ Private functions ] 00706 //[-------------------------------------------------------] 00707 private: 00708 /** 00709 * @brief 00710 * Clears all materials 00711 */ 00712 void ClearMaterials(); 00713 00714 /** 00715 * @brief 00716 * Adds a new material 00717 * 00718 * @param[in] pMaterial 00719 * Material to add, can be a null pointer 00720 * 00721 * @return 00722 * Pointer to the added material, a null pointer on error 00723 */ 00724 PLRenderer::Material *AddMaterial(PLRenderer::Material *pMaterial); 00725 00726 /** 00727 * @brief 00728 * Called when the frame of an animation manager animation has been changed 00729 */ 00730 void OnAnimationFrameChange(); 00731 00732 00733 //[-------------------------------------------------------] 00734 //[ Private event handlers ] 00735 //[-------------------------------------------------------] 00736 private: 00737 PLCore::EventHandler<> EventHandlerAnimationFrameChange; 00738 00739 00740 //[-------------------------------------------------------] 00741 //[ Private data ] 00742 //[-------------------------------------------------------] 00743 private: 00744 PLRenderer::Renderer *m_pRenderer; /**< Used renderer, can be a null pointer */ 00745 Mesh *m_pMesh; /**< Used mesh, can be a null pointer */ 00746 PLCore::Array<PLRenderer::MaterialHandler*> m_lstMaterials; /**< Materials */ 00747 PLRenderer::VertexBuffer *m_pVertexBuffer; /**< Mesh handler own vertex buffer (optional, can be a null pointer) */ 00748 00749 // Current stuff 00750 bool m_bMeshUpdateRequired; /**< Mesh update required */ 00751 PLCore::uint32 m_nLOD; /**< Current LOD level */ 00752 PLRenderer::VertexBuffer *m_pCurrentVertexBuffer; /**< Current vertex buffer to use, can be a null pointer */ 00753 PLCore::Bitset m_cGeometryVisibility; /**< Holds which geometry is visible and which not */ 00754 PLCore::Array<float> m_lstBaseMorphTargetWeights; /**< Morph target base weights */ 00755 PLCore::Array<float> m_lstMorphTargetWeights; /**< Current morph target weights */ 00756 SkeletonHandler *m_pSkeletonHandler; /**< Skeleton handler, can be a null pointer */ 00757 MeshAnimationManager *m_pMeshAnimationManager; /**< Mesh animation manager, can be a null pointer */ 00758 00759 // Precalculated data 00760 bool m_bRecalculateTrianglePlanes; /**< Do we need to recalculate the triangle planes? */ 00761 PLCore::Array<PLMath::Plane> m_lstTrianglePlanes; /**< List of triangle planes */ 00762 00763 00764 }; 00765 00766 00767 //[-------------------------------------------------------] 00768 //[ Namespace ] 00769 //[-------------------------------------------------------] 00770 } // PLMesh 00771 00772 00773 #endif // __PLMESH_MESHHANDLER_H__
|