Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gl-react-native-v2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ym
gl-react-native-v2
Commits
e72eb471
Commit
e72eb471
authored
Mar 21, 2016
by
Gaëtan Renaudeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests example: add a new test
parent
3c217d7e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
0 deletions
+66
-0
example/src/Tests/ColoredDisc.js
example/src/Tests/ColoredDisc.js
+30
-0
example/src/Tests/DiamondCrop.js
example/src/Tests/DiamondCrop.js
+28
-0
example/src/Tests/index.js
example/src/Tests/index.js
+8
-0
No files found.
example/src/Tests/ColoredDisc.js
0 → 100644
View file @
e72eb471
import
GL
from
"
gl-react
"
;
import
React
from
"
react
"
;
const
shaders
=
GL
.
Shaders
.
create
({
ColoredDisc
:
{
frag
:
`
precision highp float;
varying vec2 uv;
uniform vec3 fromColor;
uniform vec3 toColor;
void main () {
float d = 2.0 * distance(uv, vec2(0.5));
gl_FragColor = mix(
vec4(mix(fromColor, toColor, d), 1.0),
vec4(0.0),
step(1.0, d)
);
}
`
}
});
module
.
exports
=
GL
.
createComponent
(
({
fromColor
,
toColor
})
=>
<
GL
.
Node
shader
=
{
shaders
.
ColoredDisc
}
uniforms
=
{{
fromColor
,
toColor
}}
/>
,
{
displayName
:
"
ColoredDisc
"
}
);
example/src/Tests/DiamondCrop.js
0 → 100644
View file @
e72eb471
import
GL
from
"
gl-react
"
;
import
React
from
"
react
"
;
const
shaders
=
GL
.
Shaders
.
create
({
DiamondCrop
:
{
frag
:
`
precision highp float;
varying vec2 uv;
uniform sampler2D t;
void main () {
gl_FragColor = mix(
texture2D(t, uv),
vec4(0.0),
step(0.5, abs(uv.x - 0.5) + abs(uv.y - 0.5))
);
}
`
}
});
module
.
exports
=
GL
.
createComponent
(
({
children
:
t
})
=>
<
GL
.
Node
shader
=
{
shaders
.
DiamondCrop
}
uniforms
=
{{
t
}}
/>
,
{
displayName
:
"
DiamondCrop
"
}
);
example/src/Tests/index.js
View file @
e72eb471
...
...
@@ -13,6 +13,8 @@ import NativeLayer from "./NativeLayer";
import
HelloGL
from
"
./HelloGL
"
;
import
Display2
from
"
./Display2
"
;
import
Copy
from
"
./Copy
"
;
import
ColoredDisc
from
"
./ColoredDisc
"
;
import
DiamondCrop
from
"
./DiamondCrop
"
;
import
TransparentNonPremultiplied
from
"
./TransparentNonPremultiplied
"
;
import
Dimensions
from
"
Dimensions
"
;
const
{
width
:
viewportW
,
height
:
viewportH
}
=
Dimensions
.
get
(
"
window
"
);
...
...
@@ -145,6 +147,12 @@ class Tests extends React.Component {
<
HelloGL
/>
<
/Surface
>
<
Surface
style
=
{{
margin
:
4
}}
width
=
{
300
}
height
=
{
300
}
>
<
Blur
passes
=
{
6
}
factor
=
{
2
}
>
http
:
//i.imgur.com/rkiglmm.jpg
<
/Blur
>
<
/Surface
>
<
/View
>
<
/ScrollView>
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment