diff options
| author | johann nadalutti <[email protected]> | 2024-02-29 18:28:51 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-02-29 18:28:51 +0100 |
| commit | 53221eb799de037eaaae4accbfc5ef6f6c2fe1bb (patch) | |
| tree | 2f71f84d75ec63a36f1bdff8e03ecbe854db2189 /src/rmodels.c | |
| parent | 077ab6d56bea4fc464cd5c07e02071e911eac64a (diff) | |
| download | raylib-53221eb799de037eaaae4accbfc5ef6f6c2fe1bb.tar.gz raylib-53221eb799de037eaaae4accbfc5ef6f6c2fe1bb.zip | |
feat: vox_loader normals and new voxels shader (#3843)
Diffstat (limited to 'src/rmodels.c')
| -rw-r--r-- | src/rmodels.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/rmodels.c b/src/rmodels.c index 4f634990..316b91d1 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -5641,6 +5641,7 @@ static Model LoadVOX(const char *fileName) // 6*4 = 12 vertices per voxel Vector3 *pvertices = (Vector3 *)voxarray.vertices.array; + Vector3* pnormals = (Vector3*)voxarray.normals.array; Color *pcolors = (Color *)voxarray.colors.array; unsigned short *pindices = voxarray.indices.array; // 5461*6*6 = 196596 indices max per mesh @@ -5659,6 +5660,10 @@ static Model LoadVOX(const char *fileName) pmesh->vertices = RL_MALLOC(size); memcpy(pmesh->vertices, pvertices, size); + // Copy normals + pmesh->normals = RL_MALLOC(size); //Rk. size as vertices + memcpy(pmesh->normals, pnormals, size); + // Copy indices size = voxarray.indices.used*sizeof(unsigned short); pmesh->indices = RL_MALLOC(size); @@ -5676,6 +5681,7 @@ static Model LoadVOX(const char *fileName) verticesRemain -= verticesMax; pvertices += verticesMax; + pnormals += verticesMax; pcolors += verticesMax; } |
