Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Fadecandy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
scanlime
Fadecandy
Commits
5e2abfe5
Commit
5e2abfe5
authored
11 years ago
by
Micah Elizabeth Scott
Browse files
Options
Downloads
Patches
Plain Diff
More tools for testing/demoing the dithering algorithm
parent
89e33e0d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/Processing/waves/data/effect.glsl
+4
-5
4 additions, 5 deletions
examples/Processing/waves/data/effect.glsl
examples/Processing/waves/waves.pde
+12
-5
12 additions, 5 deletions
examples/Processing/waves/waves.pde
with
16 additions
and
10 deletions
examples/Processing/waves/data/effect.glsl
+
4
−
5
View file @
5e2abfe5
#define PROCESSING_COLOR_SHADER
uniform
float
time
;
uniform
float
time
,
hue
;
uniform
vec2
resolution
;
uniform
vec2
mouse
;
vec3
hsv2rgb
(
vec3
c
)
{
...
...
@@ -18,9 +17,9 @@ void main(void)
vec2
centerDist
=
gl_FragCoord
.
xy
-
resolution
.
xy
*
0
.
5
;
float
d
=
dot
(
centerDist
,
centerDist
);
//
Some interesting colors, in HSV, based on the mouse position
vec3
color1
=
vec3
(
mouse
.
x
,
mouse
.
y
,
0
.
0
);
vec3
color2
=
vec3
(
mouse
.
x
,
mouse
.
y
,
0
.
5
);
//
Interpolation endpoints in HSV
vec3
color1
=
vec3
(
hue
,
0
.
25
,
0
.
0
);
vec3
color2
=
vec3
(
hue
,
0
.
25
,
0
.
7
5
);
// Mixing factor
float
m
=
0
.
5
*
(
1
.
0
+
sin
(
d
*
1e-4
-
time
*
1
.
2
));
...
...
This diff is collapsed.
Click to expand it.
examples/Processing/waves/waves.pde
+
12
−
5
View file @
5e2abfe5
...
...
@@ -21,6 +21,9 @@ void setup() {
opc
.
ledGrid8x8
(
64
,
width
/
2
-
spacing
*
8
,
height
/
2
,
spacing
,
0
);
opc
.
ledGrid8x8
(
128
,
width
/
2
+
spacing
*
8
,
height
/
2
,
spacing
,
0
);
opc
.
showLocations
(
true
);
// Initial color correction settings
mouseMoved
();
}
void
mousePressed
()
{
...
...
@@ -31,30 +34,34 @@ void mouseReleased() {
opc
.
setStatusLed
(
false
);
}
void
mouseMoved
()
{
// Use Y axis to control brightness
float
b
=
mouseY
/
float
(
height
);
opc
.
setColorCorrection
(
2.5
,
b
,
b
,
b
);
}
void
keyPressed
()
{
if
(
key
==
'd'
)
opc
.
setDithering
(
false
);
if
(
key
==
'i'
)
opc
.
setInterpolation
(
false
);
if
(
key
==
'l'
)
opc
.
setStatusLed
(
true
);
if
(
key
==
'g'
)
opc
.
setColorCorrection
(
1.0
,
1.0
,
1.0
,
1.0
);
}
void
keyReleased
()
{
if
(
key
==
'd'
)
opc
.
setDithering
(
true
);
if
(
key
==
'i'
)
opc
.
setInterpolation
(
true
);
if
(
key
==
'l'
)
opc
.
setStatusLed
(
false
);
if
(
key
==
'g'
)
opc
.
setColorCorrection
(
2.5
,
1.0
,
1.0
,
1.0
);
}
void
draw
()
{
// The entire effect happens in a pixel shader
effect
.
set
(
"time"
,
millis
()
/
1000.0
);
effect
.
set
(
"
mous
e"
,
float
(
mouseX
)
/
width
,
float
(
mouseY
)
/
height
);
effect
.
set
(
"
hu
e"
,
float
(
mouseX
)
/
width
);
shader
(
effect
);
rect
(
0
,
0
,
width
,
height
);
resetShader
();
// Status text
textSize
(
2
0
);
text
(
"F
irmware config byte
: "
+
opc
.
firmwareConfig
,
10
,
350
);
textSize
(
1
2
);
text
(
"F
W Config
: "
+
opc
.
firmwareConfig
+
", "
+
" Color: "
+
opc
.
colorCorrection
,
10
,
350
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment