Skip to content

Commit fefa148

Browse files
nerzhulest31
authored andcommittedFeb 11, 2016
v2d & aabbox3d<f32> & sky cleanups
* Sky: rename Box => m_box and inline getBoundingBox * Uniformize aabbox3d<f32> to aabb3f
1 parent 24b312c commit fefa148

21 files changed

+39
-44
lines changed
 

‎src/client.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1471,13 +1471,13 @@ ClientActiveObject * Client::getSelectedActiveObject(
14711471
{
14721472
ClientActiveObject *obj = objects[i].obj;
14731473

1474-
core::aabbox3d<f32> *selection_box = obj->getSelectionBox();
1474+
aabb3f *selection_box = obj->getSelectionBox();
14751475
if(selection_box == NULL)
14761476
continue;
14771477

14781478
v3f pos = obj->getPosition();
14791479

1480-
core::aabbox3d<f32> offsetted_box(
1480+
aabb3f offsetted_box(
14811481
selection_box->MinEdge + pos,
14821482
selection_box->MaxEdge + pos
14831483
);

‎src/client/tile.h

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2121
#define TILE_HEADER
2222

2323
#include "irrlichttypes.h"
24-
#include "irr_v2d.h"
2524
#include "irr_v3d.h"
2625
#include <ITexture.h>
2726
#include <IrrlichtDevice.h>

‎src/clientmap.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ ClientMap::ClientMap(
5050
m_camera_direction(0,0,1),
5151
m_camera_fov(M_PI)
5252
{
53-
m_box = core::aabbox3d<f32>(-BS*1000000,-BS*1000000,-BS*1000000,
53+
m_box = aabb3f(-BS*1000000,-BS*1000000,-BS*1000000,
5454
BS*1000000,BS*1000000,BS*1000000);
5555

5656
/* TODO: Add a callback function so these can be updated when a setting

‎src/clientmap.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class ClientMap : public Map, public scene::ISceneNode
115115
renderMap(driver, SceneManager->getSceneNodeRenderPass());
116116
}
117117

118-
virtual const core::aabbox3d<f32>& getBoundingBox() const
118+
virtual const aabb3f &getBoundingBox() const
119119
{
120120
return m_box;
121121
}
@@ -140,7 +140,7 @@ class ClientMap : public Map, public scene::ISceneNode
140140
private:
141141
Client *m_client;
142142

143-
core::aabbox3d<f32> m_box;
143+
aabb3f m_box;
144144

145145
MapDrawControl &m_control;
146146

‎src/clientobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class ClientActiveObject : public ActiveObject
5656
virtual void updateLight(u8 light_at_pos){}
5757
virtual void updateLightNoCheck(u8 light_at_pos){}
5858
virtual v3s16 getLightPosition(){return v3s16(0,0,0);}
59-
virtual core::aabbox3d<f32>* getSelectionBox(){return NULL;}
59+
virtual aabb3f *getSelectionBox() { return NULL; }
6060
virtual bool getCollisionBox(aabb3f *toset){return false;}
6161
virtual bool collideWithObjects(){return false;}
6262
virtual v3f getPosition(){return v3f(0,0,0);}

‎src/clouds.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Clouds::Clouds(
6262
g_settings->registerChangedCallback("enable_3d_clouds",
6363
&cloud_3d_setting_changed, this);
6464

65-
m_box = core::aabbox3d<f32>(-BS*1000000,m_cloud_y-BS,-BS*1000000,
65+
m_box = aabb3f(-BS*1000000,m_cloud_y-BS,-BS*1000000,
6666
BS*1000000,m_cloud_y+BS,BS*1000000);
6767

6868
}

‎src/clouds.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Clouds : public scene::ISceneNode
5353

5454
virtual void render();
5555

56-
virtual const core::aabbox3d<f32>& getBoundingBox() const
56+
virtual const aabb3f &getBoundingBox() const
5757
{
5858
return m_box;
5959
}
@@ -79,15 +79,15 @@ class Clouds : public scene::ISceneNode
7979
void updateCameraOffset(v3s16 camera_offset)
8080
{
8181
m_camera_offset = camera_offset;
82-
m_box = core::aabbox3d<f32>(-BS * 1000000, m_cloud_y - BS - BS * camera_offset.Y, -BS * 1000000,
82+
m_box = aabb3f(-BS * 1000000, m_cloud_y - BS - BS * camera_offset.Y, -BS * 1000000,
8383
BS * 1000000, m_cloud_y + BS - BS * camera_offset.Y, BS * 1000000);
8484
}
8585

8686
void readSettings();
8787

8888
private:
8989
video::SMaterial m_material;
90-
core::aabbox3d<f32> m_box;
90+
aabb3f m_box;
9191
s16 m_passed_cloud_y;
9292
float m_cloud_y;
9393
u16 m_cloud_radius_i;

‎src/content_cao.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ class ItemCAO : public ClientActiveObject
309309

310310
void initialize(const std::string &data);
311311

312-
core::aabbox3d<f32>* getSelectionBox()
312+
aabb3f *getSelectionBox()
313313
{return &m_selection_box;}
314314
v3f getPosition()
315315
{return m_position;}
@@ -319,7 +319,7 @@ class ItemCAO : public ClientActiveObject
319319

320320
bool getCollisionBox(aabb3f *toset) { return false; }
321321
private:
322-
core::aabbox3d<f32> m_selection_box;
322+
aabb3f m_selection_box;
323323
scene::IMeshSceneNode *m_node;
324324
v3f m_position;
325325
std::string m_itemstring;
@@ -674,7 +674,7 @@ GenericCAO::~GenericCAO()
674674
removeFromScene(true);
675675
}
676676

677-
core::aabbox3d<f32>* GenericCAO::getSelectionBox()
677+
aabb3f *GenericCAO::getSelectionBox()
678678
{
679679
if(!m_prop.is_visible || !m_is_visible || m_is_local_player || getParent() != NULL)
680680
return NULL;
@@ -1185,7 +1185,7 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
11851185

11861186
if(m_prop.physical)
11871187
{
1188-
core::aabbox3d<f32> box = m_prop.collisionbox;
1188+
aabb3f box = m_prop.collisionbox;
11891189
box.MinEdge *= BS;
11901190
box.MaxEdge *= BS;
11911191
collisionMoveResult moveresult;

‎src/content_cao.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class GenericCAO : public ClientActiveObject
6565
//
6666
scene::ISceneManager *m_smgr;
6767
IrrlichtDevice *m_irr;
68-
core::aabbox3d<f32> m_selection_box;
68+
aabb3f m_selection_box;
6969
scene::IMeshSceneNode *m_meshnode;
7070
scene::IAnimatedMeshSceneNode *m_animated_meshnode;
7171
WieldMeshSceneNode *m_wield_meshnode;
@@ -127,7 +127,7 @@ class GenericCAO : public ClientActiveObject
127127

128128
bool collideWithObjects();
129129

130-
core::aabbox3d<f32>* getSelectionBox();
130+
aabb3f *getSelectionBox();
131131

132132
v3f getPosition();
133133

‎src/content_sao.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ void LuaEntitySAO::step(float dtime, bool send_recommended)
259259
else
260260
{
261261
if(m_prop.physical){
262-
core::aabbox3d<f32> box = m_prop.collisionbox;
262+
aabb3f box = m_prop.collisionbox;
263263
box.MinEdge *= BS;
264264
box.MaxEdge *= BS;
265265
collisionMoveResult moveresult;
@@ -786,7 +786,7 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
786786
m_prop.hp_max = PLAYER_MAX_HP;
787787
m_prop.physical = false;
788788
m_prop.weight = 75;
789-
m_prop.collisionbox = core::aabbox3d<f32>(-1/3.,-1.0,-1/3., 1/3.,1.0,1/3.);
789+
m_prop.collisionbox = aabb3f(-1/3.,-1.0,-1/3., 1/3.,1.0,1/3.);
790790
// start of default appearance, this should be overwritten by LUA
791791
m_prop.visual = "upright_sprite";
792792
m_prop.visual_size = v2f(1, 2);

‎src/mesh.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void scaleMesh(scene::IMesh *mesh, v3f scale)
104104
if (mesh == NULL)
105105
return;
106106

107-
core::aabbox3d<f32> bbox;
107+
aabb3f bbox;
108108
bbox.reset(0, 0, 0);
109109

110110
u32 mc = mesh->getMeshBufferCount();
@@ -132,7 +132,7 @@ void translateMesh(scene::IMesh *mesh, v3f vec)
132132
if (mesh == NULL)
133133
return;
134134

135-
core::aabbox3d<f32> bbox;
135+
aabb3f bbox;
136136
bbox.reset(0, 0, 0);
137137

138138
u32 mc = mesh->getMeshBufferCount();
@@ -346,7 +346,7 @@ void rotateMeshBy6dFacedir(scene::IMesh *mesh, int facedir)
346346

347347
void recalculateBoundingBox(scene::IMesh *src_mesh)
348348
{
349-
core::aabbox3d<f32> bbox;
349+
aabb3f bbox;
350350
bbox.reset(0,0,0);
351351
for (u16 j = 0; j < src_mesh->getMeshBufferCount(); j++) {
352352
scene::IMeshBuffer *buf = src_mesh->getMeshBuffer(j);

‎src/object_properties.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct ObjectProperties
3333
bool physical;
3434
bool collideWithObjects;
3535
float weight;
36-
core::aabbox3d<f32> collisionbox;
36+
aabb3f collisionbox;
3737
std::string visual;
3838
std::string mesh;
3939
v2f visual_size;

‎src/particles.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Particle::Particle(
8888
m_vertical = vertical;
8989

9090
// Irrlicht stuff
91-
m_collisionbox = core::aabbox3d<f32>
91+
m_collisionbox = aabb3f
9292
(-size/2,-size/2,-size/2,size/2,size/2,size/2);
9393
this->setAutomaticCulling(scene::EAC_OFF);
9494

@@ -128,7 +128,7 @@ void Particle::step(float dtime)
128128
m_time += dtime;
129129
if (m_collisiondetection)
130130
{
131-
core::aabbox3d<f32> box = m_collisionbox;
131+
aabb3f box = m_collisionbox;
132132
v3f p_pos = m_pos*BS;
133133
v3f p_velocity = m_velocity*BS;
134134
collisionMoveSimple(m_env, m_gamedef,

‎src/particles.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Particle : public scene::ISceneNode
5252
);
5353
~Particle();
5454

55-
virtual const core::aabbox3d<f32>& getBoundingBox() const
55+
virtual const aabb3f &getBoundingBox() const
5656
{
5757
return m_box;
5858
}
@@ -85,8 +85,8 @@ class Particle : public scene::ISceneNode
8585

8686
ClientEnvironment *m_env;
8787
IGameDef *m_gamedef;
88-
core::aabbox3d<f32> m_box;
89-
core::aabbox3d<f32> m_collisionbox;
88+
aabb3f m_box;
89+
aabb3f m_collisionbox;
9090
video::SMaterial m_material;
9191
v2f m_texpos;
9292
v2f m_texsize;

‎src/player.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class Player
198198
return m_name;
199199
}
200200

201-
core::aabbox3d<f32> getCollisionbox()
201+
aabb3f getCollisionbox()
202202
{
203203
return m_collisionbox;
204204
}
@@ -398,7 +398,7 @@ class Player
398398
f32 m_yaw;
399399
v3f m_speed;
400400
v3f m_position;
401-
core::aabbox3d<f32> m_collisionbox;
401+
aabb3f m_collisionbox;
402402

403403
bool m_dirty;
404404

‎src/script/lua_api/l_areastore.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2222
#include "lua_api/l_internal.h"
2323
#include "common/c_converter.h"
2424
#include "cpp_api/s_security.h"
25+
#include "irr_v3d.h"
2526
#include "areastore.h"
2627
#include "filesys.h"
2728
#ifndef ANDROID

‎src/script/lua_api/l_areastore.h

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2121
#define L_AREASTORE_H_
2222

2323
#include "lua_api/l_base.h"
24-
#include "irr_v3d.h"
2524
#include "areastore.h"
2625

2726
/*

‎src/sky.cpp

+2-7
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id,
2525
m_cloudcolor_bright_f(1,1,1,1)
2626
{
2727
setAutomaticCulling(scene::EAC_OFF);
28-
Box.MaxEdge.set(0,0,0);
29-
Box.MinEdge.set(0,0,0);
28+
m_box.MaxEdge.set(0,0,0);
29+
m_box.MinEdge.set(0,0,0);
3030

3131
// create material
3232

@@ -94,11 +94,6 @@ void Sky::OnRegisterSceneNode()
9494
scene::ISceneNode::OnRegisterSceneNode();
9595
}
9696

97-
const core::aabbox3d<f32>& Sky::getBoundingBox() const
98-
{
99-
return Box;
100-
}
101-
10297
//! renders the node.
10398
void Sky::render()
10499
{

‎src/sky.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class Sky : public scene::ISceneNode
4242
//! renders the node.
4343
virtual void render();
4444

45-
virtual const core::aabbox3d<f32>& getBoundingBox() const;
45+
virtual const aabb3f &getBoundingBox() const
46+
{ return m_box; }
4647

4748
// Used by Irrlicht for optimizing rendering
4849
virtual video::SMaterial& getMaterial(u32 i)
@@ -74,7 +75,7 @@ class Sky : public scene::ISceneNode
7475
}
7576

7677
private:
77-
core::aabbox3d<f32> Box;
78+
aabb3f m_box;
7879
video::SMaterial m_materials[SKY_MATERIAL_COUNT];
7980

8081
// How much sun & moon transition should affect horizon color

‎src/util/numeric.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,9 @@ inline v3f intToFloat(v3s16 p, f32 d)
310310
}
311311

312312
// Random helper. Usually d=BS
313-
inline core::aabbox3d<f32> getNodeBox(v3s16 p, float d)
313+
inline aabb3f getNodeBox(v3s16 p, float d)
314314
{
315-
return core::aabbox3d<f32>(
315+
return aabb3f(
316316
(float)p.X * d - 0.5*d,
317317
(float)p.Y * d - 0.5*d,
318318
(float)p.Z * d - 0.5*d,

‎src/wieldmesh.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class WieldMeshSceneNode: public scene::ISceneNode
5353

5454
virtual void render();
5555

56-
virtual const core::aabbox3d<f32>& getBoundingBox() const
56+
virtual const aabb3f &getBoundingBox() const
5757
{ return m_bounding_box; }
5858

5959
private:
@@ -74,7 +74,7 @@ class WieldMeshSceneNode: public scene::ISceneNode
7474
// Bounding box culling is disabled for this type of scene node,
7575
// so this variable is just required so we can implement
7676
// getBoundingBox() and is set to an empty box.
77-
core::aabbox3d<f32> m_bounding_box;
77+
aabb3f m_bounding_box;
7878
};
7979

8080
scene::IMesh *getItemMesh(IGameDef *gamedef, const ItemStack &item);

0 commit comments

Comments
 (0)
Please sign in to comment.