ADDED: IsModelReady(), IsMaterialReady(), IsTextureReady(), IsRenderTextureReady() (#2895)
This commit is contained in:
parent
0b42da4085
commit
7fff1ba0b0
3 changed files with 29 additions and 1 deletions
|
@ -1311,7 +1311,9 @@ RLAPI Texture2D LoadTexture(const char *fileName);
|
||||||
RLAPI Texture2D LoadTextureFromImage(Image image); // Load texture from image data
|
RLAPI Texture2D LoadTextureFromImage(Image image); // Load texture from image data
|
||||||
RLAPI TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported
|
RLAPI TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported
|
||||||
RLAPI RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
|
RLAPI RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
|
||||||
|
RLAPI bool IsTextureReady(Texture2D texture); // Check if a texture is ready
|
||||||
RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
|
RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
|
||||||
|
RLAPI bool IsRenderTextureReady(RenderTexture2D target); // Check if a render texture is ready
|
||||||
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
|
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
|
||||||
RLAPI void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data
|
RLAPI void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data
|
||||||
RLAPI void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels); // Update GPU texture rectangle with new data
|
RLAPI void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels); // Update GPU texture rectangle with new data
|
||||||
|
@ -1441,6 +1443,7 @@ RLAPI void DrawGrid(int slices, float spacing);
|
||||||
// Model management functions
|
// Model management functions
|
||||||
RLAPI Model LoadModel(const char *fileName); // Load model from files (meshes and materials)
|
RLAPI Model LoadModel(const char *fileName); // Load model from files (meshes and materials)
|
||||||
RLAPI Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh (default material)
|
RLAPI Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh (default material)
|
||||||
|
RLAPI bool IsModelReady(Model model); // Check if a model is ready
|
||||||
RLAPI void UnloadModel(Model model); // Unload model (including meshes) from memory (RAM and/or VRAM)
|
RLAPI void UnloadModel(Model model); // Unload model (including meshes) from memory (RAM and/or VRAM)
|
||||||
RLAPI void UnloadModelKeepMeshes(Model model); // Unload model (but not meshes) from memory (RAM and/or VRAM)
|
RLAPI void UnloadModelKeepMeshes(Model model); // Unload model (but not meshes) from memory (RAM and/or VRAM)
|
||||||
RLAPI BoundingBox GetModelBoundingBox(Model model); // Compute model bounding box limits (considers all meshes)
|
RLAPI BoundingBox GetModelBoundingBox(Model model); // Compute model bounding box limits (considers all meshes)
|
||||||
|
@ -1481,6 +1484,7 @@ RLAPI Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize);
|
||||||
// Material loading/unloading functions
|
// Material loading/unloading functions
|
||||||
RLAPI Material *LoadMaterials(const char *fileName, int *materialCount); // Load materials from model file
|
RLAPI Material *LoadMaterials(const char *fileName, int *materialCount); // Load materials from model file
|
||||||
RLAPI Material LoadMaterialDefault(void); // Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
|
RLAPI Material LoadMaterialDefault(void); // Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
|
||||||
|
RLAPI bool IsMaterialReady(Material material); // Check if a material is ready
|
||||||
RLAPI void UnloadMaterial(Material material); // Unload material from GPU memory (VRAM)
|
RLAPI void UnloadMaterial(Material material); // Unload material from GPU memory (VRAM)
|
||||||
RLAPI void SetMaterialTexture(Material *material, int mapType, Texture2D texture); // Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...)
|
RLAPI void SetMaterialTexture(Material *material, int mapType, Texture2D texture); // Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...)
|
||||||
RLAPI void SetModelMeshMaterial(Model *model, int meshId, int materialId); // Set material for a mesh
|
RLAPI void SetModelMeshMaterial(Model *model, int meshId, int materialId); // Set material for a mesh
|
||||||
|
|
|
@ -1109,6 +1109,12 @@ Model LoadModelFromMesh(Mesh mesh)
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if a model is ready
|
||||||
|
bool IsModelReady(Model model)
|
||||||
|
{
|
||||||
|
return model.meshes != NULL && model.materials != NULL && model.meshMaterial != NULL && model.meshCount > 0 && model.materialCount > 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Unload model (meshes/materials) from memory (RAM and/or VRAM)
|
// Unload model (meshes/materials) from memory (RAM and/or VRAM)
|
||||||
// NOTE: This function takes care of all model elements, for a detailed control
|
// NOTE: This function takes care of all model elements, for a detailed control
|
||||||
// over them, use UnloadMesh() and UnloadMaterial()
|
// over them, use UnloadMesh() and UnloadMaterial()
|
||||||
|
@ -1950,6 +1956,12 @@ Material LoadMaterialDefault(void)
|
||||||
return material;
|
return material;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if a material is ready
|
||||||
|
bool IsMaterialReady(Material material)
|
||||||
|
{
|
||||||
|
return material.maps != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// Unload material from memory
|
// Unload material from memory
|
||||||
void UnloadMaterial(Material material)
|
void UnloadMaterial(Material material)
|
||||||
{
|
{
|
||||||
|
|
|
@ -505,7 +505,7 @@ Image LoadImageFromScreen(void)
|
||||||
// Check if an image is ready
|
// Check if an image is ready
|
||||||
bool IsImageReady(Image image)
|
bool IsImageReady(Image image)
|
||||||
{
|
{
|
||||||
return image.data != NULL;
|
return image.data != NULL && image.width > 0 && image.height > 0 && image.format > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unload image from CPU memory (RAM)
|
// Unload image from CPU memory (RAM)
|
||||||
|
@ -3330,6 +3330,12 @@ RenderTexture2D LoadRenderTexture(int width, int height)
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if a texture is ready
|
||||||
|
bool IsTextureReady(Texture2D texture)
|
||||||
|
{
|
||||||
|
return texture.id > 0 && texture.width > 0 && texture.height > 0 && texture.format > 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Unload texture from GPU memory (VRAM)
|
// Unload texture from GPU memory (VRAM)
|
||||||
void UnloadTexture(Texture2D texture)
|
void UnloadTexture(Texture2D texture)
|
||||||
{
|
{
|
||||||
|
@ -3341,6 +3347,12 @@ void UnloadTexture(Texture2D texture)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if a render texture is ready
|
||||||
|
bool IsRenderTextureReady(RenderTexture2D target)
|
||||||
|
{
|
||||||
|
return target.id > 0 && IsTextureReady(target.depth) && IsTextureReady(target.texture);
|
||||||
|
}
|
||||||
|
|
||||||
// Unload render texture from GPU memory (VRAM)
|
// Unload render texture from GPU memory (VRAM)
|
||||||
void UnloadRenderTexture(RenderTexture2D target)
|
void UnloadRenderTexture(RenderTexture2D target)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue