5#include <unordered_map>
7#include "Bullet/btBulletDynamicsCommon.h"
8#include "Bullet/BulletCollision/CollisionDispatch/btGhostObject.h"
13struct PaintMeshCollision
15 btCollisionObject* mCollisionObject =
nullptr;
18 glm::vec3 mPosition = {};
19 glm::quat mRotation = {};
20 glm::vec3 mScale = {};
36struct PaintColorOptions
38 PaintBlendMode mBlendMode = PaintBlendMode::Mix;
39 glm::vec4 mColor = { 1.0f, 1.0f, 1.0f, 1.0f };
40 bool mOnlyFacingNormals =
true;
43struct PaintInstanceOptions
46 float mDensity = 1.0f;
47 float mMinSeparation = 0.0f;
48 glm::vec3 mMinPosition = {};
49 glm::vec3 mMaxPosition = {};
50 glm::vec3 mMinRotation = {};
51 glm::vec3 mMaxRotation = {};
52 float mMinScale = 1.0f;
53 float mMaxScale = 1.0f;
54 bool mAlignWithNormal =
false;
58struct PendingColorData
62 std::vector<uint32_t> mOriginalColors;
63 std::vector<float> mVertexDrawAlpha;
64 bool mAnyVertexPainted =
false;
67struct PendingInstanceData
70 std::vector<MeshInstanceData> mData;
71 std::vector<MeshInstanceData> mOriginalData;
81 void HandleNodeDestroy(
Node* node);
83 void AddPaintMeshCollision(
const PaintMeshCollision& col);
84 void RemovePaintMeshCollision(
const PaintMeshCollision& col);
86 void UpdateDynamicsWorld();
88 void UpdatePaintReticle();
89 void UpdatePaintDraw();
91 void FinishAdjustment();
93 bool mInitialized =
false;
95 btDefaultCollisionConfiguration* mCollisionConfig =
nullptr;
96 btCollisionDispatcher* mCollisionDispatcher =
nullptr;
97 btDbvtBroadphase* mBroadphase =
nullptr;
98 btSequentialImpulseConstraintSolver* mSolver =
nullptr;
99 btDiscreteDynamicsWorld* mDynamicsWorld =
nullptr;
101 std::unordered_map<StaticMesh3D*, PaintMeshCollision> mMeshCollisionMap;
103 btPairCachingGhostObject* mSphereGhost =
nullptr;
104 btSphereShape* mSphereGhostShape =
nullptr;
105 btGhostPairCallback* mGhostPairCallback =
nullptr;
110 glm::vec3 mSpherePosition = {};
111 glm::vec3 mSphereNormal = { 0.0f, 1.0f, 0.0f };
112 float mRadius = 1.0f;
113 float mOpacity = 1.0f;
114 bool mSphereValid =
false;
116 float mPreAdjustRadius = 1.0f;
117 float mPreAdjustOpacity = 1.0f;
119 bool mAdjustRadius =
false;
120 bool mAdjustOpacity =
false;
121 bool mAdjustmentFinished =
false;
122 glm::vec2 mAdjustmentAnchor = {};
124 bool mOnlyRenderSelected =
false;
127 float mSpacing = 10.0f;
128 glm::vec2 mLastPaintMousePos = {};
131 PaintColorOptions mColorOptions;
132 PaintInstanceOptions mInstanceOptions;
135 std::vector<PendingColorData> mPendingColorData;
136 PendingInstanceData mPendingInstanceData;
bool Update()
Definition Engine.cpp:710
Definition InstancedMesh3d.h:13
Definition StaticMesh3d.h:12
Definition ActionManager.h:541