Brenta Engine 1.2
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...
 
struct  config
 

Public Member Functions

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

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.
 

Static Public Attributes

static const config default_config
 

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 61 of file mesh.hpp.

Constructor & Destructor Documentation

◆ mesh()

mesh::mesh ( config conf)

Definition at line 24 of file mesh.cpp.

Member Function Documentation

◆ draw()

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

Definition at line 43 of file mesh.cpp.

Field Documentation

◆ default_config

const mesh::config mesh::default_config
static
Initial value:
= {
{},
{},
{},
GL_REPEAT,
GL_NEAREST,
GL_LINEAR,
GL_TRUE,
GL_LINEAR_MIPMAP_LINEAR,
GL_LINEAR,
}

Definition at line 187 of file mesh.hpp.

◆ 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 115 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 105 of file mesh.hpp.

◆ has_mipmap

GLboolean brenta::mesh::has_mipmap

Should the texture have a mipmap?

Definition at line 119 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 75 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 183 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 151 of file mesh.hpp.

◆ textures

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

textures of the mesh

Definition at line 79 of file mesh.hpp.

◆ vertices

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

vertices of the mesh

Definition at line 67 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 95 of file mesh.hpp.


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