Visual Computing Library  devel
Loading...
Searching...
No Matches
abstract_drawable_mesh.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2025 *
6 * Visual Computing Lab *
7 * ISTI - Italian National Research Council *
8 * *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the Mozilla Public License Version 2.0 as published *
13 * by the Mozilla Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * Mozilla Public License Version 2.0 *
20 * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21 ****************************************************************************/
22
23#ifndef VCL_RENDER_DRAWABLE_ABSTRACT_DRAWABLE_MESH_H
24#define VCL_RENDER_DRAWABLE_ABSTRACT_DRAWABLE_MESH_H
25
26#include "drawable_object.h"
27#include "mesh/mesh_render_settings.h"
28
29#include <vclib/space/core/matrix.h>
30
31namespace vcl {
32
41{
42protected:
44
45public:
46 AbstractDrawableMesh() = default;
47
49
50 template<MeshConcept MeshType>
51 AbstractDrawableMesh(const MeshType& m) : mMRS(m)
52 {
53 }
54
55 const MeshRenderSettings& renderSettings() const { return mMRS; }
56
57 virtual void updateBuffers(
59 MeshRenderInfo::BUFFERS_ALL) = 0;
60
61 virtual void setRenderSettings(const MeshRenderSettings& rs) { mMRS = rs; }
62
63 virtual uint vertexNumber() const = 0;
64
65 virtual uint faceNumber() const = 0;
66
67 virtual uint edgeNumber() const = 0;
68
69 virtual vcl::Matrix44d transformMatrix() const = 0;
70
71 virtual std::vector<std::string> textures() const
72 {
73 return std::vector<std::string>();
74 }
75
76 // DrawableObject implementation
77
78 inline bool isVisible() const { return mMRS.isVisible(); }
79
80 inline void setVisibility(bool vis) { mMRS.setVisibility(vis); }
81
82protected:
83 void swap(AbstractDrawableMesh& other)
84 {
85 using std::swap;
87 swap(mMRS, other.mMRS);
88 }
89};
90
91} // namespace vcl
92
93#endif // VCL_RENDER_DRAWABLE_ABSTRACT_DRAWABLE_MESH_H
The AbstractDrawableMesh class is the base class for all the drawable meshes in the VCLib render syst...
Definition abstract_drawable_mesh.h:41
void setVisibility(bool vis)
This member function is used to set the visibility of the object.
Definition abstract_drawable_mesh.h:80
bool isVisible() const
This member function is used to check if the object is visible.
Definition abstract_drawable_mesh.h:78
The BitSet class allows to treat an integral type as an array of booleans of a guaranteed size.
Definition bit_set.h:52
A class representing a box in N-dimensional space.
Definition box.h:46
The DrawableObject class is the base class for all the objects that can be drawn in a 3D viewer.
Definition drawable_object.h:55
void swap(DrawableObject &other)
Utility swap function that allows to swap the content of two DrawableObject instances.
Definition drawable_object.h:196
The MeshRenderSettings class allows an easy management of render settings of a Mesh....
Definition mesh_render_settings.h:70
bool isVisible() const
Returns whether the mesh is visible.
Definition mesh_render_settings.h:199
bool setVisibility(bool b)
Sets the visibility of the mesh.
Definition mesh_render_settings.h:321