vvopensource
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups Pages
ISFAttrib.h
Go to the documentation of this file.
1 
4 #import <Cocoa/Cocoa.h>
5 
6 
7 
8 
10 
13 typedef enum {
23 
26 typedef union ISFAttribVal {
27  BOOL eventVal;
28  BOOL boolVal;
29  long longVal;
30  GLfloat floatVal;
31  GLfloat point2DVal[2];
32  GLfloat colorVal[4];
33  long imageVal;
34 } ISFAttribVal;
35 
36 
37 
38 
40 
43 @interface ISFAttrib : NSObject {
44  NSString *attribName;
45  NSString *attribDescription;
46  NSString *attribLabel;
53  NSMutableArray *labelArray; // only used if it's a LONG. array containing NSStrings that correspond to the values in "valArray"
54  NSMutableArray *valArray; // only used if it's a LONG. array containing NSNumbers with the values that correspond to the accompanying labels
55  BOOL isFilterInputImage; // if YES, this is an image-type input and is the main input for an image filter
56  id userInfo; // retained- used to retain an NSObject-based GL resource for the lifetime of the input (retains an image for image attributes)
57  int uniformLocation[4]; // the location of this attribute in the compiled GLSL program. cached here because lookup times are costly when performed every frame. there are 4 because images require four uniforms (one of the texture name, one for the size, one for the img rect, and one for the flippedness)
58 }
59 
60 // creating attributes isn't really covered in the published documentation because you probably shouldn't be doing it from outside the framework.
61 + (id) createWithName:(NSString *)n description:(NSString *)desc label:(NSString *)l type:(ISFAttribValType)t values:(ISFAttribVal)min :(ISFAttribVal) max :(ISFAttribVal)def :(ISFAttribVal)iden :(NSArray *)lArray :(NSArray *)vArray;
62 - (id) initWithName:(NSString *)n description:(NSString *)desc label:(NSString *)l type:(ISFAttribValType)t values:(ISFAttribVal)min :(ISFAttribVal) max :(ISFAttribVal)def :(ISFAttribVal)iden :(NSArray *)lArray :(NSArray *)vArray;
63 
65 - (NSString *) attribName;
67 - (NSString *) attribDescription;
69 - (NSString *) attribLabel;
71 - (ISFAttribValType) attribType;
72 
74 - (ISFAttribVal) currentVal;
76 - (void) setCurrentVal:(ISFAttribVal)n;
78 - (ISFAttribVal) minVal;
80 - (ISFAttribVal) maxVal;
82 - (ISFAttribVal) defaultVal;
84 - (ISFAttribVal) identityVal;
86 - (NSMutableArray *) labelArray;
88 - (NSMutableArray *) valArray;
89 
90 - (void) setIsFilterInputImage:(BOOL)n;
92 - (BOOL) isFilterInputImage;
93 
95 - (void) setUserInfo:(id)n;
97 - (id) userInfo;
98 - (void) setUniformLocation:(int)n forIndex:(int)i;
99 - (int) uniformLocationForIndex:(int)i;
100 - (void) clearUniformLocations;
101 
102 @end
NSString * attribName()
returns the name of the attribute- the name of the attribute is also the variable name in the source!...
Definition: ISFAttrib.m:149
GLfloat floatVal
used if this is a float attribute
Definition: ISFAttrib.h:30
GLfloat colorVal[4]
array of four floats, used if this is a color attribute
Definition: ISFAttrib.h:32
sends a 2 element vector
Definition: ISFAttrib.h:18
long longVal
if this is a long attribute, store the desired value here
Definition: ISFAttrib.h:29
sends a long
Definition: ISFAttrib.h:16
internally, an ISFGLScene creates an ISFAttrib for each of the declared inputs in an ISF file...
Definition: ISFAttrib.h:43
NSString * attribDescription()
returns the description of the attribute (from the JSON blob) as an NSString
Definition: ISFAttrib.m:152
union ISFAttribVal ISFAttribVal
union describing a value for one of the listed attribute types
ISFAttribVal defaultVal()
returns a union describing this attribute's default val
Definition: ISFAttrib.m:198
no data, just an event. sends a 1 the next render after the event is received, a 0 any other time it'...
Definition: ISFAttrib.h:14
ISFAttribVal maxVal()
returns a union describing this attribute's max val
Definition: ISFAttrib.m:195
a long- the texture number (like GL_TEXTURE0) to pass to the shader
Definition: ISFAttrib.h:20
ISFAttribVal identityVal()
returns a union describing this attribute's identity val
Definition: ISFAttrib.m:201
a boolean choice, sends 1 or 0 to the shader
Definition: ISFAttrib.h:15
BOOL eventVal
if this is an event attribute, set eventVal to YES
Definition: ISFAttrib.h:27
NSMutableArray * labelArray()
only used if this is an ISFAT_Long-type attribute- returns an array containing labels (NSStrings) for...
Definition: ISFAttrib.m:204
long imageVal
not really used- you never pass images as values (images are passed as VVBuffers, as there are resour...
Definition: ISFAttrib.h:33
ISFAttribValType attribType()
returns an ISFAttribValType describing what type of attribute this is (what kind of value/input it is...
Definition: ISFAttrib.m:158
GLfloat point2DVal[2]
array of two floats, used if this is a point2D attribute
Definition: ISFAttrib.h:31
sends a 4 element vector representing an RGBA color
Definition: ISFAttrib.h:19
NSMutableArray * valArray()
only used if this is an ISFAT_Long-type attribute- returns an array containing values (NSNumbers) for...
Definition: ISFAttrib.m:207
ISFAttribVal minVal()
returns a union describing this attribute's min val
Definition: ISFAttrib.m:192
id userInfo()
returns the userInfo, an arbitrary id retained with this attribute
Definition: ISFAttrib.m:225
union describing a value for one of the listed attribute types
Definition: ISFAttrib.h:26
ISFAttribVal currentVal()
returns the current value of this attribute. not useful if this is an image attribute- if this is an ...
Definition: ISFAttrib.m:162
ISFAttribValType
enum describing the different types of attributes listed in the ISF spec
Definition: ISFAttrib.h:13
BOOL isFilterInputImage()
returns a YES if this attribute describes the default input for an image filter
Definition: ISFAttrib.m:215
sends a float
Definition: ISFAttrib.h:17
NSString * attribLabel()
returns the label of the attribute (from the JSON blob) as an NSString
Definition: ISFAttrib.m:155
BOOL boolVal
if this is a bool attribute, store the desired value here
Definition: ISFAttrib.h:28