Use Canvas::Stroke, not Canvas::Fill, for drawing a point.
Our points are more like fat lines than actual quads, in that they are scale-invariant.
This commit is contained in:
parent
e80a3a0a71
commit
1108a6f37d
@ -496,11 +496,12 @@ void Entity::Draw(DrawAs how, Canvas *canvas) {
|
|||||||
}
|
}
|
||||||
Canvas::hStroke hcs = canvas->GetStroke(stroke);
|
Canvas::hStroke hcs = canvas->GetStroke(stroke);
|
||||||
|
|
||||||
Canvas::Fill fill = {};
|
Canvas::Stroke pointStroke = {};
|
||||||
fill.layer = stroke.layer;
|
pointStroke.layer = stroke.layer;
|
||||||
fill.zIndex = IsPoint() ? 5 : 0;
|
pointStroke.zIndex = IsPoint() ? zIndex + 1 : 0;
|
||||||
fill.color = stroke.color;
|
pointStroke.color = stroke.color;
|
||||||
Canvas::hFill hcf = canvas->GetFill(fill);
|
pointStroke.width = 7.0;
|
||||||
|
Canvas::hStroke hcsPoint = canvas->GetStroke(pointStroke);
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case Type::POINT_N_COPY:
|
case Type::POINT_N_COPY:
|
||||||
@ -528,14 +529,15 @@ void Entity::Draw(DrawAs how, Canvas *canvas) {
|
|||||||
free = pu->free || pv->free;
|
free = pu->free || pv->free;
|
||||||
}
|
}
|
||||||
if(free) {
|
if(free) {
|
||||||
Canvas::Fill fillAnalyze = fill;
|
Canvas::Stroke analyzeStroke = pointStroke;
|
||||||
fillAnalyze.color = Style::Color(Style::ANALYZE);
|
analyzeStroke.color = Style::Color(Style::ANALYZE);
|
||||||
Canvas::hFill hcfAnalyze = canvas->GetFill(fillAnalyze);
|
analyzeStroke.width = 14.0;
|
||||||
|
Canvas::hStroke hcsAnalyze = canvas->GetStroke(analyzeStroke);
|
||||||
|
|
||||||
canvas->DrawPoint(PointGetNum(), 7.0, hcfAnalyze);
|
canvas->DrawPoint(PointGetNum(), hcsAnalyze);
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas->DrawPoint(PointGetNum(), 3.5, hcf);
|
canvas->DrawPoint(PointGetNum(), hcsPoint);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ public:
|
|||||||
void DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs drawAs) override {
|
void DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs drawAs) override {
|
||||||
ssassert(false, "Not implemented");
|
ssassert(false, "Not implemented");
|
||||||
}
|
}
|
||||||
void DrawPoint(const Vector &o, double d, hFill hcf) override {
|
void DrawPoint(const Vector &o, hStroke hcs) override {
|
||||||
ssassert(false, "Not implemented");
|
ssassert(false, "Not implemented");
|
||||||
}
|
}
|
||||||
void DrawPolygon(const SPolygon &p, hFill hcf) override {
|
void DrawPolygon(const SPolygon &p, hFill hcf) override {
|
||||||
|
@ -346,10 +346,10 @@ void ObjectPicker::DrawQuad(const Vector &a, const Vector &b, const Vector &c, c
|
|||||||
DoQuad(a, b, c, d, fill->zIndex);
|
DoQuad(a, b, c, d, fill->zIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectPicker::DrawPoint(const Vector &o, double s, hFill hcf) {
|
void ObjectPicker::DrawPoint(const Vector &o, Canvas::hStroke hcs) {
|
||||||
Fill *fill = fills.FindById(hcf);
|
Stroke *stroke = strokes.FindById(hcs);
|
||||||
double distance = point.DistanceTo(camera.ProjectPoint(o)) - s / 2;
|
double distance = point.DistanceTo(camera.ProjectPoint(o)) - stroke->width / 2;
|
||||||
DoCompare(distance, fill->zIndex);
|
DoCompare(distance, stroke->zIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectPicker::DrawPolygon(const SPolygon &p, hFill hcf) {
|
void ObjectPicker::DrawPolygon(const SPolygon &p, hFill hcf) {
|
||||||
|
@ -140,7 +140,7 @@ public:
|
|||||||
|
|
||||||
virtual void DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d,
|
virtual void DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d,
|
||||||
hFill hcf) = 0;
|
hFill hcf) = 0;
|
||||||
virtual void DrawPoint(const Vector &o, double d, hFill hcf) = 0;
|
virtual void DrawPoint(const Vector &o, hStroke hcs) = 0;
|
||||||
virtual void DrawPolygon(const SPolygon &p, hFill hcf) = 0;
|
virtual void DrawPolygon(const SPolygon &p, hFill hcf) = 0;
|
||||||
virtual void DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack = {},
|
virtual void DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack = {},
|
||||||
hStroke hcsTriangles = {}) = 0;
|
hStroke hcsTriangles = {}) = 0;
|
||||||
@ -196,7 +196,7 @@ public:
|
|||||||
|
|
||||||
void DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d,
|
void DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d,
|
||||||
hFill hcf) override;
|
hFill hcf) override;
|
||||||
void DrawPoint(const Vector &o, double s, hFill hcf) override;
|
void DrawPoint(const Vector &o, hStroke hcs) override;
|
||||||
void DrawPolygon(const SPolygon &p, hFill hcf) override;
|
void DrawPolygon(const SPolygon &p, hFill hcf) override;
|
||||||
void DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack, hStroke hcsTriangles) override;
|
void DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack, hStroke hcsTriangles) override;
|
||||||
void DrawFaces(const SMesh &m, const std::vector<uint32_t> &faces, hFill hcf) override;
|
void DrawFaces(const SMesh &m, const std::vector<uint32_t> &faces, hFill hcf) override;
|
||||||
@ -244,7 +244,7 @@ public:
|
|||||||
|
|
||||||
void DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d,
|
void DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d,
|
||||||
hFill hcf) override;
|
hFill hcf) override;
|
||||||
void DrawPoint(const Vector &o, double s, hFill hcf) override;
|
void DrawPoint(const Vector &o, hStroke hcs) override;
|
||||||
void DrawPolygon(const SPolygon &p, hFill hcf) override;
|
void DrawPolygon(const SPolygon &p, hFill hcf) override;
|
||||||
void DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack, hStroke hcsTriangles) override;
|
void DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack, hStroke hcsTriangles) override;
|
||||||
void DrawFaces(const SMesh &m, const std::vector<uint32_t> &faces, hFill hcf) override;
|
void DrawFaces(const SMesh &m, const std::vector<uint32_t> &faces, hFill hcf) override;
|
||||||
@ -347,7 +347,7 @@ public:
|
|||||||
|
|
||||||
void DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d,
|
void DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d,
|
||||||
hFill hcf) override;
|
hFill hcf) override;
|
||||||
void DrawPoint(const Vector &o, double s, hFill hcf) override;
|
void DrawPoint(const Vector &o, hStroke hcs) override;
|
||||||
void DrawPolygon(const SPolygon &p, hFill hcf) override;
|
void DrawPolygon(const SPolygon &p, hFill hcf) override;
|
||||||
void DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack, hStroke hcsTriangles) override;
|
void DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack, hStroke hcsTriangles) override;
|
||||||
void DrawFaces(const SMesh &m, const std::vector<uint32_t> &faces, hFill hcf) override;
|
void DrawFaces(const SMesh &m, const std::vector<uint32_t> &faces, hFill hcf) override;
|
||||||
|
@ -104,9 +104,17 @@ void SurfaceRenderer::DrawQuad(const Vector &a, const Vector &b, const Vector &c
|
|||||||
mesh.AddTriangle(meta, ta, td, tc);
|
mesh.AddTriangle(meta, ta, td, tc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceRenderer::DrawPoint(const Vector &o, double s, hFill hcf) {
|
void SurfaceRenderer::DrawPoint(const Vector &o, Canvas::hStroke hcs) {
|
||||||
Vector u = camera.projRight.ScaledBy(1 / camera.scale * s),
|
Stroke *stroke = strokes.FindById(hcs);
|
||||||
v = camera.projUp.ScaledBy(1 / camera.scale * s);
|
|
||||||
|
Fill fill = {};
|
||||||
|
fill.layer = stroke->layer;
|
||||||
|
fill.zIndex = stroke->zIndex;
|
||||||
|
fill.color = stroke->color;
|
||||||
|
hFill hcf = GetFill(fill);
|
||||||
|
|
||||||
|
Vector u = camera.projRight.ScaledBy(stroke->width/2.0/camera.scale),
|
||||||
|
v = camera.projUp.ScaledBy(stroke->width/2.0/camera.scale);
|
||||||
DrawQuad(o.Minus(u).Minus(v), o.Minus(u).Plus(v),
|
DrawQuad(o.Minus(u).Minus(v), o.Minus(u).Plus(v),
|
||||||
o.Plus(u).Plus(v), o.Plus(u).Minus(v), hcf);
|
o.Plus(u).Plus(v), o.Plus(u).Minus(v), hcf);
|
||||||
}
|
}
|
||||||
|
@ -501,9 +501,17 @@ void OpenGl1Renderer::DrawQuad(const Vector &a, const Vector &b, const Vector &c
|
|||||||
ssglVertex3v(d);
|
ssglVertex3v(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGl1Renderer::DrawPoint(const Vector &o, double s, hFill hcf) {
|
void OpenGl1Renderer::DrawPoint(const Vector &o, Canvas::hStroke hcs) {
|
||||||
Vector r = camera.projRight.ScaledBy(s/camera.scale);
|
Stroke *stroke = SelectStroke(hcs);
|
||||||
Vector u = camera.projUp.ScaledBy(s/camera.scale);
|
|
||||||
|
Canvas::Fill fill = {};
|
||||||
|
fill.layer = stroke->layer;
|
||||||
|
fill.zIndex = stroke->zIndex;
|
||||||
|
fill.color = stroke->color;
|
||||||
|
hFill hcf = GetFill(fill);
|
||||||
|
|
||||||
|
Vector r = camera.projRight.ScaledBy(stroke->width/2.0/camera.scale);
|
||||||
|
Vector u = camera.projUp.ScaledBy(stroke->width/2.0/camera.scale);
|
||||||
Vector a = o.Plus (r).Plus (u),
|
Vector a = o.Plus (r).Plus (u),
|
||||||
b = o.Plus (r).Minus(u),
|
b = o.Plus (r).Minus(u),
|
||||||
c = o.Minus(r).Minus(u),
|
c = o.Minus(r).Minus(u),
|
||||||
|
Loading…
Reference in New Issue
Block a user