Skip to content

Commit 8e77ee9

Browse files
author
nitrocaster
committed
ISpatial: move data to SpatialBase.
1 parent 8560904 commit 8e77ee9

39 files changed

+171
-146
lines changed

src/Layers/xrRender/light.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
static const float SQRT2 = 1.4142135623730950488016887242097f;
55
static const float RSQRTDIV2 = 0.70710678118654752440084436210485f;
66

7-
light::light (void) : ISpatial(g_SpatialSpace)
7+
light::light (void) : SpatialBase(g_SpatialSpace)
88
{
99
spatial.type = STYPE_LIGHTSOURCE;
1010
flags.type = POINT;
@@ -192,7 +192,7 @@ void light::spatial_move ()
192192
}
193193

194194
// update spatial DB
195-
ISpatial::spatial_move ();
195+
SpatialBase::spatial_move ();
196196

197197
#if (RENDER==R_R2) || (RENDER==R_R3) || (RENDER==R_R4)
198198
if (flags.bActive) gi_generate ();

src/Layers/xrRender/light.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# include "light_GI.h"
1010
#endif //(RENDER==R_R2) || (RENDER==R_R3) || (RENDER==R_R4)
1111

12-
class light : public IRender_Light, public ISpatial
12+
class light : public IRender_Light, public SpatialBase
1313
{
1414
public:
1515
struct {

src/Layers/xrRender/r__dsgraph_render.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,13 +700,13 @@ void D3DXRenderBase::r_dsgraph_render_subspace (IRender_Sector* _sector, CFrustu
700700
for (u32 o_it=0; o_it<lstRenderables.size(); o_it++)
701701
{
702702
ISpatial* spatial = lstRenderables[o_it];
703-
CSector* sector = (CSector*)spatial->spatial.sector;
703+
CSector* sector = (CSector*)spatial->GetSpatialData().sector;
704704
if (0==sector) continue; // disassociated from S/P structure
705705
if (PortalTraverser.i_marker != sector->r_marker) continue; // inactive (untouched) sector
706706
for (u32 v_it=0; v_it<sector->r_frustums.size(); v_it++)
707707
{
708708
set_Frustum (&(sector->r_frustums[v_it]));
709-
if (!View->testSphere_dirty(spatial->spatial.sphere.P,spatial->spatial.sphere.R)) continue;
709+
if (!View->testSphere_dirty(spatial->GetSpatialData().sphere.P,spatial->GetSpatialData().sphere.R)) continue;
710710

711711
// renderable
712712
IRenderable* renderable = spatial->dcast_Renderable ();

src/Layers/xrRenderPC_R1/FStaticRender.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ extern float r_ssaHZBvsTEX;
333333

334334
ICF bool pred_sp_sort (ISpatial* _1, ISpatial* _2)
335335
{
336-
float d1 = _1->spatial.sphere.P.distance_to_sqr(Device.vCameraPosition);
337-
float d2 = _2->spatial.sphere.P.distance_to_sqr(Device.vCameraPosition);
336+
float d1 = _1->GetSpatialData().sphere.P.distance_to_sqr(Device.vCameraPosition);
337+
float d2 = _2->GetSpatialData().sphere.P.distance_to_sqr(Device.vCameraPosition);
338338
return d1<d2;
339339
}
340340

@@ -454,20 +454,20 @@ void CRender::Calculate ()
454454
for (u32 o_it=0; o_it<lstRenderables.size(); o_it++)
455455
{
456456
ISpatial* spatial = lstRenderables[o_it]; spatial->spatial_updatesector ();
457-
CSector* sector = (CSector*)spatial->spatial.sector ;
457+
CSector* sector = (CSector*)spatial->GetSpatialData().sector ;
458458
if (0==sector)
459459
continue; // disassociated from S/P structure
460460

461461
// Filter only not light spatial
462-
if (PortalTraverser.i_marker != sector->r_marker && (spatial->spatial.type & STYPE_RENDERABLE) ) continue; // inactive (untouched) sector
462+
if (PortalTraverser.i_marker != sector->r_marker && (spatial->GetSpatialData().type & STYPE_RENDERABLE) ) continue; // inactive (untouched) sector
463463

464-
if (spatial->spatial.type & STYPE_RENDERABLE)
464+
if (spatial->GetSpatialData().type & STYPE_RENDERABLE)
465465
{
466466
for (u32 v_it=0; v_it<sector->r_frustums.size(); v_it++)
467467
{
468468
set_Frustum (&(sector->r_frustums[v_it]));
469469

470-
if (!View->testSphere_dirty(spatial->spatial.sphere.P,spatial->spatial.sphere.R) /*&& (spatial->spatial.type & STYPE_RENDERABLE)*/) continue;
470+
if (!View->testSphere_dirty(spatial->GetSpatialData().sphere.P,spatial->GetSpatialData().sphere.R) /*&& (spatial->spatial.type & STYPE_RENDERABLE)*/) continue;
471471
// renderable
472472
IRenderable* renderable = spatial->dcast_Renderable ();
473473
if (0==renderable) {
@@ -508,9 +508,9 @@ void CRender::Calculate ()
508508
}
509509
else
510510
{
511-
if ( ViewBase.testSphere_dirty(spatial->spatial.sphere.P,spatial->spatial.sphere.R) )
511+
if ( ViewBase.testSphere_dirty(spatial->GetSpatialData().sphere.P,spatial->GetSpatialData().sphere.R) )
512512
{
513-
VERIFY (spatial->spatial.type & STYPE_LIGHTSOURCE);
513+
VERIFY (spatial->GetSpatialData().type & STYPE_LIGHTSOURCE);
514514
// lightsource
515515
light* L = (light*) spatial->dcast_Light ();
516516
VERIFY (L);

src/Layers/xrRenderPC_R1/GlowManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818

1919
//////////////////////////////////////////////////////////////////////
20-
CGlow::CGlow () : ISpatial(g_SpatialSpace)
20+
CGlow::CGlow () : SpatialBase(g_SpatialSpace)
2121
{
2222
flags.bActive = false;
2323
position.set (0,0,0);
@@ -77,7 +77,7 @@ void CGlow::set_color (float r, float g, float b) {
7777
void CGlow::spatial_move ()
7878
{
7979
spatial.sphere.set (position,radius);
80-
ISpatial::spatial_move ();
80+
SpatialBase::spatial_move ();
8181
}
8282
//////////////////////////////////////////////////////////////////////
8383
// Construction/Destruction

src/Layers/xrRenderPC_R1/GlowManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "xrCDB/ispatial.h"
1010
#include "xrCDB/xr_collide_defs.h"
1111

12-
class CGlow : public IRender_Glow, public ISpatial
12+
class CGlow : public IRender_Glow, public SpatialBase
1313
{
1414
public:
1515
struct {

src/Layers/xrRenderPC_R1/LightProjector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void CLightProjector::set_object (IRenderable* O)
7979
if (0==spatial) current= 0;
8080
else {
8181
spatial->spatial_updatesector ();
82-
if (0==spatial->spatial.sector) {
82+
if (0==spatial->GetSpatialData().sector) {
8383
CObject* obj = dynamic_cast<CObject*>(O);
8484
if (obj) Msg ("! Invalid object '%s' position. Outside of sector structure.",obj->cName().c_str());
8585
current = 0;
@@ -298,7 +298,7 @@ void CLightProjector::calculate ()
298298
ISpatial* spatial = dynamic_cast<ISpatial*> (O);
299299
if (spatial) {
300300
spatial->spatial_updatesector ();
301-
if (spatial->spatial.sector) RImplementation.r_dsgraph_render_R1_box (spatial->spatial.sector,BB,SE_R1_LMODELS);
301+
if (spatial->GetSpatialData().sector) RImplementation.r_dsgraph_render_R1_box (spatial->GetSpatialData().sector,BB,SE_R1_LMODELS);
302302
}
303303
//if (spatial) RImplementation.r_dsgraph_render_subspace (spatial->spatial.sector,mCombine,v_C,FALSE);
304304
}

src/Layers/xrRenderPC_R2/r2_R_calculate.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ void CRender::Calculate ()
5959
g_SpatialSpace->q_sphere(lstRenderables,0,STYPE_LIGHTSOURCE,Device.vCameraPosition,EPS_L);
6060
for (u32 _it=0; _it<lstRenderables.size(); _it++) {
6161
ISpatial* spatial = lstRenderables[_it]; spatial->spatial_updatesector ();
62-
CSector* sector = (CSector*)spatial->spatial.sector;
62+
CSector* sector = (CSector*)spatial->GetSpatialData().sector;
6363
if (0==sector) continue; // disassociated from S/P structure
6464

65-
VERIFY (spatial->spatial.type & STYPE_LIGHTSOURCE);
65+
VERIFY (spatial->GetSpatialData().type & STYPE_LIGHTSOURCE);
6666
// lightsource
6767
light* L = (light*) (spatial->dcast_Light());
6868
VERIFY (L);

src/Layers/xrRenderPC_R2/r2_R_render.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
IC bool pred_sp_sort (ISpatial* _1, ISpatial* _2)
88
{
9-
float d1 = _1->spatial.sphere.P.distance_to_sqr (Device.vCameraPosition);
10-
float d2 = _2->spatial.sphere.P.distance_to_sqr (Device.vCameraPosition);
9+
float d1 = _1->GetSpatialData().sphere.P.distance_to_sqr (Device.vCameraPosition);
10+
float d2 = _2->GetSpatialData().sphere.P.distance_to_sqr (Device.vCameraPosition);
1111
return d1<d2 ;
1212
}
1313

@@ -86,10 +86,10 @@ void CRender::render_main (Fmatrix& m_ViewProjection, bool _fportals)
8686
for (u32 o_it=0; o_it<lstRenderables.size(); o_it++)
8787
{
8888
ISpatial* spatial = lstRenderables[o_it]; spatial->spatial_updatesector ();
89-
CSector* sector = (CSector*)spatial->spatial.sector;
89+
CSector* sector = (CSector*)spatial->GetSpatialData().sector;
9090
if (0==sector) continue; // disassociated from S/P structure
9191

92-
if (spatial->spatial.type & STYPE_LIGHTSOURCE) {
92+
if (spatial->GetSpatialData().type & STYPE_LIGHTSOURCE) {
9393
// lightsource
9494
light* L = (light*) (spatial->dcast_Light());
9595
VERIFY (L);
@@ -104,9 +104,9 @@ void CRender::render_main (Fmatrix& m_ViewProjection, bool _fportals)
104104
if (PortalTraverser.i_marker != sector->r_marker) continue; // inactive (untouched) sector
105105
for (u32 v_it=0; v_it<sector->r_frustums.size(); v_it++) {
106106
CFrustum& view = sector->r_frustums[v_it];
107-
if (!view.testSphere_dirty(spatial->spatial.sphere.P,spatial->spatial.sphere.R)) continue;
107+
if (!view.testSphere_dirty(spatial->GetSpatialData().sphere.P,spatial->GetSpatialData().sphere.R)) continue;
108108

109-
if (spatial->spatial.type & STYPE_RENDERABLE)
109+
if (spatial->GetSpatialData().type & STYPE_RENDERABLE)
110110
{
111111
// renderable
112112
IRenderable* renderable = spatial->dcast_Renderable ();

src/Layers/xrRenderPC_R3/r2_R_calculate.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ void CRender::Calculate ()
5959
g_SpatialSpace->q_sphere(lstRenderables,0,STYPE_LIGHTSOURCE,Device.vCameraPosition,EPS_L);
6060
for (u32 _it=0; _it<lstRenderables.size(); _it++) {
6161
ISpatial* spatial = lstRenderables[_it]; spatial->spatial_updatesector ();
62-
CSector* sector = (CSector*)spatial->spatial.sector;
62+
CSector* sector = (CSector*)spatial->GetSpatialData().sector;
6363
if (0==sector) continue; // disassociated from S/P structure
6464

65-
VERIFY (spatial->spatial.type & STYPE_LIGHTSOURCE);
65+
VERIFY (spatial->GetSpatialData().type & STYPE_LIGHTSOURCE);
6666
// lightsource
6767
light* L = (light*) (spatial->dcast_Light());
6868
VERIFY (L);

0 commit comments

Comments
 (0)