244 return; |
244 return; |
245 } |
245 } |
246 |
246 |
247 #if 0 |
247 #if 0 |
248 if (gl_colorbfc && |
248 if (gl_colorbfc && |
249 obj->getType () != OBJ_Line && |
249 obj->getType () != LDObject::Line && |
250 obj->getType () != OBJ_CondLine) |
250 obj->getType () != LDObject::CondLine) |
251 { |
251 { |
252 if (bBackSide) |
252 if (bBackSide) |
253 glColor4f (0.9f, 0.0f, 0.0f, 1.0f); |
253 glColor4f (0.9f, 0.0f, 0.0f, 1.0f); |
254 else |
254 else |
255 glColor4f (0.0f, 0.8f, 0.0f, 1.0f); |
255 glColor4f (0.0f, 0.8f, 0.0f, 1.0f); |
661 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
661 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
662 // ============================================================================= |
662 // ============================================================================= |
663 void GLRenderer::compileSubObject (LDObject* obj, const GLenum gltype) { |
663 void GLRenderer::compileSubObject (LDObject* obj, const GLenum gltype) { |
664 glBegin (gltype); |
664 glBegin (gltype); |
665 |
665 |
666 const short numverts = (obj->getType () != OBJ_CondLine) ? obj->vertices () : 2; |
666 const short numverts = (obj->getType () != LDObject::CondLine) ? obj->vertices () : 2; |
667 |
667 |
668 for (short i = 0; i < numverts; ++i) |
668 for (short i = 0; i < numverts; ++i) |
669 compileVertex (obj->vaCoords[i]); |
669 compileVertex (obj->vaCoords[i]); |
670 |
670 |
671 glEnd (); |
671 glEnd (); |
676 // ============================================================================= |
676 // ============================================================================= |
677 void GLRenderer::compileOneObject (LDObject* obj) { |
677 void GLRenderer::compileOneObject (LDObject* obj) { |
678 setObjectColor (obj); |
678 setObjectColor (obj); |
679 |
679 |
680 switch (obj->getType ()) { |
680 switch (obj->getType ()) { |
681 case OBJ_Line: |
681 case LDObject::Line: |
682 compileSubObject (obj, GL_LINES); |
682 compileSubObject (obj, GL_LINES); |
683 break; |
683 break; |
684 |
684 |
685 case OBJ_CondLine: |
685 case LDObject::CondLine: |
686 glLineStipple (1, 0x6666); |
686 glLineStipple (1, 0x6666); |
687 glEnable (GL_LINE_STIPPLE); |
687 glEnable (GL_LINE_STIPPLE); |
688 |
688 |
689 compileSubObject (obj, GL_LINES); |
689 compileSubObject (obj, GL_LINES); |
690 |
690 |
691 glDisable (GL_LINE_STIPPLE); |
691 glDisable (GL_LINE_STIPPLE); |
692 break; |
692 break; |
693 |
693 |
694 case OBJ_Triangle: |
694 case LDObject::Triangle: |
695 compileSubObject (obj, GL_TRIANGLES); |
695 compileSubObject (obj, GL_TRIANGLES); |
696 break; |
696 break; |
697 |
697 |
698 case OBJ_Quad: |
698 case LDObject::Quad: |
699 compileSubObject (obj, GL_QUADS); |
699 compileSubObject (obj, GL_QUADS); |
700 break; |
700 break; |
701 |
701 |
702 case OBJ_Subfile: |
702 case LDObject::Subfile: |
703 { |
703 { |
704 LDSubfile* ref = static_cast<LDSubfile*> (obj); |
704 LDSubfile* ref = static_cast<LDSubfile*> (obj); |
705 vector<LDObject*> objs = ref->inlineContents (true, true); |
705 vector<LDObject*> objs = ref->inlineContents (true, true); |
706 |
706 |
707 for (LDObject* obj : objs) { |
707 for (LDObject* obj : objs) { |
723 } |
723 } |
724 break; |
724 break; |
725 |
725 |
726 #if 0 |
726 #if 0 |
727 TODO: find a proper way to draw vertices without having them be affected by zoom. |
727 TODO: find a proper way to draw vertices without having them be affected by zoom. |
728 case OBJ_Vertex: |
728 case LDObject::Vertex: |
729 { |
729 { |
730 LDVertex* pVert = static_cast<LDVertex*> (obj); |
730 LDVertex* pVert = static_cast<LDVertex*> (obj); |
731 LDTriangle* pPoly; |
731 LDTriangle* pPoly; |
732 vertex* vPos = &(pVert->vPosition); |
732 vertex* vPos = &(pVert->vPosition); |
733 const double fPolyScale = max (fZoom, 1.0); |
733 const double fPolyScale = max (fZoom, 1.0); |