Skip to content
This repository has been archived by the owner on Jan 1, 2020. It is now read-only.

Commit

Permalink
Merge pull request #48 from ProjectSeptemberInc/2.17.0
Browse files Browse the repository at this point in the history
Bugfixes and Features of 2.17.x
  • Loading branch information
gre committed Dec 20, 2015
2 parents f0c5426 + 22ed9cf commit 935b358
Show file tree
Hide file tree
Showing 40 changed files with 717 additions and 355 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"parser": "babel-eslint",
"globals": {
"requestAnimationFrame": true
},
Expand Down
6 changes: 3 additions & 3 deletions Examples/AdvancedEffects/android/app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.fresco/fresco/0.8.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.fresco/imagepipeline-okhttp/0.8.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.fresco/imagepipeline/0.8.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.react/react-native/0.16.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.react/react-native/0.17.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/org.webkit/android-jsc/r174650/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
Expand All @@ -97,15 +97,15 @@
<orderEntry type="library" exported="" name="okio-1.6.0" level="project" />
<orderEntry type="library" exported="" name="stetho-okhttp-1.2.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.5.0" level="project" />
<orderEntry type="library" exported="" name="jsr305-3.0.0" level="project" />
<orderEntry type="library" exported="" name="stetho-1.2.0" level="project" />
<orderEntry type="library" exported="" name="jsr305-3.0.0" level="project" />
<orderEntry type="library" exported="" name="jackson-core-2.2.3" level="project" />
<orderEntry type="library" exported="" name="fbcore-0.8.1" level="project" />
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="imagepipeline-0.8.1" level="project" />
<orderEntry type="library" exported="" name="react-native-0.17.1" level="project" />
<orderEntry type="library" exported="" name="android-jsc-r174650" level="project" />
<orderEntry type="library" exported="" name="react-native-0.16.1" level="project" />
<orderEntry type="library" exported="" name="fresco-0.8.1" level="project" />
<orderEntry type="library" exported="" name="imagepipeline-okhttp-0.8.1" level="project" />
<orderEntry type="library" exported="" name="bolts-android-1.1.4" level="project" />
Expand Down
2 changes: 1 addition & 1 deletion Examples/AdvancedEffects/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ android {
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:0.16.+"
compile "com.facebook.react:react-native:0.17.+"

compile project(':RNGL')
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;

import com.facebook.react.LifecycleState;
import com.facebook.react.ReactInstanceManager;
Expand Down Expand Up @@ -34,6 +35,8 @@ protected void onCreate(Bundle savedInstanceState) {
mReactRootView.startReactApplication(mReactInstanceManager, "AdvancedEffects", null);

setContentView(mReactRootView);

getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion Examples/AdvancedEffects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"gl-react": "^2.0.2",
"gl-react-native": "file:../..",
"glsl-transitions": "^2015.11.8",
"react-native": "^0.16.0"
"react-native": "^0.17.0"
}
}
2 changes: 1 addition & 1 deletion Examples/AdvancedEffects/src/Banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void main( void ) {
class Banner extends React.Component {
render () {
const { width, height, time } = this.props;
return <Surface width={width} height={height} opaque={false}>
return <Surface width={width} height={height} opaque={false} onLoad={() => console.log("Banner onLoad")}>
<GL.Node shader={shaders.banner} uniforms={{ time: time }} />
</Surface>;
}
Expand Down
4 changes: 3 additions & 1 deletion Examples/AdvancedEffects/src/Slideshow.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ class Slideshow extends React.Component {
const transitionUniforms = this._uniforms;

return <View style={styles.root}>
<Surface width={width} height={height}>
<Surface width={width} height={height}
onLoad={() => console.log("Slideshow onLoad")}
onProgress={e => console.log("Slideshow onProgress", e.nativeEvent)}>
<Transition
progress={transitionProgress}
from={transitionFrom}
Expand Down
1 change: 1 addition & 0 deletions Examples/AdvancedEffects/src/Vignette.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class Vignette extends React.Component {
preload
onStartShouldSetResponder={() => true}
onMoveShouldSetResponder={() => true}
onLoad={() => console.log("Vignette onLoad")}
onResponderMove={this.onResponderMove}>
<GL.Node
shader={shaders.imageVignette}
Expand Down
6 changes: 3 additions & 3 deletions Examples/Simple/android/app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.fresco/fresco/0.8.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.fresco/imagepipeline-okhttp/0.8.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.fresco/imagepipeline/0.8.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.react/react-native/0.16.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.react/react-native/0.17.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/org.webkit/android-jsc/r174650/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
Expand All @@ -96,15 +96,15 @@
<orderEntry type="library" exported="" name="okio-1.6.0" level="project" />
<orderEntry type="library" exported="" name="stetho-okhttp-1.2.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.5.0" level="project" />
<orderEntry type="library" exported="" name="stetho-1.2.0" level="project" />
<orderEntry type="library" exported="" name="jsr305-3.0.0" level="project" />
<orderEntry type="library" exported="" name="stetho-1.2.0" level="project" />
<orderEntry type="library" exported="" name="jackson-core-2.2.3" level="project" />
<orderEntry type="library" exported="" name="fbcore-0.8.1" level="project" />
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="imagepipeline-0.8.1" level="project" />
<orderEntry type="library" exported="" name="react-native-0.17.1" level="project" />
<orderEntry type="library" exported="" name="android-jsc-r174650" level="project" />
<orderEntry type="library" exported="" name="react-native-0.16.1" level="project" />
<orderEntry type="library" exported="" name="fresco-0.8.1" level="project" />
<orderEntry type="library" exported="" name="imagepipeline-okhttp-0.8.1" level="project" />
<orderEntry type="library" exported="" name="bolts-android-1.1.4" level="project" />
Expand Down
2 changes: 1 addition & 1 deletion Examples/Simple/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ android {
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:0.16.+"
compile "com.facebook.react:react-native:0.17.+"

compile project(":RNMaterialKit")
compile project(":RNGL")
Expand Down
3 changes: 2 additions & 1 deletion Examples/Simple/index.ios.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { AppRegistry } = require("react-native");
const { AppRegistry, StatusBarIOS } = require("react-native");
const Simple = require("./src");
StatusBarIOS.setHidden(true);
AppRegistry.registerComponent("Simple", () => Simple);
2 changes: 1 addition & 1 deletion Examples/Simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dependencies": {
"gl-react-native": "file:../..",
"gl-react": "^2.0.2",
"react-native": "^0.16.0",
"react-native": "^0.17.0",
"react-native-material-kit": "^0.2.2"
}
}
79 changes: 47 additions & 32 deletions Examples/Simple/src/OneFingerResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const React = require("react-native");
const GL = require("gl-react");
const {Surface} = require("gl-react-native");

const {PanResponder, UIManager} = React;

const shaders = GL.Shaders.create({
oneFingerResponse: {
frag: `
Expand All @@ -26,44 +28,57 @@ class OneFingerResponse extends React.Component {
super(props);
this.state = {
pressed: 0,
position: [ 0, 0 ]
position: [ 0, 0 ],
surfaceBound: [ 0, 0, 1, 1 ] // x, y, w, h
};
this.onTouchStart = this.onTouchStart.bind(this);
this.onTouchEnd = this.onTouchEnd.bind(this);
this.onTouchMove = this.onTouchMove.bind(this);
}
onTouchStart (evt) {
this.setState({
pressed: 1
});
this.onTouchMove(evt);
}
onTouchMove (evt) {
const { width, height } = this.props;
const { locationX, locationY } = evt.nativeEvent;
this.setState({
position: [
Math.max(0, Math.min(locationX/width, 1)),
Math.max(0, Math.min(1-locationY/height, 1))
]
});
}
onTouchEnd () {
this.setState({
pressed: 0

this._panResponder = PanResponder.create({
onStartShouldSetPanResponder: (evt, gestureState) => true,
onStartShouldSetPanResponderCapture: (evt, gestureState) => true,
onMoveShouldSetPanResponder: (evt, gestureState) => true,
onMoveShouldSetPanResponderCapture: (evt, gestureState) => true,

onPanResponderGrant: (evt, gestureState) =>
UIManager.measure(
React.findNodeHandle(this.refs.surface),
(a, b, w, h, x, y) =>
this.setState({
pressed: 1,
surfaceBound: [x,y,w,h],
position: [ gestureState.x0, gestureState.y0 ]
})),

onPanResponderMove: (evt, gestureState) =>
this.setState({
position: [ gestureState.x0 + gestureState.dx, gestureState.y0 + gestureState.dy ]
}),

onPanResponderTerminationRequest: (evt, gestureState) => true,

onPanResponderRelease: (evt, gestureState) =>
this.setState({
pressed: 0
}),

onPanResponderTerminate: (evt, gestureState) =>
this.setState({
pressed: 0
}),

onShouldBlockNativeResponder: (evt, gestureState) => true
});

}
render () {
const { width, height } = this.props;
const { pressed, position } = this.state;
const { pressed, position:[x,y], surfaceBound: [sx,sy,sw,sh] } = this.state;
const position = [
(x - sx) / sw,
1 - (y - sy) / sh
];
return <Surface
onStartShouldSetResponderCapture={() => true}
onMoveShouldSetResponderCapture={() => true}
onResponderTerminationRequest={() => false}
onResponderGrant={this.onTouchStart}
onResponderMove={this.onTouchMove}
onResponderRelease={this.onTouchEnd}
onResponderTerminate={this.onTouchEnd}
ref="surface"
{...this._panResponder.panHandlers}
width={width}
height={height}>
<GL.Node
Expand Down
47 changes: 31 additions & 16 deletions Examples/Simple/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
Image,
TextInput,
Component,
TouchableOpacity
} = React;

const { Surface } = require("gl-react-native");
Expand Down Expand Up @@ -84,10 +85,19 @@ class Simple extends Component {
captured: null
};
this.onCapture1 = this.onCapture1.bind(this);

/*
// Crazy stress mode
const self = this;
setTimeout(function loop () {
setTimeout(loop, 100 * Math.random());
self.setState({ current: Math.floor(8 * Math.random()) });
}, 100);
*/
}

onCapture1 () {
this.refs.helloGL.captureFrame(data64 => {
this.refs.helloGL.captureFrame().then(data64 => {
this.setState({ captured: data64 });
});
}
Expand All @@ -108,21 +118,22 @@ class Simple extends Component {

return <View style={styles.container}>
<Text style={styles.title}>
Welcome to GL React Native!
gl-react-native > Simple
</Text>

<Demos onChange={current => this.setState({ current })} value={current}>
<Demo title="1. Hello GL">
<Demo id={1} title="1. Hello GL">
<Surface width={256} height={171} ref="helloGL">
<HelloGL />
</Surface>
<View style={{ paddingTop: 20, alignItems: "center", flexDirection: "row" }}>
<Button onPress={this.onCapture1}>captureFrame()</Button>
{captured && <Image source={{ uri:captured }} style={{ marginLeft: 20, width: 51, height: 34 }} />}
{captured && <Image source={{ uri: captured }} style={{ marginLeft: 20, width: 51, height: 34 }} />}
</View>
{captured && <Text style={{ marginTop: 10, fontSize: 10, fontFamily: "Cochin" }} numberOfLines={1}>{captured.slice(0, 100)}</Text>}
</Demo>

<Demo title="2. Saturate an Image">
<Demo id={2} title="2. Saturate an Image">
<Surface width={256} height={171}>
<Saturation
factor={saturationFactor}
Expand Down Expand Up @@ -156,16 +167,19 @@ class Simple extends Component {

<Demo id={4} current={current} title="4. Progress Indicator">
<View style={{ position: "relative", width: 256, height: 180 }}>
<Image style={{
width: 256,
height: 180,
position: "absolute",
top: 0,
left: 0
}}
source={{ uri: "http://i.imgur.com/qM9BHCy.jpg" }}/>
<View style={{ position: "absolute", top: 0, left: 0 }}>
<Surface width={256} height={180} opaque={false}>
<TouchableOpacity>
<Image source={{ uri: "http://i.imgur.com/qM9BHCy.jpg" }}
style={{
width: 256,
height: 180,
position: "absolute",
top: 0,
left: 0
}}
/>
</TouchableOpacity>
<View pointerEvents="box-none" style={{ position: "absolute", top: 0, left: 0, backgroundColor: "transparent" }}>
<Surface width={256} height={180} opaque={false} eventsThrough>
<PieProgress progress={progress} width={256} height={180} />
</Surface>
</View>
Expand Down Expand Up @@ -217,7 +231,7 @@ class Simple extends Component {
width={256}
height={160}
factor={factor/2}>
<View style={{ width: 256, height: 160, padding: 10, backgroundColor: "#F9F9F9" }}>
<View style={{ width: 256, height: 160, padding: 10, backgroundColor: "#f9f9f9" }}>
<Slider
style={{ height: 80 }}
max={2}
Expand All @@ -235,6 +249,7 @@ class Simple extends Component {
</Blur>
</HueRotate>
</Surface>
<Text>Note: This is highly experimental and not yet performant enough.</Text>
</Demo>

<Demo id={9} current={current} title="9. Texture from array">
Expand Down
6 changes: 3 additions & 3 deletions Examples/Tests/android/app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.fresco/fresco/0.8.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.fresco/imagepipeline-okhttp/0.8.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.fresco/imagepipeline/0.8.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.react/react-native/0.16.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.react/react-native/0.17.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/org.webkit/android-jsc/r174650/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
Expand All @@ -96,15 +96,15 @@
<orderEntry type="library" exported="" name="okio-1.6.0" level="project" />
<orderEntry type="library" exported="" name="stetho-okhttp-1.2.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.5.0" level="project" />
<orderEntry type="library" exported="" name="stetho-1.2.0" level="project" />
<orderEntry type="library" exported="" name="jsr305-3.0.0" level="project" />
<orderEntry type="library" exported="" name="stetho-1.2.0" level="project" />
<orderEntry type="library" exported="" name="jackson-core-2.2.3" level="project" />
<orderEntry type="library" exported="" name="fbcore-0.8.1" level="project" />
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="imagepipeline-0.8.1" level="project" />
<orderEntry type="library" exported="" name="react-native-0.17.1" level="project" />
<orderEntry type="library" exported="" name="android-jsc-r174650" level="project" />
<orderEntry type="library" exported="" name="react-native-0.16.1" level="project" />
<orderEntry type="library" exported="" name="fresco-0.8.1" level="project" />
<orderEntry type="library" exported="" name="imagepipeline-okhttp-0.8.1" level="project" />
<orderEntry type="library" exported="" name="bolts-android-1.1.4" level="project" />
Expand Down
2 changes: 1 addition & 1 deletion Examples/Tests/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ android {
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:0.16.+"
compile "com.facebook.react:react-native:0.17.+"

compile project(":RNGL")
}
Loading

0 comments on commit 935b358

Please sign in to comment.