SpatialComponent.cpp 1006 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include "anki/scene/SpatialComponent.h"
  2. #include "anki/scene/SceneNode.h"
  3. namespace anki {
  4. //==============================================================================
  5. SpatialComponent::SpatialComponent(SceneNode* node, U32 flags)
  6. : SceneComponent(SPATIAL_COMPONENT, node), Bitset<U8>(flags)
  7. {
  8. markForUpdate();
  9. }
  10. //==============================================================================
  11. SpatialComponent::~SpatialComponent()
  12. {}
  13. //==============================================================================
  14. Bool SpatialComponent::update(SceneNode&, F32, F32, UpdateType uptype)
  15. {
  16. Bool updated = false;
  17. if(uptype == ASYNC_UPDATE)
  18. {
  19. updated = bitsEnabled(SF_MARKED_FOR_UPDATE);
  20. if(updated)
  21. {
  22. getSpatialCollisionShape().computeAabb(aabb);
  23. disableBits(SF_MARKED_FOR_UPDATE);
  24. }
  25. }
  26. return updated;
  27. }
  28. //==============================================================================
  29. void SpatialComponent::reset()
  30. {
  31. disableBits(SF_VISIBLE_ANY);
  32. }
  33. } // end namespace anki