/*
 * 3D Engine 
 * mesh.h: 
 * Based on pikuma.com 3D software renderer in C
 * Copyright (c) 2021 986-Studio. All rights reserved.
 *
 * Created by Manoël Trapier on 04/03/2021.
 */

#ifndef THREEDENGINE_SOURCE_INCLUDE_MESH_H
#define THREEDENGINE_SOURCE_INCLUDE_MESH_H

#include <vector.h>
#include <triangle.h>
#include <texture.h>

/***********************************************************************************************************************
 * Data types
 **********************************************************************************************************************/
typedef struct mesh_t
{
    vec3_t *vertices;        /**< List of vertices */
    vec3_t *normalVertices;  /**< List of normal vertices */
    tex2_t *textureVertices; /**< List of texture vertices */
    face_t *faces;           /**< List of faces */

    vec3_t rotation;         /**< Rotation of the object */
    vec3_t scale;            /**< Scaling of the object */
    vec3_t translation;      /**< Translation of the object */

    texture_t texture;       /**< Texture to apply to the object */
} mesh_t;

/***********************************************************************************************************************
 * Prototypes
 **********************************************************************************************************************/
void loadCubeMeshData(mesh_t *mesh);
void loadOBJFile(mesh_t *mesh, const char *filepath);

void meshFree(mesh_t *mesh);

#endif /* THREEDENGINE_SOURCE_INCLUDE_MESH_H */
