#include <stdio.h>
#include <stdlib.h>
#include "3d_mesh.h"
static void my_3d_mesh__begin_solid(
{
struct my_3d_mesh* my_mesh = (struct my_3d_mesh*)cookie;
size_t tri_count = 0;
else
my_mesh->triangle_array =
(struct my_3d_triangle*)malloc(
tri_count * sizeof(struct my_3d_triangle));
my_mesh->triangle_array_count = 0;
my_mesh->triangle_array_capacity = tri_count;
}
static void my_3d_mesh__copy_triangle(
void* cookie,
uint32_t triangle_id,
{
struct my_3d_mesh* my_mesh = (struct my_3d_mesh*)cookie;
if (triangle_id >= my_mesh->triangle_array_capacity) {
size_t new_capacity = my_mesh->triangle_array_capacity;
new_capacity += new_capacity >> 3;
my_mesh->triangle_array =
(struct my_3d_triangle*)realloc(
my_mesh->triangle_array,
new_capacity * sizeof(struct my_3d_triangle));
my_mesh->triangle_array_capacity = new_capacity;
}
{
struct my_3d_triangle* my_tri = &my_mesh->triangle_array[triangle_id];
int i;
for (i = 0; i < 3; ++i) {
my_tri->vertex[i].coords[0] = tri_vertices[i].
x;
my_tri->vertex[i].coords[1] = tri_vertices[i].
y;
my_tri->vertex[i].coords[2] = tri_vertices[i].
z;
}
}
my_mesh->triangle_array_count = triangle_id + 1;
}
int main(int argc, char** argv)
{
int error = 0;
if (argc > 1) {
const char* filepath = argv[1];
struct my_3d_mesh my_mesh = {0};
mesh_creator.
cookie = &my_mesh;
fprintf(stderr, "gmio error: 0x%X\n", error);
free(my_mesh.triangle_array);
}
return error;
}