Brenta Engine 1.1
Loading...
Searching...
No Matches
brenta::mesh Class Reference

The Mesh class represents a 3D model. More...

#include <mesh.hpp>

Data Structures

class  builder
 The Builder class is used to build a Mesh object. More...
 

Public Member Functions

 mesh (std::vector< types::vertex > vertices, std::vector< unsigned int > indices, std::vector< types::texture > textures, GLint wrapping=GL_REPEAT, GLint filtering_min=GL_NEAREST, GLint filtering_mag=GL_LINEAR, GLboolean hasMipmap=GL_TRUE, GLint mipmap_min=GL_LINEAR_MIPMAP_LINEAR, GLint mipmap_max=GL_LINEAR)
 Construct a new Mesh object.
 
void draw (types::shader_name_t shader_name)
 Draw the mesh.
 

Data Fields

std::vector< types::vertexvertices
 vertices of the mesh
 
std::vector< unsigned int > indices
 indices of the mesh
 
std::vector< types::texturetextures
 textures of the mesh
 
GLint wrapping
 Type of texture wrapping.
 
GLint filtering_min
 Minifying texture filtering.
 
GLint filtering_mag
 Magnifying texture filtering.
 
GLboolean has_mipmap
 Should the texture have a mipmap?
 
GLint mipmap_min
 Type of mipmap minifying texture filtering.
 
GLint mipmap_mag
 Type of mipmap magnifying texture filtering.
 

Detailed Description

The Mesh class represents a 3D model.

A mesh is a collection of vertices, indices and textures that represent a 3D model. The mesh can be drawn using a shader and calling the Draw method.

Definition at line 83 of file mesh.hpp.

Constructor & Destructor Documentation

◆ mesh()

mesh::mesh ( std::vector< types::vertex > vertices,
std::vector< unsigned int > indices,
std::vector< types::texture > textures,
GLint wrapping = GL_REPEAT,
GLint filtering_min = GL_NEAREST,
GLint filtering_mag = GL_LINEAR,
GLboolean hasMipmap = GL_TRUE,
GLint mipmap_min = GL_LINEAR_MIPMAP_LINEAR,
GLint mipmap_max = GL_LINEAR )

Construct a new Mesh object.

Parameters
verticesVertices of the mesh
indicesIndices of the mesh
texturesTextures of the mesh
wrappingType of texture wrapping
filtering_minMinifying texture filtering
filtering_magMagnifying texture filtering
hasMipmapShould the texture have a mipmap?
mipmap_minType of mipmap minifying texture filtering
mipmap_magType of mipmap magnifying texture filtering

Definition at line 35 of file mesh.cpp.

Member Function Documentation

◆ draw()

void mesh::draw ( types::shader_name_t shader_name)

Draw the mesh.

Parameters
shader_nameShader to use to draw the mesh

Definition at line 57 of file mesh.cpp.

Field Documentation

◆ filtering_mag

GLint brenta::mesh::filtering_mag

Magnifying texture filtering.

Type of texture filtering used when magnifying (scaling up) a texture. Options are:

  • GL_NEAREST: select the closest color to the texture coordinate
  • GL_LINEAR: interpolates the neighbouring pixels to get an approximate color.

Definition at line 138 of file mesh.hpp.

◆ filtering_min

GLint brenta::mesh::filtering_min

Minifying texture filtering.

Type of texture filtering used when minifying (scaling down) a texture. Options are:

  • GL_NEAREST: select the closest color to the texture coordinate
  • GL_LINEAR: interpolates the neighbouring pixels to get an approximate color.

Definition at line 128 of file mesh.hpp.

◆ has_mipmap

GLboolean brenta::mesh::has_mipmap

Should the texture have a mipmap?

Definition at line 142 of file mesh.hpp.

◆ indices

std::vector<unsigned int> brenta::mesh::indices

indices of the mesh

Indicies are used to reduce the memory footprint required to represent a 3D model. They are indices in the vertex array and there can be multiple indices for a vertex.

Definition at line 98 of file mesh.hpp.

◆ mipmap_mag

GLint brenta::mesh::mipmap_mag

Type of mipmap magnifying texture filtering.

Type of texture filtering used when magnifying (scaling up) a texture with mipmaps. Options are:

  • GL_NEAREST: select the closest color to the texture coordinate
  • GL_LINEAR: interpolates the neighbouring pixels to get an approximate color.
  • GL_NEAREST_MIPMAP_NEAREST: selects the mipmap that most closely matches the size of the pixel being textured and uses the GL_NEAREST criterion (the texture element nearest to the center of the pixel) to produce a texture value.
  • GL_LINEAR_MIPMAP_NEAREST: selects the mipmap that most closely matches the size of the pixel being textured and uses the GL_LINEAR criterion (a weighted average of the four texture elements that are closest to the center of the pixel) to produce a texture value.
  • GL_NEAREST_MIPMAP_LINEAR: selects the two mipmaps that most closely match the size of the pixel being textured and uses the GL_NEAREST criterion (the texture element nearest to the center of the pixel) to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.
  • GL_LINEAR_MIPMAP_LINEAR: selects the two mipmaps that most closely match the size of the pixel being textured and uses the GL_LINEAR criterion (a weighted average of the texture elements that are closest to the center of the pixel) to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.

Definition at line 206 of file mesh.hpp.

◆ mipmap_min

GLint brenta::mesh::mipmap_min

Type of mipmap minifying texture filtering.

Type of texture filtering used when minifying (scaling down) a texture with mipmaps. Options are:

  • GL_NEAREST: select the closest color to the texture coordinate
  • GL_LINEAR: interpolates the neighbouring pixels to get an approximate color.
  • GL_NEAREST_MIPMAP_NEAREST: selects the mipmap that most closely matches the size of the pixel being textured and uses the GL_NEAREST criterion (the texture element nearest to the center of the pixel) to produce a texture value.
  • GL_LINEAR_MIPMAP_NEAREST: selects the mipmap that most closely matches the size of the pixel being textured and uses the GL_LINEAR criterion (a weighted average of the four texture elements that are closest to the center of the pixel) to produce a texture value.
  • GL_NEAREST_MIPMAP_LINEAR: selects the two mipmaps that most closely match the size of the pixel being textured and uses the GL_NEAREST criterion (the texture element nearest to the center of the pixel) to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.
  • GL_LINEAR_MIPMAP_LINEAR: selects the two mipmaps that most closely match the size of the pixel being textured and uses the GL_LINEAR criterion (a weighted average of the texture elements that are closest to the center of the pixel) to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.

Definition at line 174 of file mesh.hpp.

◆ textures

std::vector<types::texture> brenta::mesh::textures

textures of the mesh

Definition at line 102 of file mesh.hpp.

◆ vertices

std::vector<types::vertex> brenta::mesh::vertices

vertices of the mesh

Definition at line 89 of file mesh.hpp.

◆ wrapping

GLint brenta::mesh::wrapping

Type of texture wrapping.

Options are:

  • GL_REPEAT: The default behavior for textures. Repeats the texture image.
  • GL_MIRRORED_REPEAT: Same as GL_REPEAT but mirrors the image with each repeat.
  • GL_CLAMP_TO_EDGE: Clamps the coordinates between 0 and 1. The result is that higher coordinates become clamped to the edge, resulting in a stretched edge pattern.
  • GL_CLAMP_TO_BORDER: Coordinates outside the range are now given a user-specified border color.

Definition at line 118 of file mesh.hpp.


The documentation for this class was generated from the following files: