Commit 1eae443e authored by Gaëtan Renaudeau's avatar Gaëtan Renaudeau

changes with latest gl-react-core

parent 99e5ce2e
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* on the same Wi-Fi network. * on the same Wi-Fi network.
*/ */
//jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"]; jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"];
/** /**
* OPTION 2 * OPTION 2
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
* see http://facebook.github.io/react-native/docs/runningondevice.html * see http://facebook.github.io/react-native/docs/runningondevice.html
*/ */
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; //jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"Simple" moduleName:@"Simple"
......
...@@ -180,8 +180,14 @@ NSString* srcResource (id res) ...@@ -180,8 +180,14 @@ NSString* srcResource (id res)
id value = [data.uniforms objectForKey:uniformName]; id value = [data.uniforms objectForKey:uniformName];
GLenum type = [uniformTypes[uniformName] intValue]; GLenum type = [uniformTypes[uniformName] intValue];
if (value && (type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE)) { if (type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE) {
uniforms[uniformName] = [NSNumber numberWithInt:units++]; uniforms[uniformName] = [NSNumber numberWithInt:units++];
if (!value) {
GLTexture *emptyTexture = [[GLTexture alloc] init];
[emptyTexture setPixelsEmpty];
textures[uniformName] = emptyTexture;
}
else {
NSString *type = [RCTConvert NSString:value[@"type"]]; NSString *type = [RCTConvert NSString:value[@"type"]];
if ([type isEqualToString:@"content"]) { if ([type isEqualToString:@"content"]) {
int id = [[RCTConvert NSNumber:value[@"id"]] intValue]; int id = [[RCTConvert NSNumber:value[@"id"]] intValue];
...@@ -190,16 +196,15 @@ NSString* srcResource (id res) ...@@ -190,16 +196,15 @@ NSString* srcResource (id res)
} }
textures[uniformName] = _contentTextures[id]; textures[uniformName] = _contentTextures[id];
} }
else if ([type isEqualToString:@"framebuffer"]) { else if ([type isEqualToString:@"fbo"]) {
NSNumber *id = [RCTConvert NSNumber:value[@"id"]]; NSNumber *id = [RCTConvert NSNumber:value[@"id"]];
GLFBO *fbo = [GLShadersRegistry getFBO:id]; GLFBO *fbo = [GLShadersRegistry getFBO:id];
textures[uniformName] = fbo.color[0]; textures[uniformName] = fbo.color[0];
} }
else if ([type isEqualToString:@"image"]) { else if ([type isEqualToString:@"uri"]) {
NSObject *val = value[@"value"]; NSString *src = srcResource(value);
NSString *src = srcResource(val);
if (!src) { if (!src) {
RCTLogError(@"invalid uniform '%@' texture value '%@'", uniformName, value); RCTLogError(@"texture uniform '%@': Invalid uri format '%@'", uniformName, value);
} }
GLImage *image = images[src]; GLImage *image = images[src];
...@@ -218,7 +223,8 @@ NSString* srcResource (id res) ...@@ -218,7 +223,8 @@ NSString* srcResource (id res)
textures[uniformName] = [image getTexture]; textures[uniformName] = [image getTexture];
} }
else { else {
RCTLogError(@"invalid uniform '%@' value of type '%@'", uniformName, type); RCTLogError(@"texture uniform '%@': Unexpected type '%@'", uniformName, type);
}
} }
} }
else { else {
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
"dependencies": { "dependencies": {
"invariant": "2.1.0", "invariant": "2.1.0",
"react-native": ">=0.9.0 <0.12.0", "react-native": ">=0.9.0 <0.12.0",
"gl-react-core": "1.0.0" "gl-react-core": "git+ssh://git@github.com:ProjectSeptemberInc/gl-react-core.git"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^1.3.1", "eslint": "^1.3.1",
......
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