Commit 26e91c7b authored by Gaëtan Renaudeau's avatar Gaëtan Renaudeau

Fix Tests and bundle

parent a863fe5c
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -8,9 +8,14 @@ precision highp float; ...@@ -8,9 +8,14 @@ precision highp float;
varying vec2 uv; varying vec2 uv;
uniform sampler2D t; uniform sampler2D t;
uniform bool preventAlphaMult;
void main () { void main () {
gl_FragColor = texture2D(t, uv); vec4 c = texture2D(t, uv);
if (preventAlphaMult) // (I know if() in glsl is not performant. don't do this. It's just for readability purpose here)
gl_FragColor = c / sqrt(c.a);
else
gl_FragColor = c;
} }
` `
} }
...@@ -18,13 +23,13 @@ void main () { ...@@ -18,13 +23,13 @@ void main () {
class Copy extends GL.Component { class Copy extends GL.Component {
render () { render () {
const { width, height, children: t, ...rest } = this.props; const { width, height, children: t, last, ...rest } = this.props;
return <GL.View return <GL.View
{...rest} {...rest}
shader={shaders.Copy} shader={shaders.Copy}
width={width} width={width}
height={height} height={height}
uniforms={{ t }} uniforms={{ t, preventAlphaMult: !last }}
/>; />;
} }
} }
......
...@@ -13,7 +13,7 @@ uniform sampler2D t2; ...@@ -13,7 +13,7 @@ uniform sampler2D t2;
void main () { void main () {
vec4 c1 = texture2D(t1, uv); vec4 c1 = texture2D(t1, uv);
vec4 c2 = texture2D(t2, uv); vec4 c2 = texture2D(t2, uv);
gl_FragColor = mix(c1, c2, c2.a); gl_FragColor = vec4(mix(c1.rgb, c2.rgb, c2.a), c1.a + c2.a);
} }
` `
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -94,14 +94,14 @@ class Tests extends React.Component { ...@@ -94,14 +94,14 @@ class Tests extends React.Component {
<NativeLayer width={debugSize} height={debugSize}> <NativeLayer width={debugSize} height={debugSize}>
<Image source={{ uri: "http://i.imgur.com/S22HNaU.png" }} width={debugSize} height={debugSize} /> <Image source={{ uri: "http://i.imgur.com/S22HNaU.png" }} width={debugSize} height={debugSize} />
<Copy width={debugSize} height={debugSize} opaque={false}> <Copy width={debugSize} height={debugSize} opaque={false} last>
http://i.imgur.com/mp79p5T.png http://i.imgur.com/mp79p5T.png
</Copy> </Copy>
</NativeLayer> </NativeLayer>
<NativeLayer width={debugSize} height={debugSize}> <NativeLayer width={debugSize} height={debugSize}>
<Image source={{ uri: "http://i.imgur.com/S22HNaU.png" }} width={debugSize} height={debugSize} /> <Image source={{ uri: "http://i.imgur.com/S22HNaU.png" }} width={debugSize} height={debugSize} />
<Copy width={debugSize} height={debugSize} opaque={false}> <Copy width={debugSize} height={debugSize} opaque={false} last>
<Copy> <Copy>
http://i.imgur.com/mp79p5T.png http://i.imgur.com/mp79p5T.png
</Copy> </Copy>
...@@ -110,7 +110,7 @@ class Tests extends React.Component { ...@@ -110,7 +110,7 @@ class Tests extends React.Component {
<NativeLayer width={debugSize} height={debugSize}> <NativeLayer width={debugSize} height={debugSize}>
<Image source={{ uri: "http://i.imgur.com/S22HNaU.png" }} width={debugSize} height={debugSize} /> <Image source={{ uri: "http://i.imgur.com/S22HNaU.png" }} width={debugSize} height={debugSize} />
<Copy width={debugSize} height={debugSize} opaque={false}> <Copy width={debugSize} height={debugSize} opaque={false} last>
<Copy> <Copy>
<Copy> <Copy>
http://i.imgur.com/mp79p5T.png http://i.imgur.com/mp79p5T.png
...@@ -121,7 +121,7 @@ class Tests extends React.Component { ...@@ -121,7 +121,7 @@ class Tests extends React.Component {
<NativeLayer width={debugSize} height={debugSize}> <NativeLayer width={debugSize} height={debugSize}>
<Image source={{ uri: "http://i.imgur.com/S22HNaU.png" }} width={debugSize} height={debugSize} /> <Image source={{ uri: "http://i.imgur.com/S22HNaU.png" }} width={debugSize} height={debugSize} />
<Copy width={debugSize} height={debugSize} opaque={false}> <Copy width={debugSize} height={debugSize} opaque={false} last>
<Copy> <Copy>
<Copy> <Copy>
<Copy> <Copy>
...@@ -135,7 +135,7 @@ class Tests extends React.Component { ...@@ -135,7 +135,7 @@ class Tests extends React.Component {
<NativeLayer width={debugSize} height={debugSize}> <NativeLayer width={debugSize} height={debugSize}>
<Image source={{ uri: "http://i.imgur.com/S22HNaU.png" }} width={debugSize} height={debugSize} /> <Image source={{ uri: "http://i.imgur.com/S22HNaU.png" }} width={debugSize} height={debugSize} />
<Copy width={debugSize} height={debugSize} opaque={false}> <Copy width={debugSize} height={debugSize} opaque={false}>
<Copy> <Copy last>
<Copy> <Copy>
<Copy> <Copy>
<Copy> <Copy>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment