summaryrefslogtreecommitdiffhomepage
path: root/examples/web/models
diff options
context:
space:
mode:
authorRay <[email protected]>2021-03-14 13:10:05 +0100
committerRay <[email protected]>2021-03-14 13:10:05 +0100
commit06c815f05810fb2a72356d19f9cac218ca977892 (patch)
treeb8e08779a8374cb641c5246c55475f88e263704a /examples/web/models
parent421c4e4cd85310bef3a8f79f89d23e3a1eac9668 (diff)
downloadraylib.com-06c815f05810fb2a72356d19f9cac218ca977892.tar.gz
raylib.com-06c815f05810fb2a72356d19f9cac218ca977892.zip
Updated examples after enum values rename
Diffstat (limited to 'examples/web/models')
-rw-r--r--examples/web/models/models_cubicmap.c2
-rw-r--r--examples/web/models/models_first_person_maze.c2
-rw-r--r--examples/web/models/models_heightmap.c2
-rw-r--r--examples/web/models/models_loading.c6
-rw-r--r--examples/web/models/models_material_pbr.c68
-rw-r--r--examples/web/models/models_mesh_generation.c2
-rw-r--r--examples/web/models/models_mesh_picking.c2
-rw-r--r--examples/web/models/models_yaw_pitch_roll.c4
8 files changed, 44 insertions, 44 deletions
diff --git a/examples/web/models/models_cubicmap.c b/examples/web/models/models_cubicmap.c
index fede958..1ef04e1 100644
--- a/examples/web/models/models_cubicmap.c
+++ b/examples/web/models/models_cubicmap.c
@@ -51,7 +51,7 @@ int main(void)
// NOTE: By default each cube is mapped to one part of texture atlas
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
- model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture
+ model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
UnloadImage(image); // Unload cubesmap image from RAM, already uploaded to VRAM
diff --git a/examples/web/models/models_first_person_maze.c b/examples/web/models/models_first_person_maze.c
index 9aae811..d9e3edb 100644
--- a/examples/web/models/models_first_person_maze.c
+++ b/examples/web/models/models_first_person_maze.c
@@ -60,7 +60,7 @@ int main(void)
// NOTE: By default each cube is mapped to one part of texture atlas
texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
- model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture
+ model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
// Get map image data to be used for collision detection
mapPixels = LoadImageColors(imMap);
diff --git a/examples/web/models/models_heightmap.c b/examples/web/models/models_heightmap.c
index df65b85..c048961 100644
--- a/examples/web/models/models_heightmap.c
+++ b/examples/web/models/models_heightmap.c
@@ -48,7 +48,7 @@ int main(void)
Mesh mesh = GenMeshHeightmap(image, (Vector3){ 16, 8, 16 }); // Generate heightmap mesh (RAM and VRAM)
model = LoadModelFromMesh(mesh); // Load model from generated mesh
- model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture
+ model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
UnloadImage(image); // Unload heightmap image from RAM, already uploaded to VRAM
diff --git a/examples/web/models/models_loading.c b/examples/web/models/models_loading.c
index d438d1f..54ebcd9 100644
--- a/examples/web/models/models_loading.c
+++ b/examples/web/models/models_loading.c
@@ -66,7 +66,7 @@ int main(void)
model = LoadModel("resources/models/castle.obj"); // Load model
texture = LoadTexture("resources/models/castle_diffuse.png"); // Load model texture
- model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture
+ model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
bounds = MeshBoundingBox(model.meshes[0]); // Set model bounds
@@ -122,7 +122,7 @@ void UpdateDrawFrame(void)
{
UnloadModel(model); // Unload previous model
model = LoadModel(droppedFiles[0]); // Load new model
- model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set current map diffuse texture
+ model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set current map diffuse texture
bounds = MeshBoundingBox(model.meshes[0]);
@@ -133,7 +133,7 @@ void UpdateDrawFrame(void)
// Unload current model texture and load new one
UnloadTexture(texture);
texture = LoadTexture(droppedFiles[0]);
- model.materials[0].maps[MAP_DIFFUSE].texture = texture;
+ model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
}
}
diff --git a/examples/web/models/models_material_pbr.c b/examples/web/models/models_material_pbr.c
index ad89d92..5692653 100644
--- a/examples/web/models/models_material_pbr.c
+++ b/examples/web/models/models_material_pbr.c
@@ -102,7 +102,7 @@ void UpdateDrawFrame(void)
// Send to material PBR shader camera view position
float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z };
- SetShaderValue(model.material.shader, model.material.shader.locs[LOC_VECTOR_VIEW], cameraPos, 3);
+ SetShaderValue(model.material.shader, model.material.shader.locs[SHADER_LOC_VECTOR_VIEW], cameraPos, 3);
//----------------------------------------------------------------------------------
// Draw
@@ -138,28 +138,28 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
// Get required locations points for PBR material
// NOTE: Those location names must be available and used in the shader code
- mat.shader.locs[LOC_MAP_ALBEDO] = GetShaderLocation(mat.shader, "albedo.sampler");
- mat.shader.locs[LOC_MAP_METALNESS] = GetShaderLocation(mat.shader, "metalness.sampler");
- mat.shader.locs[LOC_MAP_NORMAL] = GetShaderLocation(mat.shader, "normals.sampler");
- mat.shader.locs[LOC_MAP_ROUGHNESS] = GetShaderLocation(mat.shader, "roughness.sampler");
- mat.shader.locs[LOC_MAP_OCCUSION] = GetShaderLocation(mat.shader, "occlusion.sampler");
- //mat.shader.locs[LOC_MAP_EMISSION] = GetShaderLocation(mat.shader, "emission.sampler");
- //mat.shader.locs[LOC_MAP_HEIGHT] = GetShaderLocation(mat.shader, "height.sampler");
- mat.shader.locs[LOC_MAP_IRRADIANCE] = GetShaderLocation(mat.shader, "irradianceMap");
- mat.shader.locs[LOC_MAP_PREFILTER] = GetShaderLocation(mat.shader, "prefilterMap");
- mat.shader.locs[LOC_MAP_BRDF] = GetShaderLocation(mat.shader, "brdfLUT");
+ mat.shader.locs[SHADER_LOC_MAP_ALBEDO] = GetShaderLocation(mat.shader, "albedo.sampler");
+ mat.shader.locs[SHADER_LOC_MAP_METALNESS] = GetShaderLocation(mat.shader, "metalness.sampler");
+ mat.shader.locs[SHADER_LOC_MAP_NORMAL] = GetShaderLocation(mat.shader, "normals.sampler");
+ mat.shader.locs[SHADER_LOC_MAP_ROUGHNESS] = GetShaderLocation(mat.shader, "roughness.sampler");
+ mat.shader.locs[SHADER_LOC_MAP_OCCUSION] = GetShaderLocation(mat.shader, "occlusion.sampler");
+ //mat.shader.locs[SHADER_LOC_MAP_EMISSION] = GetShaderLocation(mat.shader, "emission.sampler");
+ //mat.shader.locs[SHADER_LOC_MAP_HEIGHT] = GetShaderLocation(mat.shader, "height.sampler");
+ mat.shader.locs[SHADER_LOC_MAP_IRRADIANCE] = GetShaderLocation(mat.shader, "irradianceMap");
+ mat.shader.locs[SHADER_LOC_MAP_PREFILTER] = GetShaderLocation(mat.shader, "prefilterMap");
+ mat.shader.locs[SHADER_LOC_MAP_BRDF] = GetShaderLocation(mat.shader, "brdfLUT");
// Set view matrix location
- mat.shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(mat.shader, "mMatrix");
- mat.shader.locs[LOC_MATRIX_VIEW] = GetShaderLocation(mat.shader, "view");
- mat.shader.locs[LOC_VECTOR_VIEW] = GetShaderLocation(mat.shader, "viewPos");
+ mat.shader.locs[SHADER_LOC_MATRIX_MODEL] = GetShaderLocation(mat.shader, "mMatrix");
+ mat.shader.locs[SHADER_LOC_MATRIX_VIEW] = GetShaderLocation(mat.shader, "view");
+ mat.shader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(mat.shader, "viewPos");
// Set PBR standard maps
- mat.maps[MAP_ALBEDO].texture = LoadTexture("resources/pbr/trooper_albedo.png");
- mat.maps[MAP_NORMAL].texture = LoadTexture("resources/pbr/trooper_normals.png");
- mat.maps[MAP_METALNESS].texture = LoadTexture("resources/pbr/trooper_metalness.png");
- mat.maps[MAP_ROUGHNESS].texture = LoadTexture("resources/pbr/trooper_roughness.png");
- mat.maps[MAP_OCCLUSION].texture = LoadTexture("resources/pbr/trooper_ao.png");
+ mat.maps[MATERIAL_MAP_ALBEDO].texture = LoadTexture("resources/pbr/trooper_albedo.png");
+ mat.maps[MATERIAL_MAP_NORMAL].texture = LoadTexture("resources/pbr/trooper_normals.png");
+ mat.maps[MATERIAL_MAP_METALNESS].texture = LoadTexture("resources/pbr/trooper_metalness.png");
+ mat.maps[MATERIAL_MAP_ROUGHNESS].texture = LoadTexture("resources/pbr/trooper_roughness.png");
+ mat.maps[MATERIAL_MAP_OCCLUSION].texture = LoadTexture("resources/pbr/trooper_ao.png");
// Set environment maps
#define PATH_CUBEMAP_VS "resources/shaders/cubemap.vs" // Path to equirectangular to cubemap vertex shader
@@ -182,9 +182,9 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
Texture2D texHDR = LoadTexture("resources/pinetree.hdr");
Texture2D cubemap = GenTextureCubemap(shdrCubemap, texHDR, CUBEMAP_SIZE);
- mat.maps[MAP_IRRADIANCE].texture = GenTextureIrradiance(shdrIrradiance, cubemap, IRRADIANCE_SIZE);
- mat.maps[MAP_PREFILTER].texture = GenTexturePrefilter(shdrPrefilter, cubemap, PREFILTERED_SIZE);
- mat.maps[MAP_BRDF].texture = GenTextureBRDF(shdrBRDF, cubemap, BRDF_SIZE);
+ mat.maps[MATERIAL_MAP_IRRADIANCE].texture = GenTextureIrradiance(shdrIrradiance, cubemap, IRRADIANCE_SIZE);
+ mat.maps[MATERIAL_MAP_PREFILTER].texture = GenTexturePrefilter(shdrPrefilter, cubemap, PREFILTERED_SIZE);
+ mat.maps[MATERIAL_MAP_BRDG].texture = GenTextureBRDF(shdrBRDF, cubemap, BRDF_SIZE);
UnloadTexture(cubemap);
UnloadTexture(texHDR);
@@ -195,11 +195,11 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
UnloadShader(shdrBRDF);
// Set textures filtering for better quality
- SetTextureFilter(mat.maps[MAP_ALBEDO].texture, FILTER_BILINEAR);
- SetTextureFilter(mat.maps[MAP_NORMAL].texture, FILTER_BILINEAR);
- SetTextureFilter(mat.maps[MAP_METALNESS].texture, FILTER_BILINEAR);
- SetTextureFilter(mat.maps[MAP_ROUGHNESS].texture, FILTER_BILINEAR);
- SetTextureFilter(mat.maps[MAP_OCCLUSION].texture, FILTER_BILINEAR);
+ SetTextureFilter(mat.maps[MATERIAL_MAP_ALBEDO].texture, FILTER_BILINEAR);
+ SetTextureFilter(mat.maps[MATERIAL_MAP_NORMAL].texture, FILTER_BILINEAR);
+ SetTextureFilter(mat.maps[MATERIAL_MAP_METALNESS].texture, FILTER_BILINEAR);
+ SetTextureFilter(mat.maps[MATERIAL_MAP_ROUGHNESS].texture, FILTER_BILINEAR);
+ SetTextureFilter(mat.maps[MATERIAL_MAP_OCCLUSION].texture, FILTER_BILINEAR);
// Enable sample usage in shader for assigned textures
SetShaderValuei(mat.shader, GetShaderLocation(mat.shader, "albedo.useSampler"), (int[1]){ 1 }, 1);
@@ -212,13 +212,13 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
SetShaderValuei(mat.shader, renderModeLoc, (int[1]){ 0 }, 1);
// Set up material properties color
- mat.maps[MAP_ALBEDO].color = albedo;
- mat.maps[MAP_NORMAL].color = (Color){ 128, 128, 255, 255 };
- mat.maps[MAP_METALNESS].value = metalness;
- mat.maps[MAP_ROUGHNESS].value = roughness;
- mat.maps[MAP_OCCLUSION].value = 1.0f;
- mat.maps[MAP_EMISSION].value = 0.5f;
- mat.maps[MAP_HEIGHT].value = 0.5f;
+ mat.maps[MATERIAL_MAP_ALBEDO].color = albedo;
+ mat.maps[MATERIAL_MAP_NORMAL].color = (Color){ 128, 128, 255, 255 };
+ mat.maps[MATERIAL_MAP_METALNESS].value = metalness;
+ mat.maps[MATERIAL_MAP_ROUGHNESS].value = roughness;
+ mat.maps[MATERIAL_MAP_OCCLUSION].value = 1.0f;
+ mat.maps[MATERIAL_MAP_EMISSION].value = 0.5f;
+ mat.maps[MATERIAL_MAP_HEIGHT].value = 0.5f;
return mat;
} \ No newline at end of file
diff --git a/examples/web/models/models_mesh_generation.c b/examples/web/models/models_mesh_generation.c
index 862d030..9ebe5f6 100644
--- a/examples/web/models/models_mesh_generation.c
+++ b/examples/web/models/models_mesh_generation.c
@@ -62,7 +62,7 @@ int main(void)
models[7] = LoadModelFromMesh(GenMeshPoly(5, 2.0f));
// Set checked texture as default diffuse component for all models material
- for (int i = 0; i < NUM_MODELS; i++) models[i].materials[0].maps[MAP_DIFFUSE].texture = texture;
+ for (int i = 0; i < NUM_MODELS; i++) models[i].materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
SetCameraMode(camera, CAMERA_ORBITAL); // Set a orbital camera mode
diff --git a/examples/web/models/models_mesh_picking.c b/examples/web/models/models_mesh_picking.c
index edcbae7..c73701b 100644
--- a/examples/web/models/models_mesh_picking.c
+++ b/examples/web/models/models_mesh_picking.c
@@ -70,7 +70,7 @@ int main(void)
tower = LoadModel("resources/models/turret.obj"); // Load OBJ model
texture = LoadTexture("resources/models/turret_diffuse.png"); // Load model texture
- tower.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture
+ tower.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set model diffuse texture
towerBBox = MeshBoundingBox(tower.meshes[0]); // Get mesh bounding box
diff --git a/examples/web/models/models_yaw_pitch_roll.c b/examples/web/models/models_yaw_pitch_roll.c
index bdc983f..1c5dd98 100644
--- a/examples/web/models/models_yaw_pitch_roll.c
+++ b/examples/web/models/models_yaw_pitch_roll.c
@@ -65,9 +65,9 @@ int main(void)
// Model loading
model = LoadModel("resources/plane.obj"); // Load OBJ model
- model.materials[0].maps[MAP_DIFFUSE].texture = LoadTexture("resources/plane_diffuse.png"); // Set map diffuse texture
+ model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = LoadTexture("resources/plane_diffuse.png"); // Set map diffuse texture
- GenTextureMipmaps(&model.materials[0].maps[MAP_DIFFUSE].texture);
+ GenTextureMipmaps(&model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture);
camera.position = (Vector3){ 0.0f, 60.0f, -120.0f };// Camera position perspective
camera.target = (Vector3){ 0.0f, 12.0f, 0.0f }; // Camera looking at point