aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornerzhul <loic.blot@unix-experience.fr>2016-02-11 15:21:21 +0100
committerest31 <MTest31@outlook.com>2016-02-11 16:55:15 +0100
commitfefa148d694364cb4c60fbb4ffdc0f8ae6388df6 (patch)
tree8755fd0d4ef196c23924ae2909a29681f9f77f05 /src
parent24b312cc085b7fae6477c8a47fffb57484b20f6e (diff)
downloadminetest-fefa148d694364cb4c60fbb4ffdc0f8ae6388df6.tar.gz
minetest-fefa148d694364cb4c60fbb4ffdc0f8ae6388df6.tar.bz2
minetest-fefa148d694364cb4c60fbb4ffdc0f8ae6388df6.zip
v2d & aabbox3d<f32> & sky cleanups
* Sky: rename Box => m_box and inline getBoundingBox * Uniformize aabbox3d<f32> to aabb3f
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp4
-rw-r--r--src/client/tile.h1
-rw-r--r--src/clientmap.cpp2
-rw-r--r--src/clientmap.h4
-rw-r--r--src/clientobject.h2
-rw-r--r--src/clouds.cpp2
-rw-r--r--src/clouds.h6
-rw-r--r--src/content_cao.cpp8
-rw-r--r--src/content_cao.h4
-rw-r--r--src/content_sao.cpp4
-rw-r--r--src/mesh.cpp6
-rw-r--r--src/object_properties.h2
-rw-r--r--src/particles.cpp4
-rw-r--r--src/particles.h6
-rw-r--r--src/player.h4
-rw-r--r--src/script/lua_api/l_areastore.cpp1
-rw-r--r--src/script/lua_api/l_areastore.h1
-rw-r--r--src/sky.cpp9
-rw-r--r--src/sky.h5
-rw-r--r--src/util/numeric.h4
-rw-r--r--src/wieldmesh.h4
21 files changed, 39 insertions, 44 deletions
diff --git a/src/client.cpp b/src/client.cpp
index a845277bd..2dc537782 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1471,13 +1471,13 @@ ClientActiveObject * Client::getSelectedActiveObject(
{
ClientActiveObject *obj = objects[i].obj;
- core::aabbox3d<f32> *selection_box = obj->getSelectionBox();
+ aabb3f *selection_box = obj->getSelectionBox();
if(selection_box == NULL)
continue;
v3f pos = obj->getPosition();
- core::aabbox3d<f32> offsetted_box(
+ aabb3f offsetted_box(
selection_box->MinEdge + pos,
selection_box->MaxEdge + pos
);
diff --git a/src/client/tile.h b/src/client/tile.h
index 7796e801d..b75916841 100644
--- a/src/client/tile.h
+++ b/src/client/tile.h
@@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define TILE_HEADER
#include "irrlichttypes.h"
-#include "irr_v2d.h"
#include "irr_v3d.h"
#include <ITexture.h>
#include <IrrlichtDevice.h>
diff --git a/src/clientmap.cpp b/src/clientmap.cpp
index 024f2a266..e67b6cbf7 100644
--- a/src/clientmap.cpp
+++ b/src/clientmap.cpp
@@ -50,7 +50,7 @@ ClientMap::ClientMap(
m_camera_direction(0,0,1),
m_camera_fov(M_PI)
{
- m_box = core::aabbox3d<f32>(-BS*1000000,-BS*1000000,-BS*1000000,
+ m_box = aabb3f(-BS*1000000,-BS*1000000,-BS*1000000,
BS*1000000,BS*1000000,BS*1000000);
/* TODO: Add a callback function so these can be updated when a setting
diff --git a/src/clientmap.h b/src/clientmap.h
index d9239b52e..ae5ab6d35 100644
--- a/src/clientmap.h
+++ b/src/clientmap.h
@@ -115,7 +115,7 @@ public:
renderMap(driver, SceneManager->getSceneNodeRenderPass());
}
- virtual const core::aabbox3d<f32>& getBoundingBox() const
+ virtual const aabb3f &getBoundingBox() const
{
return m_box;
}
@@ -140,7 +140,7 @@ public:
private:
Client *m_client;
- core::aabbox3d<f32> m_box;
+ aabb3f m_box;
MapDrawControl &m_control;
diff --git a/src/clientobject.h b/src/clientobject.h
index be24e1388..3cc7c2391 100644
--- a/src/clientobject.h
+++ b/src/clientobject.h
@@ -56,7 +56,7 @@ public:
virtual void updateLight(u8 light_at_pos){}
virtual void updateLightNoCheck(u8 light_at_pos){}
virtual v3s16 getLightPosition(){return v3s16(0,0,0);}
- virtual core::aabbox3d<f32>* getSelectionBox(){return NULL;}
+ virtual aabb3f *getSelectionBox() { return NULL; }
virtual bool getCollisionBox(aabb3f *toset){return false;}
virtual bool collideWithObjects(){return false;}
virtual v3f getPosition(){return v3f(0,0,0);}
diff --git a/src/clouds.cpp b/src/clouds.cpp
index 29210e2b4..82b63b6b3 100644
--- a/src/clouds.cpp
+++ b/src/clouds.cpp
@@ -62,7 +62,7 @@ Clouds::Clouds(
g_settings->registerChangedCallback("enable_3d_clouds",
&cloud_3d_setting_changed, this);
- m_box = core::aabbox3d<f32>(-BS*1000000,m_cloud_y-BS,-BS*1000000,
+ m_box = aabb3f(-BS*1000000,m_cloud_y-BS,-BS*1000000,
BS*1000000,m_cloud_y+BS,BS*1000000);
}
diff --git a/src/clouds.h b/src/clouds.h
index 195f48de0..9c6b41786 100644
--- a/src/clouds.h
+++ b/src/clouds.h
@@ -53,7 +53,7 @@ public:
virtual void render();
- virtual const core::aabbox3d<f32>& getBoundingBox() const
+ virtual const aabb3f &getBoundingBox() const
{
return m_box;
}
@@ -79,7 +79,7 @@ public:
void updateCameraOffset(v3s16 camera_offset)
{
m_camera_offset = camera_offset;
- m_box = core::aabbox3d<f32>(-BS * 1000000, m_cloud_y - BS - BS * camera_offset.Y, -BS * 1000000,
+ m_box = aabb3f(-BS * 1000000, m_cloud_y - BS - BS * camera_offset.Y, -BS * 1000000,
BS * 1000000, m_cloud_y + BS - BS * camera_offset.Y, BS * 1000000);
}
@@ -87,7 +87,7 @@ public:
private:
video::SMaterial m_material;
- core::aabbox3d<f32> m_box;
+ aabb3f m_box;
s16 m_passed_cloud_y;
float m_cloud_y;
u16 m_cloud_radius_i;
diff --git a/src/content_cao.cpp b/src/content_cao.cpp
index c3247bd17..e7c7a0be5 100644
--- a/src/content_cao.cpp
+++ b/src/content_cao.cpp
@@ -309,7 +309,7 @@ public:
void initialize(const std::string &data);
- core::aabbox3d<f32>* getSelectionBox()
+ aabb3f *getSelectionBox()
{return &m_selection_box;}
v3f getPosition()
{return m_position;}
@@ -319,7 +319,7 @@ public:
bool getCollisionBox(aabb3f *toset) { return false; }
private:
- core::aabbox3d<f32> m_selection_box;
+ aabb3f m_selection_box;
scene::IMeshSceneNode *m_node;
v3f m_position;
std::string m_itemstring;
@@ -674,7 +674,7 @@ GenericCAO::~GenericCAO()
removeFromScene(true);
}
-core::aabbox3d<f32>* GenericCAO::getSelectionBox()
+aabb3f *GenericCAO::getSelectionBox()
{
if(!m_prop.is_visible || !m_is_visible || m_is_local_player || getParent() != NULL)
return NULL;
@@ -1185,7 +1185,7 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
if(m_prop.physical)
{
- core::aabbox3d<f32> box = m_prop.collisionbox;
+ aabb3f box = m_prop.collisionbox;
box.MinEdge *= BS;
box.MaxEdge *= BS;
collisionMoveResult moveresult;
diff --git a/src/content_cao.h b/src/content_cao.h
index abb242aa4..f71dfeb1f 100644
--- a/src/content_cao.h
+++ b/src/content_cao.h
@@ -65,7 +65,7 @@ private:
//
scene::ISceneManager *m_smgr;
IrrlichtDevice *m_irr;
- core::aabbox3d<f32> m_selection_box;
+ aabb3f m_selection_box;
scene::IMeshSceneNode *m_meshnode;
scene::IAnimatedMeshSceneNode *m_animated_meshnode;
WieldMeshSceneNode *m_wield_meshnode;
@@ -127,7 +127,7 @@ public:
bool collideWithObjects();
- core::aabbox3d<f32>* getSelectionBox();
+ aabb3f *getSelectionBox();
v3f getPosition();
diff --git a/src/content_sao.cpp b/src/content_sao.cpp
index fa2454821..53bf3154f 100644
--- a/src/content_sao.cpp
+++ b/src/content_sao.cpp
@@ -259,7 +259,7 @@ void LuaEntitySAO::step(float dtime, bool send_recommended)
else
{
if(m_prop.physical){
- core::aabbox3d<f32> box = m_prop.collisionbox;
+ aabb3f box = m_prop.collisionbox;
box.MinEdge *= BS;
box.MaxEdge *= BS;
collisionMoveResult moveresult;
@@ -786,7 +786,7 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
m_prop.hp_max = PLAYER_MAX_HP;
m_prop.physical = false;
m_prop.weight = 75;
- m_prop.collisionbox = core::aabbox3d<f32>(-1/3.,-1.0,-1/3., 1/3.,1.0,1/3.);
+ m_prop.collisionbox = aabb3f(-1/3.,-1.0,-1/3., 1/3.,1.0,1/3.);
// start of default appearance, this should be overwritten by LUA
m_prop.visual = "upright_sprite";
m_prop.visual_size = v2f(1, 2);
diff --git a/src/mesh.cpp b/src/mesh.cpp
index 3c3932204..b5bf8660a 100644
--- a/src/mesh.cpp
+++ b/src/mesh.cpp
@@ -104,7 +104,7 @@ void scaleMesh(scene::IMesh *mesh, v3f scale)
if (mesh == NULL)
return;
- core::aabbox3d<f32> bbox;
+ aabb3f bbox;
bbox.reset(0, 0, 0);
u32 mc = mesh->getMeshBufferCount();
@@ -132,7 +132,7 @@ void translateMesh(scene::IMesh *mesh, v3f vec)
if (mesh == NULL)
return;
- core::aabbox3d<f32> bbox;
+ aabb3f bbox;
bbox.reset(0, 0, 0);
u32 mc = mesh->getMeshBufferCount();
@@ -346,7 +346,7 @@ void rotateMeshBy6dFacedir(scene::IMesh *mesh, int facedir)
void recalculateBoundingBox(scene::IMesh *src_mesh)
{
- core::aabbox3d<f32> bbox;
+ aabb3f bbox;
bbox.reset(0,0,0);
for (u16 j = 0; j < src_mesh->getMeshBufferCount(); j++) {
scene::IMeshBuffer *buf = src_mesh->getMeshBuffer(j);
diff --git a/src/object_properties.h b/src/object_properties.h
index 02ec9d1f7..082d9a529 100644
--- a/src/object_properties.h
+++ b/src/object_properties.h
@@ -33,7 +33,7 @@ struct ObjectProperties
bool physical;
bool collideWithObjects;
float weight;
- core::aabbox3d<f32> collisionbox;
+ aabb3f collisionbox;
std::string visual;
std::string mesh;
v2f visual_size;
diff --git a/src/particles.cpp b/src/particles.cpp
index 8150e19ac..ab77e9f54 100644
--- a/src/particles.cpp
+++ b/src/particles.cpp
@@ -88,7 +88,7 @@ Particle::Particle(
m_vertical = vertical;
// Irrlicht stuff
- m_collisionbox = core::aabbox3d<f32>
+ m_collisionbox = aabb3f
(-size/2,-size/2,-size/2,size/2,size/2,size/2);
this->setAutomaticCulling(scene::EAC_OFF);
@@ -128,7 +128,7 @@ void Particle::step(float dtime)
m_time += dtime;
if (m_collisiondetection)
{
- core::aabbox3d<f32> box = m_collisionbox;
+ aabb3f box = m_collisionbox;
v3f p_pos = m_pos*BS;
v3f p_velocity = m_velocity*BS;
collisionMoveSimple(m_env, m_gamedef,
diff --git a/src/particles.h b/src/particles.h
index 0ad8d71b5..dda84385c 100644
--- a/src/particles.h
+++ b/src/particles.h
@@ -52,7 +52,7 @@ class Particle : public scene::ISceneNode
);
~Particle();
- virtual const core::aabbox3d<f32>& getBoundingBox() const
+ virtual const aabb3f &getBoundingBox() const
{
return m_box;
}
@@ -85,8 +85,8 @@ private:
ClientEnvironment *m_env;
IGameDef *m_gamedef;
- core::aabbox3d<f32> m_box;
- core::aabbox3d<f32> m_collisionbox;
+ aabb3f m_box;
+ aabb3f m_collisionbox;
video::SMaterial m_material;
v2f m_texpos;
v2f m_texsize;
diff --git a/src/player.h b/src/player.h
index 48b0a4999..0d99297ca 100644
--- a/src/player.h
+++ b/src/player.h
@@ -198,7 +198,7 @@ public:
return m_name;
}
- core::aabbox3d<f32> getCollisionbox()
+ aabb3f getCollisionbox()
{
return m_collisionbox;
}
@@ -398,7 +398,7 @@ protected:
f32 m_yaw;
v3f m_speed;
v3f m_position;
- core::aabbox3d<f32> m_collisionbox;
+ aabb3f m_collisionbox;
bool m_dirty;
diff --git a/src/script/lua_api/l_areastore.cpp b/src/script/lua_api/l_areastore.cpp
index 72fe24b20..4148780a1 100644
--- a/src/script/lua_api/l_areastore.cpp
+++ b/src/script/lua_api/l_areastore.cpp
@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "lua_api/l_internal.h"
#include "common/c_converter.h"
#include "cpp_api/s_security.h"
+#include "irr_v3d.h"
#include "areastore.h"
#include "filesys.h"
#ifndef ANDROID
diff --git a/src/script/lua_api/l_areastore.h b/src/script/lua_api/l_areastore.h
index a25529627..543a2aa32 100644
--- a/src/script/lua_api/l_areastore.h
+++ b/src/script/lua_api/l_areastore.h
@@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define L_AREASTORE_H_
#include "lua_api/l_base.h"
-#include "irr_v3d.h"
#include "areastore.h"
/*
diff --git a/src/sky.cpp b/src/sky.cpp
index 01fb8ef86..682ff05e3 100644
--- a/src/sky.cpp
+++ b/src/sky.cpp
@@ -25,8 +25,8 @@ Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id,
m_cloudcolor_bright_f(1,1,1,1)
{
setAutomaticCulling(scene::EAC_OFF);
- Box.MaxEdge.set(0,0,0);
- Box.MinEdge.set(0,0,0);
+ m_box.MaxEdge.set(0,0,0);
+ m_box.MinEdge.set(0,0,0);
// create material
@@ -94,11 +94,6 @@ void Sky::OnRegisterSceneNode()
scene::ISceneNode::OnRegisterSceneNode();
}
-const core::aabbox3d<f32>& Sky::getBoundingBox() const
-{
- return Box;
-}
-
//! renders the node.
void Sky::render()
{
diff --git a/src/sky.h b/src/sky.h
index 5023cc682..f19891773 100644
--- a/src/sky.h
+++ b/src/sky.h
@@ -42,7 +42,8 @@ public:
//! renders the node.
virtual void render();
- virtual const core::aabbox3d<f32>& getBoundingBox() const;
+ virtual const aabb3f &getBoundingBox() const
+ { return m_box; }
// Used by Irrlicht for optimizing rendering
virtual video::SMaterial& getMaterial(u32 i)
@@ -74,7 +75,7 @@ public:
}
private:
- core::aabbox3d<f32> Box;
+ aabb3f m_box;
video::SMaterial m_materials[SKY_MATERIAL_COUNT];
// How much sun & moon transition should affect horizon color
diff --git a/src/util/numeric.h b/src/util/numeric.h
index e742ab24a..615327864 100644
--- a/src/util/numeric.h
+++ b/src/util/numeric.h
@@ -310,9 +310,9 @@ inline v3f intToFloat(v3s16 p, f32 d)
}
// Random helper. Usually d=BS
-inline core::aabbox3d<f32> getNodeBox(v3s16 p, float d)
+inline aabb3f getNodeBox(v3s16 p, float d)
{
- return core::aabbox3d<f32>(
+ return aabb3f(
(float)p.X * d - 0.5*d,
(float)p.Y * d - 0.5*d,
(float)p.Z * d - 0.5*d,
diff --git a/src/wieldmesh.h b/src/wieldmesh.h
index c29c06f95..0b3136bc1 100644
--- a/src/wieldmesh.h
+++ b/src/wieldmesh.h
@@ -53,7 +53,7 @@ public:
virtual void render();
- virtual const core::aabbox3d<f32>& getBoundingBox() const
+ virtual const aabb3f &getBoundingBox() const
{ return m_bounding_box; }
private:
@@ -74,7 +74,7 @@ private:
// Bounding box culling is disabled for this type of scene node,
// so this variable is just required so we can implement
// getBoundingBox() and is set to an empty box.
- core::aabbox3d<f32> m_bounding_box;
+ aabb3f m_bounding_box;
};
scene::IMesh *getItemMesh(IGameDef *gamedef, const ItemStack &item);