Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
I added the
ShaderUnmanaged
class for #299 (comment), but honestly it didn't really solve the problem with the ownership of Models, Materials and Shader...IF you are using (Load)
Material
with Shaders, use NEED to useShaderUnmanaged
or raylibShader
(struct).Basically the ownership gets transfert to the Material.
Otherwise it's a bit more complicated when you are using
Model
, see raylib shaders_basic_pbr example:Right now you NEED to know when to unload the Material which also unloades the (non-default) Shader, so you also NEED to "unbind" the Shader from the Material before calling
UnloadMaterial
.I personally use raylib for more 2D Projects, so my experience on 3D with raylib is limited
Maybe there is a way to track the materials/shaders in the Model, to know when to
UnloadMaterial
(UnloadShader
).I experimenting a bit with the setters of Model:
SetShader
andSetMaterial
, on my own branch to control the ownership.Model.hpp
example