diff options
Diffstat (limited to 'cheatsheet/raylib_models.c')
| -rw-r--r-- | cheatsheet/raylib_models.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/cheatsheet/raylib_models.c b/cheatsheet/raylib_models.c index 4ad632b..8ceca51 100644 --- a/cheatsheet/raylib_models.c +++ b/cheatsheet/raylib_models.c @@ -18,33 +18,36 @@ void DrawPlane(Vector3 centerPos, Vector2 size, Color color); // Draw a plane XZ void DrawRay(Ray ray, Color color); // Draw a ray line void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0)) - void DrawGizmo(Vector3 position); // Draw simple gizmo // Model loading/unloading functions Model LoadModel(const char *fileName); // Load model from files (meshes and materials) Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh (default material) void UnloadModel(Model model); // Unload model (including meshes) from memory (RAM and/or VRAM) void UnloadModelKeepMeshes(Model model); // Unload model (but not meshes) from memory (RAM and/or VRAM) - - // Mesh loading/unloading functions - Mesh *LoadMeshes(const char *fileName, int *meshCount); // Load meshes from model file - void UnloadMesh(Mesh mesh); // Unload mesh from memory (RAM and/or VRAM) + + // Mesh loading/unloading functions + void UploadMesh(Mesh *mesh, bool dynamic); // Upload vertex data into GPU and provided VAO/VBO ids + void DrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d mesh with material and transform + void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int instances); // Draw multiple mesh instances with material and different transforms + void UnloadMesh(Mesh mesh); // Unload mesh data from CPU and GPU bool ExportMesh(Mesh mesh, const char *fileName); // Export mesh data to file, returns true on success - - // Material loading/unloading functions + + // Material loading/unloading functions Material *LoadMaterials(const char *fileName, int *materialCount); // Load materials from model file Material LoadMaterialDefault(void); // Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps) void UnloadMaterial(Material material); // Unload material from GPU memory (VRAM) - void SetMaterialTexture(Material *material, int mapType, Texture2D texture); // Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...) + void SetMaterialTexture(Material *material, int mapType, Texture2D texture); // Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...) void SetModelMeshMaterial(Model *model, int meshId, int materialId); // Set material for a mesh - - // Model animations loading/unloading functions + + // Model animations loading/unloading functions ModelAnimation *LoadModelAnimations(const char *fileName, int *animsCount); // Load model animations from file void UpdateModelAnimation(Model model, ModelAnimation anim, int frame); // Update model animation pose void UnloadModelAnimation(ModelAnimation anim); // Unload animation data + void UnloadModelAnimations(ModelAnimation* animations, unsigned int count); // Unload animation array data bool IsModelAnimationValid(Model model, ModelAnimation anim); // Check model animation skeleton match - - // Mesh generation functions + + // Mesh generation functions + Mesh GenMeshDefault(int vertexCount); // Generate an empty mesh with vertex: position, texcoords, normals, colors Mesh GenMeshPoly(int sides, float radius); // Generate polygonal mesh Mesh GenMeshPlane(float width, float length, int resX, int resZ); // Generate plane mesh (with subdivisions) Mesh GenMeshCube(float width, float height, float length); // Generate cuboid mesh @@ -55,12 +58,11 @@ Mesh GenMeshKnot(float radius, float size, int radSeg, int sides); // Generate trefoil knot mesh Mesh GenMeshHeightmap(Image heightmap, Vector3 size); // Generate heightmap mesh from image data Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize); // Generate cubes-based map mesh from image data - - // Mesh manipulation functions + + // Mesh manipulation functions BoundingBox MeshBoundingBox(Mesh mesh); // Compute mesh bounding box limits void MeshTangents(Mesh *mesh); // Compute mesh tangents void MeshBinormals(Mesh *mesh); // Compute mesh binormals - void MeshNormalsSmooth(Mesh *mesh); // Smooth (average) vertex normals // Model drawing functions void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set) @@ -82,4 +84,4 @@ RayHitInfo GetCollisionRayModel(Ray ray, Model model); // Get collision info between ray and model RayHitInfo GetCollisionRayTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); // Get collision info between ray and triangle RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight); // Get collision info between ray and ground plane (Y-normal plane) - + |
