diff --git a/bsp.cpp b/bsp.cpp index ae509c4..ac1c3dc 100644 --- a/bsp.cpp +++ b/bsp.cpp @@ -432,31 +432,31 @@ void SBsp3::DebugDraw(void) { glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); glBegin(GL_TRIANGLES); - glxVertex3v(tri.a); - glxVertex3v(tri.b); - glxVertex3v(tri.c); + ssglVertex3v(tri.a); + ssglVertex3v(tri.b); + ssglVertex3v(tri.c); glEnd(); glDisable(GL_LIGHTING); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - glxDepthRangeOffset(2); + ssglDepthRangeOffset(2); glBegin(GL_TRIANGLES); - glxVertex3v(tri.a); - glxVertex3v(tri.b); - glxVertex3v(tri.c); + ssglVertex3v(tri.a); + ssglVertex3v(tri.b); + ssglVertex3v(tri.c); glEnd(); glDisable(GL_LIGHTING); glPolygonMode(GL_FRONT_AND_BACK, GL_POINT); glPointSize(10); - glxDepthRangeOffset(2); + ssglDepthRangeOffset(2); glBegin(GL_TRIANGLES); - glxVertex3v(tri.a); - glxVertex3v(tri.b); - glxVertex3v(tri.c); + ssglVertex3v(tri.a); + ssglVertex3v(tri.b); + ssglVertex3v(tri.c); glEnd(); - glxDepthRangeOffset(0); + ssglDepthRangeOffset(0); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); more->DebugDraw(); @@ -669,8 +669,8 @@ void SBsp2::DebugDraw(Vector n, double d) { glLineWidth(10); glBegin(GL_LINES); - glxVertex3v(edge.a); - glxVertex3v(edge.b); + ssglVertex3v(edge.a); + ssglVertex3v(edge.b); glEnd(); pos->DebugDraw(n, d); neg->DebugDraw(n, d); diff --git a/draw.cpp b/draw.cpp index b011dc8..fc4f822 100644 --- a/draw.cpp +++ b/draw.cpp @@ -64,8 +64,8 @@ void GraphicsWindow::Selection::Draw(void) { RgbColor rgb = Style::Color(Style::HOVERED); glColor4d(rgb.redF(), rgb.greenF(), rgb.blueF(), 0.2); glBegin(GL_LINES); - glxVertex3v(topLeft); - glxVertex3v(refp); + ssglVertex3v(topLeft); + ssglVertex3v(refp); glEnd(); glLineWidth(1); } @@ -560,21 +560,21 @@ void GraphicsWindow::Paint(void) { glEnable(GL_TEXTURE_2D); glBegin(GL_QUADS); glTexCoord2d(0, 0); - glxVertex3v(origin); + ssglVertex3v(origin); glTexCoord2d(0, th); - glxVertex3v(origin.Plus(projUp.ScaledBy(mmh))); + ssglVertex3v(origin.Plus(projUp.ScaledBy(mmh))); glTexCoord2d(tw, th); - glxVertex3v(origin.Plus(projRight.ScaledBy(mmw).Plus( - projUp. ScaledBy(mmh)))); + ssglVertex3v(origin.Plus(projRight.ScaledBy(mmw).Plus( + projUp. ScaledBy(mmh)))); glTexCoord2d(tw, 0); - glxVertex3v(origin.Plus(projRight.ScaledBy(mmw))); + ssglVertex3v(origin.Plus(projRight.ScaledBy(mmw))); glEnd(); glDisable(GL_TEXTURE_2D); } - glxDepthRangeOffset(0); + ssglDepthRangeOffset(0); // Nasty case when we're reloading the imported files; could be that // we get an error, so a dialog pops up, and a message loop starts, and @@ -617,7 +617,7 @@ void GraphicsWindow::Paint(void) { (float)SS.ambientIntensity, 1 }; glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient); - glxUnlockColor(); + ssglUnlockColor(); if(showSnapGrid && LockedInWorkplane()) { hEntity he = ActiveWorkplane(); @@ -674,15 +674,15 @@ void GraphicsWindow::Paint(void) { if(j0 > j1 || j1 - j0 > 400) goto nogrid; glLineWidth(1); - glxColorRGBa(Style::Color(Style::DATUM), 0.3); + ssglColorRGBa(Style::Color(Style::DATUM), 0.3); glBegin(GL_LINES); for(i = i0 + 1; i < i1; i++) { - glxVertex3v(wp.Plus(wu.ScaledBy(i*g)).Plus(wv.ScaledBy(j0*g))); - glxVertex3v(wp.Plus(wu.ScaledBy(i*g)).Plus(wv.ScaledBy(j1*g))); + ssglVertex3v(wp.Plus(wu.ScaledBy(i*g)).Plus(wv.ScaledBy(j0*g))); + ssglVertex3v(wp.Plus(wu.ScaledBy(i*g)).Plus(wv.ScaledBy(j1*g))); } for(j = j0 + 1; j < j1; j++) { - glxVertex3v(wp.Plus(wu.ScaledBy(i0*g)).Plus(wv.ScaledBy(j*g))); - glxVertex3v(wp.Plus(wu.ScaledBy(i1*g)).Plus(wv.ScaledBy(j*g))); + ssglVertex3v(wp.Plus(wu.ScaledBy(i0*g)).Plus(wv.ScaledBy(j*g))); + ssglVertex3v(wp.Plus(wu.ScaledBy(i1*g)).Plus(wv.ScaledBy(j*g))); } glEnd(); @@ -718,31 +718,31 @@ nogrid:; // Draw the traced path, if one exists glLineWidth(Style::Width(Style::ANALYZE)); - glxColorRGB(Style::Color(Style::ANALYZE)); + ssglColorRGB(Style::Color(Style::ANALYZE)); SContour *sc = &(SS.traced.path); glBegin(GL_LINE_STRIP); for(i = 0; i < sc->l.n; i++) { - glxVertex3v(sc->l.elem[i].p); + ssglVertex3v(sc->l.elem[i].p); } glEnd(); // And the naked edges, if the user did Analyze -> Show Naked Edges. glLineWidth(Style::Width(Style::DRAW_ERROR)); - glxColorRGB(Style::Color(Style::DRAW_ERROR)); - glxDrawEdges(&(SS.nakedEdges), true); + ssglColorRGB(Style::Color(Style::DRAW_ERROR)); + ssglDrawEdges(&(SS.nakedEdges), true); // Then redraw whatever the mouse is hovering over, highlighted. glDisable(GL_DEPTH_TEST); - glxLockColorTo(Style::Color(Style::HOVERED)); + ssglLockColorTo(Style::Color(Style::HOVERED)); hover.Draw(); // And finally draw the selection, same mechanism. - glxLockColorTo(Style::Color(Style::SELECTED)); + ssglLockColorTo(Style::Color(Style::SELECTED)); for(Selection *s = selection.First(); s; s = selection.NextAfter(s)) { s->Draw(); } - glxUnlockColor(); + ssglUnlockColor(); // If a marquee selection is in progress, then draw the selection // rectangle, as an outline and a transparent fill. @@ -759,19 +759,19 @@ nogrid:; bl = UnProjectPoint(Point2d::From(xmin, ymax)); glLineWidth((GLfloat)1.3); - glxColorRGB(Style::Color(Style::HOVERED)); + ssglColorRGB(Style::Color(Style::HOVERED)); glBegin(GL_LINE_LOOP); - glxVertex3v(tl); - glxVertex3v(tr); - glxVertex3v(br); - glxVertex3v(bl); + ssglVertex3v(tl); + ssglVertex3v(tr); + ssglVertex3v(br); + ssglVertex3v(bl); glEnd(); - glxColorRGBa(Style::Color(Style::HOVERED), 0.10); + ssglColorRGBa(Style::Color(Style::HOVERED), 0.10); glBegin(GL_QUADS); - glxVertex3v(tl); - glxVertex3v(tr); - glxVertex3v(br); - glxVertex3v(bl); + ssglVertex3v(tl); + ssglVertex3v(tr); + ssglVertex3v(br); + ssglVertex3v(bl); glEnd(); } @@ -779,33 +779,33 @@ nogrid:; // plane of the monitor. if(SS.extraLine.draw) { glLineWidth(1); - glxLockColorTo(Style::Color(Style::DATUM)); + ssglLockColorTo(Style::Color(Style::DATUM)); glBegin(GL_LINES); - glxVertex3v(SS.extraLine.ptA); - glxVertex3v(SS.extraLine.ptB); + ssglVertex3v(SS.extraLine.ptA); + ssglVertex3v(SS.extraLine.ptB); glEnd(); } // A note to indicate the origin in the just-exported file. if(SS.justExportedInfo.draw) { - glxColorRGB(Style::Color(Style::DATUM)); + ssglColorRGB(Style::Color(Style::DATUM)); Vector p = SS.justExportedInfo.pt, u = SS.justExportedInfo.u, v = SS.justExportedInfo.v; glLineWidth(1.5); glBegin(GL_LINES); - glxVertex3v(p.Plus(u.WithMagnitude(-15/scale))); - glxVertex3v(p.Plus(u.WithMagnitude(30/scale))); - glxVertex3v(p.Plus(v.WithMagnitude(-15/scale))); - glxVertex3v(p.Plus(v.WithMagnitude(30/scale))); + ssglVertex3v(p.Plus(u.WithMagnitude(-15/scale))); + ssglVertex3v(p.Plus(u.WithMagnitude(30/scale))); + ssglVertex3v(p.Plus(v.WithMagnitude(-15/scale))); + ssglVertex3v(p.Plus(v.WithMagnitude(30/scale))); glEnd(); - glxWriteText("(x, y) = (0, 0) for file just exported", + ssglWriteText("(x, y) = (0, 0) for file just exported", DEFAULT_TEXT_HEIGHT, p.Plus(u.ScaledBy(10/scale)).Plus(v.ScaledBy(10/scale)), u, v, NULL, NULL); - glxWriteText("press Esc to clear this message", + ssglWriteText("press Esc to clear this message", DEFAULT_TEXT_HEIGHT, p.Plus(u.ScaledBy(40/scale)).Plus( v.ScaledBy(-(DEFAULT_TEXT_HEIGHT)/scale)), diff --git a/drawconstraint.cpp b/drawconstraint.cpp index a3b80e7..3610e3a 100644 --- a/drawconstraint.cpp +++ b/drawconstraint.cpp @@ -25,11 +25,11 @@ void Constraint::LineDrawOrGetDistance(Vector a, Vector b) { // The only constraints with styles should be comments, so don't // check otherwise, save looking up the styles constantly. if(type == COMMENT && Style::Width(hs) >= 3.0) { - glxFatLine(a, b, Style::Width(hs) / SS.GW.scale); + ssglFatLine(a, b, Style::Width(hs) / SS.GW.scale); } else { glBegin(GL_LINE_STRIP); - glxVertex3v(a); - glxVertex3v(b); + ssglVertex3v(a); + ssglVertex3v(b); glEnd(); } } @@ -87,8 +87,8 @@ void Constraint::DoLabel(Vector ref, Vector *labelPos, Vector gr, Vector gu) { } char *s = Label(); - double swidth = glxStrWidth(s, th), - sheight = glxStrHeight(th); + double swidth = ssglStrWidth(s, th), + sheight = ssglStrHeight(th); // By default, the reference is from the center; but the style could // specify otherwise if one is present, and it could also specify a @@ -118,7 +118,7 @@ void Constraint::DoLabel(Vector ref, Vector *labelPos, Vector gr, Vector gu) { if(dogd.drawing) { - glxWriteTextRefCenter(s, th, ref, gr, gu, LineCallback, this); + ssglWriteTextRefCenter(s, th, ref, gr, gu, LineCallback, this); } else { double l = swidth/2 - sheight/2; l = max(l, 5/SS.GW.scale); @@ -158,8 +158,8 @@ int Constraint::DoLineTrimmedAgainstBox(Vector ref, Vector a, Vector b) { double pixels = 1.0 / SS.GW.scale; char *s = Label(); - double swidth = glxStrWidth(s, DEFAULT_TEXT_HEIGHT) + 4*pixels, - sheight = glxStrHeight(DEFAULT_TEXT_HEIGHT) + 8*pixels; + double swidth = ssglStrWidth(s, DEFAULT_TEXT_HEIGHT) + 4*pixels, + sheight = ssglStrHeight(DEFAULT_TEXT_HEIGHT) + 8*pixels; struct { Vector n; @@ -364,8 +364,8 @@ void Constraint::DoArcForAngle(Vector a0, Vector da, Vector b0, Vector db, // complex and this looks pretty good. double tl = atan2(rm.Dot(gu), rm.Dot(gr)); double adj = EllipticalInterpolation( - glxStrWidth(Label(), DEFAULT_TEXT_HEIGHT)/2, - glxStrHeight(DEFAULT_TEXT_HEIGHT)/2, + ssglStrWidth(Label(), DEFAULT_TEXT_HEIGHT)/2, + ssglStrHeight(DEFAULT_TEXT_HEIGHT)/2, tl); *ref = (*ref).Plus(rm.WithMagnitude(adj + 3/SS.GW.scale)); } else { @@ -374,8 +374,8 @@ void Constraint::DoArcForAngle(Vector a0, Vector da, Vector b0, Vector db, *ref = (*ref).ScaledBy(0.5).Plus(disp.offset); gu = gu.WithMagnitude(1); Vector trans = - (*ref).Plus(gu.ScaledBy(-1.5*glxStrHeight(DEFAULT_TEXT_HEIGHT))); - glxWriteTextRefCenter("angle between skew lines", DEFAULT_TEXT_HEIGHT, + (*ref).Plus(gu.ScaledBy(-1.5*ssglStrHeight(DEFAULT_TEXT_HEIGHT))); + ssglWriteTextRefCenter("angle between skew lines", DEFAULT_TEXT_HEIGHT, trans, gr, gu, LineCallback, this); } } @@ -571,7 +571,7 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) { // the datum color, maybe a bit dimmer vc = vc.WithMagnitude(vd.Magnitude()*0.9); // and set the color to that. - glxColorRGB(RGBf(vc.x, vc.y, vc.z)); + ssglColorRGB(RGBf(vc.x, vc.y, vc.z)); for(int a = 0; a < 2; a++) { Vector r = SS.GW.projRight.ScaledBy((a+1)/SS.GW.scale); @@ -579,10 +579,10 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) { for(int i = 0; i < 2; i++) { Vector p = SK.GetEntity(i == 0 ? ptA : ptB)-> PointGetNum(); glBegin(GL_QUADS); - glxVertex3v(p.Plus (r).Plus (d)); - glxVertex3v(p.Plus (r).Minus(d)); - glxVertex3v(p.Minus(r).Minus(d)); - glxVertex3v(p.Minus(r).Plus (d)); + ssglVertex3v(p.Plus (r).Plus (d)); + ssglVertex3v(p.Plus (r).Minus(d)); + ssglVertex3v(p.Minus(r).Minus(d)); + ssglVertex3v(p.Minus(r).Plus (d)); glEnd(); } @@ -801,7 +801,7 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) { } if(dogd.drawing) { - glxWriteTextRefCenter("T", DEFAULT_TEXT_HEIGHT, + ssglWriteTextRefCenter("T", DEFAULT_TEXT_HEIGHT, textAt, u, v, LineCallback, this); } else { dogd.refp = textAt; @@ -984,7 +984,7 @@ s: (type == VERTICAL) ? "V" : ( (type == AT_MIDPOINT) ? "M" : NULL)); - glxWriteTextRefCenter(s, DEFAULT_TEXT_HEIGHT, + ssglWriteTextRefCenter(s, DEFAULT_TEXT_HEIGHT, m.Plus(offset), r, u, LineCallback, this); } else { dogd.refp = m.Plus(offset); @@ -1015,10 +1015,10 @@ s: dp = dp.WithMagnitude(2/SS.GW.scale); if(dogd.drawing) { glBegin(GL_QUADS); - glxVertex3v((c.Plus(d)).Plus(dp)); - glxVertex3v((c.Minus(d)).Plus(dp)); - glxVertex3v((c.Minus(d)).Minus(dp)); - glxVertex3v((c.Plus(d)).Minus(dp)); + ssglVertex3v((c.Plus(d)).Plus(dp)); + ssglVertex3v((c.Minus(d)).Plus(dp)); + ssglVertex3v((c.Minus(d)).Minus(dp)); + ssglVertex3v((c.Plus(d)).Minus(dp)); glEnd(); } else { Point2d ref = SS.GW.ProjectPoint(c); @@ -1031,7 +1031,7 @@ s: case COMMENT: { if(disp.style.v) { glLineWidth(Style::Width(disp.style)); - glxColorRGB(Style::Color(disp.style)); + ssglColorRGB(Style::Color(disp.style)); } Vector u, v; if(workplane.v == Entity::FREE_IN_3D.v) { @@ -1055,7 +1055,7 @@ void Constraint::Draw(void) { dogd.sel = NULL; glLineWidth(Style::Width(Style::CONSTRAINT)); - glxColorRGB(Style::Color(Style::CONSTRAINT)); + ssglColorRGB(Style::Color(Style::CONSTRAINT)); DrawOrGetDistance(NULL); } diff --git a/drawentity.cpp b/drawentity.cpp index b9afcd4..c7c67aa 100644 --- a/drawentity.cpp +++ b/drawentity.cpp @@ -20,19 +20,19 @@ char *Entity::DescriptionString(void) { void Entity::LineDrawOrGetDistance(Vector a, Vector b, bool maybeFat) { if(dogd.drawing) { // Draw lines from active group in front of those from previous - glxDepthRangeOffset((group.v == SS.GW.activeGroup.v) ? 4 : 3); + ssglDepthRangeOffset((group.v == SS.GW.activeGroup.v) ? 4 : 3); // Narrow lines are drawn as lines, but fat lines must be drawn as // filled polygons, to get the line join style right. if(!maybeFat || dogd.lineWidth < 3) { glBegin(GL_LINES); - glxVertex3v(a); - glxVertex3v(b); + ssglVertex3v(a); + ssglVertex3v(b); glEnd(); } else { - glxFatLine(a, b, dogd.lineWidth/SS.GW.scale); + ssglFatLine(a, b, dogd.lineWidth/SS.GW.scale); } - glxDepthRangeOffset(0); + ssglDepthRangeOffset(0); } else { Point2d ap = SS.GW.ProjectPoint(a); Point2d bp = SS.GW.ProjectPoint(b); @@ -54,8 +54,8 @@ void Entity::DrawAll(void) { double s = 3.5/SS.GW.scale; Vector r = SS.GW.projRight.ScaledBy(s); Vector d = SS.GW.projUp.ScaledBy(s); - glxColorRGB(Style::Color(Style::DATUM)); - glxDepthRangeOffset(6); + ssglColorRGB(Style::Color(Style::DATUM)); + ssglDepthRangeOffset(6); glBegin(GL_QUADS); for(i = 0; i < SK.entity.n; i++) { Entity *e = &(SK.entity.elem[i]); @@ -84,21 +84,21 @@ void Entity::DrawAll(void) { if(free) { Vector re = r.ScaledBy(2.5), de = d.ScaledBy(2.5); - glxColorRGB(Style::Color(Style::ANALYZE)); - glxVertex3v(v.Plus (re).Plus (de)); - glxVertex3v(v.Plus (re).Minus(de)); - glxVertex3v(v.Minus(re).Minus(de)); - glxVertex3v(v.Minus(re).Plus (de)); - glxColorRGB(Style::Color(Style::DATUM)); + ssglColorRGB(Style::Color(Style::ANALYZE)); + ssglVertex3v(v.Plus (re).Plus (de)); + ssglVertex3v(v.Plus (re).Minus(de)); + ssglVertex3v(v.Minus(re).Minus(de)); + ssglVertex3v(v.Minus(re).Plus (de)); + ssglColorRGB(Style::Color(Style::DATUM)); } - glxVertex3v(v.Plus (r).Plus (d)); - glxVertex3v(v.Plus (r).Minus(d)); - glxVertex3v(v.Minus(r).Minus(d)); - glxVertex3v(v.Minus(r).Plus (d)); + ssglVertex3v(v.Plus (r).Plus (d)); + ssglVertex3v(v.Plus (r).Minus(d)); + ssglVertex3v(v.Minus(r).Minus(d)); + ssglVertex3v(v.Minus(r).Plus (d)); } glEnd(); - glxDepthRangeOffset(0); + ssglDepthRangeOffset(0); } for(i = 0; i < SK.entity.n; i++) { @@ -115,7 +115,7 @@ void Entity::Draw(void) { hStyle hs = Style::ForEntity(h); dogd.lineWidth = Style::Width(hs); glLineWidth((float)dogd.lineWidth); - glxColorRGB(Style::Color(hs)); + ssglColorRGB(Style::Color(hs)); dogd.drawing = true; DrawOrGetDistance(); @@ -484,15 +484,15 @@ void Entity::DrawOrGetDistance(void) { Vector r = SS.GW.projRight.ScaledBy(s/SS.GW.scale); Vector d = SS.GW.projUp.ScaledBy(s/SS.GW.scale); - glxColorRGB(Style::Color(Style::DATUM)); - glxDepthRangeOffset(6); + ssglColorRGB(Style::Color(Style::DATUM)); + ssglDepthRangeOffset(6); glBegin(GL_QUADS); - glxVertex3v(v.Plus (r).Plus (d)); - glxVertex3v(v.Plus (r).Minus(d)); - glxVertex3v(v.Minus(r).Minus(d)); - glxVertex3v(v.Minus(r).Plus (d)); + ssglVertex3v(v.Plus (r).Plus (d)); + ssglVertex3v(v.Plus (r).Minus(d)); + ssglVertex3v(v.Minus(r).Minus(d)); + ssglVertex3v(v.Minus(r).Plus (d)); glEnd(); - glxDepthRangeOffset(0); + ssglDepthRangeOffset(0); } else { Point2d pp = SS.GW.ProjectPoint(v); dogd.dmin = pp.DistanceTo(dogd.mp) - 6; @@ -520,13 +520,13 @@ void Entity::DrawOrGetDistance(void) { // dimmer for the ones at the model origin. int f = (i == 0 ? 100 : 255); if(hr.v == Request::HREQUEST_REFERENCE_XY.v) { - glxColorRGB(RGB(0, 0, f)); + ssglColorRGB(RGB(0, 0, f)); } else if(hr.v == Request::HREQUEST_REFERENCE_YZ.v) { - glxColorRGB(RGB(f, 0, 0)); + ssglColorRGB(RGB(f, 0, 0)); } else if(hr.v == Request::HREQUEST_REFERENCE_ZX.v) { - glxColorRGB(RGB(0, f, 0)); + ssglColorRGB(RGB(0, f, 0)); } else { - glxColorRGB(Style::Color(Style::NORMALS)); + ssglColorRGB(Style::Color(Style::NORMALS)); if(i > 0) break; } @@ -544,7 +544,7 @@ void Entity::DrawOrGetDistance(void) { double w = 60 - SS.GW.width/2; tail = SS.GW.projRight.ScaledBy(w/s).Plus( SS.GW.projUp. ScaledBy(h/s)).Minus(SS.GW.offset); - glxDepthRangeLockToFront(true); + ssglDepthRangeLockToFront(true); glLineWidth(2); } @@ -557,7 +557,7 @@ void Entity::DrawOrGetDistance(void) { LineDrawOrGetDistance(tip,tip.Minus(v.RotatedAbout(axis, 0.6))); LineDrawOrGetDistance(tip,tip.Minus(v.RotatedAbout(axis,-0.6))); } - glxDepthRangeLockToFront(false); + ssglDepthRangeLockToFront(false); break; } @@ -584,7 +584,7 @@ void Entity::DrawOrGetDistance(void) { Vector mp = p.Minus(us).Plus (vs); glLineWidth(1); - glxColorRGB(Style::Color(Style::NORMALS)); + ssglColorRGB(Style::Color(Style::NORMALS)); glEnable(GL_LINE_STIPPLE); glLineStipple(3, 0x1111); if(!h.isFromRequest()) { @@ -601,10 +601,10 @@ void Entity::DrawOrGetDistance(void) { char *str = DescriptionString()+5; double th = DEFAULT_TEXT_HEIGHT; if(dogd.drawing) { - glxWriteText(str, th, mm2, u, v, NULL, NULL); + ssglWriteText(str, th, mm2, u, v, NULL, NULL); } else { - Vector pos = mm2.Plus(u.ScaledBy(glxStrWidth(str, th)/2)).Plus( - v.ScaledBy(glxStrHeight(th)/2)); + Vector pos = mm2.Plus(u.ScaledBy(ssglStrWidth(str, th)/2)).Plus( + v.ScaledBy(ssglStrHeight(th)/2)); Point2d pp = SS.GW.ProjectPoint(pos); dogd.dmin = min(dogd.dmin, pp.DistanceTo(dogd.mp) - 10); // If a line lies in a plane, then select the line, not diff --git a/generate.cpp b/generate.cpp index 0a8fa78..11c6eb6 100644 --- a/generate.cpp +++ b/generate.cpp @@ -208,17 +208,17 @@ void SolveSpace::GenerateAll(int first, int last, bool andFindFree) { double left = 80, top = -20, width = 240, height = 24; glColor3d(0.9, 0.8, 0.8); - glxAxisAlignedQuad(left, left+width, top, top-height); + ssglAxisAlignedQuad(left, left+width, top, top-height); glLineWidth(1); glColor3d(0.0, 0.0, 0.0); - glxAxisAlignedLineLoop(left, left+width, top, top-height); + ssglAxisAlignedLineLoop(left, left+width, top, top-height); - glxCreateBitmapFont(); + ssglCreateBitmapFont(); glColor3d(0, 0, 0); glPushMatrix(); glTranslated(left+8, top-20, 0); glScaled(1, -1, 1); - glxBitmapText(msg, Vector::From(0, 0, 0)); + ssglBitmapText(msg, Vector::From(0, 0, 0)); glPopMatrix(); glFlush(); glDrawBuffer(GL_BACK); diff --git a/glhelper.cpp b/glhelper.cpp index 0dcc350..35ef228 100644 --- a/glhelper.cpp +++ b/glhelper.cpp @@ -15,7 +15,7 @@ static bool ColorLocked; static bool DepthOffsetLocked; #define FONT_SCALE(h) ((h)/22.0) -double glxStrWidth(const char *str, double h) +double ssglStrWidth(const char *str, double h) { int w = 0; for(; *str; str++) { @@ -27,42 +27,42 @@ double glxStrWidth(const char *str, double h) } return w*FONT_SCALE(h)/SS.GW.scale; } -double glxStrHeight(double h) +double ssglStrHeight(double h) { // The characters have height ~22, as they appear in the table. return 22.0*FONT_SCALE(h)/SS.GW.scale; } -void glxWriteTextRefCenter(const char *str, double h, Vector t, Vector u, Vector v, - glxLineFn *fn, void *fndata) +void ssglWriteTextRefCenter(const char *str, double h, Vector t, Vector u, Vector v, + ssglLineFn *fn, void *fndata) { u = u.WithMagnitude(1); v = v.WithMagnitude(1); double scale = FONT_SCALE(h)/SS.GW.scale; - double fh = glxStrHeight(h); - double fw = glxStrWidth(str, h); + double fh = ssglStrHeight(h); + double fw = ssglStrWidth(str, h); t = t.Plus(u.ScaledBy(-fw/2)); t = t.Plus(v.ScaledBy(-fh/2)); - // Undo the (+5, +5) offset that glxWriteText applies. + // Undo the (+5, +5) offset that ssglWriteText applies. t = t.Plus(u.ScaledBy(-5*scale)); t = t.Plus(v.ScaledBy(-5*scale)); - glxWriteText(str, h, t, u, v, fn, fndata); + ssglWriteText(str, h, t, u, v, fn, fndata); } static void LineDrawCallback(void *fndata, Vector a, Vector b) { glLineWidth(1); glBegin(GL_LINES); - glxVertex3v(a); - glxVertex3v(b); + ssglVertex3v(a); + ssglVertex3v(b); glEnd(); } -void glxWriteText(const char *str, double h, Vector t, Vector u, Vector v, - glxLineFn *fn, void *fndata) +void ssglWriteText(const char *str, double h, Vector t, Vector u, Vector v, + ssglLineFn *fn, void *fndata) { if(!fn) fn = LineDrawCallback; u = u.WithMagnitude(1); @@ -101,12 +101,12 @@ void glxWriteText(const char *str, double h, Vector t, Vector u, Vector v, } } -void glxVertex3v(Vector u) +void ssglVertex3v(Vector u) { glVertex3f((GLfloat)u.x, (GLfloat)u.y, (GLfloat)u.z); } -void glxAxisAlignedQuad(double l, double r, double t, double b, bool lone) +void ssglAxisAlignedQuad(double l, double r, double t, double b, bool lone) { if(lone) glBegin(GL_QUADS); glVertex2d(l, t); @@ -116,7 +116,7 @@ void glxAxisAlignedQuad(double l, double r, double t, double b, bool lone) if(lone) glEnd(); } -void glxAxisAlignedLineLoop(double l, double r, double t, double b) +void ssglAxisAlignedLineLoop(double l, double r, double t, double b) { glBegin(GL_LINE_LOOP); glVertex2d(l, t); @@ -145,12 +145,12 @@ static void FatLineEndcap(Vector p, Vector u, Vector v) glBegin(GL_TRIANGLE_FAN); for(int i = 0; i <= 10; i++) { double c = Circle[i][0], s = Circle[i][1]; - glxVertex3v(p.Plus(u.ScaledBy(c)).Plus(v.ScaledBy(s))); + ssglVertex3v(p.Plus(u.ScaledBy(c)).Plus(v.ScaledBy(s))); } glEnd(); } -void glxFatLine(Vector a, Vector b, double width) +void ssglFatLine(Vector a, Vector b, double width) { // The half-width of the line we're drawing. double hw = width / 2; @@ -167,10 +167,10 @@ void glxFatLine(Vector a, Vector b, double width) // The body of a line is a quad glBegin(GL_QUADS); - glxVertex3v(a.Minus(abn)); - glxVertex3v(b.Minus(abn)); - glxVertex3v(b.Plus (abn)); - glxVertex3v(a.Plus (abn)); + ssglVertex3v(a.Minus(abn)); + ssglVertex3v(b.Minus(abn)); + ssglVertex3v(b.Plus (abn)); + ssglVertex3v(a.Plus (abn)); glEnd(); // And the line has two semi-circular end caps. FatLineEndcap(a, ab, abn); @@ -178,26 +178,26 @@ void glxFatLine(Vector a, Vector b, double width) } -void glxLockColorTo(RgbColor rgb) +void ssglLockColorTo(RgbColor rgb) { ColorLocked = false; glColor3d(rgb.redF(), rgb.greenF(), rgb.blueF()); ColorLocked = true; } -void glxUnlockColor(void) +void ssglUnlockColor(void) { ColorLocked = false; } -void glxColorRGB(RgbColor rgb) +void ssglColorRGB(RgbColor rgb) { // Is there a bug in some graphics drivers where this is not equivalent // to glColor3d? There seems to be... - glxColorRGBa(rgb, 1.0); + ssglColorRGBa(rgb, 1.0); } -void glxColorRGBa(RgbColor rgb, double a) +void ssglColorRGBa(RgbColor rgb, double a) { if(!ColorLocked) glColor4d(rgb.redF(), rgb.greenF(), rgb.blueF(), a); } @@ -237,19 +237,19 @@ static void StippleTriangle(STriangle *tr, bool s, RgbColor rgb) { glEnd(); glDisable(GL_LIGHTING); - glxColorRGB(rgb); + ssglColorRGB(rgb); Stipple(s); glBegin(GL_TRIANGLES); - glxVertex3v(tr->a); - glxVertex3v(tr->b); - glxVertex3v(tr->c); + ssglVertex3v(tr->a); + ssglVertex3v(tr->b); + ssglVertex3v(tr->c); glEnd(); glEnable(GL_LIGHTING); glDisable(GL_POLYGON_STIPPLE); glBegin(GL_TRIANGLES); } -void glxFillMesh(RgbColor specColor, SMesh *m, uint32_t h, uint32_t s1, uint32_t s2) +void ssglFillMesh(RgbColor specColor, SMesh *m, uint32_t h, uint32_t s1, uint32_t s2) { RgbColor rgbHovered = Style::Color(Style::HOVERED), rgbSelected = Style::Color(Style::SELECTED); @@ -278,19 +278,19 @@ void glxFillMesh(RgbColor specColor, SMesh *m, uint32_t h, uint32_t s1, uint32_t // Compute the normal from the vertices Vector n = tr->Normal(); glNormal3d(n.x, n.y, n.z); - glxVertex3v(tr->a); - glxVertex3v(tr->b); - glxVertex3v(tr->c); + ssglVertex3v(tr->a); + ssglVertex3v(tr->b); + ssglVertex3v(tr->c); } else { // Use the exact normals that are specified glNormal3d((tr->an).x, (tr->an).y, (tr->an).z); - glxVertex3v(tr->a); + ssglVertex3v(tr->a); glNormal3d((tr->bn).x, (tr->bn).y, (tr->bn).z); - glxVertex3v(tr->b); + ssglVertex3v(tr->b); glNormal3d((tr->cn).x, (tr->cn).y, (tr->cn).z); - glxVertex3v(tr->c); + ssglVertex3v(tr->c); } if((s1 != 0 && tr->meta.face == s1) || @@ -305,24 +305,24 @@ void glxFillMesh(RgbColor specColor, SMesh *m, uint32_t h, uint32_t s1, uint32_t glEnd(); } -static void GLX_CALLBACK Vertex(Vector *p) +static void SSGL_CALLBACK Vertex(Vector *p) { - glxVertex3v(*p); + ssglVertex3v(*p); } -void glxFillPolygon(SPolygon *p) +void ssglFillPolygon(SPolygon *p) { GLUtesselator *gt = gluNewTess(); - gluTessCallback(gt, GLU_TESS_BEGIN, (glxCallbackFptr *)glBegin); - gluTessCallback(gt, GLU_TESS_END, (glxCallbackFptr *)glEnd); - gluTessCallback(gt, GLU_TESS_VERTEX, (glxCallbackFptr *)Vertex); + gluTessCallback(gt, GLU_TESS_BEGIN, (ssglCallbackFptr *)glBegin); + gluTessCallback(gt, GLU_TESS_END, (ssglCallbackFptr *)glEnd); + gluTessCallback(gt, GLU_TESS_VERTEX, (ssglCallbackFptr *)Vertex); - glxTesselatePolygon(gt, p); + ssglTesselatePolygon(gt, p); gluDeleteTess(gt); } -static void GLX_CALLBACK Combine(double coords[3], void *vertexData[4], - float weight[4], void **outData) +static void SSGL_CALLBACK Combine(double coords[3], void *vertexData[4], + float weight[4], void **outData) { Vector *n = (Vector *)AllocTemporary(sizeof(Vector)); n->x = coords[0]; @@ -331,11 +331,11 @@ static void GLX_CALLBACK Combine(double coords[3], void *vertexData[4], *outData = n; } -void glxTesselatePolygon(GLUtesselator *gt, SPolygon *p) +void ssglTesselatePolygon(GLUtesselator *gt, SPolygon *p) { int i, j; - gluTessCallback(gt, GLU_TESS_COMBINE, (glxCallbackFptr *)Combine); + gluTessCallback(gt, GLU_TESS_COMBINE, (ssglCallbackFptr *)Combine); gluTessProperty(gt, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_ODD); Vector normal = p->normal; @@ -359,7 +359,7 @@ void glxTesselatePolygon(GLUtesselator *gt, SPolygon *p) gluTessEndPolygon(gt); } -void glxDebugPolygon(SPolygon *p) +void ssglDebugPolygon(SPolygon *p) { int i, j; glLineWidth(2); @@ -371,28 +371,28 @@ void glxDebugPolygon(SPolygon *p) Vector a = (sc->l.elem[j]).p; Vector b = (sc->l.elem[j+1]).p; - glxLockColorTo(RGB(0, 0, 255)); + ssglLockColorTo(RGB(0, 0, 255)); Vector d = (a.Minus(b)).WithMagnitude(-0); glBegin(GL_LINES); - glxVertex3v(a.Plus(d)); - glxVertex3v(b.Minus(d)); + ssglVertex3v(a.Plus(d)); + ssglVertex3v(b.Minus(d)); glEnd(); - glxLockColorTo(RGB(255, 0, 0)); + ssglLockColorTo(RGB(255, 0, 0)); glBegin(GL_POINTS); - glxVertex3v(a.Plus(d)); - glxVertex3v(b.Minus(d)); + ssglVertex3v(a.Plus(d)); + ssglVertex3v(b.Minus(d)); glEnd(); } } } -void glxDrawEdges(SEdgeList *el, bool endpointsToo) +void ssglDrawEdges(SEdgeList *el, bool endpointsToo) { SEdge *se; glBegin(GL_LINES); for(se = el->l.First(); se; se = el->l.NextAfter(se)) { - glxVertex3v(se->a); - glxVertex3v(se->b); + ssglVertex3v(se->a); + ssglVertex3v(se->b); } glEnd(); @@ -400,37 +400,37 @@ void glxDrawEdges(SEdgeList *el, bool endpointsToo) glPointSize(12); glBegin(GL_POINTS); for(se = el->l.First(); se; se = el->l.NextAfter(se)) { - glxVertex3v(se->a); - glxVertex3v(se->b); + ssglVertex3v(se->a); + ssglVertex3v(se->b); } glEnd(); } } -void glxDebugMesh(SMesh *m) +void ssglDebugMesh(SMesh *m) { int i; glLineWidth(1); glPointSize(7); - glxDepthRangeOffset(1); - glxUnlockColor(); + ssglDepthRangeOffset(1); + ssglUnlockColor(); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - glxColorRGBa(RGB(0, 255, 0), 1.0); + ssglColorRGBa(RGB(0, 255, 0), 1.0); glBegin(GL_TRIANGLES); for(i = 0; i < m->l.n; i++) { STriangle *t = &(m->l.elem[i]); if(t->tag) continue; - glxVertex3v(t->a); - glxVertex3v(t->b); - glxVertex3v(t->c); + ssglVertex3v(t->a); + ssglVertex3v(t->b); + ssglVertex3v(t->c); } glEnd(); - glxDepthRangeOffset(0); + ssglDepthRangeOffset(0); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } -void glxMarkPolygonNormal(SPolygon *p) +void ssglMarkPolygonNormal(SPolygon *p) { Vector tail = Vector::From(0, 0, 0); int i, j, cnt = 0; @@ -452,17 +452,17 @@ void glxMarkPolygonNormal(SPolygon *p) glColor3d(1, 1, 0); glBegin(GL_LINES); - glxVertex3v(tail); - glxVertex3v(tip); - glxVertex3v(tip); - glxVertex3v(tip.Minus(arrow.RotatedAbout(gn, 0.6))); - glxVertex3v(tip); - glxVertex3v(tip.Minus(arrow.RotatedAbout(gn, -0.6))); + ssglVertex3v(tail); + ssglVertex3v(tip); + ssglVertex3v(tip); + ssglVertex3v(tip.Minus(arrow.RotatedAbout(gn, 0.6))); + ssglVertex3v(tip); + ssglVertex3v(tip.Minus(arrow.RotatedAbout(gn, -0.6))); glEnd(); glEnable(GL_LIGHTING); } -void glxDepthRangeOffset(int units) +void ssglDepthRangeOffset(int units) { if(!DepthOffsetLocked) { // The size of this step depends on the resolution of the Z buffer; for @@ -472,18 +472,18 @@ void glxDepthRangeOffset(int units) } } -void glxDepthRangeLockToFront(bool yes) +void ssglDepthRangeLockToFront(bool yes) { if(yes) { DepthOffsetLocked = true; glDepthRange(0, 0); } else { DepthOffsetLocked = false; - glxDepthRangeOffset(0); + ssglDepthRangeOffset(0); } } -void glxCreateBitmapFont(void) +void ssglCreateBitmapFont(void) { // Place the font in our texture in a two-dimensional grid; 1d would // be simpler, but long skinny textures (256*16 = 4096 pixels wide) @@ -513,7 +513,7 @@ void glxCreateBitmapFont(void) MappedTexture); } -void glxBitmapCharQuad(char c, double x, double y) +void ssglBitmapCharQuad(char c, double x, double y) { uint8_t b = (uint8_t)c; int w, h; @@ -549,12 +549,12 @@ void glxBitmapCharQuad(char c, double x, double y) } } -void glxBitmapText(const char *str, Vector p) +void ssglBitmapText(const char *str, Vector p) { glEnable(GL_TEXTURE_2D); glBegin(GL_QUADS); while(*str) { - glxBitmapCharQuad(*str, p.x, p.y); + ssglBitmapCharQuad(*str, p.x, p.y); str++; p.x += SS.TW.CHAR_WIDTH; @@ -563,7 +563,7 @@ void glxBitmapText(const char *str, Vector p) glDisable(GL_TEXTURE_2D); } -void glxDrawPixelsWithTexture(uint8_t *data, int w, int h) +void ssglDrawPixelsWithTexture(uint8_t *data, int w, int h) { #define MAX_DIM 32 static uint8_t Texture[MAX_DIM*MAX_DIM*3]; diff --git a/groupmesh.cpp b/groupmesh.cpp index a91f0d9..906d6af 100644 --- a/groupmesh.cpp +++ b/groupmesh.cpp @@ -459,17 +459,17 @@ void Group::DrawDisplayItems(int t) { if(SS.GW.showShaded) { glEnable(GL_LIGHTING); - glxFillMesh(specColor, &displayMesh, mh, ms1, ms2); + ssglFillMesh(specColor, &displayMesh, mh, ms1, ms2); glDisable(GL_LIGHTING); } if(SS.GW.showEdges) { - glxDepthRangeOffset(2); - glxColorRGB(Style::Color(Style::SOLID_EDGE)); + ssglDepthRangeOffset(2); + ssglColorRGB(Style::Color(Style::SOLID_EDGE)); glLineWidth(Style::Width(Style::SOLID_EDGE)); - glxDrawEdges(&displayEdges, false); + ssglDrawEdges(&displayEdges, false); } - if(SS.GW.showMesh) glxDebugMesh(&displayMesh); + if(SS.GW.showMesh) ssglDebugMesh(&displayMesh); } void Group::Draw(void) { @@ -489,14 +489,14 @@ void Group::Draw(void) { // it's just a nuisance. if(type == DRAWING_WORKPLANE) { glDisable(GL_DEPTH_TEST); - glxColorRGBa(Style::Color(Style::DRAW_ERROR), 0.2); + ssglColorRGBa(Style::Color(Style::DRAW_ERROR), 0.2); glLineWidth (Style::Width(Style::DRAW_ERROR)); glBegin(GL_LINES); - glxVertex3v(polyError.notClosedAt.a); - glxVertex3v(polyError.notClosedAt.b); + ssglVertex3v(polyError.notClosedAt.a); + ssglVertex3v(polyError.notClosedAt.b); glEnd(); - glxColorRGB(Style::Color(Style::DRAW_ERROR)); - glxWriteText("not closed contour, or not all same style!", + ssglColorRGB(Style::Color(Style::DRAW_ERROR)); + ssglWriteText("not closed contour, or not all same style!", DEFAULT_TEXT_HEIGHT, polyError.notClosedAt.b, SS.GW.projRight, SS.GW.projUp, NULL, NULL); @@ -509,7 +509,7 @@ void Group::Draw(void) { // These errors occur at points, not lines if(type == DRAWING_WORKPLANE) { glDisable(GL_DEPTH_TEST); - glxColorRGB(Style::Color(Style::DRAW_ERROR)); + ssglColorRGB(Style::Color(Style::DRAW_ERROR)); const char *msg; if(polyError.how == POLY_NOT_COPLANAR) { msg = "points not all coplanar!"; @@ -518,7 +518,7 @@ void Group::Draw(void) { } else { msg = "zero-length edge!"; } - glxWriteText(msg, DEFAULT_TEXT_HEIGHT, + ssglWriteText(msg, DEFAULT_TEXT_HEIGHT, polyError.errorPointAt, SS.GW.projRight, SS.GW.projUp, NULL, NULL); glEnable(GL_DEPTH_TEST); @@ -532,9 +532,9 @@ void Group::FillLoopSetAsPolygon(SBezierLoopSet *sbls) { SPolygon sp; ZERO(&sp); sbls->MakePwlInto(&sp); - glxDepthRangeOffset(1); - glxFillPolygon(&sp); - glxDepthRangeOffset(0); + ssglDepthRangeOffset(1); + ssglFillPolygon(&sp); + ssglDepthRangeOffset(0); sp.Clear(); } @@ -550,7 +550,7 @@ void Group::DrawFilledPaths(void) { Style *s = Style::Get(hs); if(s->filled) { // This is a filled loop, where the user specified a fill color. - glxColorRGBa(s->fillColor, 1); + ssglColorRGBa(s->fillColor, 1); FillLoopSetAsPolygon(sbls); } else { if(h.v == SS.GW.activeGroup.v && SS.checkClosedContour && @@ -559,10 +559,10 @@ void Group::DrawFilledPaths(void) { // If this is the active group, and we are supposed to check // for closed contours, and we do indeed have a closed and // non-intersecting contour, then fill it dimly. - glxColorRGBa(Style::Color(Style::CONTOUR_FILL), 0.5); - glxDepthRangeOffset(1); + ssglColorRGBa(Style::Color(Style::CONTOUR_FILL), 0.5); + ssglDepthRangeOffset(1); FillLoopSetAsPolygon(sbls); - glxDepthRangeOffset(0); + ssglDepthRangeOffset(0); } } } diff --git a/solvespace.h b/solvespace.h index e16782a..37cd048 100644 --- a/solvespace.h +++ b/solvespace.h @@ -228,37 +228,37 @@ typedef IdList ParamList; // Utility functions that are provided in the platform-independent code. -void glxVertex3v(Vector u); -void glxAxisAlignedQuad(double l, double r, double t, double b, bool lone = true); -void glxAxisAlignedLineLoop(double l, double r, double t, double b); +void ssglVertex3v(Vector u); +void ssglAxisAlignedQuad(double l, double r, double t, double b, bool lone = true); +void ssglAxisAlignedLineLoop(double l, double r, double t, double b); #define DEFAULT_TEXT_HEIGHT (11.5) -#define GLX_CALLBACK __stdcall -typedef void GLX_CALLBACK glxCallbackFptr(void); -void glxTesselatePolygon(GLUtesselator *gt, SPolygon *p); -void glxFillPolygon(SPolygon *p); -void glxFillMesh(RgbColor color, SMesh *m, uint32_t h, uint32_t s1, uint32_t s2); -void glxDebugPolygon(SPolygon *p); -void glxDrawEdges(SEdgeList *l, bool endpointsToo); -void glxDebugMesh(SMesh *m); -void glxMarkPolygonNormal(SPolygon *p); -typedef void glxLineFn(void *data, Vector a, Vector b); -void glxWriteText(const char *str, double h, Vector t, Vector u, Vector v, - glxLineFn *fn, void *fndata); -void glxWriteTextRefCenter(const char *str, double h, Vector t, Vector u, Vector v, - glxLineFn *fn, void *fndata); -double glxStrWidth(const char *str, double h); -double glxStrHeight(double h); -void glxLockColorTo(RgbColor rgb); -void glxFatLine(Vector a, Vector b, double width); -void glxUnlockColor(void); -void glxColorRGB(RgbColor rgb); -void glxColorRGBa(RgbColor rgb, double a); -void glxDepthRangeOffset(int units); -void glxDepthRangeLockToFront(bool yes); -void glxDrawPixelsWithTexture(uint8_t *data, int w, int h); -void glxCreateBitmapFont(void); -void glxBitmapText(const char *str, Vector p); -void glxBitmapCharQuad(char c, double x, double y); +#define SSGL_CALLBACK __stdcall +typedef void SSGL_CALLBACK ssglCallbackFptr(void); +void ssglTesselatePolygon(GLUtesselator *gt, SPolygon *p); +void ssglFillPolygon(SPolygon *p); +void ssglFillMesh(RgbColor color, SMesh *m, uint32_t h, uint32_t s1, uint32_t s2); +void ssglDebugPolygon(SPolygon *p); +void ssglDrawEdges(SEdgeList *l, bool endpointsToo); +void ssglDebugMesh(SMesh *m); +void ssglMarkPolygonNormal(SPolygon *p); +typedef void ssglLineFn(void *data, Vector a, Vector b); +void ssglWriteText(const char *str, double h, Vector t, Vector u, Vector v, + ssglLineFn *fn, void *fndata); +void ssglWriteTextRefCenter(const char *str, double h, Vector t, Vector u, Vector v, + ssglLineFn *fn, void *fndata); +double ssglStrWidth(const char *str, double h); +double ssglStrHeight(double h); +void ssglLockColorTo(RgbColor rgb); +void ssglFatLine(Vector a, Vector b, double width); +void ssglUnlockColor(void); +void ssglColorRGB(RgbColor rgb); +void ssglColorRGBa(RgbColor rgb, double a); +void ssglDepthRangeOffset(int units); +void ssglDepthRangeLockToFront(bool yes); +void ssglDrawPixelsWithTexture(uint8_t *data, int w, int h); +void ssglCreateBitmapFont(void); +void ssglBitmapText(const char *str, Vector p); +void ssglBitmapCharQuad(char c, double x, double y); #define TEXTURE_BACKGROUND_IMG 10 #define TEXTURE_BITMAP_FONT 20 #define TEXTURE_DRAW_PIXELS 30 diff --git a/textwin.cpp b/textwin.cpp index 4b05142..513d35f 100644 --- a/textwin.cpp +++ b/textwin.cpp @@ -350,7 +350,7 @@ void TextWindow::DrawOrHitTestIcons(int how, double mx, double my) double grey = 30.0/255; double top = y - 28, bot = y + 4; glColor4d(grey, grey, grey, 1.0); - glxAxisAlignedQuad(0, width, top, bot); + ssglAxisAlignedQuad(0, width, top, bot); HideShowIcon *oldHovered = hoveredIcon; if(how != PAINT) { @@ -365,7 +365,7 @@ void TextWindow::DrawOrHitTestIcons(int how, double mx, double my) int l = x, r = l + 4, t = y, b = t - 24; glColor4d(0.17, 0.17, 0.17, 1); - glxAxisAlignedQuad(l, r, t, b); + ssglAxisAlignedQuad(l, r, t, b); } x += 12; continue; @@ -377,12 +377,12 @@ void TextWindow::DrawOrHitTestIcons(int how, double mx, double my) // Only thing that matters about the color is the alpha, // should be one for no transparency glColor3d(0, 0, 0); - glxDrawPixelsWithTexture(hsi->icon, 24, 24); + ssglDrawPixelsWithTexture(hsi->icon, 24, 24); glPopMatrix(); if(hsi == hoveredIcon) { glColor4d(1, 1, 0, 0.3); - glxAxisAlignedQuad(x - 2, x + 26, y + 2, y - 26); + ssglAxisAlignedQuad(x - 2, x + 26, y + 2, y - 26); } if(!*(hsi->var)) { glColor4d(1, 0, 0, 0.6); @@ -443,15 +443,15 @@ void TextWindow::DrawOrHitTestIcons(int how, double mx, double my) ox = min(ox, (width - 25) - tw); oy = max(oy, 5); - glxCreateBitmapFont(); + ssglCreateBitmapFont(); glLineWidth(1); glColor4d(1.0, 1.0, 0.6, 1.0); - glxAxisAlignedQuad(ox, ox+tw, oy, oy+LINE_HEIGHT); + ssglAxisAlignedQuad(ox, ox+tw, oy, oy+LINE_HEIGHT); glColor4d(0.0, 0.0, 0.0, 1.0); - glxAxisAlignedLineLoop(ox, ox+tw, oy, oy+LINE_HEIGHT); + ssglAxisAlignedLineLoop(ox, ox+tw, oy, oy+LINE_HEIGHT); glColor4d(0, 0, 0, 1); - glxBitmapText(str, Vector::From(ox+5, oy-3+LINE_HEIGHT, 0)); + ssglBitmapText(str, Vector::From(ox+5, oy-3+LINE_HEIGHT, 0)); } else { if(!hoveredIcon || (hoveredIcon != tooltippedIcon)) @@ -593,9 +593,9 @@ bool TextWindow::DrawOrHitTestColorPicker(int how, bool leftDown, int bw = 6; if(how == PAINT) { glColor4d(0.2, 0.2, 0.2, 1); - glxAxisAlignedQuad(px, pxm+bw, py, pym+bw); + ssglAxisAlignedQuad(px, pxm+bw, py, pym+bw); glColor4d(0.0, 0.0, 0.0, 1); - glxAxisAlignedQuad(px+(bw/2), pxm+(bw/2), py+(bw/2), pym+(bw/2)); + ssglAxisAlignedQuad(px+(bw/2), pxm+(bw/2), py+(bw/2), pym+(bw/2)); } else { if(x < px || x > pxm+(bw/2) || y < py || y > pym+(bw/2)) @@ -635,7 +635,7 @@ bool TextWindow::DrawOrHitTestColorPicker(int how, bool leftDown, if(how == PAINT) { glColor4d(CO(rgb), 1); - glxAxisAlignedQuad(sx, sx+SIZE, sy, sy+SIZE); + ssglAxisAlignedQuad(sx, sx+SIZE, sy, sy+SIZE); } else if(how == CLICK) { if(x >= sx && x <= sx+SIZE && y >= sy && y <= sy+SIZE) { editControl.colorPicker.rgb = RGBf(rgb.x, rgb.y, rgb.z); @@ -654,8 +654,8 @@ bool TextWindow::DrawOrHitTestColorPicker(int how, bool leftDown, hxm = hx + PITCH*7 + SIZE; hym = hy + PITCH*2 + SIZE; if(how == PAINT) { - glxColorRGB(editControl.colorPicker.rgb); - glxAxisAlignedQuad(hx, hxm, hy, hym); + ssglColorRGB(editControl.colorPicker.rgb); + ssglAxisAlignedQuad(hx, hxm, hy, hym); } else if(how == CLICK) { if(x >= hx && x <= hxm && y >= hy && y <= hym) { ColorPickerDone(); @@ -827,7 +827,7 @@ void TextWindow::Paint(void) { glBegin(GL_QUADS); } else if(a == 1) { glEnable(GL_TEXTURE_2D); - glxCreateBitmapFont(); + ssglCreateBitmapFont(); glBegin(GL_QUADS); } @@ -860,12 +860,12 @@ void TextWindow::Paint(void) { // Move the quad down a bit, so that the descenders // still have the correct background. y += adj; - glxAxisAlignedQuad(x, x + CHAR_WIDTH, y, y + bh, false); + ssglAxisAlignedQuad(x, x + CHAR_WIDTH, y, y + bh, false); y -= adj; } } else if(a == 1) { glColor3fv(&(fgColorTable[fg*3])); - glxBitmapCharQuad(text[r][c], x, y + CHAR_HEIGHT); + ssglBitmapCharQuad(text[r][c], x, y + CHAR_HEIGHT); // If this is a link and it's hovered, then draw the // underline diff --git a/toolbar.cpp b/toolbar.cpp index 0d65e9b..efebe55 100644 --- a/toolbar.cpp +++ b/toolbar.cpp @@ -132,7 +132,7 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, double c = 30.0/255; glColor4d(c, c, c, 1.0); - glxAxisAlignedQuad(aleft, aright, atop, abot); + ssglAxisAlignedQuad(aleft, aright, atop, abot); } struct { @@ -156,7 +156,7 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, glColor4d(0.17, 0.17, 0.17, 1); x += 16; y += 24; - glxAxisAlignedQuad(x+divw, x-divw, y+divh, y-divh); + ssglAxisAlignedQuad(x+divw, x-divw, y+divh, y-divh); x -= 16; y -= 24; } @@ -172,7 +172,7 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, // Highlight the hovered or pending item. glColor4d(1, 1, 0, 0.3); int boxhw = 15; - glxAxisAlignedQuad(x+boxhw, x-boxhw, y+boxhw, y-boxhw); + ssglAxisAlignedQuad(x+boxhw, x-boxhw, y+boxhw, y-boxhw); } if(toolbarTooltipped == Toolbar[i].menu) { @@ -204,7 +204,7 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, if(paint) { // Do this last so that nothing can draw over it. if(toolTip.show) { - glxCreateBitmapFont(); + ssglCreateBitmapFont(); char str[1024]; if(strlen(toolTip.str) >= 200) oops(); strcpy(str, toolTip.str); @@ -225,18 +225,18 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, double ox = toolbarMouseX + 3, oy = toolbarMouseY + 3; glLineWidth(1); glColor4d(1.0, 1.0, 0.6, 1.0); - glxAxisAlignedQuad(ox, ox+tw, oy, oy+th); + ssglAxisAlignedQuad(ox, ox+tw, oy, oy+th); glColor4d(0.0, 0.0, 0.0, 1.0); - glxAxisAlignedLineLoop(ox, ox+tw, oy, oy+th); + ssglAxisAlignedLineLoop(ox, ox+tw, oy, oy+th); glColor4d(0, 0, 0, 1); glPushMatrix(); glTranslated(ox+5, oy+3, 0); glScaled(1, -1, 1); - glxBitmapText(str, Vector::From(0, 0, 0)); + ssglBitmapText(str, Vector::From(0, 0, 0)); glPopMatrix(); } - glxDepthRangeLockToFront(false); + ssglDepthRangeLockToFront(false); } return withinToolbar;