Group of functions and structures for handling 3D models. More...
Classes | |
struct | Material |
Structure representing a material with various properties. More... | |
struct | ModelObjectData |
Structure representing the data of a 3D model object. More... | |
struct | ModelKeyframe |
Structure representing the data of a 3D model keyframe. More... | |
struct | Bone |
Structure representing a bone in a 3D model. More... | |
struct | ModelAnimation |
Structure representing the data of a 3D model animation. More... | |
struct | ModelData |
Structure representing the data of a 3D model. More... | |
Typedefs | |
typedef float | Vertex[VERTEX_ATTRIBUTE_COUNT] |
Array of VERTEX_ATTRIBUTE_COUNT floats representing a vertex. | |
Functions | |
void | create_textured_plane (TexturedMesh *texturedMesh, const char *texture) |
Creates a textured plane. | |
void | create_screen_plane (Mesh *mesh) |
Creates a screen plane. | |
void | render_model (mat4 modelMatrix, Shader activeShader, Model *model) |
Renders a 3D model using the specified shader and transformation matrix. | |
Group of functions and structures for handling 3D models.
Vertex |
Array of VERTEX_ATTRIBUTE_COUNT floats representing a vertex.
enum VertexAttribute |
Enumeration of vertex attributes used in 3D models.
This enumeration defines various attributes that can be associated with a vertex in a 3D model. These attributes include positions, normals, texture coordinates, tangents, bitangents, and bone data.
enum MaterialProperties |
Enum representing different material properties.
This enum is used to identify various material properties such as diffuse, specular, ambient, emission, etc. Each property can be associated with a texture map or a flat color.
enum ModelFlags |
Enum representing flags for a model.
This enum is used to set various flags for a model, such as glow effect.
void create_textured_plane | ( | TexturedMesh * | texturedMesh, |
const char * | texture | ||
) |
Creates a textured plane.
This function initializes a textured plane with the given texture.
texturedMesh | Pointer to the TexturedMesh structure to be initialized. |
texture | Path to the texture file. |
Creates a textured plane mesh using the specified texture file.
texturedMesh | {TexturedMesh*} A pointer to a TexturedMesh structure that will hold the created mesh's VAO, texture, and length. |
texture | {char*} The file path of the texture image to be applied to the plane. |
This function generates a textured plane by creating a Vertex Array Object (VAO) and binding it with a Vertex Buffer Object (VBO) containing the vertex data for a rectangular plane. The plane is positioned in the 3D space with a specified texture applied to it.
The plane is defined by a series of vertices that include position, normal, and texture coordinate data:
If the texture is successfully loaded, an OpenGL texture is generated, and its parameters are set, including wrapping and filtering modes. If the texture fails to load, an error message is printed.
The function initializes the following attributes in the TexturedMesh structure:
Example Usage: TexturedMesh myPlane; create_textured_plane(&myPlane, "path/to/texture.png"); // Use myPlane for rendering...
Return: This function does not return a value but modifies the TexturedMesh structure pointed to by texturedMesh
.
void create_screen_plane | ( | Mesh * | mesh | ) |
Creates a screen plane.
This function initializes a screen plane.
mesh | Pointer to the Mesh structure to be initialized. |
Creates a fullscreen quad (screen plane) mesh for rendering.
mesh | {Mesh*} A pointer to a Mesh structure that will hold the created mesh's VAO and length. |
This function generates a fullscreen quad mesh suitable for rendering images or effects that cover the entire screen. The quad is defined by six vertices forming two triangles.
The vertex data includes positions in normalized device coordinates (NDC) and corresponding texture coordinates, allowing for the mapping of textures across the full screen.
The function initializes the following attributes in the Mesh structure:
Example Usage: Mesh screenPlane; create_screen_plane(&screenPlane); // Use screenPlane for rendering...
Return: This function does not return a value but modifies the Mesh structure pointed to by mesh
.
Renders a 3D model using the specified shader and transformation matrix.
This function takes a transformation matrix, an active shader, and a model, and renders the model using the provided shader and transformation matrix.
modelMatrix | A 4x4 transformation matrix (mat4) that defines the model's position, rotation, and scale in the world space. |
activeShader | The shader program to be used for rendering the model. |
model | A pointer to the Model structure that contains the model's data, such as vertices, indices, textures, etc. |