-
Notifications
You must be signed in to change notification settings - Fork 8
/
KinemeGLMultMatrixPatch.m
78 lines (64 loc) · 1.4 KB
/
KinemeGLMultMatrixPatch.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
70
71
72
73
74
75
76
77
78
#import <OpenGL/gl.h>
#import <OpenGL/OpenGL.h>
#import <OpenGL/CGLMacro.h>
#import "KinemeGLMultMatrixPatch.h"
@implementation KinemeGLMultMatrixPatch : 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)
{
[input00 setDoubleValue:1.0];
[input11 setDoubleValue:1.0];
[input22 setDoubleValue:1.0];
[input33 setDoubleValue:1.0];
[[self userInfo] setObject:@"Kineme GL Matrix Mult" forKey:@"name"];
}
return self;
}
- (BOOL)execute:(QCOpenGLContext *)context time:(double)time arguments:(NSDictionary *)arguments
{
CGLContextObj cgl_ctx = [context CGLContextObj];
double m[16] =
{
[input00 doubleValue],
[input01 doubleValue],
[input02 doubleValue],
[input03 doubleValue],
[input10 doubleValue],
[input11 doubleValue],
[input12 doubleValue],
[input13 doubleValue],
[input20 doubleValue],
[input21 doubleValue],
[input22 doubleValue],
[input23 doubleValue],
[input30 doubleValue],
[input31 doubleValue],
[input32 doubleValue],
[input33 doubleValue],
};
glPushMatrix();
{
if([inputTranspose booleanValue])
glMultTransposeMatrixd(m);
else
glMultMatrixd(m);
[self executeSubpatches:time arguments:arguments];
}
glPopMatrix();
return YES;
}
@end