mirror of
https://github.com/expo/gl-react-native.git
synced 2026-11-15 17:34:35 -10:00
39 lines
1.3 KiB
Objective-C
39 lines
1.3 KiB
Objective-C
#import "RCTConvert+GLData.h"
|
|
|
|
@implementation RCTConvert (GLData)
|
|
|
|
+ (GLData *)GLData:(id)json
|
|
{
|
|
json = [self NSDictionary:json];
|
|
|
|
NSNumber *shader = [self NSNumber:json[@"shader"]];
|
|
NSDictionary *uniforms = [self NSDictionary:json[@"uniforms"]];
|
|
NSNumber *width = [self NSNumber:json[@"width"]];
|
|
NSNumber *height = [self NSNumber:json[@"height"]];
|
|
NSNumber *fboId = [self NSNumber:json[@"fboId"]];
|
|
NSArray *contextChildrenJSON = [self NSArray: json[@"contextChildren"]];
|
|
NSArray *childrenJSON = [self NSArray: json[@"children"]];
|
|
|
|
NSMutableArray *children = [NSMutableArray array];
|
|
for (NSObject *childJSON in childrenJSON) {
|
|
GLData *child = [self GLData:childJSON];
|
|
[children addObject:child];
|
|
}
|
|
|
|
NSMutableArray *contextChildren = [NSMutableArray array];
|
|
for (NSObject *childJSON in contextChildrenJSON) {
|
|
GLData *child = [self GLData:childJSON];
|
|
[contextChildren addObject:child];
|
|
}
|
|
|
|
return [[GLData alloc] initWithShader: shader
|
|
withUniforms: uniforms
|
|
withWidth: width
|
|
withHeight: height
|
|
withFboId: fboId
|
|
withContextChildren: contextChildren
|
|
withChildren: children];
|
|
}
|
|
|
|
@end
|