/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/EnginePlugins/ParticlePlugin/Behavior/ParticleBehavior_Turbulence.h
53 строки
2 KB
Jan Krassnigg
Added Expression Particle Behavior (#1884)
29 мар 2026, 23:32
Не верифицирован
29 мар 2026, 23:32
071fa9d
Код
Авторство
О чём код?
#pragma once #include <Foundation/SimdMath/SimdNoise.h> #include <ParticlePlugin/Behavior/ParticleBehavior.h> /// Applies a turbulent force to particles using 3D curl noise. /// /// Curl noise produces divergence-free flow fields that look natural and avoid /// compression artifacts. Useful for smoke, fire, and magical effects. class EZ_PARTICLEPLUGIN_DLL ezParticleBehaviorFactory_Turbulence final : public ezParticleBehaviorFactory { EZ_ADD_DYNAMIC_REFLECTION(ezParticleBehaviorFactory_Turbulence, ezParticleBehaviorFactory); public: ezParticleBehaviorFactory_Turbulence(); virtual const ezRTTI* GetBehaviorType() const override; virtual void CopyBehaviorProperties(ezParticleBehavior* pObject, bool bFirstTime) const override; virtual void QueryFinalizerDependencies(ezSet<const ezRTTI*>& inout_finalizerDeps) const override; virtual void Save(ezStreamWriter& inout_stream) const override; virtual void Load(ezStreamReader& inout_stream, const ezParticleEffectDescriptor& ownerEffectDescriptor, const ezParticleSystemDescriptor& ownerSystemDescriptor) override; float m_fStrength = 2.0f; float m_fFrequency = 1.0f; ezVec3 m_vScrollSpeed = ezVec3::MakeZero(); ezUInt8 m_uiOctaves = 1; bool m_bAffectVelocity = true; }; class EZ_PARTICLEPLUGIN_DLL ezParticleBehavior_Turbulence final : public ezParticleBehavior { EZ_ADD_DYNAMIC_REFLECTION(ezParticleBehavior_Turbulence, ezParticleBehavior); public: float m_fStrength = 2.0f; float m_fFrequency = 1.0f; ezVec3 m_vScrollSpeed = ezVec3::MakeZero(); ezUInt8 m_uiOctaves = 1; bool m_bAffectVelocity = true; protected: virtual void OnFinalize() override; virtual void CreateRequiredStreams() override; virtual void Process(ezUInt64 uiNumElements) override; ezProcessingStream* m_pStreamPosition = nullptr; ezProcessingStream* m_pStreamVelocity = nullptr; ezSimdPerlinNoise m_Noise; ezTime m_TotalTime; };