Fix variable thickness
This commit is contained in:
parent
9a5c02f67d
commit
1e6332e4dc
|
|
@ -80,8 +80,7 @@ int main(void)
|
||||||
|
|
||||||
// Spline config variables
|
// Spline config variables
|
||||||
float splineThickness = 8.0f;
|
float splineThickness = 8.0f;
|
||||||
int splineTypeActive = SPLINE_LINEAR_VAR; // 0-Linear, 1-BSpline, 2-CatmullRom, 3-Bezier, 4-LinearVar, 5-BezierVar
|
int splineTypeActive = SPLINE_LINEAR; // 0-Linear, 1-BSpline, 2-CatmullRom, 3-Bezier, 4-LinearVar, 5-BezierVar
|
||||||
// TODO: Change the default back to SPLINE_LINEAR when finished testing
|
|
||||||
bool splineTypeEditMode = false;
|
bool splineTypeEditMode = false;
|
||||||
bool splineHelpersActive = true;
|
bool splineHelpersActive = true;
|
||||||
|
|
||||||
|
|
@ -226,8 +225,8 @@ int main(void)
|
||||||
float thicks[] = {
|
float thicks[] = {
|
||||||
0.0f,
|
0.0f,
|
||||||
splineThickness,
|
splineThickness,
|
||||||
|
-splineThickness,
|
||||||
splineThickness,
|
splineThickness,
|
||||||
0.0f,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Draw spline: variable-width linear
|
// Draw spline: variable-width linear
|
||||||
|
|
|
||||||
|
|
@ -2144,10 +2144,9 @@ void DrawSplineSegmentLinearVar(Vector2 p1, Vector2 p2, const float* thicks, int
|
||||||
point.x = p1.x*(1.0f - t) + p2.x*t;
|
point.x = p1.x*(1.0f - t) + p2.x*t;
|
||||||
point.y = p1.y*(1.0f - t) + p2.y*t;
|
point.y = p1.y*(1.0f - t) + p2.y*t;
|
||||||
|
|
||||||
// TODO: Doesn't seem to be working properly for more than 3 distinct values
|
|
||||||
float thick;
|
float thick;
|
||||||
{
|
{
|
||||||
float tMajor = t*(float)thickCount;
|
float tMajor = t*(float)thickCount/3.0f;
|
||||||
int tIndex = (int)tMajor;
|
int tIndex = (int)tMajor;
|
||||||
float tMinor = tMajor - (float)tIndex;
|
float tMinor = tMajor - (float)tIndex;
|
||||||
tIndex *= 3;
|
tIndex *= 3;
|
||||||
|
|
@ -2235,10 +2234,9 @@ void DrawSplineSegmentBezierCubicVar(Vector2 p1, Vector2 c2, Vector2 c3, Vector2
|
||||||
point.x = a*p1.x + b*c2.x + c*c3.x + d*p4.x;
|
point.x = a*p1.x + b*c2.x + c*c3.x + d*p4.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Doesn't seem to be working properly for more than 3 distinct values
|
|
||||||
float thick;
|
float thick;
|
||||||
{
|
{
|
||||||
float tMajor = t*(float)thickCount;
|
float tMajor = t*(float)thickCount/3.0f;
|
||||||
int tIndex = (int)tMajor;
|
int tIndex = (int)tMajor;
|
||||||
float tMinor = tMajor - (float)tIndex;
|
float tMinor = tMajor - (float)tIndex;
|
||||||
tIndex *= 3;
|
tIndex *= 3;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user