Finalize math constants and build v1.9.0
This commit is contained in:
parent
704dbae342
commit
53e1c931ab
|
|
@ -897,7 +897,7 @@ int main(void)
|
||||||
float cycleLength = 300.0f;
|
float cycleLength = 300.0f;
|
||||||
if (currentState == GAMEPLAY) gameTime += GetFrameTime();
|
if (currentState == GAMEPLAY) gameTime += GetFrameTime();
|
||||||
float timeOfDay = fmodf(gameTime, cycleLength) / cycleLength;
|
float timeOfDay = fmodf(gameTime, cycleLength) / cycleLength;
|
||||||
float sunAngle = timeOfDay * 2.0f * PI - PI/2.0f;
|
float sunAngle = timeOfDay * 2.0f * 3.14159f - 3.14159f/2.0f;
|
||||||
float dayFactor = (sinf(sunAngle) + 1.0f) / 2.0f;
|
float dayFactor = (sinf(sunAngle) + 1.0f) / 2.0f;
|
||||||
float quickMix = (dayFactor - 0.5f) * 5.0f + 0.5f;
|
float quickMix = (dayFactor - 0.5f) * 5.0f + 0.5f;
|
||||||
if (quickMix > 1.0f) quickMix = 1.0f;
|
if (quickMix > 1.0f) quickMix = 1.0f;
|
||||||
|
|
@ -1782,7 +1782,7 @@ int main(void)
|
||||||
BeginMode3D(camera3D);
|
BeginMode3D(camera3D);
|
||||||
// Draw Sun and Moon (simple billboards or spheres far away)
|
// Draw Sun and Moon (simple billboards or spheres far away)
|
||||||
Vector3 sunPos = { camera3D.position.x + cosf(sunAngle) * 100, camera3D.position.y + sinf(sunAngle) * 100, camera3D.position.z };
|
Vector3 sunPos = { camera3D.position.x + cosf(sunAngle) * 100, camera3D.position.y + sinf(sunAngle) * 100, camera3D.position.z };
|
||||||
Vector3 moonPos = { camera3D.position.x + cosf(sunAngle + PI) * 100, camera3D.position.y + sinf(sunAngle + PI) * 100, camera3D.position.z };
|
Vector3 moonPos = { camera3D.position.x + cosf(sunAngle + 3.14159f) * 100, camera3D.position.y + sinf(sunAngle + 3.14159f) * 100, camera3D.position.z };
|
||||||
|
|
||||||
DrawSphere(sunPos, 5.0f, YELLOW);
|
DrawSphere(sunPos, 5.0f, YELLOW);
|
||||||
DrawSphere(moonPos, 4.0f, LIGHTGRAY);
|
DrawSphere(moonPos, 4.0f, LIGHTGRAY);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue