VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
WaterBodyLogic.h
1 /*
2  * Copyright (C) 2014 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef WATERBODYLOGIC_H
18 #define WATERBODYLOGIC_H
19 
20 #include "ParticleEmitterLogic.h"
21 
31  Q_OBJECT
35  Q_PROPERTY(float spawnStride MEMBER mSpawnStride NOTIFY spawnStrideChanged)
36 
37 public:
42 
47  virtual int getSupportedMaxEntityCount() const override { return mInitialSpawnCount; }
51  virtual void init() override;
56  virtual void update() override;
57 
58 signals:
62  void spawnStrideChanged();
63 
64 protected:
69  virtual void onPausedChanged() override;
70  virtual QRectF getEmitterWorldBounds() override;
71 
72 private:
73  class KeepAliveQueryCallback;
74 
75  void spawnInitialParticles();
76 
77  float mSpawnStride = 1.35f;
78  bool mNeedsRespawn = false;
79  int mInitialSpawnCount = 0;
80  QRectF mInitialBoundingBox;
81 };
82 
83 #endif // WATERBODYLOGIC_H
WaterBodyLogic()
Constructs a WaterBodyLogic.
Creates a body of water formed from WaterParticles.
Definition: WaterBodyLogic.h:30
virtual void update() override
Spawns particles to fill the WaterBody if necessary and decays particles outside of the actor's Body ...
void spawnStrideChanged()
Emitted when spawnStride changes.
virtual void onPausedChanged() override
Notifies WaterBodyLogic to respawn enough particles to fill actor's Body shape if the emitter has bec...
Spawns WaterParticles into the world (i.e. an unbounded WaterParticleSet).
Definition: ParticleEmitterLogic.h:28
float spawnStride
Distance between spawned particles in the WaterBody, as a scale of particle size. ...
Definition: WaterBodyLogic.h:35
virtual int getSupportedMaxEntityCount() const override
Returns the maximum number of particles that can be spawned by the class (i.e. the maximum number of ...
Definition: WaterBodyLogic.h:47
virtual void init() override
Spawns initial particles to fill the body of water.
virtual QRectF getEmitterWorldBounds() override
Returns the bounding box of this emitter in world coordinates.