diff options
| author | Ray <raysan5@gmail.com> | 2019-04-04 13:32:17 +0200 |
|---|---|---|
| committer | Ray <raysan5@gmail.com> | 2019-04-04 13:32:17 +0200 |
| commit | 22dece2935ae0fcd67f0d040bdb3f95318495908 (patch) | |
| tree | ff9a48bb537862aaa93946e3b7671bb6a38a4803 /src | |
| parent | f1cbdd6b3af5dc51cef306cbbc4619c7b6ed548a (diff) | |
| download | raylib-22dece2935ae0fcd67f0d040bdb3f95318495908.tar.gz raylib-22dece2935ae0fcd67f0d040bdb3f95318495908.zip | |
Animated vertex renaming
Diffstat (limited to 'src')
| -rw-r--r-- | src/rlgl.h | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -205,8 +205,8 @@ typedef unsigned char byte; unsigned short *indices;// vertex indices (in case vertex data comes indexed) // Animation vertex data - float *baseVertices; // Vertex base position (required to apply bones transformations) - float *baseNormals; // Vertex base normals (required to apply bones transformations) + float *animVertices; // Animated vertex positions (after bones transformations) + float *animNormals; // Animated normals (after bones transformations) float *weightBias; // Vertex weight bias int *weightId; // Vertex weight id @@ -455,6 +455,7 @@ void rlDeleteVertexArrays(unsigned int id); // Unload vertex data (V void rlDeleteBuffers(unsigned int id); // Unload vertex data (VBO) from GPU memory void rlClearColor(byte r, byte g, byte b, byte a); // Clear color buffer with color void rlClearScreenBuffers(void); // Clear used screen buffers (color and depth) +void rlUpdateBuffer(int bufferId, void *data, int dataSize); // Update GPU buffer with new data //------------------------------------------------------------------------------------ // Functions Declaration - rlgl functionality @@ -1501,6 +1502,13 @@ void rlClearScreenBuffers(void) //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); // Stencil buffer not used... } +// Update GPU buffer with new data +void rlUpdateBuffer(int bufferId, void *data, int dataSize) +{ + glBindBuffer(GL_ARRAY_BUFFER, bufferId); + glBufferSubData(GL_ARRAY_BUFFER, 0, dataSize, data); +} + //---------------------------------------------------------------------------------- // Module Functions Definition - rlgl Functions //---------------------------------------------------------------------------------- @@ -2788,10 +2796,10 @@ void rlUnloadMesh(Mesh *mesh) free(mesh->texcoords2); free(mesh->indices); - free(mesh->baseVertices); - free(mesh->baseNormals); - free(mesh->weightBias); - free(mesh->weightId); + free(mesh->animVertices); + free(mesh->animNormals); + free(mesh->boneWeights); + free(mesh->boneIds); rlDeleteBuffers(mesh->vboId[0]); // vertex rlDeleteBuffers(mesh->vboId[1]); // texcoords |
