Skip to content

Commit

Permalink
Merge pull request #3 from reindernijhoff/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
reindernijhoff committed Nov 18, 2015
2 parents 40d47f9 + 5852908 commit 63a41ab
Show file tree
Hide file tree
Showing 30 changed files with 394 additions and 69 deletions.
7 changes: 6 additions & 1 deletion shadertoy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
objects = {

/* Begin PBXBuildFile section */
4B2FD9E31BC16FC20026F317 /* shaders in Resources */ = {isa = PBXBuildFile; fileRef = 4B2FD9E21BC16FC20026F317 /* shaders */; };
4B375CA31B85038F00583F2B /* ShaderCanvasViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B375CA21B85038F00583F2B /* ShaderCanvasViewController.m */; };
4B375CA91B85DCF600583F2B /* presets in Resources */ = {isa = PBXBuildFile; fileRef = 4B375CA81B85DCF600583F2B /* presets */; };
4B759EDE1BADDF93001563AA /* VRSettings.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B759EDD1BADDF93001563AA /* VRSettings.m */; settings = {ASSET_TAGS = (); }; };
4B759EDE1BADDF93001563AA /* VRSettings.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B759EDD1BADDF93001563AA /* VRSettings.m */; };
4B8610B61B8C7B6900928AD5 /* AboutViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B8610B51B8C7B6900928AD5 /* AboutViewController.m */; };
4B8610BA1B94590E00928AD5 /* Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B8610B91B94590E00928AD5 /* Utils.m */; };
4B8610BE1B947F9600928AD5 /* SoundPassPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B8610BD1B947F9600928AD5 /* SoundPassPlayer.m */; };
Expand All @@ -35,6 +36,7 @@
/* Begin PBXFileReference section */
2800C908504AD9E3F8AB4736 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
4874C87E02ECA6C569F740F2 /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4B2FD9E21BC16FC20026F317 /* shaders */ = {isa = PBXFileReference; lastKnownFileType = folder; path = shaders; sourceTree = "<group>"; };
4B375CA11B85038F00583F2B /* ShaderCanvasViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShaderCanvasViewController.h; sourceTree = "<group>"; };
4B375CA21B85038F00583F2B /* ShaderCanvasViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShaderCanvasViewController.m; sourceTree = "<group>"; };
4B375CA81B85DCF600583F2B /* presets */ = {isa = PBXFileReference; lastKnownFileType = folder; path = presets; sourceTree = "<group>"; };
Expand Down Expand Up @@ -112,6 +114,7 @@
4BF748C61B84852A00E2F772 /* shadertoy */ = {
isa = PBXGroup;
children = (
4B2FD9E21BC16FC20026F317 /* shaders */,
4B8610B41B8C7B6900928AD5 /* AboutViewController.h */,
4B8610B51B8C7B6900928AD5 /* AboutViewController.m */,
4BF749071B84B1B500E2F772 /* APIShaderObject.h */,
Expand Down Expand Up @@ -214,6 +217,7 @@
TargetAttributes = {
4BF748C31B84852A00E2F772 = {
CreatedOnToolsVersion = 6.4;
DevelopmentTeam = 98UZZR2W46;
};
};
};
Expand Down Expand Up @@ -243,6 +247,7 @@
4BF748D61B84852A00E2F772 /* Main.storyboard in Resources */,
4BF748FF1B8498E100E2F772 /* QueryTableViewCell.xib in Resources */,
4B375CA91B85DCF600583F2B /* presets in Resources */,
4B2FD9E31BC16FC20026F317 /* shaders in Resources */,
4BF748DB1B84852A00E2F772 /* LaunchScreen.xib in Resources */,
4BF748D81B84852A00E2F772 /* Images.xcassets in Resources */,
);
Expand Down
14 changes: 14 additions & 0 deletions shadertoy/APIShaderObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@
#import <Foundation/Foundation.h>
#import "AFNetworking.h"

@interface APIShaderPassInputSampler : NSObject

- (APIShaderPassInputSampler *) updateWithDict:(NSDictionary *) dict;
- (void)encodeWithCoder:(NSCoder *)coder;
- (id)initWithCoder:(NSCoder *)coder;

@property (nonatomic, strong) NSString *filter;
@property (nonatomic, strong) NSString *wrap;
@property (nonatomic, strong) NSString *vflip;
@property (nonatomic, strong) NSString *srgb;

@end

@interface APIShaderPassInput : NSObject

- (APIShaderPassInput *) updateWithDict:(NSDictionary *) dict;
Expand All @@ -19,6 +32,7 @@
@property (nonatomic, strong) NSString *src;
@property (nonatomic, strong) NSString *ctype;
@property (nonatomic, strong) NSNumber *channel;
@property (nonatomic, strong) APIShaderPassInputSampler *sampler;

@end

Expand Down
40 changes: 39 additions & 1 deletion shadertoy/APIShaderObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,55 @@

#import "APIShaderObject.h"


@implementation APIShaderPassInputSampler : NSObject
- (APIShaderPassInputSampler *) updateWithDict:(NSDictionary *) dict {
self.filter = [dict objectForKey:@"filter"];
self.wrap = [dict objectForKey:@"wrap"];
self.vflip = [dict objectForKey:@"vflip"];
self.srgb = [dict objectForKey:@"srgb"];

return self;
}
- (void)encodeWithCoder:(NSCoder *)coder {
[coder encodeObject:self.filter forKey:@"filter"];
[coder encodeObject:self.wrap forKey:@"wrap"];
[coder encodeObject:self.vflip forKey:@"vflip"];
[coder encodeObject:self.srgb forKey:@"srgb"];
}
- (id)initWithCoder:(NSCoder *)coder {
self = [super init];
if (self != nil) {
self.filter = [coder decodeObjectForKey:@"filter"];
self.wrap = [coder decodeObjectForKey:@"wrap"];
self.vflip = [coder decodeObjectForKey:@"vflip"];
self.srgb = [coder decodeObjectForKey:@"srgb"];
}
return self;
}
@end


@implementation APIShaderPassInput : NSObject
- (APIShaderPassInput *) updateWithDict:(NSDictionary *) dict {
self.inputId = [dict objectForKey:@"id"];
self.src = [dict objectForKey:@"src"];
self.ctype = [dict objectForKey:@"ctype"];
self.channel = [dict objectForKey:@"channel"];

NSDictionary* d = [dict objectForKey:@"sampler"];
if( d ) { // backward compatibility
self.sampler = [[[APIShaderPassInputSampler alloc] init] updateWithDict:d];
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)coder {
[coder encodeObject:self.inputId forKey:@"inputId"];
[coder encodeObject:self.src forKey:@"src"];
[coder encodeObject:self.ctype forKey:@"ctype"];
[coder encodeObject:self.channel forKey:@"channel"];
if( self.sampler ) { // backward compatibility
[coder encodeObject:self.sampler forKey:@"sampler"];
}
}
- (id)initWithCoder:(NSCoder *)coder {
self = [super init];
Expand All @@ -30,6 +65,9 @@ - (id)initWithCoder:(NSCoder *)coder {
self.src = [coder decodeObjectForKey:@"src"];
self.ctype = [coder decodeObjectForKey:@"ctype"];
self.channel = [coder decodeObjectForKey:@"channel"];
if( [coder containsValueForKey:@"sampler"] ) { // backward compatibility
self.sampler = [coder decodeObjectForKey:@"sampler"];
}
}
return self;
}
Expand Down
Loading

0 comments on commit 63a41ab

Please sign in to comment.