diff options
author | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
commit | 15740faf9fe9fe4be08965098bbf2947e096aeeb (patch) | |
tree | a730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Dynamics/ClothRenderer.h |
Diffstat (limited to 'Runtime/Dynamics/ClothRenderer.h')
-rw-r--r-- | Runtime/Dynamics/ClothRenderer.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Runtime/Dynamics/ClothRenderer.h b/Runtime/Dynamics/ClothRenderer.h new file mode 100644 index 0000000..06e4cd6 --- /dev/null +++ b/Runtime/Dynamics/ClothRenderer.h @@ -0,0 +1,54 @@ +#pragma once +#include "Configuration/UnityConfigure.h" + +#if ENABLE_CLOTH + +#include "Runtime/Filters/Renderer.h" + +class VBO; + +namespace Unity { class Cloth; } + + +class ClothRenderer : public Renderer +{ +public: + REGISTER_DERIVED_CLASS (ClothRenderer, Renderer) + DECLARE_OBJECT_SERIALIZE (ClothRenderer) + + ClothRenderer (MemLabelId label, ObjectCreationMode mode); + + virtual void AwakeFromLoad (AwakeFromLoadMode awakeMode); + + virtual void Reset (); + virtual void Render (int/* subsetIndex*/, const ChannelAssigns& channels); + + virtual void UpdateTransformInfo(); + + virtual void RendererBecameVisible(); + virtual void RendererBecameInvisible(); + + bool GetPauseWhenNotVisible() const { return m_PauseWhenNotVisible; } + void SetPauseWhenNotVisible(bool pause) { SetDirty(); m_PauseWhenNotVisible = pause; } + + void UnloadVBOFromGfxDevice(); + void ReloadVBOToGfxDevice(); + +private: + + void UpdateClothVBOImmediate (int requiredChannels, UInt32& unavailableChannels); + void UpdateClothVerticesFromPhysics (); + void UpdateAABB (); + + VBO* m_VBO; + UInt32 m_ChannelsInVBO; + UInt32 m_UnavailableInVBO; + AABB m_AABB; + bool m_PauseWhenNotVisible; + bool m_IsPaused; + bool m_AABBDirty; + + friend class DeformableMesh; +}; + +#endif // ENABLE_CLOTH |