summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--API.md8
-rw-r--r--ReiLua_API.lua9
-rw-r--r--changelog5
-rw-r--r--devnotes4
-rw-r--r--docgen.lua8
-rw-r--r--examples/iqm_test/main.lua2
-rw-r--r--examples/platformer/main.lua2
-rw-r--r--examples/resources/shaders/glsl330/base.fs9
-rw-r--r--examples/resources/shaders/glsl330/base.vs10
-rw-r--r--src/models.c18
10 files changed, 42 insertions, 33 deletions
diff --git a/API.md b/API.md
index 93c0374..761ab4d 100644
--- a/API.md
+++ b/API.md
@@ -2782,7 +2782,7 @@ Default projection matrix near cull distance
---
-> RL_CULL_DISTANCE_FAR = 1000.0
+> RL_CULL_DISTANCE_FAR = 1000
Default projection matrix far cull distance
@@ -7381,7 +7381,7 @@ Check if a model is ready
> RL.UnloadModel( Model model )
-Unload model (including meshes) from memory (RAM and/or VRAM)
+Unload model (meshes/materials) from memory (RAM and/or VRAM)
---
@@ -7774,9 +7774,9 @@ Check if a material is ready
---
-> RL.UnloadMaterial( Material material )
+> RL.UnloadMaterial( Material material, bool freeAll )
-Unload material from GPU memory (VRAM)
+Unload material from GPU memory (VRAM). Note! Use freeAll to unload shaders and textures
---
diff --git a/ReiLua_API.lua b/ReiLua_API.lua
index 740729b..383386d 100644
--- a/ReiLua_API.lua
+++ b/ReiLua_API.lua
@@ -944,7 +944,7 @@ RL.RL_MAX_SHADER_LOCATIONS=32
---Default projection matrix near cull distance
RL.RL_CULL_DISTANCE_NEAR=0.01
---Default projection matrix far cull distance
-RL.RL_CULL_DISTANCE_FAR=1000.0
+RL.RL_CULL_DISTANCE_FAR=1000
-- Defines - RLGL Texture parameters
@@ -4557,7 +4557,7 @@ function RL.LoadModelFromMesh( mesh ) end
---@return any isReady
function RL.IsModelReady( model ) end
----Unload model (including meshes) from memory (RAM and/or VRAM)
+---Unload model (meshes/materials) from memory (RAM and/or VRAM)
---@param model any
---@return any RL.UnloadModel
function RL.UnloadModel( model ) end
@@ -4936,10 +4936,11 @@ function RL.CreateMaterial( materialData ) end
---@return any isReady
function RL.IsMaterialReady( material ) end
----Unload material from GPU memory (VRAM)
+---Unload material from GPU memory (VRAM). Note! Use freeAll to unload shaders and textures
---@param material any
+---@param freeAll boolean
---@return any RL.UnloadMaterial
-function RL.UnloadMaterial( material ) end
+function RL.UnloadMaterial( material, freeAll ) end
---Set texture for a material map type (MATERIAL_MAP_ALBEDO, MATERIAL_MAP_METALNESS...)
---@param material any
diff --git a/changelog b/changelog
index 9afb55a..09e5648 100644
--- a/changelog
+++ b/changelog
@@ -63,8 +63,8 @@ DETAILED CHANGES:
- ADDED: GetMouseOffset and GetMouseScale.
- CHANGE: Raymath *Equals functions return bool instead of int.
- FIXED: ColorToInt cast to unsigned int.
- - ADDED: Many Gui controls accept now nil for text.
- - ADDED: Some raygui controls return 1 instead of 0 when pressed or scrolled.
+ - CHANGE: Many Gui controls accept now nil for text.
+ - CHANGE: Some raygui controls return 1 instead of 0 when pressed or scrolled.
- ADDED: DrawGridEx.
- ADDED: GetRayBoxCells.
- FIXED: GenImageColor color was also argument 1.
@@ -72,6 +72,7 @@ DETAILED CHANGES:
- ADDED: LoadBufferFormatted, SetBufferData and CopyBufferData. Compressed resource file example.
- ADDED: GetBufferAsString.
- FIXED: rlSetVertexAttribute takes pointer as Buffer.
+ - CHANGE: UnloadMaterial can also optionally free textures and shader.
------------------------------------------------------------------------
Release: ReiLua version 0.7.0 Using Raylib 5.0 and Forked Raygui 4.0
diff --git a/devnotes b/devnotes
index 5802cb0..9548b61 100644
--- a/devnotes
+++ b/devnotes
@@ -14,7 +14,11 @@ Backlog {
* AudioStream.
* Models
* Mesh bone weight management?
+ * CBuffer
+ * Check endianess.
+ * Textures
+ * Try making atlas packer with stbrp_pack_rects.
* Examples
* Improve Dungeon crawler example by generating custom mesh instead of drawing 3D quads.
* Platformer example physics update for true framerate independence.
diff --git a/docgen.lua b/docgen.lua
index 6a4f041..48d9f37 100644
--- a/docgen.lua
+++ b/docgen.lua
@@ -330,11 +330,11 @@ for _, src in ipairs( sourceFiles ) do
elseif type( value ) == "table" then
-- All tables are colors.
apiFile:write( defineName.." = { "
- ..math.tointeger( value[1] )..", "..math.tointeger( value[2] )..", "
- ..math.tointeger( value[3] )..", "..math.tointeger( value[4] ).." }\n\n" )
+ ..math.floor( value[1] )..", "..math.floor( value[2] )..", "
+ ..math.floor( value[3] )..", "..math.floor( value[4] ).." }\n\n" )
luaApiFile:write( "RL."..defineName.."={"
- ..math.tointeger( value[1] )..","..math.tointeger( value[2] )..","
- ..math.tointeger( value[3] )..","..math.tointeger( value[4] ).."}\n" )
+ ..math.floor( value[1] )..","..math.floor( value[2] )..","
+ ..math.floor( value[3] )..","..math.floor( value[4] ).."}\n" )
else
apiFile:write( "> "..defineName.." = "..value.."\n\n" )
luaApiFile:write( "RL."..defineName.."="..value.."\n" )
diff --git a/examples/iqm_test/main.lua b/examples/iqm_test/main.lua
index 66aed82..01afebe 100644
--- a/examples/iqm_test/main.lua
+++ b/examples/iqm_test/main.lua
@@ -43,7 +43,7 @@ function RL.init()
} )
model = RL.LoadModel( RL.GetBasePath().."../resources/iqm/monkey.iqm" )
-- Unload old material.
- RL.UnloadMaterial( RL.GetModelMaterial( model, 0 ) )
+ RL.UnloadMaterial( RL.GetModelMaterial( model, 0 ), true )
RL.SetModelMaterial( model, 0, material )
animations = RL.LoadModelAnimations( RL.GetBasePath().."../resources/iqm/monkey.iqm" )
diff --git a/examples/platformer/main.lua b/examples/platformer/main.lua
index 9e71984..299e1b8 100644
--- a/examples/platformer/main.lua
+++ b/examples/platformer/main.lua
@@ -286,7 +286,7 @@ local function drawPlayer()
end
function RL.draw()
- RL.ClearBackground( RL.RED )
+ RL.ClearBackground( RL.BLACK )
RL.BeginTextureMode( framebuffer )
drawMap()
diff --git a/examples/resources/shaders/glsl330/base.fs b/examples/resources/shaders/glsl330/base.fs
index 57d9725..c36eead 100644
--- a/examples/resources/shaders/glsl330/base.fs
+++ b/examples/resources/shaders/glsl330/base.fs
@@ -14,11 +14,10 @@ out vec4 finalColor;
// NOTE: Add here your custom variables
void main() {
- // Texel color fetching from texture sampler
- vec4 texelColor = texture( texture0, fragTexCoord );
+ // Texel color fetching from texture sampler
+ vec4 texelColor = texture( texture0, fragTexCoord );
- // NOTE: Implement here your fragment shader code
+ // NOTE: Implement here your fragment shader code
- finalColor = texelColor * colDiffuse;
+ finalColor = texelColor * colDiffuse;
}
-
diff --git a/examples/resources/shaders/glsl330/base.vs b/examples/resources/shaders/glsl330/base.vs
index 04f50db..c6e94f6 100644
--- a/examples/resources/shaders/glsl330/base.vs
+++ b/examples/resources/shaders/glsl330/base.vs
@@ -16,10 +16,10 @@ out vec4 fragColor;
// NOTE: Add here your custom variables
void main() {
- // Send vertex attributes to fragment shader
- fragTexCoord = vertexTexCoord;
- fragColor = vertexColor;
+ // Send vertex attributes to fragment shader
+ fragTexCoord = vertexTexCoord;
+ fragColor = vertexColor;
- // Calculate final vertex position
- gl_Position = mvp * vec4( vertexPosition, 1.0 );
+ // Calculate final vertex position
+ gl_Position = mvp * vec4( vertexPosition, 1.0 );
} \ No newline at end of file
diff --git a/src/models.c b/src/models.c
index 579cf44..0466812 100644
--- a/src/models.c
+++ b/src/models.c
@@ -605,7 +605,7 @@ int lmodelsIsModelReady( lua_State* L ) {
/*
> RL.UnloadModel( Model model )
-Unload model (including meshes) from memory (RAM and/or VRAM)
+Unload model (meshes/materials) from memory (RAM and/or VRAM)
*/
int lmodelsUnloadModel( lua_State* L ) {
Model* model = uluaGetModel( L, 1 );
@@ -1951,19 +1951,23 @@ int lmodelsIsMaterialReady( lua_State* L ) {
}
/*
-> RL.UnloadMaterial( Material material )
+> RL.UnloadMaterial( Material material, bool freeAll )
-Unload material from GPU memory (VRAM)
+Unload material from GPU memory (VRAM). Note! Use freeAll to unload shaders and textures
*/
int lmodelsUnloadMaterial( lua_State* L ) {
Material* material = uluaGetMaterial( L, 1 );
+ bool freeAll = lua_toboolean( L, 2 );
- /* Custom UnloadMaterial since we don't want to free Shaders or Textures. */
- unloadMaterial( material );
+ if ( freeAll ) {
+ UnloadMaterial( *material );
+ }
+ /* Custom UnloadMaterial if we don't want to free Shaders or Textures. */
+ else {
+ unloadMaterial( material );
+ }
memset( material, 0, sizeof( Material ) );
- // UnloadMaterial( *material );
-
return 0;
}