Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
OODebugGLDrawing.h File Reference
import "OOMaths.h"
import "OOColor.h"
+ Include dependency graph for OODebugGLDrawing.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  OODebugWFState
 

Functions

OODebugWFState OODebugBeginWireframe (BOOL ignoreZ)
 
void OODebugEndWireframe (OODebugWFState state)
 
OOINLINE void OODebugDrawBoundingBox (BoundingBox box)
 
OOINLINE void OODebugDrawBoundingBoxBetween (Vector min, Vector max)
 
OOINLINE void OODebugDrawColoredBoundingBox (BoundingBox box, OOColor *color)
 
void OODebugDrawColoredBoundingBoxBetween (Vector min, Vector max, OOColor *color)
 
OOINLINE void OODebugDrawNormal (Vector position, Vector normal, GLfloat scale)
 
OOINLINE void OODebugDrawNormalAtOrigin (Vector normal, GLfloat scale)
 
OOINLINE void OODebugDrawVector (Vector position, Vector v)
 
OOINLINE void OODebugDrawColoredVector (Vector position, Vector v, OOColor *color)
 
OOINLINE void OODebugDrawVectorAtOrigin (Vector v)
 
OOINLINE void OODebugDrawColoredVectorAtOrigin (Vector v, OOColor *color)
 
OOINLINE void OODebugDrawLine (Vector start, Vector end)
 
void OODebugDrawColoredLine (Vector start, Vector end, OOColor *color)
 
void OODebugDrawBasis (Vector position, GLfloat scale)
 
OOINLINE void OODebugDrawBasisAtOrigin (GLfloat scale)
 
void OODebugDrawPoint (Vector position, OOColor *color)
 

Function Documentation

◆ OODebugBeginWireframe()

OODebugWFState OODebugBeginWireframe ( BOOL ignoreZ)

Definition at line 133 of file OODebugGLDrawing.m.

134{
136
137 OODebugWFState state = { .material = [OOMaterial current] };
138 [OOMaterial applyNone];
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}
#define OO_ENTER_OPENGL()
void GLScaledLineWidth(GLfloat width)
Definition OOOpenGL.m:218
#define OOGL(statement)
Definition OOOpenGL.h:251

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:

◆ OODebugDrawBasisAtOrigin()

OOINLINE void OODebugDrawBasisAtOrigin ( GLfloat scale)

Definition at line 141 of file OODebugGLDrawing.h.

142{
144}
void OODebugDrawBasis(Vector position, GLfloat scale)
const Vector kZeroVector
Definition OOVector.m:28

References kZeroVector, and OODebugDrawBasis().

+ Here is the call graph for this function:

◆ OODebugDrawBoundingBox()

OOINLINE void OODebugDrawBoundingBox ( BoundingBox box)

Definition at line 87 of file OODebugGLDrawing.h.

88{
89 OODebugDrawBoundingBoxBetween(box.min, box.max);
90}
OOINLINE void OODebugDrawBoundingBoxBetween(Vector min, Vector max)

References OODebugDrawBoundingBoxBetween().

+ Here is the call graph for this function:

◆ OODebugDrawBoundingBoxBetween()

OOINLINE void OODebugDrawBoundingBoxBetween ( Vector min,
Vector max )

Definition at line 81 of file OODebugGLDrawing.h.

82{
83 OODebugDrawColoredBoundingBoxBetween(min, max, [OOColor blueColor]);
84}
void OODebugDrawColoredBoundingBoxBetween(Vector min, Vector max, OOColor *color)

References OODebugDrawColoredBoundingBoxBetween().

Referenced by OODebugDrawBoundingBox().

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

◆ OODebugDrawColoredBoundingBox()

OOINLINE void OODebugDrawColoredBoundingBox ( BoundingBox box,
OOColor * color )

Definition at line 93 of file OODebugGLDrawing.h.

94{
95 OODebugDrawColoredBoundingBoxBetween(box.min, box.max, color);
96}

References OODebugDrawColoredBoundingBoxBetween().

+ Here is the call 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:

◆ OODebugDrawColoredVector()

OOINLINE void OODebugDrawColoredVector ( Vector position,
Vector v,
OOColor * color )

Definition at line 111 of file OODebugGLDrawing.h.

112{
113 OODebugDrawColoredLine(position, vector_add(position, v), color);
114}
void OODebugDrawColoredLine(Vector start, Vector end, OOColor *color)

References OODebugDrawColoredLine().

Referenced by OODebugDrawColoredVectorAtOrigin(), OODebugDrawNormal(), and OODebugDrawVector().

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

◆ OODebugDrawColoredVectorAtOrigin()

OOINLINE void OODebugDrawColoredVectorAtOrigin ( Vector v,
OOColor * color )

Definition at line 129 of file OODebugGLDrawing.h.

130{
132}
OOINLINE void OODebugDrawColoredVector(Vector position, Vector v, OOColor *color)

References kZeroVector, and OODebugDrawColoredVector().

+ Here is the call graph for this function:

◆ OODebugDrawLine()

OOINLINE void OODebugDrawLine ( Vector start,
Vector end )

Definition at line 135 of file OODebugGLDrawing.h.

136{
137 OODebugDrawColoredLine(start, end, [OOColor whiteColor]);
138}

References OODebugDrawColoredLine().

+ Here is the call graph for this function:

◆ OODebugDrawNormal()

OOINLINE void OODebugDrawNormal ( Vector position,
Vector normal,
GLfloat scale )

Definition at line 99 of file OODebugGLDrawing.h.

100{
101 OODebugDrawColoredVector(position, vector_add(position, vector_multiply_scalar(normal, scale)), [OOColor cyanColor]);
102}

References OODebugDrawColoredVector().

Referenced by OODebugDrawNormalAtOrigin().

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

◆ OODebugDrawNormalAtOrigin()

OOINLINE void OODebugDrawNormalAtOrigin ( Vector normal,
GLfloat scale )

Definition at line 105 of file OODebugGLDrawing.h.

106{
107 OODebugDrawNormal(kZeroVector, normal, scale);
108}
OOINLINE void OODebugDrawNormal(Vector position, Vector normal, GLfloat scale)

References kZeroVector, and OODebugDrawNormal().

+ Here is the call 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:

◆ OODebugDrawVector()

OOINLINE void OODebugDrawVector ( Vector position,
Vector v )

Definition at line 117 of file OODebugGLDrawing.h.

118{
119 OODebugDrawColoredVector(position, v, [OOColor magentaColor]);
120}

References OODebugDrawColoredVector().

Referenced by OODebugDrawVectorAtOrigin().

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

◆ OODebugDrawVectorAtOrigin()

OOINLINE void OODebugDrawVectorAtOrigin ( Vector v)

Definition at line 123 of file OODebugGLDrawing.h.

124{
126}
OOINLINE void OODebugDrawVector(Vector position, Vector v)

References kZeroVector, and OODebugDrawVector().

+ 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}
OOMaterial * material

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: