Skip to content

Commit

Permalink
fix debug print
Browse files Browse the repository at this point in the history
  • Loading branch information
KilledByAPixel authored Feb 22, 2020
1 parent fde3419 commit 40bcaa1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
road = []; // clear list of road segments

// generate the road
for(let i = 0; i < roadEnd*2; ++i) // generate every section of road
for(let i = 0; i < roadEnd*2; ++i) // build road past end
{
// make wavy hills
const x = Math.sin(i*roadGenWaveFrequencyX) * roadGenWaveScaleX; // road X
Expand All @@ -130,11 +130,11 @@
road[i] = road[i]? road[i] : {x:x, y:y, w:roadGenWidth}; // get road segment

// apply taper
const p = Clamp(roadGenSectionDistance / roadGenTaper, 0, 1); // get taper percent
road[i].x = Lerp(p, road[i].x, x); // X pos and taper
road[i].y = Lerp(p, road[i].y, y); // Y pos and taper
road[i].z = i*roadSegmentLength; // Z pos
road[i].w = i > roadEnd ? 0 : Lerp(p, road[i].w, roadGenWidth); // check for road end, width and taper
const p = Clamp(roadGenSectionDistance / roadGenTaper, 0, 1); // get taper percent
road[i].x = Lerp(p, road[i].x, x); // X pos and taper
road[i].y = Lerp(p, road[i].y, y); // Y pos and taper
road[i].z = i*roadSegmentLength; // Z pos
road[i].w = i > roadEnd ? 0 : Lerp(p, road[i].w, roadGenWidth); // check for road end, width and taper

// get pitch angle and object pos
road[i].a = road[i-1]? Math.atan2(road[i-1].y-road[i].y, roadSegmentLength) : 0; // pitch angle
Expand Down Expand Up @@ -614,7 +614,7 @@
UpdateFps();

context.font='2em"';
for (i in debugPrintLines)
for (let i in debugPrintLines)
{
let line = debugPrintLines[i];
context.fillStyle = line.color;
Expand Down

0 comments on commit 40bcaa1

Please sign in to comment.