-
Notifications
You must be signed in to change notification settings - Fork 10
/
OutlineShader.mm
57 lines (39 loc) · 1.17 KB
/
OutlineShader.mm
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
//
// OutlineShader.m
// Core3D
//
// Created by CoreCode on 13.10.08.
// Copyright 2007 - 2012 CoreCode. Licensed under the MIT License, see LICENSE.txt
//
#import "Core3D.h"
#import "OutlineShader.h"
@implementation OutlineShader
- (void)render // override render instead of implementing renderNode
{
// main pass
[children makeObjectsPerformSelector:@selector(render)];
// edge pass
if (globalSettings.outlineMode)
{
glCullFace(GL_FRONT);
#ifndef GL_ES_VERSION_2_0
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
#endif
if (globalSettings.outlineMode == 1)
myLineWidth((GLfloat) [scene bounds].width / 800);
else if (globalSettings.outlineMode == 2)
myLineWidth((GLfloat) [scene bounds].width / 550);
else if (globalSettings.outlineMode == 3)
myLineWidth((GLfloat) [scene bounds].width / 400);
globalMaterial.color = globalSettings.outlineColor;
[[scene colorOnlyShader] bind];
currentRenderPass.settings = kRenderPassUsePVS;
[children makeObjectsPerformSelector:@selector(render)];
currentRenderPass.settings = kMainRenderPass;
glCullFace(GL_BACK);
#ifndef GL_ES_VERSION_2_0
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
#endif
}
}
@end