1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Move object nametags to camera

This commit is contained in:
RealBadAngel 2016-02-15 14:01:01 +01:00 committed by est31
parent 4c654557ec
commit c3b279750e
9 changed files with 138 additions and 54 deletions

View file

@ -26,6 +26,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/tile.h"
#include "util/numeric.h"
#include <ICameraSceneNode.h>
#include <ISceneNode.h>
#include <list>
#include "client.h"
@ -34,6 +36,20 @@ struct MapDrawControl;
class IGameDef;
class WieldMeshSceneNode;
struct Nametag {
Nametag(scene::ISceneNode *a_parent_node,
const std::string &a_nametag_text,
const video::SColor &a_nametag_color):
parent_node(a_parent_node),
nametag_text(a_nametag_text),
nametag_color(a_nametag_color)
{
}
scene::ISceneNode *parent_node;
std::string nametag_text;
video::SColor nametag_color;
};
enum CameraMode {CAMERA_MODE_FIRST, CAMERA_MODE_THIRD, CAMERA_MODE_THIRD_FRONT};
/*
@ -84,7 +100,7 @@ public:
{
return m_camera_direction;
}
// Get the camera offset
inline v3s16 getOffset() const
{
@ -151,6 +167,13 @@ public:
return m_camera_mode;
}
Nametag *addNametag(scene::ISceneNode *parent_node,
std::string nametag_text, video::SColor nametag_color);
void removeNametag(Nametag *nametag);
void drawNametags();
private:
// Nodes
scene::ISceneNode* m_playernode;
@ -162,8 +185,9 @@ private:
// draw control
MapDrawControl& m_draw_control;
IGameDef *m_gamedef;
video::IVideoDriver *m_driver;
// Absolute camera position
v3f m_camera_position;
@ -214,6 +238,8 @@ private:
f32 m_cache_wanted_fps;
f32 m_cache_fov;
bool m_cache_view_bobbing;
std::list<Nametag *> m_nametags;
};
#endif