11 #ifndef CUBBYFLOW_CUDA_PARTICLE_SYSTEM_SOLVER_BASE3_HPP 12 #define CUBBYFLOW_CUDA_PARTICLE_SYSTEM_SOLVER_BASE3_HPP 14 #ifdef CUBBYFLOW_USE_CUDA 29 class CUDAParticleSystemSolverBase3 :
public PhysicsAnimation
33 CUDAParticleSystemSolverBase3();
36 CUDAParticleSystemSolverBase3(
const CUDAParticleSystemSolverBase3&) =
40 CUDAParticleSystemSolverBase3(CUDAParticleSystemSolverBase3&&) noexcept =
44 ~CUDAParticleSystemSolverBase3() override = default;
47 CUDAParticleSystemSolverBase3& operator=(
48 const CUDAParticleSystemSolverBase3&) = delete;
51 CUDAParticleSystemSolverBase3& operator=(
52 CUDAParticleSystemSolverBase3&&) noexcept = delete;
55 float DragCoefficient() const;
64 void SetDragCoefficient(
float newDragCoefficient);
73 float RestitutionCoefficient() const;
83 void SetRestitutionCoefficient(
float newRestitutionCoefficient);
89 void SetGravity(const
Vector3F& newGravity);
97 virtual CUDAParticleSystemData3* ParticleSystemData();
105 virtual const CUDAParticleSystemData3* ParticleSystemData() const;
109 void OnInitialize() override;
111 void UpdateCollider(
double timeStepInSeconds);
113 void UpdateEmitter(
double timeStepInSeconds);
116 float m_dragCoefficient = 1e-4f;
117 float m_restitutionCoefficient = 0.0f;
119 CUDAParticleSystemData3Ptr m_particleSystemData;
123 using CUDAParticleSystemSolverBase3Ptr =
124 std::shared_ptr<CUDAParticleSystemSolverBase3>;
129 template <
typename DerivedBuilder>
130 class CUDAParticleSystemSolverBuilderBase3
134 DerivedBuilder& WithDragCoefficient(
float coeff);
137 DerivedBuilder& WithRestitutionCoefficient(
float coeff);
140 DerivedBuilder& WithGravity(
const Vector3F& gravity);
143 float m_dragCoefficient = 1e-4f;
144 float m_restitutionCoefficient = 0.0f;
148 template <
typename T>
149 T& CUDAParticleSystemSolverBuilderBase3<T>::WithDragCoefficient(
float coeff)
151 m_dragCoefficient = coeff;
152 return static_cast<T&
>(*this);
155 template <
typename T>
156 T& CUDAParticleSystemSolverBuilderBase3<T>::WithRestitutionCoefficient(
159 m_restitutionCoefficient = coeff;
160 return static_cast<T&
>(*this);
163 template <
typename T>
164 T& CUDAParticleSystemSolverBuilderBase3<T>::WithGravity(
const Vector3F& gravity)
167 return static_cast<T&
>(*this);
Vector3< float > Vector3F
Definition: Matrix.hpp:786
Definition: pybind11Utils.hpp:20
constexpr float GRAVITY_FLOAT
Gravity.
Definition: Constants.hpp:298