summaryrefslogtreecommitdiff
path: root/Runtime/Dynamics/ClothRenderer.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-08-14 22:50:43 +0800
committerchai <chaifix@163.com>2019-08-14 22:50:43 +0800
commit15740faf9fe9fe4be08965098bbf2947e096aeeb (patch)
treea730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Dynamics/ClothRenderer.h
+Unity Runtime codeHEADmaster
Diffstat (limited to 'Runtime/Dynamics/ClothRenderer.h')
-rw-r--r--Runtime/Dynamics/ClothRenderer.h54
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