Kohi Game Engine
geometry_utils.h File Reference
#include "math_types.h"

Go to the source code of this file.

Functions

void geometry_generate_normals (u32 vertex_count, vertex_3d *vertices, u32 index_count, u32 *indices)
 Calculates normals for the given vertex and index data. Modifies vertices in place. More...
 
void geometry_generate_tangents (u32 vertex_count, vertex_3d *vertices, u32 index_count, u32 *indices)
 Calculates tangents for the given vertex and index data. Modifies vertices in place. More...
 
void geometry_deduplicate_vertices (u32 vertex_count, vertex_3d *vertices, u32 index_count, u32 *indices, u32 *out_vertex_count, vertex_3d **out_vertices)
 De-duplicates vertices, leaving only unique ones. Leaves the original vertices array intact. Allocates a new array in out_vertices. Modifies indices in-place. Original vertex array should be freed by caller. More...
 
void terrain_geometry_generate_normals (u32 vertex_count, struct terrain_vertex *vertices, u32 index_count, u32 *indices)
 
void terrain_geometry_generate_tangents (u32 vertex_count, struct terrain_vertex *vertices, u32 index_count, u32 *indices)
 

Function Documentation

◆ geometry_deduplicate_vertices()

void geometry_deduplicate_vertices ( u32  vertex_count,
vertex_3d vertices,
u32  index_count,
u32 indices,
u32 out_vertex_count,
vertex_3d **  out_vertices 
)

De-duplicates vertices, leaving only unique ones. Leaves the original vertices array intact. Allocates a new array in out_vertices. Modifies indices in-place. Original vertex array should be freed by caller.

Parameters
vertex_countThe number of vertices in the array.
verticesThe original array of vertices to be de-duplicated. Not modified.
index_countThe number of indices in the array.
indicesThe array of indices. Modified in-place as vertices are removed.
out_vertex_countA pointer to hold the final vertex count.
out_verticesA pointer to hold the array of de-duplicated vertices.

◆ geometry_generate_normals()

void geometry_generate_normals ( u32  vertex_count,
vertex_3d vertices,
u32  index_count,
u32 indices 
)

Calculates normals for the given vertex and index data. Modifies vertices in place.

Parameters
vertex_countThe number of vertices.
verticesAn array of vertices.
index_countThe number of indices.
indicesAn array of vertices.

◆ geometry_generate_tangents()

void geometry_generate_tangents ( u32  vertex_count,
vertex_3d vertices,
u32  index_count,
u32 indices 
)

Calculates tangents for the given vertex and index data. Modifies vertices in place.

Parameters
vertex_countThe number of vertices.
verticesAn array of vertices.
index_countThe number of indices.
indicesAn array of vertices.

◆ terrain_geometry_generate_normals()

void terrain_geometry_generate_normals ( u32  vertex_count,
struct terrain_vertex vertices,
u32  index_count,
u32 indices 
)

◆ terrain_geometry_generate_tangents()

void terrain_geometry_generate_tangents ( u32  vertex_count,
struct terrain_vertex vertices,
u32  index_count,
u32 indices 
)