Skip to content

Commit

Permalink
better (=correct) normals for the tube profile
Browse files Browse the repository at this point in the history
  • Loading branch information
biasmv committed Feb 12, 2015
1 parent 4f4f962 commit ad6e8bd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/gfx/geom-builders.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,8 @@ function TubeProfile(points, num, strength) {

var normal = vec3.create();
for (var i = 0; i < this._arcs; ++i) {
var i_prev = i === 0 ? this._arcs - 1 : i - 1;
var i_next = i === this._arcs - 1 ? 0 : i + 1;
normal[0] = this._verts[3 * i_next + 1] - this._verts[3 * i_prev + 1];
normal[1] = this._verts[3 * i_prev] - this._verts[3 * i_next];
normal[0] = this._verts[3 * i + 0];
normal[1] = this._verts[3 * i + 1];
vec3.normalize(normal, normal);
this._normals[3 * i] = normal[0];
this._normals[3 * i + 1] = normal[1];
Expand Down

0 comments on commit ad6e8bd

Please sign in to comment.