appNode.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _APPNODE_H_
  23. #define _APPNODE_H_
  24. #ifndef _MMATH_H_
  25. #include "math/mMath.h"
  26. #endif
  27. #ifndef _TVECTOR_H_
  28. #include "core/util/tVector.h"
  29. #endif
  30. #ifndef _APPMESH_H_
  31. #include "ts/loader/appMesh.h"
  32. #endif
  33. class AppNode
  34. {
  35. friend class TSShapeLoader;
  36. // add attached meshes and child nodes to app node
  37. // the reason these are tracked by AppNode is that
  38. // AppNode is responsible for deleting all it's children
  39. // and attached meshes.
  40. virtual void buildMeshList() = 0;
  41. virtual void buildChildList() = 0;
  42. protected:
  43. S32 mParentIndex;
  44. Vector<AppMesh*> mMeshes;
  45. Vector<AppNode*> mChildNodes;
  46. char* mName;
  47. char* mParentName;
  48. public:
  49. AppNode();
  50. virtual ~AppNode();
  51. S32 getNumMesh();
  52. AppMesh* getMesh(S32 idx);
  53. S32 getNumChildNodes();
  54. AppNode* getChildNode(S32 idx);
  55. virtual MatrixF getNodeTransform(F32 time) = 0;
  56. virtual bool isEqual(AppNode* node) = 0;
  57. virtual bool animatesTransform(const AppSequence* appSeq) = 0;
  58. virtual const char* getName() = 0;
  59. virtual const char* getParentName() = 0;
  60. virtual bool getFloat(const char* propName, F32& defaultVal) = 0;
  61. virtual bool getInt(const char* propName, S32& defaultVal) = 0;
  62. virtual bool getBool(const char* propName, bool& defaultVal) = 0;
  63. virtual bool isBillboard();
  64. virtual bool isBillboardZAxis();
  65. virtual bool isParentRoot() = 0;
  66. virtual bool isDummy();
  67. virtual bool isBounds();
  68. virtual bool isSequence();
  69. virtual bool isRoot();
  70. };
  71. #endif // _APPNODE_H_