-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Description
By default a few useful uniforms don't get set for a shader.
The defaults are: MVP (transform), MV, P, (MV)^-1T (normalMat) and textureMat.
In addition it would be useful to set the view, viewInv matrices and the cameraPos vector.
For example when working in world space (reflection/refraction with env mapping).
It is possible to set them manually:
pg = (PGraphicsOpenGL) this.g;
...
shader.set("view", pg.camera);
shader.set("viewInv", pg.cameraInv);
shader.set("cameraPos", pg.modelviewInv.m03, pg.modelviewInv.m13, pg.modelviewInv.m23);And then the model matrix can be calculated in the shader like this: viewInv * modelview
I'm going to make the required changes during the next week.
My question is, how should I call them according to the conventions (alternative names)?