diff options
Diffstat (limited to 'src/client/camera.h')
-rw-r--r-- | src/client/camera.h | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/client/camera.h b/src/client/camera.h index 6fd8d9aa7..30fac5289 100644 --- a/src/client/camera.h +++ b/src/client/camera.h @@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc., class LocalPlayer; struct MapDrawControl; class Client; +class RenderingEngine; class WieldMeshSceneNode; struct Nametag @@ -39,18 +40,44 @@ struct Nametag video::SColor textcolor; Optional<video::SColor> bgcolor; v3f pos; + ITextureSource *texture_source; + std::vector<video::ITexture *> images; + core::dimension2di images_dim; Nametag(scene::ISceneNode *a_parent_node, const std::string &text, const video::SColor &textcolor, const Optional<video::SColor> &bgcolor, - const v3f &pos): + const v3f &pos, + ITextureSource *tsrc, + const std::vector<std::string> &image_names): parent_node(a_parent_node), text(text), textcolor(textcolor), bgcolor(bgcolor), - pos(pos) + pos(pos), + texture_source(tsrc), + images(), + images_dim(0, 0) { + setImages(image_names); + } + + void setImages(const std::vector<std::string> &image_names) + { + images.clear(); + images_dim = core::dimension2di(0, 0); + + for (const std::string &image_name : image_names) { + video::ITexture *texture = texture_source->getTexture(image_name); + core::dimension2di imgsize(texture->getOriginalSize()); + + images_dim.Width += imgsize.Width; + if (images_dim.Height < imgsize.Height) + images_dim.Height = imgsize.Height; + + images.push_back(texture); + } } video::SColor getBgColor(bool use_fallback) const @@ -78,7 +105,7 @@ enum CameraMode {CAMERA_MODE_FIRST, CAMERA_MODE_THIRD, CAMERA_MODE_THIRD_FRONT}; class Camera { public: - Camera(MapDrawControl &draw_control, Client *client); + Camera(MapDrawControl &draw_control, Client *client, RenderingEngine *rendering_engine); ~Camera(); // Get camera scene node. @@ -185,7 +212,8 @@ public: Nametag *addNametag(scene::ISceneNode *parent_node, const std::string &text, video::SColor textcolor, - Optional<video::SColor> bgcolor, const v3f &pos); + Optional<video::SColor> bgcolor, const v3f &pos, + const std::vector<std::string> &image_names); void removeNametag(Nametag *nametag); |