3 #ifndef SCENEVIEW_GEOMETRY_RESOURCE_HPP__
4 #define SCENEVIEW_GEOMETRY_RESOURCE_HPP__
14 #include <QOpenGLBuffer>
16 #include <sceneview/axis_aligned_box.hpp>
93 typedef std::shared_ptr<GeometryResource> Ptr;
104 QOpenGLBuffer* VBO() {
return &vbo_; }
106 QOpenGLBuffer* IndexBuffer();
108 int VertexOffset()
const {
return vertex_offset_; }
110 int NumVertices()
const {
return num_vertices_; }
112 int NormalOffset()
const {
return normal_offset_; }
114 int NumNormals()
const {
return num_normals_; }
116 int DiffuseOffset()
const {
return diffuse_offset_; }
118 int NumDiffuse()
const {
return num_diffuse_; }
120 int NumSpecular()
const {
return num_specular_; }
122 int SpecularOffset()
const {
return specular_offset_; }
124 int NumShininess()
const {
return num_shininess_; }
126 int ShininessOffset()
const {
return shininess_offset_; }
128 int TexCoords0Offset()
const {
return tex_coords_0_offset_; }
130 int NumTexCoords0()
const {
return num_tex_coords_0_; }
132 int NumIndices()
const {
return num_indices_; }
144 GLenum
GLMode()
const {
return gl_mode_; }
146 const AxisAlignedBox& BoundingBox()
const {
return bounding_box_; }
149 friend class ResourceManager;
151 friend class Drawable;
153 explicit GeometryResource(
const QString& name);
155 void AddListener(Drawable* drawable);
157 void RemoveListener(Drawable* drawable);
164 QOpenGLBuffer index_buffer_;
169 int specular_offset_;
170 int shininess_offset_;
171 int tex_coords_0_offset_;
178 int num_tex_coords_0_;
185 AxisAlignedBox bounding_box_;
187 std::vector<Drawable*> listeners_;
192 #endif // SCENEVIEW_GEOMETRY_RESOURCE_HPP__
GLenum GLMode() const
What kind of primitives are in this geometry (GL_POINTS, GL_LINE_STRIP, ...)
Definition: geometry_resource.hpp:144
std::vector< QVector3D > vertices
Vertices of the geometry.
Definition: geometry_resource.hpp:34
std::vector< float > shininess
Shininess component.
Definition: geometry_resource.hpp:57
Geometry that can be rendered with glDrawArrays() or glDrawElements().
Definition: geometry_resource.hpp:91
Geometry description to be used with GeometryResource.
Definition: geometry_resource.hpp:30
std::vector< QVector4D > diffuse
Diffuse color component.
Definition: geometry_resource.hpp:45
An axis-aligned box typically used for bounding box and intersection calculations.
Definition: axis_aligned_box.hpp:17
GLenum IndexType() const
Returns the type parameter to pass to glDrawElements() Either GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT.
Definition: geometry_resource.hpp:138
GLenum gl_mode
The OpenGL primitive type.
Definition: geometry_resource.hpp:74
std::vector< uint32_t > indices
Vertex indices.
Definition: geometry_resource.hpp:68
void Load(const GeometryData &data)
Loads the specified geometry into this resource.
std::vector< QVector4D > specular
Specular color component.
Definition: geometry_resource.hpp:51
std::vector< QVector2D > tex_coords_0
Texture coordinates.
Definition: geometry_resource.hpp:62
std::vector< QVector3D > normals
Normal vectors.
Definition: geometry_resource.hpp:39