Add GenMeshPlaneData() for CPU-side mesh generation without GPU upload
This commit is contained in:
parent
c5fc771622
commit
9cfc16923c
|
|
@ -1617,7 +1617,8 @@ RLAPI bool ExportMeshAsCode(Mesh mesh, const char *fileName);
|
|||
|
||||
// Mesh generation functions
|
||||
RLAPI Mesh GenMeshPoly(int sides, float radius); // Generate polygonal mesh
|
||||
RLAPI Mesh GenMeshPlane(float width, float length, int resX, int resZ); // Generate plane mesh (with subdivisions)
|
||||
RLAPI Mesh GenMeshPlane(float width, float length, int resX, int resZ); // Generate plane mesh (with subdivisions) and upload to GPU
|
||||
RLAPI Mesh GenMeshPlaneData(float width, float length, int resX, int resZ); // Generate plane mesh data (with subdivisions)
|
||||
RLAPI Mesh GenMeshCube(float width, float height, float length); // Generate cuboid mesh
|
||||
RLAPI Mesh GenMeshSphere(float radius, int rings, int slices); // Generate sphere mesh (standard sphere)
|
||||
RLAPI Mesh GenMeshHemiSphere(float radius, int rings, int slices); // Generate half-sphere mesh (no bottom cap)
|
||||
|
|
|
|||
|
|
@ -2634,8 +2634,20 @@ Mesh GenMeshPoly(int sides, float radius)
|
|||
return mesh;
|
||||
}
|
||||
|
||||
// Generate plane mesh (with subdivisions)
|
||||
// Generate plane mesh (with subdivisions) and upload to GPU
|
||||
Mesh GenMeshPlane(float width, float length, int resX, int resZ)
|
||||
{
|
||||
Mesh mesh = GenMeshPlaneData(width, length, resX, resZ);
|
||||
|
||||
// Upload vertex data to GPU (static mesh)
|
||||
UploadMesh(&mesh, false);
|
||||
|
||||
return mesh;
|
||||
}
|
||||
|
||||
// Generate plane mesh data (with subdivisions), no GPU upload
|
||||
// Allows CPU-side mesh manipulation (e.g. vertex deformation) before manually calling UploadMesh()
|
||||
Mesh GenMeshPlaneData(float width, float length, int resX, int resZ)
|
||||
{
|
||||
Mesh mesh = { 0 };
|
||||
|
||||
|
|
@ -2761,9 +2773,6 @@ Mesh GenMeshPlane(float width, float length, int resX, int resZ)
|
|||
par_shapes_free_mesh(plane);
|
||||
#endif
|
||||
|
||||
// Upload vertex data to GPU (static mesh)
|
||||
UploadMesh(&mesh, false);
|
||||
|
||||
return mesh;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user