Added a function for randomizing vertex buffers (useful for testing)
This commit is contained in:
@@ -57,6 +57,23 @@ acMeshSet(const AcReal value, AcMesh* mesh)
|
|||||||
return AC_SUCCESS;
|
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
|
AcResult
|
||||||
acMeshClear(AcMesh* mesh)
|
acMeshClear(AcMesh* mesh)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ AcResult acMeshDestroy(AcMesh* mesh);
|
|||||||
|
|
||||||
AcResult acMeshSet(const AcReal value, AcMesh* mesh);
|
AcResult acMeshSet(const AcReal value, AcMesh* mesh);
|
||||||
|
|
||||||
|
AcResult acMeshRandomize(AcMesh* mesh);
|
||||||
|
|
||||||
AcResult acMeshClear(AcMesh* mesh);
|
AcResult acMeshClear(AcMesh* mesh);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
Reference in New Issue
Block a user