Bug in geometry, complete header
This commit is contained in:
parent
1da4e82e8d
commit
5617ac7ecb
1
sweet.h
1
sweet.h
@ -25,6 +25,7 @@
|
|||||||
#include "sweet_math.h"
|
#include "sweet_math.h"
|
||||||
#include "sweet_matrix.h"
|
#include "sweet_matrix.h"
|
||||||
#include "sweet_matrix_stack.h"
|
#include "sweet_matrix_stack.h"
|
||||||
|
#include "sweet_geometry.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -226,7 +226,7 @@ middle_point (struct map * map,
|
|||||||
v2 = v->vertices[b];
|
v2 = v->vertices[b];
|
||||||
middle = sweet_vector_middle3 (v1, v2);
|
middle = sweet_vector_middle3 (v1, v2);
|
||||||
|
|
||||||
if (v->buffer < (v->nb_vertices * sizeof (vec3)))
|
if (v->buffer <= (v->nb_vertices * sizeof (vec3)))
|
||||||
{
|
{
|
||||||
vec3 * p;
|
vec3 * p;
|
||||||
v->buffer = v->buffer * 2;
|
v->buffer = v->buffer * 2;
|
||||||
@ -302,9 +302,9 @@ sweet_geometry_icosphere (unsigned int nb_iterations, float scale,
|
|||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
map_init (&map);
|
map_init (&map);
|
||||||
|
|
||||||
*mesh_vertices = NULL;
|
*mesh_vertices = NULL;
|
||||||
*mesh_indices = NULL;
|
*mesh_indices = NULL;
|
||||||
|
|
||||||
nb_faces = 20;
|
nb_faces = 20;
|
||||||
v.nb_vertices = 12;
|
v.nb_vertices = 12;
|
||||||
v.buffer = v.nb_vertices * sizeof (vec3);
|
v.buffer = v.nb_vertices * sizeof (vec3);
|
||||||
@ -348,7 +348,7 @@ sweet_geometry_icosphere (unsigned int nb_iterations, float scale,
|
|||||||
(*mesh_indices) = malloc (nb_faces * sizeof (unsigned int) * 3);
|
(*mesh_indices) = malloc (nb_faces * sizeof (unsigned int) * 3);
|
||||||
(*mesh_vertices) = malloc (v.nb_vertices * sizeof (float) * 3);
|
(*mesh_vertices) = malloc (v.nb_vertices * sizeof (float) * 3);
|
||||||
|
|
||||||
if (*mesh_indices == NULL || *mesh_vertices == NULL)
|
if ((*mesh_indices) == NULL || (*mesh_vertices) == NULL)
|
||||||
{
|
{
|
||||||
free_all (&map, &v, root, *mesh_vertices, *mesh_indices);
|
free_all (&map, &v, root, *mesh_vertices, *mesh_indices);
|
||||||
*count_vertices = 0;
|
*count_vertices = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user