@@ -57,15 +57,10 @@ void D3DXRenderBase::r_dsgraph_insert_dynamic(dxRender_Visual* pVisual, Fvector&
57
57
// a) Allow to optimize RT order
58
58
// b) Should be rendered to special distort buffer in another pass
59
59
VERIFY (pVisual->shader ._get ());
60
- ShaderElement* sh_d = &*pVisual->shader ->E [4 ];
60
+ ShaderElement* sh_d = &*pVisual->shader ->E [4 ]; // 4=L_special
61
61
if (RImplementation.o .distortion && sh_d && sh_d->flags .bDistort && pmask[sh_d->flags .iPriority / 2 ])
62
62
{
63
- mapSorted_Node* N = mapDistort.insertInAnyWay (distSQ);
64
- N->val .ssa = SSA;
65
- N->val .pObject = RI.val_pObject ;
66
- N->val .pVisual = pVisual;
67
- N->val .Matrix = *RI.val_pTransform ;
68
- N->val .se = sh_d; // 4=L_special
63
+ mapDistort.emplace_back (std::make_pair (distSQ, _MatrixItemS ({ SSA, RI.val_pObject , pVisual, *RI.val_pTransform , sh_d }))); // sh_d -> L_special
69
64
}
70
65
71
66
// Select shader
@@ -75,62 +70,35 @@ void D3DXRenderBase::r_dsgraph_insert_dynamic(dxRender_Visual* pVisual, Fvector&
75
70
if (!pmask[sh->flags .iPriority / 2 ])
76
71
return ;
77
72
78
- // Create common node
79
- // NOTE: Invisible elements exist only in R1
80
- _MatrixItem item = {SSA, RI.val_pObject , pVisual, *RI.val_pTransform };
81
-
82
73
// HUD rendering
83
74
if (RI.val_bHUD )
84
75
{
85
76
if (sh->flags .bStrictB2F )
86
77
{
87
- mapSorted_Node* N = mapSorted.insertInAnyWay (distSQ);
88
- N->val .ssa = SSA;
89
- N->val .pObject = RI.val_pObject ;
90
- N->val .pVisual = pVisual;
91
- N->val .Matrix = *RI.val_pTransform ;
92
- N->val .se = sh;
93
- return ;
78
+ mapSorted.emplace_back (std::make_pair (distSQ, _MatrixItemS ({ SSA, RI.val_pObject , pVisual, *RI.val_pTransform , sh })));
94
79
}
95
80
else
96
81
{
97
- mapHUD_Node* N = mapHUD.insertInAnyWay (distSQ);
98
- N->val .ssa = SSA;
99
- N->val .pObject = RI.val_pObject ;
100
- N->val .pVisual = pVisual;
101
- N->val .Matrix = *RI.val_pTransform ;
102
- N->val .se = sh;
82
+ mapHUD.emplace_back (std::make_pair (distSQ, _MatrixItemS ({ SSA, RI.val_pObject , pVisual, *RI.val_pTransform , sh })));
103
83
#if RENDER != R_R1
104
84
if (sh->flags .bEmissive )
105
- {
106
- mapSorted_Node* N2 = mapHUDEmissive.insertInAnyWay (distSQ);
107
- N2->val .ssa = SSA;
108
- N2->val .pObject = RI.val_pObject ;
109
- N2->val .pVisual = pVisual;
110
- N2->val .Matrix = *RI.val_pTransform ;
111
- N2->val .se = &*pVisual->shader ->E [4 ]; // 4=L_special
112
- }
113
- #endif // RENDER!=R_R1
114
- return ;
85
+ mapHUDEmissive.emplace_back (std::make_pair (distSQ, _MatrixItemS ({ SSA, RI.val_pObject , pVisual, *RI.val_pTransform , sh_d }))); // sh_d -> L_special
86
+ #endif // RENDER!=R_R1
115
87
}
88
+ return ;
116
89
}
117
90
118
91
// Shadows registering
119
92
#if RENDER == R_R1
120
- RI.L_Shadows ->add_element (item );
93
+ RI.L_Shadows ->add_element (_MatrixItem{ SSA, RI. val_pObject , pVisual, *RI. val_pTransform } );
121
94
#endif
122
95
if (RI.val_bInvisible )
123
96
return ;
124
97
125
98
// strict-sorting selection
126
99
if (sh->flags .bStrictB2F )
127
100
{
128
- mapSorted_Node* N = mapSorted.insertInAnyWay (distSQ);
129
- N->val .ssa = SSA;
130
- N->val .pObject = RI.val_pObject ;
131
- N->val .pVisual = pVisual;
132
- N->val .Matrix = *RI.val_pTransform ;
133
- N->val .se = sh;
101
+ mapSorted.emplace_back (std::make_pair (distSQ, _MatrixItemS ({ SSA, RI.val_pObject , pVisual, *RI.val_pTransform , sh })));
134
102
return ;
135
103
}
136
104
@@ -142,25 +110,19 @@ void D3DXRenderBase::r_dsgraph_insert_dynamic(dxRender_Visual* pVisual, Fvector&
142
110
// d) Should be rendered to accumulation buffer in the second pass
143
111
if (sh->flags .bEmissive )
144
112
{
145
- mapSorted_Node* N = mapEmissive.insertInAnyWay (distSQ);
146
- N->val .ssa = SSA;
147
- N->val .pObject = RI.val_pObject ;
148
- N->val .pVisual = pVisual;
149
- N->val .Matrix = *RI.val_pTransform ;
150
- N->val .se = &*pVisual->shader ->E [4 ]; // 4=L_special
113
+ mapEmissive.emplace_back (std::make_pair (distSQ, _MatrixItemS ({ SSA, RI.val_pObject , pVisual, *RI.val_pTransform , sh_d }))); // sh_d -> L_special
151
114
}
152
115
if (sh->flags .bWmark && pmask_wmark)
153
116
{
154
- mapSorted_Node* N = mapWmark.insertInAnyWay (distSQ);
155
- N->val .ssa = SSA;
156
- N->val .pObject = RI.val_pObject ;
157
- N->val .pVisual = pVisual;
158
- N->val .Matrix = *RI.val_pTransform ;
159
- N->val .se = sh;
117
+ mapWmark.emplace_back (std::make_pair (distSQ, _MatrixItemS ({ SSA, RI.val_pObject , pVisual, *RI.val_pTransform , sh })));
160
118
return ;
161
119
}
162
120
#endif
163
121
122
+ // Create common node
123
+ // NOTE: Invisible elements exist only in R1
124
+ _MatrixItem item = { SSA, RI.val_pObject , pVisual, *RI.val_pTransform };
125
+
164
126
for (u32 iPass = 0 ; iPass < sh->passes .size (); ++iPass)
165
127
{
166
128
auto &pass = *sh->passes [iPass];
@@ -262,15 +224,10 @@ void D3DXRenderBase::r_dsgraph_insert_static(dxRender_Visual* pVisual)
262
224
// a) Allow to optimize RT order
263
225
// b) Should be rendered to special distort buffer in another pass
264
226
VERIFY (pVisual->shader ._get ());
265
- ShaderElement* sh_d = &*pVisual->shader ->E [4 ];
227
+ ShaderElement* sh_d = &*pVisual->shader ->E [4 ]; // 4=L_special
266
228
if (RImplementation.o .distortion && sh_d && sh_d->flags .bDistort && pmask[sh_d->flags .iPriority / 2 ])
267
229
{
268
- mapSorted_Node* N = mapDistort.insertInAnyWay (distSQ);
269
- N->val .ssa = SSA;
270
- N->val .pObject = nullptr ;
271
- N->val .pVisual = pVisual;
272
- N->val .Matrix = Fidentity;
273
- N->val .se = &*pVisual->shader ->E [4 ]; // 4=L_special
230
+ mapDistort.emplace_back (std::make_pair (distSQ, _MatrixItemS ({ SSA, nullptr , pVisual, Fidentity, sh_d }))); // sh_d -> L_special
274
231
}
275
232
276
233
// Select shader
@@ -283,11 +240,9 @@ void D3DXRenderBase::r_dsgraph_insert_static(dxRender_Visual* pVisual)
283
240
// strict-sorting selection
284
241
if (sh->flags .bStrictB2F )
285
242
{
286
- mapSorted_Node* N = mapSorted.insertInAnyWay (distSQ);
287
- N->val .pObject = nullptr ;
288
- N->val .pVisual = pVisual;
289
- N->val .Matrix = Fidentity;
290
- N->val .se = sh;
243
+ // TODO: Выяснить, почему в единственном месте параметр ssa не используется
244
+ // Визуально различий не замечено
245
+ mapSorted.emplace_back (std::make_pair (distSQ, _MatrixItemS ({ /* 0*/ SSA, nullptr , pVisual, Fidentity, sh })));
291
246
return ;
292
247
}
293
248
@@ -299,21 +254,11 @@ void D3DXRenderBase::r_dsgraph_insert_static(dxRender_Visual* pVisual)
299
254
// d) Should be rendered to accumulation buffer in the second pass
300
255
if (sh->flags .bEmissive )
301
256
{
302
- mapSorted_Node* N = mapEmissive.insertInAnyWay (distSQ);
303
- N->val .ssa = SSA;
304
- N->val .pObject = NULL ;
305
- N->val .pVisual = pVisual;
306
- N->val .Matrix = Fidentity;
307
- N->val .se = &*pVisual->shader ->E [4 ]; // 4=L_special
257
+ mapEmissive.emplace_back (std::make_pair (distSQ, _MatrixItemS ({ SSA, nullptr , pVisual, Fidentity, sh_d }))); // sh_d -> L_special
308
258
}
309
259
if (sh->flags .bWmark && pmask_wmark)
310
260
{
311
- mapSorted_Node* N = mapWmark.insertInAnyWay (distSQ);
312
- N->val .ssa = SSA;
313
- N->val .pObject = NULL ;
314
- N->val .pVisual = pVisual;
315
- N->val .Matrix = Fidentity;
316
- N->val .se = sh;
261
+ mapWmark.emplace_back (std::make_pair (distSQ, _MatrixItemS ({ SSA, nullptr , pVisual, Fidentity, sh })));
317
262
return ;
318
263
}
319
264
#endif
@@ -323,14 +268,14 @@ void D3DXRenderBase::r_dsgraph_insert_static(dxRender_Visual* pVisual)
323
268
324
269
counter_S++;
325
270
326
- _NormalItem item = {SSA, pVisual};
271
+ _NormalItem item = { SSA, pVisual };
327
272
328
273
for (u32 iPass = 0 ; iPass < sh->passes .size (); ++iPass)
329
274
{
330
275
auto &pass = *sh->passes [iPass];
331
276
auto &map = mapNormalPasses[sh->flags .iPriority / 2 ][iPass];
332
277
333
- #if defined( USE_OGL)
278
+ #ifdef USE_OGL
334
279
auto &Nvs = map[pass.vs ->vs ];
335
280
auto &Ngs = Nvs[pass.gs ->gs ];
336
281
auto &Nps = Ngs[pass.ps ->ps ];
@@ -351,7 +296,6 @@ void D3DXRenderBase::r_dsgraph_insert_static(dxRender_Visual* pVisual)
351
296
#else
352
297
auto &Ncs = Nps[pass.constants ._get ()];
353
298
#endif
354
- // auto &Nstate = Ncs[pass.state->state];
355
299
auto &Nstate = Ncs[&*pass.state ];
356
300
auto &Ntex = Nstate[pass.T ._get ()];
357
301
Ntex.push_back (item);
@@ -375,7 +319,7 @@ void D3DXRenderBase::r_dsgraph_insert_static(dxRender_Visual* pVisual)
375
319
{
376
320
Nps.ssa = SSA;
377
321
#endif
378
- #if defined(USE_DX10) || defined(USE_DX11)
322
+ #if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
379
323
if (SSA > Ngs.ssa )
380
324
{
381
325
Ngs.ssa = SSA;
@@ -384,7 +328,7 @@ void D3DXRenderBase::r_dsgraph_insert_static(dxRender_Visual* pVisual)
384
328
{
385
329
Nvs.ssa = SSA;
386
330
}
387
- #if defined(USE_DX10) || defined(USE_DX11)
331
+ #if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
388
332
}
389
333
#endif
390
334
}
0 commit comments