[780] | 1 | #pragma once
|
---|
| 2 | #include "RenderingRun.h"
|
---|
| 3 |
|
---|
| 4 | class TechniqueGroup;
|
---|
| 5 |
|
---|
[1055] | 6 |
|
---|
[1722] | 7 | #define RUN_TYPE_COUNT 24
|
---|
[780] | 8 | /**
|
---|
| 9 | @brief Enum of RenderingRun types.
|
---|
| 10 |
|
---|
| 11 | If a new class is derived from RenderingRun, this enum should be extended.
|
---|
[2240] | 12 | These types are used in messages sent when a run changes or updates.
|
---|
[780] | 13 | */
|
---|
| 14 | enum RenderingRunType
|
---|
| 15 | {
|
---|
[1722] | 16 | ILLUMRUN_CUBEMAP,
|
---|
[780] | 17 | ILLUMRUN_COLOR_CUBEMAP,
|
---|
[1722] | 18 | ILLUMRUN_COLOR_CUBEMAP_L1,
|
---|
| 19 | ILLUMRUN_COLOR_CUBEMAP_L2,
|
---|
| 20 | ILLUMRUN_COLOR_CUBEMAP_L3,
|
---|
| 21 | ILLUMRUN_COLOR_CUBEMAP_L4,
|
---|
| 22 | ILLUMRUN_COLOR_CUBEMAP_L5,
|
---|
| 23 | ILLUMRUN_COLOR_CUBEMAP_L6,
|
---|
[780] | 24 | ILLUMRUN_DISTANCE_CUBEMAP,
|
---|
[1722] | 25 | ILLUMRUN_DISTANCE_CUBEMAP_L1,
|
---|
| 26 | ILLUMRUN_DISTANCE_CUBEMAP_L2,
|
---|
| 27 | ILLUMRUN_DISTANCE_CUBEMAP_L3,
|
---|
| 28 | ILLUMRUN_DISTANCE_CUBEMAP_L4,
|
---|
| 29 | ILLUMRUN_DISTANCE_CUBEMAP_L5,
|
---|
| 30 | ILLUMRUN_DISTANCE_CUBEMAP_L6,
|
---|
[780] | 31 | ILLUMRUN_CAUSTIC_CUBEMAP,
|
---|
| 32 | ILLUMRUN_REDUCED_CUBEMAP,
|
---|
| 33 | ILLUMRUN_PHOTONMAP,
|
---|
| 34 | ILLUMRUN_DEPTH_SHADOWMAP,
|
---|
[1055] | 35 | ILLUMRUN_SCENE_CAMERA_DEPTH,
|
---|
[1103] | 36 | ILLUMRUN_HPP_IMPOSTOR,
|
---|
[1425] | 37 | ILLUMRUN_FOCUSING_MAP,
|
---|
| 38 | ILLUMRUN_LIGHTVOLUME_MAP,
|
---|
[2189] | 39 | ILLUMRUN_PHASE_TEXTURE,
|
---|
| 40 | ILLUMRUN_PM_ENTRYPOINTMAP,
|
---|
| 41 | ILLUMRUN_PM_WEIGHTMAP
|
---|
[780] | 42 | };
|
---|
| 43 |
|
---|
| 44 | /**
|
---|
| 45 | @brief Base abstract class for a collection of shared resources (RenderingRuns).
|
---|
| 46 |
|
---|
| 47 | Technique resources which can be shared between several techniques or objects are managed by SharedRuns.
|
---|
| 48 | These SharedRuns store the shared resources. They also act like nodes of a binary tree, as separate
|
---|
[2240] | 49 | SharedRuns can also be joined if for example the objects for which they store resources are close enough so
|
---|
[780] | 50 | even one shared resources is enough for the given objects.
|
---|
| 51 | */
|
---|
| 52 | class SharedRuns
|
---|
| 53 | {
|
---|
| 54 | public:
|
---|
| 55 | /**
|
---|
| 56 | &brief Constructor.
|
---|
| 57 | */
|
---|
| 58 | SharedRuns(void);
|
---|
[2240] | 59 | /**
|
---|
| 60 | &brief Returns true if this shared run object has a given run type.
|
---|
| 61 |
|
---|
| 62 | It returns true if the shared run object node has a rendering run object with the given type.
|
---|
| 63 | It checks only the current node of the tree, no children nodes are searched for existing rendering runs.
|
---|
| 64 |
|
---|
| 65 | @param runType enum, type of the RenderingRun to search for
|
---|
| 66 | @return search result
|
---|
| 67 | */
|
---|
[780] | 68 | virtual bool hasOwnRun(RenderingRunType runType) = 0;
|
---|
| 69 | /**
|
---|
| 70 | &brief Retrieves a shared resource.
|
---|
| 71 |
|
---|
| 72 | @param runType enum, type of the RenderingRun to be retrieved
|
---|
| 73 | @return pointer to the RenderingRun of type "runType", null if this type does not exists
|
---|
| 74 | */
|
---|
| 75 | virtual RenderingRun* getRun(RenderingRunType runType) = 0;
|
---|
| 76 | /**
|
---|
| 77 | &brief Adds a RenderingRun instance to the shared resources.
|
---|
| 78 |
|
---|
| 79 | @param runType enum, type of the RenderingRun to add
|
---|
| 80 | @param run pointer to the RenderingRun instance to add
|
---|
| 81 | */
|
---|
| 82 | virtual void addRun(RenderingRunType runType, RenderingRun* run)=0;
|
---|
| 83 | /**
|
---|
| 84 | &brief Updates a shared RenderingRun.
|
---|
| 85 |
|
---|
| 86 | @param runType enum, type of the RenderingRun to update
|
---|
| 87 | @param frameNum current framenumber
|
---|
| 88 | */
|
---|
| 89 | virtual void updateRun(RenderingRunType runType, unsigned long frameNum) = 0;
|
---|
| 90 | /**
|
---|
| 91 | &brief Joines two SharedRuns.
|
---|
| 92 |
|
---|
| 93 | The resulting SharedRuns become the parent of the two SharedRuns.
|
---|
| 94 |
|
---|
| 95 | @param otherRuns pointer to the SharedRuns instance to join with
|
---|
| 96 | @return the new parent SharedRuns instance
|
---|
| 97 | */
|
---|
| 98 | virtual SharedRuns* joinRuns(SharedRuns* otherRuns);
|
---|
| 99 | /**
|
---|
| 100 | @brief Called after one of he shared runs changes.
|
---|
| 101 |
|
---|
| 102 | This message will be forwarded to each child.
|
---|
| 103 |
|
---|
| 104 | @param runType enum describing the type of the changed run
|
---|
| 105 | @param run pointer to the changed RenderingRun
|
---|
| 106 | */
|
---|
| 107 | virtual void runChanged(RenderingRunType runType, RenderingRun* run);
|
---|
| 108 | /**
|
---|
| 109 | @brief Called after one of he shared runs updates.
|
---|
| 110 |
|
---|
| 111 | This message will be forwarded to each child.
|
---|
| 112 |
|
---|
| 113 | @param runType enum describing the type of the updated run
|
---|
| 114 | @param run pointer to the updated RenderingRun
|
---|
| 115 | */
|
---|
| 116 | virtual void runUpdated(RenderingRunType runType, RenderingRun* run);
|
---|
| 117 | /**
|
---|
[1055] | 118 | @brief Adds a child TechniqueGroup.
|
---|
[780] | 119 |
|
---|
| 120 | @param group pointer to the TechniqueGroup instance to add.
|
---|
| 121 | */
|
---|
[1055] | 122 | virtual void addTechniqueGroup(TechniqueGroup* group) = 0;
|
---|
[780] | 123 | /**
|
---|
| 124 | @brief Shows or hides this SharedRuns (and also all childnodes).
|
---|
| 125 |
|
---|
| 126 | @param visible visibility
|
---|
| 127 | */
|
---|
| 128 | virtual void setVisible(bool visible);
|
---|
| 129 | /**
|
---|
| 130 | @brief Hides this SharedRuns (and also all childs).
|
---|
| 131 |
|
---|
| 132 | The previous visibility is saved.
|
---|
| 133 | */
|
---|
| 134 | virtual void hide();
|
---|
| 135 | /**
|
---|
| 136 | @brief Restores the visibility of this SharedRuns (and also all childs).
|
---|
| 137 | */
|
---|
| 138 | virtual void restoreVisibility();
|
---|
| 139 | /**
|
---|
| 140 | @brief Retrieves the root node of this SharedRuns node.
|
---|
| 141 |
|
---|
| 142 | @return pointer to the root SharedRuns instance
|
---|
| 143 | */
|
---|
| 144 | virtual SharedRuns* getRoot();
|
---|
| 145 | /**
|
---|
| 146 | @brief Retrieves the topmost parent node of this SharedRuns node, which have a specified RenderingRun type.
|
---|
| 147 |
|
---|
| 148 | @param runType the RenderingRun type
|
---|
| 149 |
|
---|
| 150 | @return pointer to the parent SharedRuns instance
|
---|
| 151 | */
|
---|
| 152 | virtual SharedRuns* getRoot(RenderingRunType runType);
|
---|
| 153 | /**
|
---|
| 154 | @brief Updates the boundary of this SharedRuns (and also it's parent).
|
---|
| 155 | */
|
---|
| 156 | virtual void updateBounds() = 0;
|
---|
| 157 | /**
|
---|
| 158 | @brief Validate this SharedRuns (and also all childs).
|
---|
| 159 |
|
---|
| 160 | Validation meens that all the SharedRuns that are joined will be examined if the sharing is still valid.
|
---|
| 161 | If it finds out that two SharedRuns can't be joined anymore (eg.: they moved far from each other), their
|
---|
| 162 | parent will be split and destroyed (all parent of this node also should be deleted recursively).
|
---|
| 163 | */
|
---|
| 164 | virtual void validate() = 0;
|
---|
| 165 | /**
|
---|
| 166 | @brief Destroys the node (and all parents recursively).
|
---|
| 167 | */
|
---|
| 168 | virtual void destroy() = 0;
|
---|
| 169 | /**
|
---|
| 170 | @brief Unbinds the parent of the node, called at splitting.
|
---|
| 171 | */
|
---|
| 172 | virtual void unbindParent(){parent = 0;}
|
---|
| 173 | /**
|
---|
| 174 | @brief Unbinds the deletes the parent of the node, called at splitting.
|
---|
| 175 | */
|
---|
| 176 | virtual void unbindAndKillParent(){delete parent; parent = 0;}
|
---|
[2320] | 177 |
|
---|
| 178 | virtual void freeAllResources()=0;
|
---|
[780] | 179 |
|
---|
| 180 | protected:
|
---|
| 181 | /**
|
---|
| 182 | @brief parent SharedRuns instance
|
---|
| 183 | */
|
---|
| 184 | SharedRuns* parent;
|
---|
| 185 | /**
|
---|
| 186 | @brief child SharedRuns instance
|
---|
| 187 | */
|
---|
| 188 | SharedRuns* child1;
|
---|
| 189 | /**
|
---|
| 190 | @brief child SharedRuns instance
|
---|
| 191 | */
|
---|
| 192 | SharedRuns* child2;
|
---|
[1055] | 193 |
|
---|
[780] | 194 | /**
|
---|
| 195 | @brief Collects RenderingRuns references from the child nodes, used when joining
|
---|
| 196 | */
|
---|
| 197 | virtual void gatherRuns() = 0;
|
---|
| 198 | /**
|
---|
| 199 | @brief Sends runChanged events for each RenderingRun type, used after join and split
|
---|
| 200 | */
|
---|
| 201 | virtual void fireRunChanges() = 0;
|
---|
| 202 | /**
|
---|
| 203 | @brief Creates a new SharedRuns instance. All derivatives should implement this.
|
---|
| 204 |
|
---|
| 205 | @return a new SharedRuns instance
|
---|
| 206 | */
|
---|
| 207 | virtual SharedRuns* createInstance() = 0; //{ return 0; }
|
---|
| 208 | /**
|
---|
| 209 | @brief Set visibility of connected renderables, only used if this is a leaf.
|
---|
| 210 |
|
---|
| 211 | @param visible visibility
|
---|
| 212 | */
|
---|
| 213 | virtual void setRenderablesVisible(bool visible) = 0;
|
---|
| 214 | /**
|
---|
| 215 | @brief Hides all the connected renderables, only used if this is a leaf.
|
---|
| 216 | */
|
---|
| 217 | virtual void hideRenderables() = 0;
|
---|
| 218 | /**
|
---|
| 219 | @brief Restires visibility of all the connected renderables, only used if this is a leaf.
|
---|
| 220 | */
|
---|
| 221 | virtual void restoreRenderableVisibility() = 0;
|
---|
| 222 | };
|
---|
| 223 |
|
---|