Updating julia set example.
Now dividing by the zoom instead of multiplying (in the shader), so zoom works as expected. Also zoom increase/decrease is now scaled depending on the current zoom.
This commit is contained in:
parent
998b4180e1
commit
a7c5e3cab7
2 changed files with 10 additions and 10 deletions
|
@ -40,14 +40,14 @@ int main()
|
|||
|
||||
// Load julia set shader
|
||||
// NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
|
||||
Shader shader = LoadShader(0, "resources/shaders/glsl330/julia_shader.fs");
|
||||
Shader shader = LoadShader(0, "julia_shader.fs");
|
||||
|
||||
// c constant to use in z^2 + c
|
||||
float c[2] = { POINTS_OF_INTEREST[0][0], POINTS_OF_INTEREST[0][1] };
|
||||
|
||||
// Offset and zoom to draw the julia set at. (centered on screen and 1.6 times smaller)
|
||||
float offset[2] = { -(float)screenWidth/2, -(float)screenHeight/2 };
|
||||
float zoom = 1.6f;
|
||||
float zoom = 1.0f;
|
||||
|
||||
Vector2 offsetSpeed = { 0.0f, 0.0f };
|
||||
|
||||
|
@ -111,8 +111,8 @@ int main()
|
|||
// Probably offset movement should be proportional to zoom level
|
||||
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON) || IsMouseButtonDown(MOUSE_RIGHT_BUTTON))
|
||||
{
|
||||
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) zoom -= 0.003f;
|
||||
if (IsMouseButtonDown(MOUSE_RIGHT_BUTTON)) zoom += 0.003f;
|
||||
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) zoom += zoom * 0.003f;
|
||||
if (IsMouseButtonDown(MOUSE_RIGHT_BUTTON)) zoom -= zoom * 0.003f;
|
||||
|
||||
Vector2 mousePos = GetMousePosition();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue