Tweaks to visual clip tools
Originally committed to SVN as r1365.
This commit is contained in:
parent
570321722b
commit
201a9a4b26
|
@ -193,7 +193,7 @@ void Spline::MovePoint(int curveIndex,int point,wxPoint pos) {
|
||||||
SplineCurve *c2 = NULL;
|
SplineCurve *c2 = NULL;
|
||||||
|
|
||||||
// Indices
|
// Indices
|
||||||
int size = curves.size();
|
//int size = curves.size();
|
||||||
int i0 = curveIndex-1;
|
int i0 = curveIndex-1;
|
||||||
int i1 = curveIndex;
|
int i1 = curveIndex;
|
||||||
int i2 = curveIndex+1;
|
int i2 = curveIndex+1;
|
||||||
|
@ -282,8 +282,11 @@ void Spline::GetPointList(std::vector<wxPoint> &points) {
|
||||||
int y3 = cur->y3;
|
int y3 = cur->y3;
|
||||||
int y4 = cur->y4;
|
int y4 = cur->y4;
|
||||||
|
|
||||||
// Hardcoded at 50 steps for now
|
// Find number of steps
|
||||||
int steps = 50;
|
int len = sqrt(double((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))) + sqrt(double((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3))) + sqrt(double((x3-x4)*(x3-x4)+(y3-y4)*(y3-y4)));
|
||||||
|
int steps = len/8;
|
||||||
|
|
||||||
|
// Render curve
|
||||||
for (int i=0;i<steps;i++) {
|
for (int i=0;i<steps;i++) {
|
||||||
// Get t and t-1 (u)
|
// Get t and t-1 (u)
|
||||||
float t = float(i)/float(steps);
|
float t = float(i)/float(steps);
|
||||||
|
|
|
@ -86,7 +86,7 @@ void VisualToolClip::Draw() {
|
||||||
int dy2 = curY2;
|
int dy2 = curY2;
|
||||||
|
|
||||||
// Draw rectangle
|
// Draw rectangle
|
||||||
SetLineColour(colour[3]);
|
SetLineColour(colour[3],1.0f,2);
|
||||||
SetFillColour(colour[3],0.0f);
|
SetFillColour(colour[3],0.0f);
|
||||||
DrawRectangle(dx1,dy1,dx2,dy2);
|
DrawRectangle(dx1,dy1,dx2,dy2);
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ void VisualToolVectorClip::Draw() {
|
||||||
spline.GetPointList(points);
|
spline.GetPointList(points);
|
||||||
|
|
||||||
// Draw lines
|
// Draw lines
|
||||||
SetLineColour(colour[3]);
|
SetLineColour(colour[3],1.0f,2);
|
||||||
SetFillColour(colour[3],0.0f);
|
SetFillColour(colour[3],0.0f);
|
||||||
for (size_t i=0;i<points.size()-1;i++) {
|
for (size_t i=0;i<points.size()-1;i++) {
|
||||||
DrawLine(points[i].x,points[i].y,points[i+1].x,points[i+1].y);
|
DrawLine(points[i].x,points[i].y,points[i+1].x,points[i+1].y);
|
||||||
|
@ -91,6 +91,7 @@ void VisualToolVectorClip::Draw() {
|
||||||
glColorMask(1,1,1,1);
|
glColorMask(1,1,1,1);
|
||||||
glStencilFunc(GL_EQUAL, 0, 1);
|
glStencilFunc(GL_EQUAL, 0, 1);
|
||||||
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
||||||
|
SetLineColour(colour[3],0.0f);
|
||||||
SetFillColour(wxColour(0,0,0),0.5f);
|
SetFillColour(wxColour(0,0,0),0.5f);
|
||||||
DrawRectangle(0,0,sw,sh);
|
DrawRectangle(0,0,sw,sh);
|
||||||
glDisable(GL_STENCIL_TEST);
|
glDisable(GL_STENCIL_TEST);
|
||||||
|
|
Loading…
Reference in a new issue