T3DSceneClient.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 _T3DSCENECLIENT_H_
  23. #define _T3DSCENECLIENT_H_
  24. #include "component/simComponent.h"
  25. #include "T3DSceneComponent.h"
  26. class T3DSceneClient : public SimComponent
  27. {
  28. typedef SimComponent Parent;
  29. public:
  30. T3DSceneClient()
  31. {
  32. _nextClient = NULL;
  33. _sceneGroup = NULL;
  34. _sceneGroupName = NULL;
  35. _sceneClientName = NULL;
  36. }
  37. T3DSceneClient * getNextSceneClient() { return _nextClient; }
  38. // TODO: internal
  39. void setNextSceneClient(T3DSceneClient * client) { _nextClient = client; }
  40. T3DSceneComponent * getSceneGroup() { return _sceneGroup; }
  41. StringTableEntry getSceneGroupName() { return _sceneGroupName; }
  42. void setSceneGroupName(const char * name);
  43. StringTableEntry getSceneClientName() { return _sceneClientName; }
  44. void setSceneClientName(const char * name) { _sceneClientName = StringTable->insert(name); }
  45. protected:
  46. bool onComponentRegister(SimComponent * owner);
  47. void registerInterfaces(SimComponent * owner);
  48. T3DSceneClient * _nextClient;
  49. T3DSceneComponent * _sceneGroup;
  50. StringTableEntry _sceneGroupName;
  51. StringTableEntry _sceneClientName;
  52. };
  53. class T3DSolidSceneClient : public T3DSceneClient, public ISolid3D, public Transform3D::IDirtyListener
  54. {
  55. public:
  56. T3DSolidSceneClient()
  57. {
  58. _transform = NULL;
  59. _objectBox = new ValueWrapperInterface<Box3F>();
  60. }
  61. Box3F getObjectBox() { return _objectBox->get(); }
  62. void setObjectBox(const Box3F & box) { _objectBox->set(box); }
  63. Box3F getWorldBox();
  64. const MatrixF & getTransform();
  65. Transform3D * getTransform3D() { return _transform; }
  66. void OnTransformDirty();
  67. protected:
  68. // TODO: internal
  69. void setTransform3D(Transform3D * transform);
  70. Transform3D * _transform;
  71. ValueWrapperInterface<Box3F> * _objectBox;
  72. };
  73. #endif // #ifndef _T3DSCENECLIENT_H_