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