Skip to content

Commit 7bde76c

Browse files
satchelfrostReese Gallagherraysan5
authored
[rmodels] More performant point cloud rendering with DrawModelPoints() (#4203)
* Added the ability to draw a model as a point cloud * Added example to demonstrate drawing a model as a point cloud * polished the demo a bit * picture for example * adhere to conventions for example * update png to match aspect ratio * minor changes * address code convention comments * added point rendering to makefiles * added point rendering to readme and renumbered examples * comment formatting --------- Co-authored-by: Reese Gallagher <re325479@ucf.edu.com> Co-authored-by: Ray <raysan5@gmail.com>
1 parent b0c3013 commit 7bde76c

File tree

7 files changed

+224
-25
lines changed

7 files changed

+224
-25
lines changed

examples/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ MODELS = \
582582
models/models_mesh_generation \
583583
models/models_mesh_picking \
584584
models/models_orthographic_projection \
585+
models/models_point_rendering \
585586
models/models_rlgl_solar_system \
586587
models/models_skybox \
587588
models/models_waving_cubes \

examples/Makefile.Web

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ MODELS = \
447447
models/models_mesh_generation \
448448
models/models_mesh_picking \
449449
models/models_orthographic_projection \
450+
models/models_point_rendering \
450451
models/models_rlgl_solar_system \
451452
models/models_skybox \
452453
models/models_waving_cubes \

examples/README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -147,38 +147,38 @@ Examples using raylib models functionality, including models loading/generation
147147
| 91 | [models_loading_vox](models/models_loading_vox.c) | <img src="models/models_loading_vox.png" alt="models_loading_vox" width="80"> | ⭐️☆☆☆ | **4.0** | **4.0** | [Johann Nadalutti](https://github.com/procfxgen) |
148148
| 92 | [models_loading_m3d](models/models_loading_m3d.c) | <img src="models/models_loading_m3d.png" alt="models_loading_m3d" width="80"> | ⭐️☆☆☆ | **4.2** | **4.2** | [bzt](https://bztsrc.gitlab.io/model3d) |
149149
| 93 | [models_orthographic_projection](models/models_orthographic_projection.c) | <img src="models/models_orthographic_projection.png" alt="models_orthographic_projection" width="80"> | ⭐️☆☆☆ | 2.0 | 3.7 | [Max Danielsson](https://github.com/autious) |
150-
| 94 | [models_rlgl_solar_system](models/models_rlgl_solar_system.c) | <img src="models/models_rlgl_solar_system.png" alt="models_rlgl_solar_system" width="80"> | ⭐️⭐️⭐️⭐️ | 2.5 | **4.0** | [Ray](https://github.com/raysan5) |
151-
| 95 | [models_yaw_pitch_roll](models/models_yaw_pitch_roll.c) | <img src="models/models_yaw_pitch_roll.png" alt="models_yaw_pitch_roll" width="80"> | ⭐️⭐️☆☆ | 1.8 | **4.0** | [Berni](https://github.com/Berni8k) |
152-
| 96 | [models_waving_cubes](models/models_waving_cubes.c) | <img src="models/models_waving_cubes.png" alt="models_waving_cubes" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [codecat](https://github.com/codecat) |
153-
| 97 | [models_heightmap](models/models_heightmap.c) | <img src="models/models_heightmap.png" alt="models_heightmap" width="80"> | ⭐️☆☆☆ | 1.8 | 3.5 | [Ray](https://github.com/raysan5) |
154-
| 98 | [models_skybox](models/models_skybox.c) | <img src="models/models_skybox.png" alt="models_skybox" width="80"> | ⭐️⭐️☆☆ | 1.8 | **4.0** | [Ray](https://github.com/raysan5) |
150+
| 94 | [models_point_rendering](models/models_point_rendering.c) | <img src="models/models_point_rendering.png" alt="models_point_rendering" width="80"> | ⭐️⭐️☆☆ | 5.0 | 5.0 | [Reese Gallagher](https://github.com/satchelfrost) |
151+
| 95 | [models_rlgl_solar_system](models/models_rlgl_solar_system.c) | <img src="models/models_rlgl_solar_system.png" alt="models_rlgl_solar_system" width="80"> | ⭐️⭐️⭐️⭐️ | 2.5 | **4.0** | [Ray](https://github.com/raysan5) |
152+
| 96 | [models_yaw_pitch_roll](models/models_yaw_pitch_roll.c) | <img src="models/models_yaw_pitch_roll.png" alt="models_yaw_pitch_roll" width="80"> | ⭐️⭐️☆☆ | 1.8 | **4.0** | [Berni](https://github.com/Berni8k) |
153+
| 97 | [models_waving_cubes](models/models_waving_cubes.c) | <img src="models/models_waving_cubes.png" alt="models_waving_cubes" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [codecat](https://github.com/codecat) |
154+
| 98 | [models_heightmap](models/models_heightmap.c) | <img src="models/models_heightmap.png" alt="models_heightmap" width="80"> | ⭐️☆☆☆ | 1.8 | 3.5 | [Ray](https://github.com/raysan5) |
155+
| 99 | [models_skybox](models/models_skybox.c) | <img src="models/models_skybox.png" alt="models_skybox" width="80"> | ⭐️⭐️☆☆ | 1.8 | **4.0** | [Ray](https://github.com/raysan5) |
155156

156157
### category: shaders
157158

158159
Examples using raylib shaders functionality, including shaders loading, parameters configuration and drawing using them (model shaders and postprocessing shaders). This functionality is directly provided by raylib [rlgl](../src/rlgl.c) module.
159160

160161
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
161162
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
162-
| 99 | [shaders_basic_lighting](shaders/shaders_basic_lighting.c) | <img src="shaders/shaders_basic_lighting.png" alt="shaders_basic_lighting" width="80"> | ⭐️⭐️⭐️⭐️ | 3.0 | **4.2** | [Chris Camacho](https://github.com/codifies) |
163-
| 100 | [shaders_model_shader](shaders/shaders_model_shader.c) | <img src="shaders/shaders_model_shader.png" alt="shaders_model_shader" width="80"> | ⭐️⭐️☆☆ | 1.3 | 3.7 | [Ray](https://github.com/raysan5) |
164-
| 101 | [shaders_shapes_textures](shaders/shaders_shapes_textures.c) | <img src="shaders/shaders_shapes_textures.png" alt="shaders_shapes_textures" width="80"> | ⭐️⭐️☆☆ | 1.7 | 3.7 | [Ray](https://github.com/raysan5) |
165-
| 102 | [shaders_custom_uniform](shaders/shaders_custom_uniform.c) | <img src="shaders/shaders_custom_uniform.png" alt="shaders_custom_uniform" width="80"> | ⭐️⭐️☆☆ | 1.3 | **4.0** | [Ray](https://github.com/raysan5) |
166-
| 103 | [shaders_postprocessing](shaders/shaders_postprocessing.c) | <img src="shaders/shaders_postprocessing.png" alt="shaders_postprocessing" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | **4.0** | [Ray](https://github.com/raysan5) |
167-
| 104 | [shaders_palette_switch](shaders/shaders_palette_switch.c) | <img src="shaders/shaders_palette_switch.png" alt="shaders_palette_switch" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [Marco Lizza](https://github.com/MarcoLizza) |
168-
| 105 | [shaders_raymarching](shaders/shaders_raymarching.c) | <img src="shaders/shaders_raymarching.png" alt="shaders_raymarching" width="80"> | ⭐️⭐️⭐️⭐️ | 2.0 | **4.2** | [Ray](https://github.com/raysan5) |
169-
| 106 | [shaders_texture_drawing](shaders/shaders_texture_drawing.c) | <img src="shaders/shaders_texture_drawing.png" alt="shaders_texture_drawing" width="80"> | ⭐️⭐️☆☆ | 2.0 | 3.7 | [Michał Ciesielski](https://github.com/) |
170-
| 107 | [shaders_texture_outline](shaders/shaders_texture_outline.c) | <img src="shaders/shaders_texture_outline.png" alt="shaders_texture_outline" width="80"> | ⭐️⭐️⭐️☆ | **4.0** | **4.0** | [Samuel Skiff](https://github.com/GoldenThumbs) |
171-
| 108 | [shaders_texture_waves](shaders/shaders_texture_waves.c) | <img src="shaders/shaders_texture_waves.png" alt="shaders_texture_waves" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Anata](https://github.com/anatagawa) |
172-
| 109 | [shaders_julia_set](shaders/shaders_julia_set.c) | <img src="shaders/shaders_julia_set.png" alt="shaders_julia_set" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | **4.0** | [eggmund](https://github.com/eggmund) |
173-
| 110 | [shaders_eratosthenes](shaders/shaders_eratosthenes.c) | <img src="shaders/shaders_eratosthenes.png" alt="shaders_eratosthenes" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | **4.0** | [ProfJski](https://github.com/ProfJski) |
174-
| 111 | [shaders_fog](shaders/shaders_fog.c) | <img src="shaders/shaders_fog.png" alt="shaders_fog" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
175-
| 112 | [shaders_simple_mask](shaders/shaders_simple_mask.c) | <img src="shaders/shaders_simple_mask.png" alt="shaders_simple_mask" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
176-
| 113 | [shaders_hot_reloading](shaders/shaders_hot_reloading.c) | <img src="shaders/shaders_hot_reloading.png" alt="shaders_hot_reloading" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 3.5 | [Ray](https://github.com/raysan5) |
177-
| 114 | [shaders_mesh_instancing](shaders/shaders_mesh_instancing.c) | <img src="shaders/shaders_mesh_instancing.png" alt="shaders_mesh_instancing" width="80"> | ⭐️⭐️⭐️⭐️ | 3.7 | **4.2** | [seanpringle](https://github.com/seanpringle) |
178-
| 115 | [shaders_multi_sample2d](shaders/shaders_multi_sample2d.c) | <img src="shaders/shaders_multi_sample2d.png" alt="shaders_multi_sample2d" width="80"> | ⭐️⭐️☆☆ | 3.5 | 3.5 | [Ray](https://github.com/raysan5) |
179-
| 116 | [shaders_spotlight](shaders/shaders_spotlight.c) | <img src="shaders/shaders_spotlight.png" alt="shaders_spotlight" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
180-
| 117 | [shaders_deferred_render](shaders/shaders_deferred_render.c) | <img src="shaders/shaders_deferred_render.png" alt="shaders_deferred_render" width="80"> | ⭐️⭐️⭐️⭐️ | 4.5 | 4.5 | [Justin Andreas Lacoste](https://github.com/27justin) |
181-
| 118 | [shaders_vertex_displacement](shaders/shaders_vertex_displacement.c) | <img src="shaders/shaders_vertex_displacement.png" alt="shaders_deferred_render" width="80"> | ⭐️☆☆☆ | 1.5 | 1.5 | [Alex ZH](https://github.com/ZzzhHe) |
163+
| 100 | [shaders_basic_lighting](shaders/shaders_basic_lighting.c) | <img src="shaders/shaders_basic_lighting.png" alt="shaders_basic_lighting" width="80"> | ⭐️⭐️⭐️⭐️ | 3.0 | **4.2** | [Chris Camacho](https://github.com/codifies) |
164+
| 101 | [shaders_model_shader](shaders/shaders_model_shader.c) | <img src="shaders/shaders_model_shader.png" alt="shaders_model_shader" width="80"> | ⭐️⭐️☆☆ | 1.3 | 3.7 | [Ray](https://github.com/raysan5) |
165+
| 102 | [shaders_shapes_textures](shaders/shaders_shapes_textures.c) | <img src="shaders/shaders_shapes_textures.png" alt="shaders_shapes_textures" width="80"> | ⭐️⭐️☆☆ | 1.7 | 3.7 | [Ray](https://github.com/raysan5) |
166+
| 103 | [shaders_custom_uniform](shaders/shaders_custom_uniform.c) | <img src="shaders/shaders_custom_uniform.png" alt="shaders_custom_uniform" width="80"> | ⭐️⭐️☆☆ | 1.3 | **4.0** | [Ray](https://github.com/raysan5) |
167+
| 104 | [shaders_postprocessing](shaders/shaders_postprocessing.c) | <img src="shaders/shaders_postprocessing.png" alt="shaders_postprocessing" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | **4.0** | [Ray](https://github.com/raysan5) |
168+
| 105 | [shaders_palette_switch](shaders/shaders_palette_switch.c) | <img src="shaders/shaders_palette_switch.png" alt="shaders_palette_switch" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [Marco Lizza](https://github.com/MarcoLizza) |
169+
| 106 | [shaders_raymarching](shaders/shaders_raymarching.c) | <img src="shaders/shaders_raymarching.png" alt="shaders_raymarching" width="80"> | ⭐️⭐️⭐️⭐️ | 2.0 | **4.2** | [Ray](https://github.com/raysan5) |
170+
| 107 | [shaders_texture_drawing](shaders/shaders_texture_drawing.c) | <img src="shaders/shaders_texture_drawing.png" alt="shaders_texture_drawing" width="80"> | ⭐️⭐️☆☆ | 2.0 | 3.7 | [Michał Ciesielski](https://github.com/) |
171+
| 108 | [shaders_texture_outline](shaders/shaders_texture_outline.c) | <img src="shaders/shaders_texture_outline.png" alt="shaders_texture_outline" width="80"> | ⭐️⭐️⭐️☆ | **4.0** | **4.0** | [Samuel Skiff](https://github.com/GoldenThumbs) |
172+
| 109 | [shaders_texture_waves](shaders/shaders_texture_waves.c) | <img src="shaders/shaders_texture_waves.png" alt="shaders_texture_waves" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Anata](https://github.com/anatagawa) |
173+
| 110 | [shaders_julia_set](shaders/shaders_julia_set.c) | <img src="shaders/shaders_julia_set.png" alt="shaders_julia_set" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | **4.0** | [eggmund](https://github.com/eggmund) |
174+
| 111 | [shaders_eratosthenes](shaders/shaders_eratosthenes.c) | <img src="shaders/shaders_eratosthenes.png" alt="shaders_eratosthenes" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | **4.0** | [ProfJski](https://github.com/ProfJski) |
175+
| 112 | [shaders_fog](shaders/shaders_fog.c) | <img src="shaders/shaders_fog.png" alt="shaders_fog" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
176+
| 113 | [shaders_simple_mask](shaders/shaders_simple_mask.c) | <img src="shaders/shaders_simple_mask.png" alt="shaders_simple_mask" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
177+
| 114 | [shaders_hot_reloading](shaders/shaders_hot_reloading.c) | <img src="shaders/shaders_hot_reloading.png" alt="shaders_hot_reloading" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 3.5 | [Ray](https://github.com/raysan5) |
178+
| 115 | [shaders_mesh_instancing](shaders/shaders_mesh_instancing.c) | <img src="shaders/shaders_mesh_instancing.png" alt="shaders_mesh_instancing" width="80"> | ⭐️⭐️⭐️⭐️ | 3.7 | **4.2** | [seanpringle](https://github.com/seanpringle) |
179+
| 116 | [shaders_multi_sample2d](shaders/shaders_multi_sample2d.c) | <img src="shaders/shaders_multi_sample2d.png" alt="shaders_multi_sample2d" width="80"> | ⭐️⭐️☆☆ | 3.5 | 3.5 | [Ray](https://github.com/raysan5) |
180+
| 117 | [shaders_spotlight](shaders/shaders_spotlight.c) | <img src="shaders/shaders_spotlight.png" alt="shaders_spotlight" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
181+
| 118 | [shaders_deferred_render](shaders/shaders_deferred_render.c) | <img src="shaders/shaders_deferred_render.png" alt="shaders_deferred_render" width="80"> | ⭐️⭐️⭐️⭐️ | 4.5 | 4.5 | [Justin Andreas Lacoste](https://github.com/27justin) |
182182

183183
### category: audio
184184

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
/*******************************************************************************************
2+
*
3+
* raylib example - point rendering
4+
*
5+
* Example originally created with raylib 5.0, last time updated with raylib 5.0
6+
*
7+
* Example contributed by Reese Gallagher (@satchelfrost) and reviewed by Ramon Santamaria (@raysan5)
8+
*
9+
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
10+
* BSD-like license that allows static linking with closed source software
11+
*
12+
* Copyright (c) 2024 Reese Gallagher (@satchelfrost)
13+
*
14+
********************************************************************************************/
15+
16+
#include "raylib.h"
17+
#include <stdlib.h> // Required for: rand()
18+
#include <math.h> // Required for: cos(), sin()
19+
20+
#define MAX_POINTS 10000000 // 10 million
21+
#define MIN_POINTS 1000 // 1 thousand
22+
23+
static float RandFloat();
24+
25+
//------------------------------------------------------------------------------------
26+
// Program main entry point
27+
//------------------------------------------------------------------------------------
28+
int main()
29+
{
30+
// Initialization
31+
//--------------------------------------------------------------------------------------
32+
const int screenWidth = 800;
33+
const int screenHeight = 450;
34+
InitWindow(screenWidth, screenHeight, "raylib [models] example - point rendering");
35+
SetTargetFPS(60);
36+
37+
Camera camera = {
38+
.position = {3.0f, 3.0f, 3.0f},
39+
.target = {0.0f, 0.0f, 0.0f},
40+
.up = {0.0f, 1.0f, 0.0f},
41+
.fovy = 45.0f,
42+
.projection = CAMERA_PERSPECTIVE,
43+
};
44+
45+
Vector3 position = {0.0f, 0.0f, 0.0f};
46+
bool useDrawModelPoints = true;
47+
bool numPointsChanged = false;
48+
int numPoints = 1000;
49+
Mesh mesh = GenPoints(numPoints);
50+
Model model = LoadModelFromMesh(mesh);
51+
//--------------------------------------------------------------------------------------
52+
53+
// Main game loop
54+
while(!WindowShouldClose())
55+
{
56+
// Update
57+
//----------------------------------------------------------------------------------
58+
UpdateCamera(&camera, CAMERA_ORBITAL);
59+
60+
if (IsKeyPressed(KEY_SPACE)) useDrawModelPoints = !useDrawModelPoints;
61+
if (IsKeyPressed(KEY_UP))
62+
{
63+
numPoints = (numPoints * 10 > MAX_POINTS) ? MAX_POINTS : numPoints * 10;
64+
numPointsChanged = true;
65+
TraceLog(LOG_INFO, "num points %d", numPoints);
66+
}
67+
if (IsKeyPressed(KEY_DOWN))
68+
{
69+
numPoints = (numPoints / 10 < MIN_POINTS) ? MIN_POINTS : numPoints / 10;
70+
numPointsChanged = true;
71+
TraceLog(LOG_INFO, "num points %d", numPoints);
72+
}
73+
74+
// upload a different point cloud size
75+
if (numPointsChanged)
76+
{
77+
UnloadModel(model);
78+
mesh = GenPoints(numPoints);
79+
model = LoadModelFromMesh(mesh);
80+
numPointsChanged = false;
81+
}
82+
83+
// Draw
84+
//----------------------------------------------------------------------------------
85+
BeginDrawing();
86+
ClearBackground(BLACK);
87+
BeginMode3D(camera);
88+
89+
// The new method only uploads the points once to the GPU
90+
if (useDrawModelPoints)
91+
{
92+
DrawModelPoints(model, position, 1.0f, WHITE);
93+
}
94+
// The old method must continually draw the "points" (lines)
95+
else
96+
{
97+
for (int i = 0; i < numPoints; i++)
98+
{
99+
Vector3 pos = {
100+
.x = mesh.vertices[i * 3 + 0],
101+
.y = mesh.vertices[i * 3 + 1],
102+
.z = mesh.vertices[i * 3 + 2],
103+
};
104+
Color color = {
105+
.r = mesh.colors[i * 4 + 0],
106+
.g = mesh.colors[i * 4 + 1],
107+
.b = mesh.colors[i * 4 + 2],
108+
.a = mesh.colors[i * 4 + 3],
109+
};
110+
DrawPoint3D(pos, color);
111+
}
112+
}
113+
114+
// Draw a unit sphere for reference
115+
DrawSphereWires(position, 1.0f, 10, 10, YELLOW);
116+
EndMode3D();
117+
118+
// Text formatting
119+
Color color = WHITE;
120+
int fps = GetFPS();
121+
if ((fps < 30) && (fps >= 15)) color = ORANGE;
122+
else if (fps < 15) color = RED;
123+
DrawText(TextFormat("%2i FPS", fps), 20, 20, 40, color);
124+
DrawText(TextFormat("Point Count: %d", numPoints), 20, screenHeight - 50, 40, WHITE);
125+
DrawText("Up - increase points", 20, 70, 20, WHITE);
126+
DrawText("Down - decrease points", 20, 100, 20, WHITE);
127+
DrawText("Space - drawing function", 20, 130, 20, WHITE);
128+
if (useDrawModelPoints) DrawText("DrawModelPoints()", 20, 160, 20, GREEN);
129+
else DrawText("DrawPoint3D()", 20, 160, 20, RED);
130+
EndDrawing();
131+
//----------------------------------------------------------------------------------
132+
}
133+
134+
// De-Initialization
135+
//--------------------------------------------------------------------------------------
136+
UnloadModel(model);
137+
CloseWindow();
138+
//--------------------------------------------------------------------------------------
139+
return 0;
140+
}
141+
142+
// Generate a spherical point cloud
143+
Mesh GenPoints(int numPoints)
144+
{
145+
Mesh mesh = {
146+
.triangleCount = 1,
147+
.vertexCount = numPoints,
148+
.vertices = (float *)MemAlloc(numPoints * 3 * sizeof(float)),
149+
.colors = (unsigned char*)MemAlloc(numPoints * 4 * sizeof(unsigned char)),
150+
};
151+
152+
// https://en.wikipedia.org/wiki/Spherical_coordinate_system
153+
for (int i = 0; i < numPoints; i++)
154+
{
155+
float theta = PI * rand() / RAND_MAX;
156+
float phi = 2.0f * PI * rand() / RAND_MAX;
157+
float r = 10.0f * rand() / RAND_MAX;
158+
mesh.vertices[i * 3 + 0] = r * sin(theta) * cos(phi);
159+
mesh.vertices[i * 3 + 1] = r * sin(theta) * sin(phi);
160+
mesh.vertices[i * 3 + 2] = r * cos(theta);
161+
Color color = ColorFromHSV(r * 360.0f, 1.0f, 1.0f);
162+
mesh.colors[i * 4 + 0] = color.r;
163+
mesh.colors[i * 4 + 1] = color.g;
164+
mesh.colors[i * 4 + 2] = color.b;
165+
mesh.colors[i * 4 + 3] = color.a;
166+
}
167+
168+
// Upload mesh data from CPU (RAM) to GPU (VRAM) memory
169+
UploadMesh(&mesh, false);
170+
return mesh;
171+
}
127 KB
Loading

0 commit comments

Comments
 (0)