1 | #pragma once
|
---|
2 | #include "RenderTechnique.h"
|
---|
3 |
|
---|
4 | /**
|
---|
5 | @brief Base abstract class __declspec( dllexport ) of rendering a hierarchical particle system.
|
---|
6 |
|
---|
7 | A hierarchical particle system is a particle system made out of a smaller particle system.
|
---|
8 | It renders an image of the smaller particle system and multiplies this image to achieve a bigger particle system.
|
---|
9 | This way fewer computation is needed to simulate large number of particles, while the trick is usually unnoticable.
|
---|
10 | */
|
---|
11 | class __declspec( dllexport ) HierarchicalParticleSystemTechnique : virtual public RenderTechnique
|
---|
12 | {
|
---|
13 | public:
|
---|
14 | /**
|
---|
15 | @brief Constructor.
|
---|
16 |
|
---|
17 | @param startFrame adds an offset to the current frame number to help evenly distribute updates between frames
|
---|
18 | @param impostorUpdateInterval update frequency of the impostor texture (image of the smaller system)
|
---|
19 | @param impostorResolution resolution of the impostor texture
|
---|
20 | @param useDistCalc flag to skip impostor update if object is far away (//not used)
|
---|
21 | @param perspectiveRendering sets if the impostor should be rendered with a perspective projection or orthogonal
|
---|
22 | @param parentRenderable the object to operate on
|
---|
23 | @param parentTechniqueGroup the TechniqueGroup this RenderedTechnique is attached to
|
---|
24 | */
|
---|
25 | HierarchicalParticleSystemTechnique(
|
---|
26 | unsigned long startFrame,
|
---|
27 | unsigned long impostorUpdateInterval,
|
---|
28 | unsigned int impostorResolution,
|
---|
29 | bool useDistCalc,
|
---|
30 | bool perspectiveRendering,
|
---|
31 | ElementaryRenderable* parentRenderable,
|
---|
32 | TechniqueGroup* parentTechniqueGroup
|
---|
33 | );
|
---|
34 | virtual ~HierarchicalParticleSystemTechnique();
|
---|
35 |
|
---|
36 | //inherited
|
---|
37 | void update(unsigned long frameNum);
|
---|
38 | //inherited
|
---|
39 | void runChanged(RenderingRunType runType, RenderingRun* run);
|
---|
40 | //inherited
|
---|
41 | void runUpdated(RenderingRunType runType, RenderingRun* run);
|
---|
42 |
|
---|
43 | protected:
|
---|
44 | /**
|
---|
45 | @brief update frequency of the impostor texture (image of the smaller system)
|
---|
46 | */
|
---|
47 | unsigned long impostorUpdateInterval;
|
---|
48 | /**
|
---|
49 | @brief resolution of the impostor texture
|
---|
50 | */
|
---|
51 | unsigned int impostorResolution;
|
---|
52 | /**
|
---|
53 | @brief offset in frame number used during update
|
---|
54 | */
|
---|
55 | unsigned long startFrame;
|
---|
56 | /**
|
---|
57 | @brief flag to skip impostor update if object is far away (//not used)
|
---|
58 | */
|
---|
59 | bool useDistCalc;
|
---|
60 | /**
|
---|
61 | @brief sets if the impostor should be rendered with a perspective projection or orthogonal
|
---|
62 | */
|
---|
63 | bool perspectiveRendering;
|
---|
64 | /**
|
---|
65 | @brief Creates the ChildParticleSystemRenderingRun needed by this technique.
|
---|
66 |
|
---|
67 | @return pointer to the ChildParticleSystemRenderingRun created instance
|
---|
68 | */
|
---|
69 | virtual RenderingRun* createChildPSysRenderingRun()=0;
|
---|
70 | /**
|
---|
71 | @brief Called if the impostor rendering run changed.
|
---|
72 |
|
---|
73 | @param run pointer to the new ChildParticleSystemRenderingRun instance to use
|
---|
74 | */
|
---|
75 | virtual void impostorChanged(RenderingRun* run) = 0;
|
---|
76 | /**
|
---|
77 | @brief Called if the impostor rendering run is updated.
|
---|
78 |
|
---|
79 | @param run pointer to the updated ChildParticleSystemRenderingRu.
|
---|
80 | */
|
---|
81 | virtual void impostorUpdated(RenderingRun* run) = 0;
|
---|
82 |
|
---|
83 | }; |
---|