Vulkan2D
2D renderer written in C using Vulkan and SDL2
Loading...
Searching...
No Matches
Model.h File Reference

Declares things related to loading and managing models. More...

#include "VK2D/Structs.h"
Include dependency graph for Model.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

VK2DModel vk2dModelCreate (const VK2DVertex3D *vertices, uint32_t vertexCount, const uint16_t *indices, uint32_t indexCount, VK2DTexture tex)
 Creates a model from a set of vertices.
 
VK2DModel vk2dModelFrom (const void *objFile, uint32_t objFileSize, VK2DTexture texture)
 Loads a .obj model from a binary buffer.
 
VK2DModel vk2dModelLoad (const char *objFile, VK2DTexture texture)
 Loads a model from a .obj file.
 
void vk2dModelFree (VK2DModel model)
 The texture stored in the model is not destroyed.
 

Detailed Description

Declares things related to loading and managing models.

Author
Paolo Mazzon

Function Documentation

◆ vk2dModelCreate()

VK2DModel vk2dModelCreate ( const VK2DVertex3D vertices,
uint32_t  vertexCount,
const uint16_t *  indices,
uint32_t  indexCount,
VK2DTexture  tex 
)

Creates a model from a set of vertices.

Parameters
verticesList of VK2DVertex3D vertices the model will use
vertexCountNumber of vertices in the list
indicesList of uint16_t indices for the vertex list
indexCountNumber of indices in the list
texTexture bound to the texture
Returns
Returns a new VK2DModel or NULL if it fails
Warning
The input must be triangulated.

◆ vk2dModelFree()

void vk2dModelFree ( VK2DModel  model)

The texture stored in the model is not destroyed.

Parameters
modelModel to free from memory

◆ vk2dModelFrom()

VK2DModel vk2dModelFrom ( const void *  objFile,
uint32_t  objFileSize,
VK2DTexture  texture 
)

Loads a .obj model from a binary buffer.

Parameters
objFile.obj file binary buffer
objFileSizeSize of the buffer in bytes
textureTexture the .obj file expects
Returns
Returns a new model or NULL if it fails
Warning
This function is very taxing as it builds a proper index list from the loaded model to save video memory

◆ vk2dModelLoad()

VK2DModel vk2dModelLoad ( const char *  objFile,
VK2DTexture  texture 
)

Loads a model from a .obj file.

Parameters
objFilePath to the .obj file
textureTexture the .obj file expects
Returns
Returns a new model or NULL if it fails
Warning
This function is very taxing as it builds a proper index list from the loaded model to save video memory