From 94794cee91cb98aa066374a4b8ed27404286dfb8 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 24 Aug 2020 14:29:01 +0300 Subject: [PATCH] Added acVertexBufferSet in the utils interface --- include/astaroth_utils.h | 3 +++ src/utils/memory.c | 13 ++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/astaroth_utils.h b/include/astaroth_utils.h index 632d7ce..f742f73 100644 --- a/include/astaroth_utils.h +++ b/include/astaroth_utils.h @@ -44,6 +44,9 @@ typedef struct { /** Loads data from the config file */ AcResult acLoadConfig(const char* config_path, AcMeshInfo* config); +/** */ +AcResult acVertexBufferSet(const VertexBufferHandle handle, const AcReal value, AcMesh* mesh); + /** */ AcResult acMeshSet(const AcReal value, AcMesh* mesh); diff --git a/src/utils/memory.c b/src/utils/memory.c index f587f4d..334d106 100644 --- a/src/utils/memory.c +++ b/src/utils/memory.c @@ -21,12 +21,19 @@ #include "errchk.h" AcResult -acMeshSet(const AcReal value, AcMesh* mesh) +acVertexBufferSet(const VertexBufferHandle handle, const AcReal value, AcMesh* mesh) { const int n = acVertexBufferSize(mesh->info); + for (int i = 0; i < n; ++i) + mesh->vertex_buffer[handle][i] = value; + + return AC_SUCCESS; +} +AcResult +acMeshSet(const AcReal value, AcMesh* mesh) +{ for (int w = 0; w < NUM_VTXBUF_HANDLES; ++w) - for (int i = 0; i < n; ++i) - mesh->vertex_buffer[w][i] = value; + acVertexBufferSet(w, value, mesh); return AC_SUCCESS; }