-
Notifications
You must be signed in to change notification settings - Fork 8
/
KinemeGLPolygonOffsetPatch.m
53 lines (44 loc) · 1.15 KB
/
KinemeGLPolygonOffsetPatch.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
/*
* KinemeGLPolygonOffsetPatch.m
* GLTools
*
* Created by Christopher Wright on 10/20/08.
* Copyright (c) 2008 Kosada Incorporated. All rights reserved.
*
*/
#import <OpenGL/CGLMacro.h>
#import "KinemeGLPolygonOffsetPatch.h"
@implementation KinemeGLPolygonOffsetPatch : 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])
[[self userInfo] setObject:@"Kineme GL Polygon Offset" forKey:@"name"];
return self;
}
- (BOOL)execute:(QCOpenGLContext *)context time:(double)time arguments:(NSDictionary *)arguments
{
CGLContextObj cgl_ctx = [context CGLContextObj];
glPolygonOffset([inputFactor doubleValue], [inputUnits doubleValue]);
glEnable(GL_POLYGON_OFFSET_FILL);
glEnable(GL_POLYGON_OFFSET_LINE);
glEnable(GL_POLYGON_OFFSET_POINT);
[self executeSubpatches: time arguments: arguments];
glDisable(GL_POLYGON_OFFSET_FILL);
glDisable(GL_POLYGON_OFFSET_LINE);
glDisable(GL_POLYGON_OFFSET_POINT);
glPolygonOffset(0.f, 0.f);
return YES;
}
@end