-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathKinemeGLColorMaskPatch.m
61 lines (49 loc) · 1.2 KB
/
KinemeGLColorMaskPatch.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
/*
* GLColorMask.m
* GLTools
*
* Created by Christopher Wright on 9/2/08.
* Copyright (c) 2008 Kosada Incorporated. All rights reserved.
*
*/
#import "KinemeGLColorMaskPatch.h"
#import <OpenGL/CGLMacro.h>
@implementation KinemeGLColorMaskPatch : QCPatch
+ (QCPatchExecutionMode)executionModeWithIdentifier:(id)fp8
{
return 1;
}
+ (BOOL)allowsSubpatchesWithIdentifier:(id)fp8
{
return YES;
}
+ (BOOL)isSafe
{
return YES;
}
- (id)initWithIdentifier:(id)fp8
{
if(self=[super initWithIdentifier:fp8])
{
[inputRed setBooleanValue: YES];
[inputGreen setBooleanValue: YES];
[inputBlue setBooleanValue: YES];
[inputAlpha setBooleanValue: YES];
[[self userInfo] setObject:@"Kineme GL Color Mask" forKey:@"name"];
}
return self;
}
- (BOOL)execute:(QCOpenGLContext *)context time:(double)time arguments:(NSDictionary *)arguments
{
CGLContextObj cgl_ctx = [context CGLContextObj];
GLboolean mask[4];
glGetBooleanv(GL_COLOR_WRITEMASK, mask);
glColorMask([inputRed booleanValue],
[inputGreen booleanValue],
[inputBlue booleanValue],
[inputAlpha booleanValue]);
[self executeSubpatches:time arguments:arguments];
glColorMask(mask[0], mask[1], mask[2], mask[3]);
return YES;
}
@end