vvopensource
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups Pages
ISFTargetBuffer.h
1 #import <Cocoa/Cocoa.h>
2 #import <VVBasics/VVBasics.h>
3 #import <VVBufferPool/VVBufferPool.h>
4 #import <DDMathParser/DDExpression.h>
5 
6 
7 
8 
9 /*
10  this class represents a target buffer for an ISF shader- it stores the VVBuffer (the GL
11  resource) as well as the expressions determining the width/height (the raw string, the
12  evaluated expression- capable of being executed with substitutions for variables, and the
13  evaluated value), and the cached uniform locations for this target buffer's attributes in
14  the compiled GL program (so you don't have to look up the uniform location every frame).
15 */
16 
17 
18 
19 
20 @interface ISFTargetBuffer : NSObject {
21  NSString *name; // the name of this buffer
22  VVBuffer *buffer; // nil, or the VVBuffer instance for this
23 
24  double targetWidth;
25  NSString *targetWidthString;
26  DDExpression *targetWidthExpression;
27  double targetHeight;
28  NSString *targetHeightString;
29  DDExpression *targetHeightExpression;
30 
31  BOOL floatFlag; // NO by default. if YES, makes float textures!
32 
33  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)
34 }
35 
36 + (id) create;
37 
38 - (void) setTargetSize:(NSSize)n;
39 - (void) setTargetSize:(NSSize)n createNewBuffer:(BOOL)c;
40 - (void) setTargetSize:(NSSize)n resizeExistingBuffer:(BOOL)r;
41 - (void) setTargetSize:(NSSize)n resizeExistingBuffer:(BOOL)r createNewBuffer:(BOOL)c;
42 - (void) setTargetWidthString:(NSString *)n;
43 - (void) setTargetHeightString:(NSString *)n;
44 - (void) setFloatFlag:(BOOL)n;
45 - (BOOL) floatFlag;
46 - (void) clearBuffer;
47 
48 // returns a YES if there's a target width string
49 - (BOOL) targetSizeNeedsEval;
50 - (void) evalTargetSizeWithSubstitutionsDict:(NSDictionary *)d;
51 - (void) evalTargetSizeWithSubstitutionsDict:(NSDictionary *)d resizeExistingBuffer:(BOOL)r;
52 - (void) evalTargetSizeWithSubstitutionsDict:(NSDictionary *)d resizeExistingBuffer:(BOOL)r createNewBuffer:(BOOL)c;
53 
54 @property (retain,readwrite) NSString *name;
55 @property (retain,readwrite) VVBuffer *buffer;
56 
57 - (NSSize) targetSize;
58 
59 - (void) setUniformLocation:(int)n forIndex:(int)i;
60 - (int) uniformLocationForIndex:(int)i;
61 - (void) clearUniformLocations;
62 
63 @end
VVBuffer represents a buffer- almost always in VRAM as a GL texture or renderbuffer- created and mana...
Definition: VVBuffer.h:134