diff options
| author | Ray <[email protected]> | 2021-03-14 13:10:05 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2021-03-14 13:10:05 +0100 |
| commit | 06c815f05810fb2a72356d19f9cac218ca977892 (patch) | |
| tree | b8e08779a8374cb641c5246c55475f88e263704a /examples/web | |
| parent | 421c4e4cd85310bef3a8f79f89d23e3a1eac9668 (diff) | |
| download | raylib.com-06c815f05810fb2a72356d19f9cac218ca977892.tar.gz raylib.com-06c815f05810fb2a72356d19f9cac218ca977892.zip | |
Updated examples after enum values rename
Diffstat (limited to 'examples/web')
23 files changed, 111 insertions, 111 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 diff --git a/examples/web/shaders/shaders_basic_lighting.c b/examples/web/shaders/shaders_basic_lighting.c index 2bcae63..05b5acc 100644 --- a/examples/web/shaders/shaders_basic_lighting.c +++ b/examples/web/shaders/shaders_basic_lighting.c @@ -95,16 +95,16 @@ int main(void) texture = LoadTexture("resources/texel_checker.png"); // Assign texture to default model material - modelA.materials[0].maps[MAP_DIFFUSE].texture = texture; - modelB.materials[0].maps[MAP_DIFFUSE].texture = texture; - modelC.materials[0].maps[MAP_DIFFUSE].texture = texture; + modelA.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; + modelB.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; + modelC.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; shader = LoadShader(TextFormat("resources/shaders/glsl%i/base_lighting.vs", GLSL_VERSION), TextFormat("resources/shaders/glsl%i/lighting.fs", GLSL_VERSION)); // Get some shader loactions - shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel"); - shader.locs[LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos"); + shader.locs[SHADER_LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel"); + shader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos"); // ambient light level ambientLoc = GetShaderLocation(shader, "ambient"); @@ -187,7 +187,7 @@ void UpdateDrawFrame(void) // Update the light shader with the camera view position float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z }; - SetShaderValue(shader, shader.locs[LOC_VECTOR_VIEW], cameraPos, UNIFORM_VEC3); + SetShaderValue(shader, shader.locs[SHADER_LOC_VECTOR_VIEW], cameraPos, UNIFORM_VEC3); //---------------------------------------------------------------------------------- // Draw diff --git a/examples/web/shaders/shaders_custom_uniform.c b/examples/web/shaders/shaders_custom_uniform.c index 2057dcc..83fa51c 100644 --- a/examples/web/shaders/shaders_custom_uniform.c +++ b/examples/web/shaders/shaders_custom_uniform.c @@ -72,7 +72,7 @@ int main(void) model = LoadModel("resources/models/barracks.obj"); // Load OBJ model texture = LoadTexture("resources/models/barracks_diffuse.png"); // Load model texture - model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture + model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set model diffuse texture // Load postprocessing shader // NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader diff --git a/examples/web/shaders/shaders_fog.c b/examples/web/shaders/shaders_fog.c index 859b4e2..a2a0290 100644 --- a/examples/web/shaders/shaders_fog.c +++ b/examples/web/shaders/shaders_fog.c @@ -94,23 +94,23 @@ int main(void) texture = LoadTexture("resources/texel_checker.png"); // Assign texture to default model material - modelA.materials[0].maps[MAP_DIFFUSE].texture = texture; - modelB.materials[0].maps[MAP_DIFFUSE].texture = texture; - modelC.materials[0].maps[MAP_DIFFUSE].texture = texture; + modelA.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; + modelB.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; + modelC.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Load shader and set up some uniforms shader = LoadShader(TextFormat("resources/shaders/glsl%i/base_lighting.vs", GLSL_VERSION), TextFormat("resources/shaders/glsl%i/fog.fs", GLSL_VERSION)); - shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel"); - shader.locs[LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos"); + shader.locs[SHADER_LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel"); + shader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos"); // Ambient light level ambientLoc = GetShaderLocation(shader, "ambient"); - SetShaderValue(shader, ambientLoc, (float[4]){ 0.2f, 0.2f, 0.2f, 1.0f }, UNIFORM_VEC4); + SetShaderValue(shader, ambientLoc, (float[4]){ 0.2f, 0.2f, 0.2f, 1.0f }, SHADER_UNIFORM_VEC4); fogDensityLoc = GetShaderLocation(shader, "fogDensity"); - SetShaderValue(shader, fogDensityLoc, &fogDensity, UNIFORM_FLOAT); + SetShaderValue(shader, fogDensityLoc, &fogDensity, SHADER_UNIFORM_FLOAT); // NOTE: All models share the same shader modelA.materials[0].shader = shader; @@ -170,14 +170,14 @@ void UpdateDrawFrame(void) if (fogDensity < 0.0) fogDensity = 0.0; } - SetShaderValue(shader, fogDensityLoc, &fogDensity, UNIFORM_FLOAT); + SetShaderValue(shader, fogDensityLoc, &fogDensity, SHADER_UNIFORM_FLOAT); // Rotate the torus modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateX(-0.025)); modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateZ(0.012)); // Update the light shader with the camera view position - SetShaderValue(shader, shader.locs[LOC_VECTOR_VIEW], &camera.position.x, UNIFORM_VEC3); + SetShaderValue(shader, shader.locs[SHADER_LOC_VECTOR_VIEW], &camera.position.x, SHADER_UNIFORM_VEC3); //---------------------------------------------------------------------------------- // Draw diff --git a/examples/web/shaders/shaders_hot_reloading.c b/examples/web/shaders/shaders_hot_reloading.c index fb645c8..ef101b4 100644 --- a/examples/web/shaders/shaders_hot_reloading.c +++ b/examples/web/shaders/shaders_hot_reloading.c @@ -44,7 +44,7 @@ int main(void) int timeLoc = GetShaderLocation(shader, "time"); float resolution[2] = { (float)screenWidth, (float)screenHeight }; - SetShaderValue(shader, resolutionLoc, resolution, UNIFORM_VEC2); + SetShaderValue(shader, resolutionLoc, resolution, SHADER_UNIFORM_VEC2); float totalTime = 0.0f; bool shaderAutoReloading = false; @@ -62,8 +62,8 @@ int main(void) float mousePos[2] = { mouse.x, mouse.y }; // Set shader required uniform values - SetShaderValue(shader, timeLoc, &totalTime, UNIFORM_FLOAT); - SetShaderValue(shader, mouseLoc, mousePos, UNIFORM_VEC2); + SetShaderValue(shader, timeLoc, &totalTime, SHADER_UNIFORM_FLOAT); + SetShaderValue(shader, mouseLoc, mousePos, SHADER_UNIFORM_VEC2); // Hot shader reloading if (shaderAutoReloading || (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) @@ -87,7 +87,7 @@ int main(void) timeLoc = GetShaderLocation(shader, "time"); // Reset required uniforms - SetShaderValue(shader, resolutionLoc, resolution, UNIFORM_VEC2); + SetShaderValue(shader, resolutionLoc, resolution, SHADER_UNIFORM_VEC2); } fragShaderFileModTime = currentFragShaderModTime; diff --git a/examples/web/shaders/shaders_julia_set.c b/examples/web/shaders/shaders_julia_set.c index 4922675..378da2f 100644 --- a/examples/web/shaders/shaders_julia_set.c +++ b/examples/web/shaders/shaders_julia_set.c @@ -98,11 +98,11 @@ int main(void) // Tell the shader what the screen dimensions, zoom, offset and c are float screenDims[2] = { (float)screenWidth, (float)screenHeight }; - SetShaderValue(shader, GetShaderLocation(shader, "screenDims"), screenDims, UNIFORM_VEC2); + SetShaderValue(shader, GetShaderLocation(shader, "screenDims"), screenDims, SHADER_UNIFORM_VEC2); - SetShaderValue(shader, cLoc, c, UNIFORM_VEC2); - SetShaderValue(shader, zoomLoc, &zoom, UNIFORM_FLOAT); - SetShaderValue(shader, offsetLoc, offset, UNIFORM_VEC2); + SetShaderValue(shader, cLoc, c, SHADER_UNIFORM_VEC2); + SetShaderValue(shader, zoomLoc, &zoom, SHADER_UNIFORM_FLOAT); + SetShaderValue(shader, offsetLoc, offset, SHADER_UNIFORM_VEC2); // Create a RenderTexture2D to be used for render to texture target = LoadRenderTexture(screenWidth, screenHeight); @@ -154,7 +154,7 @@ void UpdateDrawFrame(void) else if (IsKeyPressed(KEY_FIVE)) c[0] = POINTS_OF_INTEREST[4][0], c[1] = POINTS_OF_INTEREST[4][1]; else if (IsKeyPressed(KEY_SIX)) c[0] = POINTS_OF_INTEREST[5][0], c[1] = POINTS_OF_INTEREST[5][1]; - SetShaderValue(shader, cLoc, c, UNIFORM_VEC2); + SetShaderValue(shader, cLoc, c, SHADER_UNIFORM_VEC2); } if (IsKeyPressed(KEY_SPACE)) pause = !pause; // Pause animation (c change) @@ -183,15 +183,15 @@ void UpdateDrawFrame(void) } else offsetSpeed = (Vector2){ 0.0f, 0.0f }; - SetShaderValue(shader, zoomLoc, &zoom, UNIFORM_FLOAT); - SetShaderValue(shader, offsetLoc, offset, UNIFORM_VEC2); + SetShaderValue(shader, zoomLoc, &zoom, SHADER_UNIFORM_FLOAT); + SetShaderValue(shader, offsetLoc, offset, SHADER_UNIFORM_VEC2); // Increment c value with time float amount = GetFrameTime()*incrementSpeed*0.0005f; c[0] += amount; c[1] += amount; - SetShaderValue(shader, cLoc, c, UNIFORM_VEC2); + SetShaderValue(shader, cLoc, c, SHADER_UNIFORM_VEC2); } //---------------------------------------------------------------------------------- diff --git a/examples/web/shaders/shaders_model_shader.c b/examples/web/shaders/shaders_model_shader.c index cc2ebaf..18abea5 100644 --- a/examples/web/shaders/shaders_model_shader.c +++ b/examples/web/shaders/shaders_model_shader.c @@ -72,7 +72,7 @@ int main(void) shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/grayscale.fs", GLSL_VERSION)); model.materials[0].shader = shader; // Set shader effect to 3d model - model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Bind texture to model + model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Bind texture to model // Setup orbital camera SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode diff --git a/examples/web/shaders/shaders_postprocessing.c b/examples/web/shaders/shaders_postprocessing.c index 7b62889..00fe96b 100644 --- a/examples/web/shaders/shaders_postprocessing.c +++ b/examples/web/shaders/shaders_postprocessing.c @@ -98,7 +98,7 @@ int main(void) model = LoadModel("resources/models/church.obj"); // Load OBJ model texture = LoadTexture("resources/models/church_diffuse.png"); // Load model texture - model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture + model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set model diffuse texture // Load all postpro shaders // NOTE 1: All postpro shader use the base vertex shader (DEFAULT_VERTEX_SHADER) diff --git a/examples/web/shaders/shaders_raymarching.c b/examples/web/shaders/shaders_raymarching.c index 3d61fd9..37a38f2 100644 --- a/examples/web/shaders/shaders_raymarching.c +++ b/examples/web/shaders/shaders_raymarching.c @@ -86,7 +86,7 @@ int main(void) resolutionLoc = GetShaderLocation(shader, "resolution"); float resolution[2] = { screenWidth, screenHeight }; - SetShaderValue(shader, resolutionLoc, resolution, UNIFORM_VEC2); + SetShaderValue(shader, resolutionLoc, resolution, SHADER_UNIFORM_VEC2); #if defined(PLATFORM_WEB) emscripten_set_main_loop(UpdateDrawFrame, 60, 1); @@ -128,11 +128,11 @@ void UpdateDrawFrame(void) runTime += deltaTime; // Set shader required uniform values - SetShaderValue(shader, viewEyeLoc, cameraPos, UNIFORM_VEC3); - SetShaderValue(shader, viewCenterLoc, cameraTarget, UNIFORM_VEC3); - SetShaderValue(shader, viewUpLoc, cameraUp, UNIFORM_VEC3); - SetShaderValue(shader, deltaTimeLoc, &deltaTime, UNIFORM_FLOAT); - SetShaderValue(shader, runTimeLoc, &runTime, UNIFORM_FLOAT); + SetShaderValue(shader, viewEyeLoc, cameraPos, SHADER_UNIFORM_VEC3); + SetShaderValue(shader, viewCenterLoc, cameraTarget, SHADER_UNIFORM_VEC3); + SetShaderValue(shader, viewUpLoc, cameraUp, SHADER_UNIFORM_VEC3); + SetShaderValue(shader, deltaTimeLoc, &deltaTime, SHADER_UNIFORM_FLOAT); + SetShaderValue(shader, runTimeLoc, &runTime, SHADER_UNIFORM_FLOAT); //---------------------------------------------------------------------------------- // Draw diff --git a/examples/web/shaders/shaders_rlgl_mesh_instanced.c b/examples/web/shaders/shaders_rlgl_mesh_instanced.c index 702fbcb..9657144 100644 --- a/examples/web/shaders/shaders_rlgl_mesh_instanced.c +++ b/examples/web/shaders/shaders_rlgl_mesh_instanced.c @@ -77,9 +77,9 @@ int main(void) TextFormat("resources/shaders/glsl%i/lighting.fs", GLSL_VERSION)); // Get some shader loactions - shader.locs[LOC_MATRIX_MVP] = GetShaderLocation(shader, "mvp"); - shader.locs[LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos"); - shader.locs[LOC_MATRIX_MODEL] = GetShaderLocationAttrib(shader, "instance"); + shader.locs[SHADER_LOC_MATRIX_MVP] = GetShaderLocation(shader, "mvp"); + shader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos"); + shader.locs[SHADER_LOC_MATRIX_MODEL] = GetShaderLocationAttrib(shader, "instance"); // Ambient light level int ambientLoc = GetShaderLocation(shader, "ambient"); @@ -89,7 +89,7 @@ int main(void) Material material = LoadMaterialDefault(); material.shader = shader; - material.maps[MAP_DIFFUSE].color = RED; + material.maps[MATERIAL_MAP_DIFFUSE].color = RED; SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode @@ -105,7 +105,7 @@ int main(void) // Update the light shader with the camera view position float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z }; - SetShaderValue(shader, shader.locs[LOC_VECTOR_VIEW], cameraPos, UNIFORM_VEC3); + SetShaderValue(shader, shader.locs[SHADER_LOC_VECTOR_VIEW], cameraPos, UNIFORM_VEC3); // Apply per-instance rotations for (int i = 0; i < count; i++) diff --git a/examples/web/shaders/shaders_simple_mask.c b/examples/web/shaders/shaders_simple_mask.c index 1dd63f8..79effab 100644 --- a/examples/web/shaders/shaders_simple_mask.c +++ b/examples/web/shaders/shaders_simple_mask.c @@ -94,16 +94,16 @@ int main(void) // Load and apply the diffuse texture (colour map) texDiffuse = LoadTexture("resources/plasma.png"); - model1.materials[0].maps[MAP_DIFFUSE].texture = texDiffuse; - model2.materials[0].maps[MAP_DIFFUSE].texture = texDiffuse; + model1.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texDiffuse; + model2.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texDiffuse; - // Using MAP_EMISSION as a spare slot to use for 2nd texture - // NOTE: Don't use MAP_IRRADIANCE, MAP_PREFILTER or MAP_CUBEMAP + // Using MATERIAL_MAP_EMISSION as a spare slot to use for 2nd texture + // NOTE: Don't use MATERIAL_MAP_IRRADIANCE, MATERIAL_MAP_PREFILTER or MATERIAL_MAP_CUBEMAP // as they are bound as cube maps texMask = LoadTexture("resources/mask.png"); - model1.materials[0].maps[MAP_EMISSION].texture = texMask; - model2.materials[0].maps[MAP_EMISSION].texture = texMask; - shader.locs[LOC_MAP_EMISSION] = GetShaderLocation(shader, "mask"); + model1.materials[0].maps[MATERIAL_MAP_EMISSION].texture = texMask; + model2.materials[0].maps[MATERIAL_MAP_EMISSION].texture = texMask; + shader.locs[SHADER_LOC_MAP_EMISSION] = GetShaderLocation(shader, "mask"); // Frame is incremented each frame to animate the shader shaderFrame = GetShaderLocation(shader, "frame"); @@ -155,7 +155,7 @@ void UpdateDrawFrame(void) rotation.z -= 0.0025f; // Send frames counter to shader for animation - SetShaderValue(shader, shaderFrame, &framesCounter, UNIFORM_INT); + SetShaderValue(shader, shaderFrame, &framesCounter, SHADER_UNIFORM_INT); // Rotate one of the models model1.transform = MatrixRotateXYZ(rotation); diff --git a/examples/web/shaders/shaders_spotlight.c b/examples/web/shaders/shaders_spotlight.c index 51e5f6f..f924bac 100644 --- a/examples/web/shaders/shaders_spotlight.c +++ b/examples/web/shaders/shaders_spotlight.c @@ -114,7 +114,7 @@ int main(void) // a pitch black half and a dimly lit half. unsigned int wLoc = GetShaderLocation(shdrSpot, "screenWidth"); float sw = (float)GetScreenWidth(); - SetShaderValue(shdrSpot, wLoc, &sw, UNIFORM_FLOAT); + SetShaderValue(shdrSpot, wLoc, &sw, SHADER_UNIFORM_FLOAT); // Randomise the locations and velocities of the spotlights // and initialise the shader locations @@ -133,9 +133,9 @@ int main(void) spots[i].inner = 28 * (i + 1); spots[i].radius = 48 * (i + 1); - SetShaderValue(shdrSpot, spots[i].posLoc, &spots[i].pos.x, UNIFORM_VEC2); - SetShaderValue(shdrSpot, spots[i].innerLoc, &spots[i].inner, UNIFORM_FLOAT); - SetShaderValue(shdrSpot, spots[i].radiusLoc, &spots[i].radius, UNIFORM_FLOAT); + SetShaderValue(shdrSpot, spots[i].posLoc, &spots[i].pos.x, SHADER_UNIFORM_VEC2); + SetShaderValue(shdrSpot, spots[i].innerLoc, &spots[i].inner, SHADER_UNIFORM_FLOAT); + SetShaderValue(shdrSpot, spots[i].radiusLoc, &spots[i].radius, SHADER_UNIFORM_FLOAT); } SetTargetFPS(60); // Set to run at 60 frames-per-second @@ -171,7 +171,7 @@ int main(void) if (spots[i].pos.y > (screenHeight - 64)) spots[i].vel.y = -spots[i].vel.y; } - SetShaderValue(shdrSpot, spots[i].posLoc, &spots[i].pos.x, UNIFORM_VEC2); + SetShaderValue(shdrSpot, spots[i].posLoc, &spots[i].pos.x, SHADER_UNIFORM_VEC2); } // Draw diff --git a/examples/web/shaders/shaders_texture_drawing.c b/examples/web/shaders/shaders_texture_drawing.c index 37dd2fb..374bc2b 100644 --- a/examples/web/shaders/shaders_texture_drawing.c +++ b/examples/web/shaders/shaders_texture_drawing.c @@ -61,7 +61,7 @@ int main(void) shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/cubes_panning.fs", GLSL_VERSION)); timeLoc = GetShaderLocation(shader, "uTime"); - SetShaderValue(shader, timeLoc, &time, UNIFORM_FLOAT); + SetShaderValue(shader, timeLoc, &time, SHADER_UNIFORM_FLOAT); #if defined(PLATFORM_WEB) emscripten_set_main_loop(UpdateDrawFrame, 60, 1); @@ -94,7 +94,7 @@ void UpdateDrawFrame(void) // Update //---------------------------------------------------------------------------------- time = GetTime(); - SetShaderValue(shader, timeLoc, &time, UNIFORM_FLOAT); + SetShaderValue(shader, timeLoc, &time, SHADER_UNIFORM_FLOAT); //---------------------------------------------------------------------------------- // Draw diff --git a/examples/web/shaders/shaders_texture_waves.c b/examples/web/shaders/shaders_texture_waves.c index f27fd53..e43dc5f 100644 --- a/examples/web/shaders/shaders_texture_waves.c +++ b/examples/web/shaders/shaders_texture_waves.c @@ -88,13 +88,13 @@ int main(void) speedYLoc = GetShaderLocation(shader, "speedY"); float screenSize[2] = { (float)GetScreenWidth(), (float)GetScreenHeight() }; - SetShaderValue(shader, GetShaderLocation(shader, "size"), &screenSize, UNIFORM_VEC2); - SetShaderValue(shader, freqXLoc, &freqX, UNIFORM_FLOAT); - SetShaderValue(shader, freqYLoc, &freqY, UNIFORM_FLOAT); - SetShaderValue(shader, ampXLoc, &X, UNIFORM_FLOAT); - SetShaderValue(shader, ampYLoc, &Y, UNIFORM_FLOAT); - SetShaderValue(shader, speedXLoc, &speedX, UNIFORM_FLOAT); - SetShaderValue(shader, speedYLoc, &speedY, UNIFORM_FLOAT); + SetShaderValue(shader, GetShaderLocation(shader, "size"), &screenSize, SHADER_UNIFORM_VEC2); + SetShaderValue(shader, freqXLoc, &freqX, SHADER_UNIFORM_FLOAT); + SetShaderValue(shader, freqYLoc, &freqY, SHADER_UNIFORM_FLOAT); + SetShaderValue(shader, ampXLoc, &X, SHADER_UNIFORM_FLOAT); + SetShaderValue(shader, ampYLoc, &Y, SHADER_UNIFORM_FLOAT); + SetShaderValue(shader, speedXLoc, &speedX, SHADER_UNIFORM_FLOAT); + SetShaderValue(shader, speedYLoc, &speedY, SHADER_UNIFORM_FLOAT); #if defined(PLATFORM_WEB) emscripten_set_main_loop(UpdateDrawFrame, 60, 1); @@ -129,7 +129,7 @@ void UpdateDrawFrame(void) //---------------------------------------------------------------------------------- seconds += GetFrameTime(); - SetShaderValue(shader, secondsLoc, &seconds, UNIFORM_FLOAT); + SetShaderValue(shader, secondsLoc, &seconds, SHADER_UNIFORM_FLOAT); //---------------------------------------------------------------------------------- // Draw diff --git a/examples/web/textures/textures_image_processing.c b/examples/web/textures/textures_image_processing.c index 5f7f330..94d39d8 100644 --- a/examples/web/textures/textures_image_processing.c +++ b/examples/web/textures/textures_image_processing.c @@ -74,7 +74,7 @@ int main(void) // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) image = LoadImage("resources/parrots.png"); // Loaded in CPU memory (RAM) - ImageFormat(&image, UNCOMPRESSED_R8G8B8A8); // Format image to RGBA 32bit (required for texture update) + ImageFormat(&image, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8); // Format image to RGBA 32bit (required for texture update) texture = LoadTextureFromImage(image); // Image converted to texture, GPU memory (VRAM) for (int i = 0; i < NUM_PROCESSES; i++) selectRecs[i] = (Rectangle){ 40, 50 + 32*i, 150, 30 }; diff --git a/examples/web/textures/textures_raw_data.c b/examples/web/textures/textures_raw_data.c index c1078dc..dded6c3 100644 --- a/examples/web/textures/textures_raw_data.c +++ b/examples/web/textures/textures_raw_data.c @@ -43,7 +43,7 @@ int main(void) InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture from raw data"); // Load RAW image data (512x512, 32bit RGBA, no file header) - Image fudesumiRaw = LoadImageRaw("resources/fudesumi.raw", 384, 512, UNCOMPRESSED_R8G8B8A8, 0); + Image fudesumiRaw = LoadImageRaw("resources/fudesumi.raw", 384, 512, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, 0); fudesumi = LoadTextureFromImage(fudesumiRaw); // Upload CPU (RAM) image to GPU (VRAM) UnloadImage(fudesumiRaw); // Unload CPU (RAM) image data @@ -68,7 +68,7 @@ int main(void) .data = pixels, // We can assign pixels directly to data .width = width, .height = height, - .format = UNCOMPRESSED_R8G8B8A8, + .format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, .mipmaps = 1 }; |
