CParticle.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. #pragma once
  2. #include "CRenderable.h"
  3. #include "WallpaperEngine/Data/Model/Object.h"
  4. #include "WallpaperEngine/Render/Objects/Effects/CPass.h"
  5. #include "WallpaperEngine/Render/Wallpapers/CScene.h"
  6. #include "WallpaperEngine/Scripting/ScriptableObject.h"
  7. #include "WallpaperEngine/Data/Utils/FloatCompare.h"
  8. #include <array>
  9. #include <deque>
  10. #include <functional>
  11. #include <glm/mat4x4.hpp>
  12. #include <glm/vec3.hpp>
  13. #include <glm/vec4.hpp>
  14. #include <memory>
  15. #include <optional>
  16. #include <random>
  17. #include <vector>
  18. using namespace WallpaperEngine;
  19. using namespace WallpaperEngine::Render;
  20. using namespace WallpaperEngine::Data::Model;
  21. namespace WallpaperEngine::Render::Objects {
  22. class CImage;
  23. class PuppetRig;
  24. constexpr uint32_t DEFAULT_MAX_PARTICLES = 1000;
  25. // no installed system has more than 100000, a count a file claims past this would only be an allocation
  26. constexpr uint32_t MAX_PARTICLES = 1000000;
  27. // the vertex data a system may hold (400 MB), a rope trail keeps several quads per particle
  28. constexpr size_t MAX_VERTEX_FLOATS = 100000000;
  29. struct ParticleInstance {
  30. glm::vec3 position { 0.0f };
  31. /** Where the particle was when this frame's operators started, collisionquad tests the step in between */
  32. glm::vec3 previousPosition { 0.0f };
  33. glm::vec3 velocity { 0.0f };
  34. glm::vec3 acceleration { 0.0f };
  35. glm::vec3 rotation { 0.0f };
  36. glm::vec3 angularVelocity { 0.0f };
  37. glm::vec3 angularAcceleration { 0.0f };
  38. glm::vec3 color { 1.0f };
  39. float alpha { 1.0f };
  40. float size { 20.0f };
  41. float frame { 0.0f };
  42. float lifetime { 1.0f };
  43. float age { 0.0f };
  44. struct {
  45. glm::vec3 color { 1.0f };
  46. float alpha { 1.0f };
  47. float size { 20.0f };
  48. float lifetime { 1.0f };
  49. } initial;
  50. /** Random 0..1 picked at spawn, WE's turbulence operator uses it for the particle's phase and speed */
  51. float seed { 0.0f };
  52. /** Unique per system, eventfollow children find the particle they follow by it (indices shift on compaction) */
  53. uint32_t id { 0 };
  54. /** WE's pool slot: the lowest one free at spawn, what orders particles handed to child control points */
  55. uint32_t slot { 0 };
  56. bool alive { false };
  57. float getLifetimePos () const { return lifetime > 0.0f ? (age / lifetime) : 1.0f; }
  58. // sub_140236CD0 kills a particle once lifetime < age, so it is still drawn on the frame it reaches its lifetime
  59. bool isAlive () const { return alive && WallpaperEngine::Data::Utils::isNonZero (lifetime) && !(lifetime < age); }
  60. };
  61. struct ControlPointData {
  62. glm::vec3 position { 0.0f };
  63. glm::mat3 orientation { 1.0f };
  64. glm::vec3 offset { 0.0f };
  65. bool linkMouse { false };
  66. bool worldSpace { false };
  67. bool followParent { false };
  68. /** Flag 8: takes the parent's control point as it is, without moving it into this system's space */
  69. bool copyUntransformed { false };
  70. /** Written by a remap component, the engine leaves it alone (WE's loader flag 0x10000) */
  71. bool remapOutput { false };
  72. int parentIndex { 0 };
  73. glm::vec3 velocity { 0.0f };
  74. /** How far it moved since the last update (wallpaper64.exe keeps last frame's matrix at +64) */
  75. glm::vec3 movement { 0.0f };
  76. glm::vec3 previousPosition { 0.0f };
  77. bool hasPreviousPosition { false };
  78. };
  79. using EmitterFunc = std::function<void (std::vector<ParticleInstance>&, uint32_t&, float)>;
  80. /** An emitter's timers, the runtime part of its record in wallpaper64.exe sub_1402378A0 */
  81. struct EmitterClock {
  82. float delay { 0.0f };
  83. /** Counts down while > 0, -1 once it ran out */
  84. float duration { 0.0f };
  85. float accumulator { 0.0f };
  86. /** Periodic emitters: > 0 emitting for that long, < 0 waiting */
  87. float period { 0.0f };
  88. int emittedInPeriod { 0 };
  89. uint32_t pendingBurst { 0 };
  90. bool finished { false };
  91. };
  92. using InitializerFunc = std::function<void (ParticleInstance&)>;
  93. using OperatorFunc = std::function<
  94. void (std::vector<ParticleInstance>&, uint32_t, const std::vector<ControlPointData>&, float, float)>;
  95. class CParticle final : public CRenderable, public Scripting::ScriptableObject {
  96. friend CObject;
  97. public:
  98. CParticle (Wallpapers::CScene& scene, const Particle& particle);
  99. ~CParticle ();
  100. void setup () override;
  101. void render () override;
  102. /** sub_140230650, before scripts */
  103. void simulate ();
  104. void update (float dt);
  105. [[nodiscard]] const Particle& getParticle () const;
  106. [[nodiscard]] const float& getBrightness () const override;
  107. [[nodiscard]] const float& getUserAlpha () const override;
  108. [[nodiscard]] const float& getAlpha () const override;
  109. [[nodiscard]] const glm::vec3& getColor () const override;
  110. [[nodiscard]] const glm::vec4& getColor4 () const override;
  111. [[nodiscard]] const glm::vec3& getCompositeColor () const override;
  112. [[nodiscard]] bool isPlaying () const override;
  113. void applyPlayback (Playback playback) override;
  114. /** IParticleSystem.emitParticles (sub_14024CAC0): every emitter spawns count more right away, 0 is one */
  115. void emitParticles (int count);
  116. /** Emitter clocks finished (sub_14022F640) or running again (sub_14022F5B0), static children too */
  117. void finishEmitters ();
  118. void resumeEmitters ();
  119. // IParticleSystemInstance (instance override at +1912, sub_14024D940) beyond the scene's instanceoverride: colorn
  120. // -1 and control point x FLT_MAX until written (sub_14024D760); angle picks controlpointangleN
  121. [[nodiscard]] glm::vec3 getInstanceColor () const;
  122. void setInstanceColor (const glm::vec3& color);
  123. [[nodiscard]] glm::vec3 getInstanceControlPoint (size_t index, bool angle) const;
  124. void setInstanceControlPoint (size_t index, bool angle, const glm::vec3& value);
  125. protected:
  126. void setupEmitters ();
  127. void setupInitializers ();
  128. void setupOperators ();
  129. EmitterFunc createBoxEmitter (const ParticleEmitter& emitter);
  130. EmitterFunc createSphereEmitter (const ParticleEmitter& emitter);
  131. uint32_t emitCount (EmitterClock& clock, const ParticleEmitter& emitter, float dt);
  132. void placeSpawn (
  133. ParticleInstance& p, const ControlPointData* cp, int controlPointIndex, const glm::vec3& origin,
  134. glm::vec3& offset
  135. );
  136. [[nodiscard]] float
  137. sampleAudio (int mode, const glm::vec2& bounds, float exponent, int frequencyStart, int frequencyEnd) const;
  138. InitializerFunc createColorRandomInitializer (const ColorRandomInitializer& init);
  139. InitializerFunc createSizeRandomInitializer (const SizeRandomInitializer& init);
  140. InitializerFunc createAlphaRandomInitializer (const AlphaRandomInitializer& init);
  141. InitializerFunc createLifetimeRandomInitializer (const LifetimeRandomInitializer& init);
  142. InitializerFunc createVelocityRandomInitializer (const VelocityRandomInitializer& init);
  143. InitializerFunc createRotationRandomInitializer (const RotationRandomInitializer& init);
  144. InitializerFunc createAngularVelocityRandomInitializer (const AngularVelocityRandomInitializer& init);
  145. InitializerFunc createTurbulentVelocityRandomInitializer (const TurbulentVelocityRandomInitializer& init);
  146. InitializerFunc
  147. createMapSequenceAroundControlPointInitializer (const MapSequenceAroundControlPointInitializer& init);
  148. InitializerFunc createInheritInitialValueFromEventInitializer (const InheritInitialValueFromEventInitializer& init);
  149. InitializerFunc createInheritControlPointVelocityInitializer (const InheritControlPointVelocityInitializer& init);
  150. InitializerFunc createHsvColorRandomInitializer (const HsvColorRandomInitializer& init);
  151. InitializerFunc createColorListInitializer (const ColorListInitializer& init);
  152. InitializerFunc createPositionOffsetRandomInitializer (const PositionOffsetRandomInitializer& init);
  153. InitializerFunc
  154. createMapSequenceBetweenControlPointsInitializer (const MapSequenceBetweenControlPointsInitializer& init);
  155. InitializerFunc createRemapInitialValueInitializer (const RemapInitialValueInitializer& init);
  156. OperatorFunc createMovementOperator (const MovementOperator& op);
  157. OperatorFunc createAngularMovementOperator (const AngularMovementOperator& op);
  158. OperatorFunc createAlphaFadeOperator (const AlphaFadeOperator& op);
  159. OperatorFunc createSizeChangeOperator (const SizeChangeOperator& op);
  160. OperatorFunc createAlphaChangeOperator (const AlphaChangeOperator& op);
  161. OperatorFunc createColorChangeOperator (const ColorChangeOperator& op);
  162. OperatorFunc createTurbulenceOperator (const TurbulenceOperator& op);
  163. OperatorFunc createVortexOperator (const VortexOperator& op);
  164. OperatorFunc createControlPointAttractOperator (const ControlPointAttractOperator& op);
  165. OperatorFunc createOscillateAlphaOperator (const OscillateAlphaOperator& op);
  166. OperatorFunc createOscillateSizeOperator (const OscillateSizeOperator& op);
  167. OperatorFunc createOscillatePositionOperator (const OscillatePositionOperator& op);
  168. OperatorFunc createInheritValueFromEventOperator (const InheritValueFromEventOperator& op);
  169. OperatorFunc createCapVelocityOperator (const CapVelocityOperator& op);
  170. OperatorFunc createBoidsOperator (const BoidsOperator& op);
  171. OperatorFunc createRemapValueOperator (const RemapValueOperator& op);
  172. OperatorFunc createMaintainDistanceToControlPointOperator (const MaintainDistanceToControlPointOperator& op);
  173. OperatorFunc
  174. createMaintainDistanceBetweenControlPointsOperator (const MaintainDistanceBetweenControlPointsOperator& op);
  175. OperatorFunc createReduceMovementNearControlPointOperator (const ReduceMovementNearControlPointOperator& op);
  176. OperatorFunc createCollisionOperator (const CollisionOperator& op);
  177. /** A remap input as wallpaper64.exe reads it during the simulation (sub_14023FBC0 case 19), in its y-up space */
  178. [[nodiscard]] glm::vec3 remapOperatorInput (const ParticleRemap& remap, const ParticleInstance& p) const;
  179. /** The same for remapinitialvalue (sub_14023B340 case 15), which reads the particle's base values */
  180. [[nodiscard]] glm::vec3 remapInitialInput (const ParticleRemap& remap, ParticleInstance& p);
  181. [[nodiscard]] glm::vec3 remapLayerOrigin () const;
  182. [[nodiscard]] glm::mat4 localControlPointMatrix (size_t index) const;
  183. /** Operators scale some forces by how long frames take (sub_140236CD0): dt * min(1, 0.025 / frame time)^0.7 */
  184. [[nodiscard]] float frameScaledDelta (float dt) const;
  185. /** wallpaper64.exe's time since the layer became visible (+1904), the remap input layertime */
  186. [[nodiscard]] float layerTime () const;
  187. void renderSprites ();
  188. void renderRope ();
  189. /** REFRACT: fills the _rt_FullFrameBuffer copy right before drawing, like WE's copy of the bound target */
  190. void copyRefractSource () const;
  191. void buildRopeTrail (uint32_t& vertexIndex, uint32_t& indexOffset);
  192. void buildRopeSegments (uint32_t& vertexIndex, uint32_t& indexOffset);
  193. struct CollisionCapsule {
  194. glm::vec3 start;
  195. glm::vec3 direction;
  196. float length;
  197. float radius;
  198. };
  199. [[nodiscard]] std::vector<CollisionCapsule> collisionCapsules (int index) const;
  200. [[nodiscard]] glm::mat4 worldToParticles () const;
  201. [[nodiscard]] const CObject* componentDependency (const char* type, int index) const;
  202. /** A layerimage pixel: its colour and its place in layer units around the layer's center, y down */
  203. struct ImagePixel {
  204. uint8_t r = 0, g = 0, b = 0;
  205. int16_t x = 0, y = 0;
  206. /** puppet layers, 0xFF none */
  207. uint8_t bone = 0xFF;
  208. };
  209. /** sub_1401D3AE0 */
  210. struct ImageEmitter {
  211. int index = 0;
  212. std::vector<ImagePixel> pixels;
  213. /** first call only sets layer flags 0x1010 */
  214. bool flagged { false };
  215. bool requested { false };
  216. uint32_t requestFrame { 0 };
  217. /** 0 nothing, 1 downsampled into staging, 2 pixels ready */
  218. int stage { 0 };
  219. std::vector<ImagePixel> staged;
  220. glm::ivec2 size { 0 };
  221. glm::ivec2 stagedSize { 0 };
  222. float refreshTimer { 0.0f };
  223. glm::mat4 world { 1.0f };
  224. glm::mat4 previousWorld { 1.0f };
  225. /** only if already loaded at setup */
  226. std::shared_ptr<const TextureProvider> mask;
  227. std::vector<glm::mat4> boneInverseBind;
  228. };
  229. std::vector<ImageEmitter> m_imageEmitters;
  230. EmitterFunc createImageEmitter (const ParticleEmitter& emitter);
  231. bool readImagePixels (ImageEmitter& state, const CObject& layer);
  232. void downsampleLayerBuffer (ImageEmitter& state, const CFBO& buffer);
  233. static void assignImagePixelBones (ImageEmitter& state, const PuppetRig& rig);
  234. OperatorFunc createCollisionModelOperator (const CollisionOperator& op);
  235. /** collisionmodel components set up so far, each one reads the dependency record with its index */
  236. int m_collisionModels { 0 };
  237. [[nodiscard]] float ropeUVScale () const;
  238. void setupPass ();
  239. void setupGeometryCallbacks ();
  240. void setupParticleUniforms ();
  241. void updateMatrices ();
  242. void updateParticleViewProjection ();
  243. /** g_OrientationForward/Right/Up from the renderer's orientation (sub_1402298B0) */
  244. void updateOrientation ();
  245. void updateParticleRenderVars ();
  246. void prewarm (double now);
  247. /** base is the matrix the parent leaves for its children, identity for top level systems */
  248. void draw (const glm::mat4& base);
  249. /** The object's transform (origin, parallax, angles, scale), what WE keeps at +928 for top level systems */
  250. [[nodiscard]] glm::mat4 objectMatrix () const;
  251. /** WE's world to the camera's space: the 2D scene space, identity in 3D */
  252. [[nodiscard]] glm::mat4 sceneMatrix () const;
  253. [[nodiscard]] bool isShown () const;
  254. /** The matrix stack top WE simulates this system with (sub_140229760 / sub_140229810) */
  255. void updateFrame ();
  256. /** wallpaper64.exe sub_14022E3E0 */
  257. void updateControlPoints ();
  258. [[nodiscard]] DynamicValue* emitterCountOverride () const;
  259. /** wallpaper64.exe sub_14022BD40 / sub_14022F890: whether the instanceoverride color applies, and how */
  260. void refreshColorOverride ();
  261. /** wallpaper64.exe sub_14022A360: where an event child sits for one of this system's particles */
  262. [[nodiscard]] glm::mat4 eventPlacement (const ParticleChild& child, const glm::vec3& position) const;
  263. CParticle (CParticle& parent, const ParticleChild& child);
  264. void setupChildren ();
  265. void updateChildren (float dt);
  266. void spawnEventChildren (ParticleChildType type, const ParticleInstance& particle, bool alive);
  267. void clearEventChildren ();
  268. void placeChild (const glm::mat4& placement);
  269. [[nodiscard]] const ParticleInstance* findParticle (uint32_t id) const;
  270. void passControlPoints (CParticle& child, const ParticleChild& definition) const;
  271. void restart ();
  272. /** sub_14022F6C0 + sub_14022F5B0: timers, sequences and emitters back to their start, particles are kept */
  273. void restartEmission ();
  274. /** sub_14022F790, a periodic emitter starts a new period */
  275. void startEmitterPeriod ();
  276. [[nodiscard]] bool isFinished () const;
  277. [[nodiscard]] bool emittersExhausted () const;
  278. private:
  279. const Particle& m_particle;
  280. std::vector<ParticleInstance> m_particles;
  281. uint32_t m_particleCount { 0 };
  282. uint32_t m_maxParticles { DEFAULT_MAX_PARTICLES };
  283. std::vector<EmitterFunc> m_emitters;
  284. std::vector<InitializerFunc> m_initializers;
  285. std::vector<OperatorFunc> m_operators;
  286. std::vector<ControlPointData> m_controlPoints;
  287. std::vector<float> m_vertices;
  288. std::vector<uint32_t> m_indices;
  289. double m_time { 0.0 };
  290. bool m_prewarmed { false };
  291. // Mouse-linked systems run on unscaled real time so cursor trails track 1:1 regardless of --speed
  292. bool m_hasMouseControlPoint { false };
  293. Effects::CPass* m_pass { nullptr };
  294. std::unique_ptr<ImageEffectPassOverride> m_passOverride;
  295. std::shared_ptr<FBOProvider> m_passFBOProvider;
  296. TextureMap m_passBinds;
  297. GLsizei m_activeIndexCount { 0 };
  298. // REFRACT: copy of the scene FBO, it can't be read while drawn into
  299. bool m_hasRefract { false };
  300. std::shared_ptr<CFBO> m_refractFBO;
  301. GLuint m_vao { 0 };
  302. GLuint m_vbo { 0 };
  303. GLuint m_ebo { 0 };
  304. GLint m_prevVAO { 0 };
  305. // m_worldModelMatrix in sceneMatrix () space, CPass points at these
  306. glm::mat4 m_modelMatrix { 1.0f };
  307. glm::mat4 m_worldModelMatrix { 1.0f };
  308. glm::mat4 m_modelMatrixInverse { 1.0f };
  309. glm::mat4 m_mvpMatrix { 1.0f };
  310. glm::mat4 m_mvpMatrixInverse { 1.0f };
  311. glm::mat4 m_viewProjectionMatrix { 1.0f };
  312. glm::vec3 m_orientationUp { 0.0f, 1.0f, 0.0f };
  313. glm::vec3 m_orientationRight { 1.0f, 0.0f, 0.0f };
  314. glm::vec3 m_orientationForward { 0.0f, 0.0f, 1.0f };
  315. glm::vec3 m_viewUp { 0.0f, 1.0f, 0.0f };
  316. glm::vec3 m_viewRight { 1.0f, 0.0f, 0.0f };
  317. glm::vec3 m_eyePosition { 0.0f, 0.0f, 1000.0f };
  318. glm::vec4 m_renderVar0 { 0.0f };
  319. glm::vec4 m_renderVar1 { 0.0f };
  320. int m_spritesheetFrames { 0 };
  321. float m_overbright { 1.0f };
  322. float m_refractAmount { 0.05f };
  323. bool m_useTrailRenderer { false };
  324. float m_trailLength { 0.05f };
  325. float m_trailMaxLength { 10.0f };
  326. float m_trailMinLength { 0.0f };
  327. bool m_useRopeRenderer { false };
  328. int m_ropeSubdivision { 4 };
  329. int m_ropeSegments { 4 };
  330. float m_ropeUVScale { 1.0f };
  331. bool m_ropeUVScrolling { false };
  332. uint32_t m_ropeDeaths { 0 };
  333. bool m_trailFadeAlpha { false };
  334. bool m_trailFadeSize { false };
  335. /** ropetrail: m_ropeSegments past positions per particle slot, newest first, compacted with the particles */
  336. std::vector<glm::vec3> m_trailHistory;
  337. std::vector<uint16_t> m_trailCount;
  338. std::vector<uint16_t> m_trailScroll;
  339. /** Counts down to the next history push, WE starts it at 0 so the first update pushes */
  340. float m_trailTimer { 0.0f };
  341. float m_trailInterval { 1.0f };
  342. static constexpr int SPRITE_FLOATS_PER_VERTEX = 17;
  343. static constexpr int ROPE_FLOATS_PER_VERTEX = 26;
  344. bool m_geometryStage { false };
  345. std::mt19937 m_rng;
  346. /** Only drawn when an operator needs it, so systems without one keep the same random sequence */
  347. bool m_usesParticleSeed = false;
  348. bool m_initialized { false };
  349. struct EventChildSlot {
  350. const ParticleChild* child;
  351. std::vector<std::unique_ptr<CParticle>> active;
  352. std::vector<std::unique_ptr<CParticle>> pool;
  353. };
  354. CParticle* m_parent { nullptr };
  355. const ParticleChild* m_childDefinition { nullptr };
  356. /**
  357. * WE's +928 matrix. Top level: the object's transform. Static children: the child transform. Event children:
  358. * the spawning particle's position and the child transform, in the parent's space or the world (eventPlacement)
  359. */
  360. glm::mat4 m_placement { 1.0f };
  361. glm::mat4 m_frame { 1.0f };
  362. bool m_worldSpace { false };
  363. glm::mat3 m_emitOrientation { 1.0f };
  364. std::optional<uint32_t> m_eventId;
  365. ParticleInstance m_eventParticle;
  366. bool m_hasEventParticle { false };
  367. bool m_following { false };
  368. bool m_emissionStopped { false };
  369. /** Particles emitParticles () adds to what each emitter spawns, sub_1402378A0's count argument */
  370. uint32_t m_forcedEmission { 0 };
  371. bool m_scriptColor { false };
  372. std::array<std::optional<glm::vec3>, 8> m_scriptControlPoints {};
  373. std::array<std::optional<glm::vec3>, 8> m_scriptControlPointAngles {};
  374. void registerNewParticles (uint32_t firstNew);
  375. /** Child systems inherit the root's pause (wallpaper64.exe copies +0x3F7 down) */
  376. [[nodiscard]] bool emissionPaused () const;
  377. std::vector<EmitterClock> m_emitterClocks;
  378. /** Where a mapsequence initializer is in its sequence, WE keeps it in the initializer's record (+4, +8) */
  379. struct SequenceCounter {
  380. float step = 0.0f;
  381. float sequence { 0.0f };
  382. /** Starts over with every new emitter period (mapsequencebetweencontrolpoints flag 0x20) */
  383. bool periodReset { false };
  384. };
  385. std::deque<SequenceCounter> m_sequences;
  386. std::vector<std::unique_ptr<CParticle>> m_staticChildren;
  387. std::vector<EventChildSlot> m_eventChildren;
  388. bool m_hasBirthEvents { false };
  389. bool m_hasDeathEvents { false };
  390. /** No events while prewarming, like WE */
  391. bool m_prewarming { false };
  392. uint32_t m_nextParticleId { 0 };
  393. std::vector<uint8_t> m_slotUsed;
  394. std::vector<uint32_t> m_births;
  395. std::vector<ParticleInstance> m_deaths;
  396. /** Slots handed out since the last restart, wallpaper64.exe's particle count (+832), the boids sample stride */
  397. uint32_t m_slotExtent { 0 };
  398. /**
  399. * wallpaper64.exe never clears a dead pool slot: movement keeps integrating it and boids still reads it as a
  400. * neighbor (see createBoidsOperator). Kept per slot for systems with boids, the only operator that reads others
  401. */
  402. std::vector<ParticleInstance> m_ghosts;
  403. std::vector<uint8_t> m_ghostUsed;
  404. bool m_hasBoids { false };
  405. /** wallpaper64.exe +1008: simulated time since the system started, the remapinitialvalue particlesystemtime */
  406. float m_systemTime { 0.0f };
  407. float m_layerTime { 0.0f };
  408. float m_frameDelta { 0.0f };
  409. float m_lastRealTime { 0.0f };
  410. struct ColorOverride {
  411. /** override color given and further than 0.9/255 from the particle file's reference color */
  412. bool active = false;
  413. /** spawn color every particle starts from (sub_1401D15A0), the override color itself only in tint mode */
  414. glm::vec3 tint = glm::vec3 (1.0f);
  415. glm::vec3 hsv = glm::vec3 (0.0f);
  416. glm::vec3 shift = glm::vec3 (0.0f);
  417. };
  418. ColorOverride m_colorOverride {};
  419. /** System flag 2 in wallpaper64.exe: angularvelocityrandom or angularmovement, angular speed means something */
  420. bool m_hasAngularVelocity { false };
  421. /** sub_14023FBC0 restores these from the spawn values before the operators when a remapvalue writes them */
  422. bool m_resetSizeFromBase { true };
  423. bool m_resetAlphaFromBase { false };
  424. bool m_resetColorFromBase { false };
  425. bool m_tracksPreviousPosition { false };
  426. };
  427. }