132
132
camToUse=cameras[activeCam];
134
134
//Inform text about current camera, so it can billboard if needed
135
DrawGLText::setCurCamera(camToUse);
136
DrawField3D::setCurCamera(camToUse);
135
DrawableObj::setCurCamera(camToUse);
138
136
Effect::setCurCam(camToUse);
183
181
glDisable(GL_LIGHTING);
185
//Draw the referenced objects
186
for(unsigned int ui=0; ui<refObjects.size(); ui++)
188
//overlays need to be drawn later
189
if(refObjects[ui]->isOverlay())
194
if(!refObjects[ui]->wantsLight && lightsOn)
197
glDisable(GL_LIGHTING);
199
else if (refObjects[ui]->wantsLight && !lightsOn)
201
glEnable(GL_LIGHTING);
206
refObjects[ui]->draw();
210
for(unsigned int ui=0; ui<objects.size(); ui++)
212
//overlays need to be drawn later
213
if(objects[ui]->isOverlay())
217
if(!objects[ui]->wantsLight && lightsOn )
219
//Object prefers doing its thing in the dark
220
glDisable(GL_LIGHTING);
223
else if (objects[ui]->wantsLight && !lightsOn)
225
glEnable(GL_LIGHTING);
230
//If we are in selection mode, draw the bounding box
231
//if the object is selected.
232
if(ui == lastSelected && selectionMode)
234
//May be required for selection box drawing
237
//Get the bounding box for the object & draw it
238
objects[ui]->getBoundingBox(bObject);
239
p.setAxisAligned(bObject);
240
p.setColour(0,0.2,1,0.5); //blue-greenish
242
glDisable(GL_LIGHTING);
245
glEnable(GL_LIGHTING);
185
//First sub-pass with opaque objects
187
//Draw the referenced objects
188
drawObjectVector(refObjects,lightsOn,true);
189
//Draw normal objects
190
drawObjectVector(objects,lightsOn,true);
193
//Second pass with transparent objects
195
//Draw the referenced objects
196
drawObjectVector(refObjects,lightsOn,false);
197
//Draw normal objects
198
drawObjectVector(objects,lightsOn,false);
229
void Scene::drawObjectVector(const vector<const DrawableObj*> &drawObjs, bool &lightsOn, bool drawOpaques) const
231
for(unsigned int ui=0; ui<drawObjs.size(); ui++)
233
//FIXME: Use logical operator to simplify this.
234
// its late, and i'm tired and can't think. Its very easy
235
// when you can think.
238
//Don't draw opaque drawObjs in this pass
239
if(drawObjs[ui]->needsDepthSorting())
244
//Do draw opaque drawObjs in this pass
245
if(!drawObjs[ui]->needsDepthSorting())
249
//overlays need to be drawn later
250
if(drawObjs[ui]->isOverlay())
254
if(!drawObjs[ui]->wantsLight && lightsOn )
256
//Object prefers doing its thing in the dark
257
glDisable(GL_LIGHTING);
260
else if (drawObjs[ui]->wantsLight && !lightsOn)
262
glEnable(GL_LIGHTING);
267
//If we are in selection mode, draw the bounding box
268
//if the object is selected.
269
if(ui == lastSelected && selectionMode)
271
//May be required for selection box drawing
274
//Get the bounding box for the object & draw it
275
drawObjs[ui]->getBoundingBox(bObject);
276
p.setAxisAligned(bObject);
277
p.setColour(0,0.2,1,0.5); //blue-greenish
279
glDisable(GL_LIGHTING);
282
glEnable(GL_LIGHTING);
286
drawObjs[ui]->draw();
281
290
void Scene::drawOverlays() const