v2d & aabbox3d<f32> & sky cleanups
* Sky: rename Box => m_box and inline getBoundingBox * Uniformize aabbox3d<f32> to aabb3f
This commit is contained in:
parent
24b312cc08
commit
fefa148d69
|
@ -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
|
||||
);
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
||||
/*
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue