-
Notifications
You must be signed in to change notification settings - Fork 8
/
KinemeGLFrustumPatch.m
69 lines (57 loc) · 1.48 KB
/
KinemeGLFrustumPatch.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#import <OpenGL/CGLMacro.h>
#import "KinemeGLFrustumPatch.h"
@implementation KinemeGLFrustumPatch : QCPatch
+ (QCPatchExecutionMode)executionModeWithIdentifier:(id)fp8
{
return 1;
}
+ (BOOL)allowsSubpatchesWithIdentifier:(id)fp8
{
return YES;
}
+ (BOOL)isSafe
{
return YES;
}
- (id)initWithIdentifier:(id)fp8
{
self=[super initWithIdentifier:fp8];
if(self)
{
[inputLeft setDoubleValue:-1.];
[inputRight setDoubleValue:+1.];
[inputBottom setDoubleValue:-3./4];
[inputTop setDoubleValue:+3./4];
[inputNear setDoubleValue:0.1];
[inputNear setMinDoubleValue:0.0];
[inputFar setDoubleValue:10];
[inputFar setMinDoubleValue:0.0];
[[self userInfo] setObject:@"Kineme GL Frustum" forKey:@"name"];
}
return self;
}
- (BOOL)execute:(QCOpenGLContext *)context time:(double)time arguments:(NSDictionary *)arguments
{
if([inputBypass booleanValue])
{
[self executeSubpatches:time arguments:arguments];
return YES;
}
CGLContextObj cgl_ctx = [context CGLContextObj];
glMatrixMode(GL_PROJECTION);
glPushMatrix();
{
glLoadIdentity();
glFrustum([inputLeft doubleValue],[inputRight doubleValue],
[inputBottom doubleValue], [inputTop doubleValue],
[inputNear doubleValue], [inputFar doubleValue]);
// glTranslatef([inputTX doubleValue], [inputTY doubleValue], [inputTZ doubleValue]);
glMatrixMode(GL_MODELVIEW);
[self executeSubpatches:time arguments:arguments];
}
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
return YES;
}
@end