Added acMeshRandomize to astaroth.h to keep core and utils separate

This commit is contained in:
jpekkila
2020-11-02 17:14:26 +02:00
parent d48a478254
commit 349093768d
6 changed files with 21 additions and 23 deletions

View File

@@ -221,6 +221,23 @@ acMeshCreate(const AcMeshInfo info, AcMesh* mesh)
return AC_SUCCESS;
}
static AcReal
randf(void)
{
return (AcReal)rand() / (AcReal)RAND_MAX;
}
AcResult
acMeshRandomize(AcMesh* mesh)
{
const int n = acVertexBufferSize(mesh->info);
for (int w = 0; w < NUM_VTXBUF_HANDLES; ++w)
for (int i = 0; i < n; ++i)
mesh->vertex_buffer[w][i] = randf();
return AC_SUCCESS;
}
AcResult
acMeshDestroy(AcMesh* mesh)
{