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

changes with latest gl-react-core

parent 99e5ce2e
......@@ -31,7 +31,7 @@
* 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
......@@ -43,7 +43,7 @@
* 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
moduleName:@"Simple"
......
......@@ -180,45 +180,51 @@ NSString* srcResource (id res)
id value = [data.uniforms objectForKey:uniformName];
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++];
NSString *type = [RCTConvert NSString:value[@"type"]];
if ([type isEqualToString:@"content"]) {
int id = [[RCTConvert NSNumber:value[@"id"]] intValue];
if (id >= [_contentTextures count]) {
[self resizeUniformContentTextures:id+1];
}
textures[uniformName] = _contentTextures[id];
}
else if ([type isEqualToString:@"framebuffer"]) {
NSNumber *id = [RCTConvert NSNumber:value[@"id"]];
GLFBO *fbo = [GLShadersRegistry getFBO:id];
textures[uniformName] = fbo.color[0];
if (!value) {
GLTexture *emptyTexture = [[GLTexture alloc] init];
[emptyTexture setPixelsEmpty];
textures[uniformName] = emptyTexture;
}
else if ([type isEqualToString:@"image"]) {
NSObject *val = value[@"value"];
NSString *src = srcResource(val);
if (!src) {
RCTLogError(@"invalid uniform '%@' texture value '%@'", uniformName, value);
else {
NSString *type = [RCTConvert NSString:value[@"type"]];
if ([type isEqualToString:@"content"]) {
int id = [[RCTConvert NSNumber:value[@"id"]] intValue];
if (id >= [_contentTextures count]) {
[self resizeUniformContentTextures:id+1];
}
textures[uniformName] = _contentTextures[id];
}
GLImage *image = images[src];
if (image == nil) {
image = prevImages[src];
if (image != nil)
else if ([type isEqualToString:@"fbo"]) {
NSNumber *id = [RCTConvert NSNumber:value[@"id"]];
GLFBO *fbo = [GLShadersRegistry getFBO:id];
textures[uniformName] = fbo.color[0];
}
else if ([type isEqualToString:@"uri"]) {
NSString *src = srcResource(value);
if (!src) {
RCTLogError(@"texture uniform '%@': Invalid uri format '%@'", uniformName, value);
}
GLImage *image = images[src];
if (image == nil) {
image = prevImages[src];
if (image != nil)
images[src] = image;
}
if (image == nil) {
image = [[GLImage alloc] initWithBridge:_bridge withOnLoad:^{
[self onImageLoad:src];
}];
image.src = src;
images[src] = image;
}
textures[uniformName] = [image getTexture];
}
if (image == nil) {
image = [[GLImage alloc] initWithBridge:_bridge withOnLoad:^{
[self onImageLoad:src];
}];
image.src = src;
images[src] = image;
else {
RCTLogError(@"texture uniform '%@': Unexpected type '%@'", uniformName, type);
}
textures[uniformName] = [image getTexture];
}
else {
RCTLogError(@"invalid uniform '%@' value of type '%@'", uniformName, type);
}
}
else {
......
......@@ -25,7 +25,7 @@
"dependencies": {
"invariant": "2.1.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": {
"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