Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project5: Lan Lou #4

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
done
  • Loading branch information
LanLou123 committed Oct 25, 2018
commit 668b72e0bd945e1e967621d03a4d94242d71017a
7 changes: 2 additions & 5 deletions src/renderers/base.js
Original file line number Diff line number Diff line change
@@ -5,13 +5,10 @@ import { mat4, vec4, vec3, vec2 } from 'gl-matrix';
export const MAX_LIGHTS_PER_CLUSTER = 700;

function getNormalComponents(angle) {
//normal connects from point on hypot to end of view vec, can form 4 similar triangles
//for the normal triangle, extend the hypot so it's 1 and we get the side lengths for a normalized normal
//bigSide1 is 1 // view vec
// let angle = xstart+xlengthPerCluster*j;

let bigHypot = Math.sqrt(1 + angle*angle);
let normSide1 = 1 / bigHypot;
let normSide2 = -angle*normSide1;//lhs of plane, 2nd comp needs to be pos, rhs of plane 2nd comp needs to be neg
let normSide2 = -angle*normSide1;
return vec2.fromValues(normSide1, normSide2);
}