diff options
| author | Jeffery Myers <[email protected]> | 2021-04-25 09:50:26 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-04-25 18:50:26 +0200 |
| commit | 6c518008a58853197890b45e941f342e4195de60 (patch) | |
| tree | 429e12c1ee0c6206c69c7a93c7726aa3ab3d533b /examples/shaders | |
| parent | 87198586554e218834542098ec40e6611452c3aa (diff) | |
| download | raylib-6c518008a58853197890b45e941f342e4195de60.tar.gz raylib-6c518008a58853197890b45e941f342e4195de60.zip | |
Fixes for 64 bit typecast warnings (#1733)
Diffstat (limited to 'examples/shaders')
| -rw-r--r-- | examples/shaders/shaders_basic_lighting.c | 4 | ||||
| -rw-r--r-- | examples/shaders/shaders_custom_uniform.c | 2 | ||||
| -rw-r--r-- | examples/shaders/shaders_eratosthenes.c | 2 | ||||
| -rw-r--r-- | examples/shaders/shaders_fog.c | 18 | ||||
| -rw-r--r-- | examples/shaders/shaders_julia_set.c | 12 | ||||
| -rw-r--r-- | examples/shaders/shaders_spotlight.c | 22 |
6 files changed, 30 insertions, 30 deletions
diff --git a/examples/shaders/shaders_basic_lighting.c b/examples/shaders/shaders_basic_lighting.c index c7e43b0c..6ef09e4a 100644 --- a/examples/shaders/shaders_basic_lighting.c +++ b/examples/shaders/shaders_basic_lighting.c @@ -146,8 +146,8 @@ int main(void) // Draw the three models DrawModel(modelA, Vector3Zero(), 1.0f, WHITE); - DrawModel(modelB, (Vector3){-1.6,0,0}, 1.0f, WHITE); - DrawModel(modelC, (Vector3){ 1.6,0,0}, 1.0f, WHITE); + DrawModel(modelB, (Vector3){-1.6f,0.0f,0.0f}, 1.0f, WHITE); + DrawModel(modelC, (Vector3){ 1.6f,0.0f,0.0f}, 1.0f, WHITE); // Draw markers to show where the lights are if (lights[0].enabled) { DrawSphereEx(lights[0].position, 0.2f, 8, 8, WHITE); } diff --git a/examples/shaders/shaders_custom_uniform.c b/examples/shaders/shaders_custom_uniform.c index ecc314e4..6efda727 100644 --- a/examples/shaders/shaders_custom_uniform.c +++ b/examples/shaders/shaders_custom_uniform.c @@ -109,7 +109,7 @@ int main(void) BeginShaderMode(shader); // NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom) - DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, WHITE); + DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2){ 0, 0 }, WHITE); EndShaderMode(); diff --git a/examples/shaders/shaders_eratosthenes.c b/examples/shaders/shaders_eratosthenes.c index f0b828a9..d5163a7f 100644 --- a/examples/shaders/shaders_eratosthenes.c +++ b/examples/shaders/shaders_eratosthenes.c @@ -75,7 +75,7 @@ int main(void) BeginShaderMode(shader); // NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom) - DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE); + DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE); EndShaderMode(); EndDrawing(); diff --git a/examples/shaders/shaders_fog.c b/examples/shaders/shaders_fog.c index 0f9d782e..fef311c4 100644 --- a/examples/shaders/shaders_fog.c +++ b/examples/shaders/shaders_fog.c @@ -102,21 +102,21 @@ int main(void) if (IsKeyDown(KEY_UP)) { - fogDensity += 0.001; - if (fogDensity > 1.0) fogDensity = 1.0; + fogDensity += 0.001f; + if (fogDensity > 1.0f) fogDensity = 1.0f; } if (IsKeyDown(KEY_DOWN)) { - fogDensity -= 0.001; - if (fogDensity < 0.0) fogDensity = 0.0; + fogDensity -= 0.001f; + if (fogDensity < 0.0f) fogDensity = 0.0f; } 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)); + modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateX(-0.025f)); + modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateZ(0.012f)); // Update the light shader with the camera view position SetShaderValue(shader, shader.locs[SHADER_LOC_VECTOR_VIEW], &camera.position.x, SHADER_UNIFORM_VEC3); @@ -132,10 +132,10 @@ int main(void) // Draw the three models DrawModel(modelA, Vector3Zero(), 1.0f, WHITE); - DrawModel(modelB, (Vector3){ -2.6, 0, 0 }, 1.0f, WHITE); - DrawModel(modelC, (Vector3){ 2.6, 0, 0 }, 1.0f, WHITE); + DrawModel(modelB, (Vector3){ -2.6f, 0, 0 }, 1.0f, WHITE); + DrawModel(modelC, (Vector3){ 2.6f, 0, 0 }, 1.0f, WHITE); - for (int i = -20; i < 20; i += 2) DrawModel(modelA,(Vector3){ i, 0, 2 }, 1.0f, WHITE); + for (int i = -20; i < 20; i += 2) DrawModel(modelA,(Vector3){ (float)i, 0, 2 }, 1.0f, WHITE); EndMode3D(); diff --git a/examples/shaders/shaders_julia_set.c b/examples/shaders/shaders_julia_set.c index 6ca22686..b6138b7b 100644 --- a/examples/shaders/shaders_julia_set.c +++ b/examples/shaders/shaders_julia_set.c @@ -27,12 +27,12 @@ // A few good julia sets const float pointsOfInterest[6][2] = { - { -0.348827, 0.607167 }, - { -0.786268, 0.169728 }, - { -0.8, 0.156 }, - { 0.285, 0.0 }, - { -0.835, -0.2321 }, - { -0.70176, -0.3842 }, + { -0.348827f, 0.607167f }, + { -0.786268f, 0.169728f }, + { -0.8f, 0.156f }, + { 0.285f, 0.0f }, + { -0.835f, -0.2321f }, + { -0.70176f, -0.3842f }, }; int main(void) diff --git a/examples/shaders/shaders_spotlight.c b/examples/shaders/shaders_spotlight.c index 40fd2317..892093d7 100644 --- a/examples/shaders/shaders_spotlight.c +++ b/examples/shaders/shaders_spotlight.c @@ -116,22 +116,22 @@ int main(void) float sw = (float)GetScreenWidth(); SetShaderValue(shdrSpot, wLoc, &sw, SHADER_UNIFORM_FLOAT); - // Randomise the locations and velocities of the spotlights - // and initialise the shader locations + // Randomize the locations and velocities of the spotlights + // and initialize the shader locations for (int i = 0; i < MAX_SPOTS; i++) { - spots[i].pos.x = GetRandomValue(64, screenWidth - 64); - spots[i].pos.y = GetRandomValue(64, screenHeight - 64); + spots[i].pos.x = GetRandomValue(64.0f, screenWidth - 64.0f); + spots[i].pos.y = GetRandomValue(64.0f, screenHeight - 64.0f); spots[i].vel = (Vector2){ 0, 0 }; while ((fabs(spots[i].vel.x) + fabs(spots[i].vel.y)) < 2) { - spots[i].vel.x = GetRandomValue(-40, 40)/10.0; - spots[i].vel.y = GetRandomValue(-40, 40)/10.0; + spots[i].vel.x = GetRandomValue(-400.f, 40.0f) / 10.0f; + spots[i].vel.y = GetRandomValue(-400.f, 40.0f) / 10.0f; } - spots[i].inner = 28 * (i + 1); - spots[i].radius = 48 * (i + 1); + spots[i].inner = 28.0f * (i + 1); + spots[i].radius = 48.0f * (i + 1); SetShaderValue(shdrSpot, spots[i].posLoc, &spots[i].pos.x, SHADER_UNIFORM_VEC2); SetShaderValue(shdrSpot, spots[i].innerLoc, &spots[i].inner, SHADER_UNIFORM_FLOAT); @@ -184,14 +184,14 @@ int main(void) for (int n = 0; n < MAX_STARS; n++) { // Single pixel is just too small these days! - DrawRectangle(stars[n].pos.x, stars[n].pos.y, 2, 2, WHITE); + DrawRectangle((int)stars[n].pos.x, (int)stars[n].pos.y, 2, 2, WHITE); } for (int i = 0; i < 16; i++) { DrawTexture(texRay, - (screenWidth/2.0) + cos((frameCounter + i*8)/51.45f)*(screenWidth/2.2) - 32, - (screenHeight/2.0) + sin((frameCounter + i*8)/17.87f)*(screenHeight/4.2), WHITE); + (screenWidth/2.0f) + cos((frameCounter + i*8)/51.45f)*(screenWidth/2.2f) - 32, + (screenHeight/2.0f) + sin((frameCounter + i*8)/17.87f)*(screenHeight/4.2f), WHITE); } // Draw spot lights |
