Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
OODebugGLDrawing.m File Reference
import "OODebugGLDrawing.h"
import "OOMacroOpenGL.h"
import "OOMaterial.h"
+ Include dependency graph for OODebugGLDrawing.m:

Go to the source code of this file.

Functions

OOINLINE void ApplyColor (OOColor *color)
 
void OODebugDrawColoredBoundingBoxBetween (Vector min, Vector max, OOColor *color)
 
void OODebugDrawColoredLine (Vector start, Vector end, OOColor *color)
 
void OODebugDrawBasis (Vector position, GLfloat scale)
 
void OODebugDrawPoint (Vector position, OOColor *color)
 
OODebugWFState OODebugBeginWireframe (BOOL ignoreZ)
 
void OODebugEndWireframe (OODebugWFState state)
 

Function Documentation

◆ ApplyColor()

OOINLINE void ApplyColor ( OOColor * color)

Definition at line 35 of file OODebugGLDrawing.m.

36{
37 GLfloat r, g, b, a;
38
40
41 if (EXPECT_NOT(color == nil)) color = [OOColor lightGrayColor];
42 [color getRed:&r green:&g blue:&b alpha:&a];
43 OOGL(glColor4f(r, g, b, a));
44}
#define EXPECT_NOT(x)
#define OO_ENTER_OPENGL()
#define OOGL(statement)
Definition OOOpenGL.h:251
return nil
void getRed:green:blue:alpha:(float *red,[green] float *green,[blue] float *blue,[alpha] float *alpha)
Definition OOColor.m:368
OOColor * lightGrayColor()
Definition OOColor.m:250

References EXPECT_NOT, OOColor::getRed:green:blue:alpha:, OOColor::lightGrayColor, nil, OO_ENTER_OPENGL, and OOGL.

Referenced by OODebugDrawColoredBoundingBoxBetween(), OODebugDrawColoredLine(), and OODebugDrawPoint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OODebugBeginWireframe()

OODebugWFState OODebugBeginWireframe ( BOOL ignoreZ)

Definition at line 133 of file OODebugGLDrawing.m.

134{
136
137 OODebugWFState state = { .material = [OOMaterial current] };
139
140 OOGL(glPushAttrib(GL_ENABLE_BIT | GL_DEPTH_BUFFER_BIT | GL_LINE_BIT | GL_POINT_BIT | GL_CURRENT_BIT));
141
142 OOGL(glDisable(GL_LIGHTING));
143 OOGL(glDisable(GL_TEXTURE_2D));
144 OOGL(glDisable(GL_FOG));
145 if (ignoreZ)
146 {
147 OOGL(glDisable(GL_DEPTH_TEST));
148 OOGL(glDepthMask(GL_FALSE));
149 }
150 else
151 {
152 OOGL(glEnable(GL_DEPTH_TEST));
153 OOGL(glDepthMask(GL_TRUE));
154 }
155
156 OOGL(GLScaledLineWidth(1.0f));
157
158 return state;
159}
void GLScaledLineWidth(GLfloat width)
Definition OOOpenGL.m:218
OOMaterial * current()
Definition OOMaterial.m:88
void applyNone()
Definition OOMaterial.m:80

References OOMaterial::applyNone, OOMaterial::current, GLScaledLineWidth(), OO_ENTER_OPENGL, and OOGL.

Referenced by Octree(Private)::drawOctreeCollisionFromLocation:loc:scale:, OODebugDrawBasis(), OODebugDrawColoredBoundingBoxBetween(), OODebugDrawColoredLine(), and OODebugDrawPoint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OODebugDrawBasis()

void OODebugDrawBasis ( Vector position,
GLfloat scale )

Definition at line 94 of file OODebugGLDrawing.m.

95{
98
99 OOGLBEGIN(GL_LINES);
100 glColor4f(1.0f, 0.0f, 0.0f, 1.0f);
101 glVertex3f(position.x, position.y, position.z);
102 glVertex3f(position.x + scale, position.y, position.z);
103
104 glColor4f(0.0f, 1.0f, 0.0f, 1.0f);
105 glVertex3f(position.x, position.y, position.z);
106 glVertex3f(position.x, position.y + scale, position.z);
107
108 glColor4f(0.0f, 0.0f, 1.0f, 1.0f);
109 glVertex3f(position.x, position.y, position.z);
110 glVertex3f(position.x, position.y, position.z + scale);
111 OOGLEND();
112
113 OODebugEndWireframe(state);
114}
void OODebugEndWireframe(OODebugWFState state)
OODebugWFState OODebugBeginWireframe(BOOL ignoreZ)
#define OOGLBEGIN
Definition OOOpenGL.h:253
#define OOGLEND
Definition OOOpenGL.h:254

References OO_ENTER_OPENGL, OODebugBeginWireframe(), OODebugEndWireframe(), OOGLBEGIN, and OOGLEND.

Referenced by OODebugDrawBasisAtOrigin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OODebugDrawColoredBoundingBoxBetween()

void OODebugDrawColoredBoundingBoxBetween ( Vector min,
Vector max,
OOColor * color )

Definition at line 47 of file OODebugGLDrawing.m.

48{
51
52 ApplyColor(color);
53 OOGLBEGIN(GL_LINE_LOOP);
54 glVertex3f(min.x, min.y, min.z);
55 glVertex3f(max.x, min.y, min.z);
56 glVertex3f(max.x, max.y, min.z);
57 glVertex3f(min.x, max.y, min.z);
58 glVertex3f(min.x, max.y, max.z);
59 glVertex3f(max.x, max.y, max.z);
60 glVertex3f(max.x, min.y, max.z);
61 glVertex3f(min.x, min.y, max.z);
62 OOGLEND();
63 OOGLBEGIN(GL_LINES);
64 glVertex3f(max.x, min.y, min.z);
65 glVertex3f(max.x, min.y, max.z);
66 glVertex3f(max.x, max.y, min.z);
67 glVertex3f(max.x, max.y, max.z);
68 glVertex3f(min.x, min.y, min.z);
69 glVertex3f(min.x, max.y, min.z);
70 glVertex3f(min.x, min.y, max.z);
71 glVertex3f(min.x, max.y, max.z);
72 OOGLEND();
73
75}
OOINLINE void ApplyColor(OOColor *color)

References ApplyColor(), OO_ENTER_OPENGL, OODebugBeginWireframe(), OODebugEndWireframe(), OOGLBEGIN, and OOGLEND.

Referenced by OODebugDrawBoundingBoxBetween(), and OODebugDrawColoredBoundingBox().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OODebugDrawColoredLine()

void OODebugDrawColoredLine ( Vector start,
Vector end,
OOColor * color )

Definition at line 78 of file OODebugGLDrawing.m.

79{
82
83 ApplyColor(color);
84
85 OOGLBEGIN(GL_LINES);
86 glVertex3f(start.x, start.y, start.z);
87 glVertex3f(end.x, end.y, end.z);
88 OOGLEND();
89
91}

References ApplyColor(), OO_ENTER_OPENGL, OODebugBeginWireframe(), OODebugEndWireframe(), OOGLBEGIN, and OOGLEND.

Referenced by OODebugDrawColoredVector(), and OODebugDrawLine().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OODebugDrawPoint()

void OODebugDrawPoint ( Vector position,
OOColor * color )

Definition at line 117 of file OODebugGLDrawing.m.

118{
121
122 ApplyColor(color);
124
125 OOGLBEGIN(GL_POINTS);
126 glVertex3f(position.x, position.y, position.z);
127 OOGLEND();
128
129 OODebugEndWireframe(state);
130}
void GLScaledPointSize(GLfloat size)
Definition OOOpenGL.m:225

References ApplyColor(), GLScaledPointSize(), OO_ENTER_OPENGL, OODebugBeginWireframe(), OODebugEndWireframe(), OOGL, OOGLBEGIN, and OOGLEND.

+ Here is the call graph for this function:

◆ OODebugEndWireframe()

void OODebugEndWireframe ( OODebugWFState state)

Definition at line 162 of file OODebugGLDrawing.m.

163{
165 OOGL(glPopAttrib());
166 [state.material apply];
167}

References OO_ENTER_OPENGL, and OOGL.

Referenced by Octree(Private)::drawOctreeCollisionFromLocation:loc:scale:, OODebugDrawBasis(), OODebugDrawColoredBoundingBoxBetween(), OODebugDrawColoredLine(), and OODebugDrawPoint().

+ Here is the caller graph for this function: