Skip to content

Commit

Permalink
GraphToy formulas
Browse files Browse the repository at this point in the history
  • Loading branch information
davesmith00000 committed Nov 29, 2023
1 parent 9b457a2 commit 61acce4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions shaders/patterns/rainbow/src/Rainbow.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ object CustomShader:

import ultraviolet.syntax.*

/*
GraphToy:
1.0 - step(0.5, x)
*/

@SuppressWarnings(Array("scalafix:DisableSyntax.var"))
inline def fragment: Shader[FragmentEnv, Unit] =
Shader[FragmentEnv] { env =>
Expand Down
5 changes: 5 additions & 0 deletions shaders/shapes/doughnut-normal/src/DoughnutNormal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ object CustomShader:

import ultraviolet.syntax.*

/*
GraphToy:
((cos((x - 0.25) * PI * 4.0) * 0.5) + 0.5) * min(step(-0.5, x), 1.0 - step(0.5, x))
*/

inline def fragment: Shader[FragmentEnv, Unit] =
Shader[FragmentEnv] { env =>

Expand Down
5 changes: 5 additions & 0 deletions shaders/shapes/doughnut/src/Doughnut.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ object CustomShader:

import ultraviolet.syntax.*

/*
GraphToy:
((cos(x * PI * 2.0) * 0.5) + 0.5) * min(step(-0.5, x), 1.0 - step(0.5, x))
*/

// Based on work by Inigo Quilez
// https://iquilezles.org/articles/distfunctions2d/
inline def fragment: Shader[FragmentEnv, Unit] =
Expand Down

0 comments on commit 61acce4

Please sign in to comment.