summaryrefslogtreecommitdiffhomepage
path: root/src/models.c
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2017-07-20 14:27:17 +0200
committerraysan5 <[email protected]>2017-07-20 14:27:17 +0200
commit4c06725461227d90feb169b30208e5bc3cec9c4d (patch)
tree9d29f29f3d927b4fbd46c0bbce9107e75d9b4d1f /src/models.c
parent52cd5c63243df8be4a13d3500d2701d368c731c5 (diff)
downloadraylib-4c06725461227d90feb169b30208e5bc3cec9c4d.tar.gz
raylib-4c06725461227d90feb169b30208e5bc3cec9c4d.zip
Removed useless functions
SetMaterialTexture() and UnsetMaterialTexture()... too shader dependant...
Diffstat (limited to 'src/models.c')
-rw-r--r--src/models.c100
1 files changed, 2 insertions, 98 deletions
diff --git a/src/models.c b/src/models.c
index 7c325c5e..03e0cb45 100644
--- a/src/models.c
+++ b/src/models.c
@@ -592,8 +592,6 @@ Model LoadModel(const char *fileName)
model.mesh = LoadMesh(fileName);
model.transform = MatrixIdentity();
model.material = LoadMaterialDefault();
-
- rlLoadMesh(&model.mesh, false); // Upload mesh data to GPU (static)
return model;
}
@@ -622,7 +620,7 @@ void UnloadModel(Model model)
}
// Load mesh from file
-// NOTE: Mesh data loaded in CPU, not GPU
+// NOTE: Mesh data loaded in CPU and GPU
Mesh LoadMesh(const char *fileName)
{
Mesh mesh = { 0 };
@@ -634,6 +632,7 @@ Mesh LoadMesh(const char *fileName)
#endif
if (mesh.vertexCount == 0) TraceLog(LOG_WARNING, "Mesh could not be loaded");
+ else rlLoadMesh(&mesh, false); // Upload vertex data to GPU (static mesh)
// TODO: Initialize default mesh data in case loading fails, maybe a cube?
@@ -1271,101 +1270,6 @@ void UnloadMaterial(Material material)
}
}
-// Set material texture
-void SetMaterialTexture(Material *mat, int mapType, Texture2D texture)
-{
- mat->maps[mapType].texture = texture;
-
- // Update MaterialProperty use sampler state to use texture fetch instead of color attribute
- int location = -1;
- switch (mapType)
- {
- case MAP_ALBEDO:
- {
- location = GetShaderLocation(mat->shader, "albedo.useSampler");
- SetShaderValuei(mat->shader, location, (int[1]){ 1 }, 1);
- } break;
- case MAP_NORMAL:
- {
- location = GetShaderLocation(mat->shader, "normals.useSampler");
- SetShaderValuei(mat->shader, location, (int[1]){ 1 }, 1);
- } break;
- case MAP_METALNESS:
- {
- location = GetShaderLocation(mat->shader, "metalness.useSampler");
- SetShaderValuei(mat->shader, location, (int[1]){ 1 }, 1);
- } break;
- case MAP_ROUGHNESS:
- {
- location = GetShaderLocation(mat->shader, "roughness.useSampler");
- SetShaderValuei(mat->shader, location, (int[1]){ 1 }, 1);
- } break;
- case MAP_OCCLUSION:
- {
- location = GetShaderLocation(mat->shader, "occlusion.useSampler");
- SetShaderValuei(mat->shader, location, (int[1]){ 1 }, 1);
- } break;
- case MAP_EMISSION:
- {
- location = GetShaderLocation(mat->shader, "emission.useSampler");
- SetShaderValuei(mat->shader, location, (int[1]){ 1 }, 1);
- } break;
- case MAP_HEIGHT:
- {
- location = GetShaderLocation(mat->shader, "height.useSampler");
- SetShaderValuei(mat->shader, location, (int[1]){ 1 }, 1);
- } break;
- }
-}
-
-// Unset texture from material and unload it from GPU
-void UnsetMaterialTexture(Material *mat, int mapType)
-{
- UnloadTexture(mat->maps[mapType].texture);
- mat->maps[mapType].texture = (Texture2D){ 0 };
-
- // Update MaterialProperty use sampler state to use texture fetch instead of color attribute
- int location = -1;
- switch (mapType)
- {
- case MAP_ALBEDO:
- {
- location = GetShaderLocation(mat->shader, "albedo.useSampler");
- SetShaderValuei(mat->shader, location, (int[1]){ 0 }, 1);
- } break;
- case MAP_NORMAL:
- {
- location = GetShaderLocation(mat->shader, "normals.useSampler");
- SetShaderValuei(mat->shader, location, (int[1]){ 0 }, 1);
- } break;
- case MAP_METALNESS:
- {
- location = GetShaderLocation(mat->shader, "metalness.useSampler");
- SetShaderValuei(mat->shader, location, (int[1]){ 0 }, 1);
- } break;
- case MAP_ROUGHNESS:
- {
- location = GetShaderLocation(mat->shader, "roughness.useSampler");
- SetShaderValuei(mat->shader, location, (int[1]){ 0 }, 1);
- } break;
- case MAP_OCCLUSION:
- {
- location = GetShaderLocation(mat->shader, "occlusion.useSampler");
- SetShaderValuei(mat->shader, location, (int[1]){ 0 }, 1);
- } break;
- case MAP_EMISSION:
- {
- location = GetShaderLocation(mat->shader, "emission.useSampler");
- SetShaderValuei(mat->shader, location, (int[1]){ 0 }, 1);
- } break;
- case MAP_HEIGHT:
- {
- location = GetShaderLocation(mat->shader, "height.useSampler");
- SetShaderValuei(mat->shader, location, (int[1]){ 0 }, 1);
- } break;
- }
-}
-
// Draw a model (with texture if set)
void DrawModel(Model model, Vector3 position, float scale, Color tint)
{