History

Removed frustum display in preview mode

atlante45 committed 13 years ago

Commit 229821e1 parent f21a2791 file · +0 −98Browse files

Showing the changes to interface/src/ImportDialog.cpp (1 of 1 file). Show all

Unified · Split

interface/src/ImportDialog.cpp+0−98
@@ -135,105 +135,7 @@ void GLWidget::paintGL() { · 134 unmodified lines
135 glEnd();135 glEnd();
136 136
137 glScalef(1.0f / TREE_SCALE, 1.0f / TREE_SCALE, 1.0f / TREE_SCALE);137 glScalef(1.0f / TREE_SCALE, 1.0f / TREE_SCALE, 1.0f / TREE_SCALE);
138
139 _voxelSystem->render(false);138 _voxelSystem->render(false);
140
141
142 ViewFrustum& viewFrustum = *Application::getInstance()->getSharedVoxelSystem()->getViewFrustum();
143 glm::vec3 position = viewFrustum.getOffsetPosition();
144 glm::vec3 direction = viewFrustum.getOffsetDirection();
145 glm::vec3 up = viewFrustum.getOffsetUp();
146 glm::vec3 right = viewFrustum.getOffsetRight();
147
148 // Calculate the origin direction vectors
149 glm::vec3 lookingAt = position + (direction * 0.2f);
150 glm::vec3 lookingAtUp = position + (up * 0.2f);
151 glm::vec3 lookingAtRight = position + (right * 0.2f);
152
153 glBegin(GL_LINES);
154 // Looking At = white
155 glColor3d(1.0f, 1.0f, 1.0f);
156 glVertex3d(position.x, position.y, position.z);
157 glVertex3d(lookingAt.x, lookingAt.y, lookingAt.z);
158
159 // Looking At Up = purple
160 glColor3d(1.0f, 0.0f, 1.0f);
161 glVertex3d(position.x, position.y, position.z);
162 glVertex3d(lookingAtUp.x, lookingAtUp.y, lookingAtUp.z);
163
164 // Looking At Right = cyan
165 glColor3d(0.0f, 1.0f, 1.0f);
166 glVertex3d(position.x, position.y, position.z);
167 glVertex3d(lookingAtRight.x, lookingAtRight.y, lookingAtRight.z);
168
169
170 // Drawing the bounds of the frustum
171 // viewFrustum.getNear plane - bottom edge
172 glColor3d(1.0f, 0.0f, 0.0f);
173 glVertex3d(viewFrustum.getNearBottomLeft().x, viewFrustum.getNearBottomLeft().y, viewFrustum.getNearBottomLeft().z);
174 glVertex3d(viewFrustum.getNearBottomRight().x, viewFrustum.getNearBottomRight().y, viewFrustum.getNearBottomRight().z);
175
176 // viewFrustum.getNear plane - top edge
177 glVertex3d(viewFrustum.getNearTopLeft().x, viewFrustum.getNearTopLeft().y, viewFrustum.getNearTopLeft().z);
178 glVertex3d(viewFrustum.getNearTopRight().x, viewFrustum.getNearTopRight().y, viewFrustum.getNearTopRight().z);
179
180 // viewFrustum.getNear plane - right edge
181 glVertex3d(viewFrustum.getNearBottomRight().x, viewFrustum.getNearBottomRight().y, viewFrustum.getNearBottomRight().z);
182 glVertex3d(viewFrustum.getNearTopRight().x, viewFrustum.getNearTopRight().y, viewFrustum.getNearTopRight().z);
183
184 // viewFrustum.getNear plane - left edge
185 glVertex3d(viewFrustum.getNearBottomLeft().x, viewFrustum.getNearBottomLeft().y, viewFrustum.getNearBottomLeft().z);
186 glVertex3d(viewFrustum.getNearTopLeft().x, viewFrustum.getNearTopLeft().y, viewFrustum.getNearTopLeft().z);
187
188
189 // viewFrustum.getFar plane - bottom edge
190 glColor3d(0.0f, 1.0f, 0.0f); // GREEN!!!
191 glVertex3d(viewFrustum.getFarBottomLeft().x, viewFrustum.getFarBottomLeft().y, viewFrustum.getFarBottomLeft().z);
192 glVertex3d(viewFrustum.getFarBottomRight().x, viewFrustum.getFarBottomRight().y, viewFrustum.getFarBottomRight().z);
193
194 // viewFrustum.getFar plane - top edge
195 glVertex3d(viewFrustum.getFarTopLeft().x, viewFrustum.getFarTopLeft().y, viewFrustum.getFarTopLeft().z);
196 glVertex3d(viewFrustum.getFarTopRight().x, viewFrustum.getFarTopRight().y, viewFrustum.getFarTopRight().z);
197
198 // viewFrustum.getFar plane - right edge
199 glVertex3d(viewFrustum.getFarBottomRight().x, viewFrustum.getFarBottomRight().y, viewFrustum.getFarBottomRight().z);
200 glVertex3d(viewFrustum.getFarTopRight().x, viewFrustum.getFarTopRight().y, viewFrustum.getFarTopRight().z);
201
202 // viewFrustum.getFar plane - left edge
203 glVertex3d(viewFrustum.getFarBottomLeft().x, viewFrustum.getFarBottomLeft().y, viewFrustum.getFarBottomLeft().z);
204 glVertex3d(viewFrustum.getFarTopLeft().x, viewFrustum.getFarTopLeft().y, viewFrustum.getFarTopLeft().z);
205
206 // RIGHT PLANE IS CYAN
207 // right plane - bottom edge - viewFrustum.getNear to distant
208 glColor3d(0.0f, 1.0f, 1.0f);
209 glVertex3d(viewFrustum.getNearBottomRight().x, viewFrustum.getNearBottomRight().y, viewFrustum.getNearBottomRight().z);
210 glVertex3d(viewFrustum.getFarBottomRight().x, viewFrustum.getFarBottomRight().y, viewFrustum.getFarBottomRight().z);
211
212 // right plane - top edge - viewFrustum.getNear to distant
213 glVertex3d(viewFrustum.getNearTopRight().x, viewFrustum.getNearTopRight().y, viewFrustum.getNearTopRight().z);
214 glVertex3d(viewFrustum.getFarTopRight().x, viewFrustum.getFarTopRight().y, viewFrustum.getFarTopRight().z);
215
216 // LEFT PLANE IS BLUE
217 // left plane - bottom edge - viewFrustum.getNear to distant
218 glColor3d(0.0f, 0.0f, 1.0f);
219 glVertex3d(viewFrustum.getNearBottomLeft().x, viewFrustum.getNearBottomLeft().y, viewFrustum.getNearBottomLeft().z);
220 glVertex3d(viewFrustum.getFarBottomLeft().x, viewFrustum.getFarBottomLeft().y, viewFrustum.getFarBottomLeft().z);
221
222 // left plane - top edge - viewFrustum.getNear to distant
223 glVertex3d(viewFrustum.getNearTopLeft().x, viewFrustum.getNearTopLeft().y, viewFrustum.getNearTopLeft().z);
224 glVertex3d(viewFrustum.getFarTopLeft().x, viewFrustum.getFarTopLeft().y, viewFrustum.getFarTopLeft().z);
225 glEnd();
226
227 // Draw the keyhole
228 float keyholeRadius = viewFrustum.getKeyholeRadius();
229 if (keyholeRadius > 0.0f) {
230 glPushMatrix();
231 glColor3d(1.0f, 1.0f, 0.0f);
232 glTranslatef(position.x, position.y, position.z); // where we actually want it!
233 glutWireSphere(keyholeRadius, 20, 20);
234 glPopMatrix();
235 }
236
237 }139 }
238}140}
239 141

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t