Skip to content

Commit ca9e852

Browse files
committed
Finale: Tick-tock IgnOgreRenderingMode
Signed-off-by: methylDragon <[email protected]>
1 parent 3258608 commit ca9e852

17 files changed

+80
-67
lines changed

Migration.md

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ release will remove the deprecated code.
2727
3. `IGN_VISIBILITY_SELECTION`
2828
4. `IGN_VISIBILITY_GUI`
2929
5. `IGN_VISIBILITY_SELECTABLE`
30+
7. The `IgnRenderingMode` enum is deprecated and will be removed in future versions. Use `GzRenderingMode` instead.
31+
1. Similarly, the `IORM_` prefixed enum values are deprecated. Use the `GORM_` prefix instead.
32+
2. Also, `Ogre2RenderEngine->SetIgnOgreRenderingMode` is deprecated and will be removed. Use `Ogre2RenderEngine->SetGzOgreRenderingMode` instead.
3033

3134
### Breaking Changes
3235

ogre2/include/gz/rendering/ogre2/Ogre2GzOgreRenderingMode.hh

+12-7
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,32 @@ namespace gz
2929
/// \brief Rendering modes so that GzHlms implementations
3030
/// follow alternate code paths or extra customizations
3131
/// when they're enabled
32-
enum IgnOgreRenderingMode
32+
enum GzOgreRenderingMode
3333
{
3434
/// \brief Normal rendering
35-
IORM_NORMAL,
35+
GORM_NORMAL = 0,
36+
IORM_NORMAL = 0, // TODO(CH3): Deprecated. Remove on tock.
3637

3738
/// \brief Render a solid color explicit per object.
3839
/// Used by e.g. Segmentation camera mode
39-
IORM_SOLID_COLOR,
40+
GORM_SOLID_COLOR = 1,
41+
IORM_SOLID_COLOR = 1, // TODO(CH3): Deprecated. Remove on tock.
4042

41-
/// \brief Like IORM_SOLID_COLOR, but if CustomParameter 2u
43+
/// \brief Like GORM_SOLID_COLOR, but if CustomParameter 2u
4244
/// is present, raw diffuse texture will be multiplied against
4345
/// the solid colour.
4446
///
45-
/// Also Unlit will behave as if IORM_NORMAL
47+
/// Also Unlit will behave as if GORM_NORMAL
4648
///
4749
/// Used by thermal camera
48-
IORM_SOLID_THERMAL_COLOR_TEXTURED,
50+
GORM_SOLID_THERMAL_COLOR_TEXTURED = 2,
51+
IORM_SOLID_THERMAL_COLOR_TEXTURED = 2, // TODO(CH3): Deprecated. Remove on tock.
4952

5053
/// \brief Total number of rendering modes
51-
IORM_COUNT,
54+
GORM_COUNT = 3,
55+
IORM_COUNT = 3, // TODO(CH3): Deprecated. Remove on tock.
5256
};
57+
using IgnOgreRenderingMode GZ_DEPRECATED(7) = GzOgreRenderingMode; // TODO(CH3): Deprecated. Remove on tock.
5358
} // namespace GZ_RENDERING_VERSION_NAMESPACE
5459
} // namespace rendering
5560
} // namespace gz

ogre2/include/gz/rendering/ogre2/Ogre2RenderEngine.hh

+7-2
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,15 @@ namespace gz
193193
public: Ogre::v1::OverlaySystem *OverlaySystem() const;
194194

195195
/// \internal
196-
/// \brief Sets the current rendering mode. See IgnOgreRenderingMode
196+
/// \brief Sets the current rendering mode. See GzOgreRenderingMode
197197
/// and see Ogre::GzHlmsPbs
198198
/// \param[in] renderingMode
199-
public: void SetIgnOgreRenderingMode(IgnOgreRenderingMode renderingMode);
199+
public: void SetGzOgreRenderingMode(GzOgreRenderingMode renderingMode);
200+
// TODO(CH3): Deprecated. Remove on tock.
201+
public:
202+
inline void GZ_DEPRECATED(7) SetIgnOgreRenderingMode(GzOgreRenderingMode renderingMode){
203+
return SetGzOgreRenderingMode(renderingMode);
204+
}
200205

201206
/// \internal
202207
/// \brief Get a pointer to the Pbs listener that adds terra shadows.

ogre2/src/Ogre2GpuRays.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ void Ogre2LaserRetroMaterialSwitcher::passPreExecute(
219219
return;
220220

221221
auto engine = Ogre2RenderEngine::Instance();
222-
engine->SetIgnOgreRenderingMode(IORM_SOLID_COLOR);
222+
engine->SetGzOgreRenderingMode(GORM_SOLID_COLOR);
223223

224224
this->materialMap.clear();
225225
this->datablockMap.clear();
@@ -452,7 +452,7 @@ void Ogre2LaserRetroMaterialSwitcher::passPosExecute(
452452
this->datablockMap.clear();
453453

454454
// Remove the custom parameter. Why? If there are multiple cameras that
455-
// use IORM_SOLID_COLOR (or any other mode), we want them to throw if
455+
// use GORM_SOLID_COLOR (or any other mode), we want them to throw if
456456
// that code forgot to call setCustomParameter. We may miss those errors
457457
// if that code forgets to call but it was already carrying the value
458458
// we set here.
@@ -490,7 +490,7 @@ void Ogre2LaserRetroMaterialSwitcher::passPosExecute(
490490
heightmap->Terra()->UnsetSolidColors();
491491
}
492492

493-
engine->SetIgnOgreRenderingMode(IORM_NORMAL);
493+
engine->SetGzOgreRenderingMode(GORM_NORMAL);
494494
}
495495

496496
//////////////////////////////////////////////////
@@ -1186,7 +1186,7 @@ void Ogre2GpuRays::Setup1stPass()
11861186
false);
11871187

11881188
// add laser retro material switcher to workspace listener
1189-
// so we can switch to use IORM_SOLID_COLOR
1189+
// so we can switch to use GORM_SOLID_COLOR
11901190
this->dataPtr->laserRetroMaterialSwitcher[i].reset(
11911191
new Ogre2LaserRetroMaterialSwitcher(this->scene));
11921192
this->dataPtr->ogreCompositorWorkspace1st[i]->addListener(

ogre2/src/Ogre2GzHlmsPbsPrivate.cc

+13-13
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ namespace Ogre
6262
Hlms *_hlms)
6363
{
6464
if (!_casterPass &&
65-
(this->gzOgreRenderingMode == IORM_SOLID_COLOR ||
66-
this->gzOgreRenderingMode == IORM_SOLID_THERMAL_COLOR_TEXTURED))
65+
(this->gzOgreRenderingMode == GORM_SOLID_COLOR ||
66+
this->gzOgreRenderingMode == GORM_SOLID_THERMAL_COLOR_TEXTURED))
6767
{
6868
_hlms->_setProperty("gz_render_solid_color", 1);
6969

70-
if (this->gzOgreRenderingMode == IORM_SOLID_THERMAL_COLOR_TEXTURED)
70+
if (this->gzOgreRenderingMode == GORM_SOLID_THERMAL_COLOR_TEXTURED)
7171
_hlms->_setProperty("gz_render_solid_color_textured", 1);
7272
}
7373

@@ -146,8 +146,8 @@ namespace Ogre
146146
}
147147

148148
if (_casterPass ||
149-
(this->gzOgreRenderingMode != IORM_SOLID_COLOR &&
150-
this->gzOgreRenderingMode != IORM_SOLID_THERMAL_COLOR_TEXTURED))
149+
(this->gzOgreRenderingMode != GORM_SOLID_COLOR &&
150+
this->gzOgreRenderingMode != GORM_SOLID_THERMAL_COLOR_TEXTURED))
151151
{
152152
return;
153153
}
@@ -163,8 +163,8 @@ namespace Ogre
163163
const uint32 instanceIdx = HlmsPbs::fillBuffersForV1(
164164
_cache, _queuedRenderable, _casterPass, _lastCacheHash, _commandBuffer);
165165

166-
if ((this->gzOgreRenderingMode == IORM_SOLID_COLOR ||
167-
this->gzOgreRenderingMode == IORM_SOLID_THERMAL_COLOR_TEXTURED) &&
166+
if ((this->gzOgreRenderingMode == GORM_SOLID_COLOR ||
167+
this->gzOgreRenderingMode == GORM_SOLID_THERMAL_COLOR_TEXTURED) &&
168168
!_casterPass)
169169
{
170170
Vector4 customParam =
@@ -177,12 +177,12 @@ namespace Ogre
177177
dataPtr[1] = customParam.y;
178178
dataPtr[2] = customParam.z;
179179

180-
if (this->gzOgreRenderingMode == IORM_SOLID_THERMAL_COLOR_TEXTURED &&
180+
if (this->gzOgreRenderingMode == GORM_SOLID_THERMAL_COLOR_TEXTURED &&
181181
_queuedRenderable.renderable->hasCustomParameter(2u))
182182
{
183183
GZ_ASSERT(customParam.w >= 0.0f,
184184
"customParam.w can't be negative for "
185-
"IORM_SOLID_THERMAL_COLOR_TEXTURED");
185+
"GORM_SOLID_THERMAL_COLOR_TEXTURED");
186186

187187
// Negate customParam.w to tell the shader we wish to multiply
188188
// against the diffuse texture. We substract 0.5f to avoid -0.0 = 0.0
@@ -205,8 +205,8 @@ namespace Ogre
205205
const uint32 instanceIdx = HlmsPbs::fillBuffersForV2(
206206
_cache, _queuedRenderable, _casterPass, _lastCacheHash, _commandBuffer);
207207

208-
if ((this->gzOgreRenderingMode == IORM_SOLID_COLOR ||
209-
this->gzOgreRenderingMode == IORM_SOLID_THERMAL_COLOR_TEXTURED) &&
208+
if ((this->gzOgreRenderingMode == GORM_SOLID_COLOR ||
209+
this->gzOgreRenderingMode == GORM_SOLID_THERMAL_COLOR_TEXTURED) &&
210210
!_casterPass)
211211
{
212212
Vector4 customParam;
@@ -236,12 +236,12 @@ namespace Ogre
236236
dataPtr[2] = customParam.z;
237237
dataPtr[3] = customParam.w;
238238

239-
if (this->gzOgreRenderingMode == IORM_SOLID_THERMAL_COLOR_TEXTURED &&
239+
if (this->gzOgreRenderingMode == GORM_SOLID_THERMAL_COLOR_TEXTURED &&
240240
_queuedRenderable.renderable->hasCustomParameter(2u))
241241
{
242242
GZ_ASSERT(customParam.w >= 0.0f,
243243
"customParam.w can't be negative for "
244-
"IORM_SOLID_THERMAL_COLOR_TEXTURED");
244+
"GORM_SOLID_THERMAL_COLOR_TEXTURED");
245245

246246
// Negate customParam.w to tell the shader we wish to multiply
247247
// against the diffuse texture. We substract 0.5f to avoid -0.0 = 0.0

ogre2/src/Ogre2GzHlmsPbsPrivate.hh

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ namespace Ogre
132132
public: virtual void notifyPropertiesMergedPreGenerationStep() override;
133133

134134
/// \brief Override HlmsListener::hlmsTypeChanged so we can
135-
/// bind buffers which carry per-object data when in IORM_SOLID_COLOR
135+
/// bind buffers which carry per-object data when in GORM_SOLID_COLOR
136136
/// \param[in] _casterPass true if this is a caster pass
137137
/// \param[in] _commandBuffer command buffer so we can add commands
138138
/// \param[in] _datablock material of the object that caused

ogre2/src/Ogre2GzHlmsSharedPrivate.hh

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace gz
3838
{
3939
inline namespace GZ_RENDERING_VERSION_NAMESPACE
4040
{
41-
typedef gz::rendering::IgnOgreRenderingMode IgnOgreRenderingMode;
41+
typedef gz::rendering::GzOgreRenderingMode GzOgreRenderingMode;
4242
typedef Ogre::vector<Ogre::ConstBufferPacked*>::type ConstBufferPackedVec;
4343

4444
/// \brief Implements code shared across all or most of our Hlms
@@ -106,9 +106,9 @@ namespace gz
106106
/// \internal
107107
protected: float *currPerObjectDataPtr = nullptr;
108108

109-
/// \brief See IgnOgreRenderingMode. Public variable.
109+
/// \brief See GzOgreRenderingMode. Public variable.
110110
/// Modifying it takes change on the next render
111-
public: IgnOgreRenderingMode gzOgreRenderingMode = IORM_NORMAL;
111+
public: GzOgreRenderingMode gzOgreRenderingMode = GORM_NORMAL;
112112
};
113113
}
114114
}

ogre2/src/Ogre2GzHlmsTerraPrivate.cc

+13-13
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ namespace Ogre
5959
bool _dualParaboloid, SceneManager *_sceneManager, Hlms *_hlms)
6060
{
6161
if (!_casterPass &&
62-
(this->gzOgreRenderingMode == IORM_SOLID_COLOR ||
63-
this->gzOgreRenderingMode == IORM_SOLID_THERMAL_COLOR_TEXTURED))
62+
(this->gzOgreRenderingMode == GORM_SOLID_COLOR ||
63+
this->gzOgreRenderingMode == GORM_SOLID_THERMAL_COLOR_TEXTURED))
6464
{
6565
_hlms->_setProperty("gz_render_solid_color", 1);
6666

67-
if (this->gzOgreRenderingMode == IORM_SOLID_THERMAL_COLOR_TEXTURED)
67+
if (this->gzOgreRenderingMode == GORM_SOLID_THERMAL_COLOR_TEXTURED)
6868
_hlms->_setProperty("gz_render_solid_color_textured", 1);
6969
}
7070

@@ -143,8 +143,8 @@ namespace Ogre
143143
}
144144

145145
if (_casterPass ||
146-
(this->gzOgreRenderingMode != IORM_SOLID_COLOR &&
147-
this->gzOgreRenderingMode != IORM_SOLID_THERMAL_COLOR_TEXTURED))
146+
(this->gzOgreRenderingMode != GORM_SOLID_COLOR &&
147+
this->gzOgreRenderingMode != GORM_SOLID_THERMAL_COLOR_TEXTURED))
148148
{
149149
return;
150150
}
@@ -160,8 +160,8 @@ namespace Ogre
160160
const uint32 instanceIdx = HlmsTerra::fillBuffersForV1(
161161
_cache, _queuedRenderable, _casterPass, _lastCacheHash, _commandBuffer);
162162

163-
if ((this->gzOgreRenderingMode == IORM_SOLID_COLOR ||
164-
this->gzOgreRenderingMode == IORM_SOLID_THERMAL_COLOR_TEXTURED) &&
163+
if ((this->gzOgreRenderingMode == GORM_SOLID_COLOR ||
164+
this->gzOgreRenderingMode == GORM_SOLID_THERMAL_COLOR_TEXTURED) &&
165165
!_casterPass)
166166
{
167167
const Ogre::Terra *terra =
@@ -193,12 +193,12 @@ namespace Ogre
193193
dataPtr[1] = customParam.y;
194194
dataPtr[2] = customParam.z;
195195

196-
if (this->gzOgreRenderingMode == IORM_SOLID_THERMAL_COLOR_TEXTURED &&
196+
if (this->gzOgreRenderingMode == GORM_SOLID_THERMAL_COLOR_TEXTURED &&
197197
terra->HasSolidColor(2u))
198198
{
199199
GZ_ASSERT(customParam.w >= 0.0f,
200200
"customParam.w can't be negative for "
201-
"IORM_SOLID_THERMAL_COLOR_TEXTURED");
201+
"GORM_SOLID_THERMAL_COLOR_TEXTURED");
202202

203203
// Negate customParam.w to tell the shader we wish to multiply
204204
// against the diffuse texture. We substract 0.5f to avoid -0.0 = 0.0
@@ -221,8 +221,8 @@ namespace Ogre
221221
const uint32 instanceIdx = HlmsTerra::fillBuffersForV2(
222222
_cache, _queuedRenderable, _casterPass, _lastCacheHash, _commandBuffer);
223223

224-
if ((this->gzOgreRenderingMode == IORM_SOLID_COLOR ||
225-
this->gzOgreRenderingMode == IORM_SOLID_THERMAL_COLOR_TEXTURED) &&
224+
if ((this->gzOgreRenderingMode == GORM_SOLID_COLOR ||
225+
this->gzOgreRenderingMode == GORM_SOLID_THERMAL_COLOR_TEXTURED) &&
226226
!_casterPass)
227227
{
228228
const Ogre::Terra *terra =
@@ -255,12 +255,12 @@ namespace Ogre
255255
dataPtr[2] = customParam.z;
256256
dataPtr[3] = customParam.w;
257257

258-
if (this->gzOgreRenderingMode == IORM_SOLID_THERMAL_COLOR_TEXTURED &&
258+
if (this->gzOgreRenderingMode == GORM_SOLID_THERMAL_COLOR_TEXTURED &&
259259
terra->HasSolidColor(2u))
260260
{
261261
GZ_ASSERT(customParam.w >= 0.0f,
262262
"customParam.w can't be negative for "
263-
"IORM_SOLID_THERMAL_COLOR_TEXTURED");
263+
"GORM_SOLID_THERMAL_COLOR_TEXTURED");
264264

265265
// Negate customParam.w to tell the shader we wish to multiply
266266
// against the diffuse texture. We substract 0.5f to avoid -0.0 = 0.0

ogre2/src/Ogre2GzHlmsTerraPrivate.hh

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ namespace Ogre
129129
public: virtual void notifyPropertiesMergedPreGenerationStep() override;
130130

131131
/// \brief Override HlmsListener::hlmsTypeChanged so we can
132-
/// bind buffers which carry per-object data when in IORM_SOLID_COLOR
132+
/// bind buffers which carry per-object data when in GORM_SOLID_COLOR
133133
/// \param[in] _casterPass true if this is a caster pass
134134
/// \param[in] _commandBuffer command buffer so we can add commands
135135
/// \param[in] _datablock material of the object that caused

ogre2/src/Ogre2GzHlmsUnlitPrivate.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace Ogre
5656
const CompositorShadowNode *_shadowNode, bool _casterPass,
5757
bool _dualParaboloid, SceneManager *_sceneManager, Hlms *_hlms)
5858
{
59-
if (!_casterPass && this->gzOgreRenderingMode == IORM_SOLID_COLOR)
59+
if (!_casterPass && this->gzOgreRenderingMode == GORM_SOLID_COLOR)
6060
{
6161
_hlms->_setProperty("gz_render_solid_color", 1);
6262
}
@@ -135,7 +135,7 @@ namespace Ogre
135135
listener->hlmsTypeChanged(_casterPass, _commandBuffer, _datablock);
136136
}
137137

138-
if (_casterPass || this->gzOgreRenderingMode != IORM_SOLID_COLOR)
138+
if (_casterPass || this->gzOgreRenderingMode != GORM_SOLID_COLOR)
139139
{
140140
return;
141141
}
@@ -151,7 +151,7 @@ namespace Ogre
151151
const uint32 instanceIdx = HlmsUnlit::fillBuffersForV1(
152152
_cache, _queuedRenderable, _casterPass, _lastCacheHash, _commandBuffer);
153153

154-
if (this->gzOgreRenderingMode == IORM_SOLID_COLOR && !_casterPass)
154+
if (this->gzOgreRenderingMode == GORM_SOLID_COLOR && !_casterPass)
155155
{
156156
Vector4 customParam;
157157
try
@@ -192,7 +192,7 @@ namespace Ogre
192192
const uint32 instanceIdx = HlmsUnlit::fillBuffersForV2(
193193
_cache, _queuedRenderable, _casterPass, _lastCacheHash, _commandBuffer);
194194

195-
if (this->gzOgreRenderingMode == IORM_SOLID_COLOR && !_casterPass)
195+
if (this->gzOgreRenderingMode == GORM_SOLID_COLOR && !_casterPass)
196196
{
197197
Vector4 customParam =
198198
_queuedRenderable.renderable->getCustomParameter(1u);

ogre2/src/Ogre2GzHlmsUnlitPrivate.hh

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ namespace Ogre
129129
public: virtual void notifyPropertiesMergedPreGenerationStep() override;
130130

131131
/// \brief Override HlmsListener::hlmsTypeChanged so we can
132-
/// bind buffers which carry per-object data when in IORM_SOLID_COLOR
132+
/// bind buffers which carry per-object data when in GORM_SOLID_COLOR
133133
/// \param[in] _casterPass true if this is a caster pass
134134
/// \param[in] _commandBuffer command buffer so we can add commands
135135
/// \param[in] _datablock material of the object that caused

ogre2/src/Ogre2MaterialSwitcher.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void Ogre2MaterialSwitcher::cameraPreRenderScene(
5959
Ogre::Camera * /*_evt*/)
6060
{
6161
auto engine = Ogre2RenderEngine::Instance();
62-
engine->SetIgnOgreRenderingMode(IORM_SOLID_COLOR);
62+
engine->SetGzOgreRenderingMode(GORM_SOLID_COLOR);
6363

6464
this->materialMap.clear();
6565
this->datablockMap.clear();
@@ -196,7 +196,7 @@ void Ogre2MaterialSwitcher::cameraPostRenderScene(
196196
this->datablockMap.clear();
197197

198198
// Remove the custom parameter. Why? If there are multiple cameras that
199-
// use IORM_SOLID_COLOR (or any other mode), we want them to throw if
199+
// use GORM_SOLID_COLOR (or any other mode), we want them to throw if
200200
// that code forgot to call setCustomParameter. We may miss those errors
201201
// if that code forgets to call but it was already carrying the value
202202
// we set here.
@@ -234,7 +234,7 @@ void Ogre2MaterialSwitcher::cameraPostRenderScene(
234234
heightmap->Terra()->UnsetSolidColors();
235235
}
236236

237-
engine->SetIgnOgreRenderingMode(IORM_NORMAL);
237+
engine->SetGzOgreRenderingMode(GORM_NORMAL);
238238
}
239239

240240
/////////////////////////////////////////////////

ogre2/src/Ogre2RenderEngine.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1082,8 +1082,8 @@ Ogre::v1::OverlaySystem *Ogre2RenderEngine::OverlaySystem() const
10821082
}
10831083

10841084
/////////////////////////////////////////////////
1085-
void Ogre2RenderEngine::SetIgnOgreRenderingMode(
1086-
IgnOgreRenderingMode renderingMode)
1085+
void Ogre2RenderEngine::SetGzOgreRenderingMode(
1086+
GzOgreRenderingMode renderingMode)
10871087
{
10881088
this->dataPtr->gzHlmsPbs->gzOgreRenderingMode = renderingMode;
10891089
this->dataPtr->gzHlmsUnlit->gzOgreRenderingMode = renderingMode;

0 commit comments

Comments
 (0)