The small3d framework
Public Member Functions | Public Attributes | List of all members
small3d::Model Struct Reference

A 3D model, loaded from a Wavefront file. More...

#include <Model.hpp>

Public Member Functions

 Model ()
 Default constructor. More...
 
 Model (const std::string fileLocation)
 Constructor that loads model from file. More...
 

Public Attributes

bool alreadyInGPU = false
 Is the model already in GPU memory? (Vulkan-specific, avoid direct manipulation)
 
VkBuffer positionBuffer
 Buffer containing vertex positions (Vulkan-specific, avoid direct manipulation)
 
VkDeviceMemory positionBufferMemory
 Memory for buffer containing vertex positions (Vulkan-specific, avoid direct manipulation)
 
VkBuffer indexBuffer
 Index buffer (Vulkan-specific, avoid direct manipulation)
 
VkDeviceMemory indexBufferMemory
 Memory for index buffer (Vulkan-specific, avoid direct manipulation)
 
VkBuffer normalsBuffer
 Normals buffer (Vulkan-specific, avoid direct manipulation)
 
VkDeviceMemory normalsBufferMemory
 Memory for normals buffer (Vulkan-specific, avoid direct manipulation)
 
VkBuffer uvBuffer
 UV coordinates buffer (Vulkan-specific, avoid direct manipulation)
 
VkDeviceMemory uvBufferMemory
 Memory for UV coordinates buffer (Vulkan-specific, avoid direct manipulation)
 
uint32_t orientationMemIndex = 0
 Index of model orientation in the orientation dynamic uniform buffer (Vulkan-specific, avoid direct manipulation)
 
uint32_t colourMemIndex = 0
 Index of model colour in the colour dynamic uniform buffer (Vulkan-specific, avoid direct manipulation)
 
std::vector< float > vertexData
 The vertex data. This is an array, which is to be treated as a 4 column table, holding the x, y, z values in each column. The fourth column is there to assist in matrix operations.
 
int vertexDataByteSize = 0
 Size of the vertex data, in bytes.
 
std::vector< uint32_t > indexData
 3 column table. Each element refers to a "row" in the vertex data table. Each "row" in the index data table forms a triangle. More...
 
int indexDataByteSize = 0
 Size of the index data, in bytes.
 
std::vector< float > normalsData
 Array, to be treated as a 3 column table. Each "row" contains the x, y and z components of the vector representing the normal of a vertex. The position of the "row" in the array is the same as the position of the corresponding vertex "row" in the vertexData array.
 
int normalsDataByteSize = 0
 Size of the normals data, in bytes.
 
std::vector< float > textureCoordsData
 Array, to be treated as a 2 column table. Each "row" contains the x and y components of the pixel coordinates on the model's texture image for the vertex in the corresponding "row" of the vertex data "table".
 
int textureCoordsDataByteSize = 0
 Size of the texture coordinates data, in bytes.
 
std::string textureName = ""
 Name of the texture the model will be rendered with. The texture has to have been previously generated with Renderer.generateTexture().
 
bool perspective = false
 True if the model is to be rendered with perspective, False for orthographic rendering.
 

Detailed Description

A 3D model, loaded from a Wavefront file.

Constructor & Destructor Documentation

◆ Model() [1/2]

small3d::Model::Model ( )

Default constructor.

◆ Model() [2/2]

small3d::Model::Model ( const std::string  fileLocation)

Constructor that loads model from file.

Parameters
fileLocationLocation of the Wavefront file from which to load the model.

Member Data Documentation

◆ indexData

std::vector<uint32_t> small3d::Model::indexData

3 column table. Each element refers to a "row" in the vertex data table. Each "row" in the index data table forms a triangle.


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