mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
added resolution uniform
This commit is contained in:
@@ -122,6 +122,7 @@ public class PShader implements PConstants {
|
||||
protected int ppixelsLoc;
|
||||
protected int ppixelsUnit;
|
||||
protected int viewportLoc;
|
||||
protected int resolutionLoc;
|
||||
|
||||
// Uniforms only for lines and points
|
||||
protected int perspectiveLoc;
|
||||
@@ -1148,6 +1149,7 @@ public class PShader implements PConstants {
|
||||
projectionMatLoc = getUniformLoc("projectionMatrix");
|
||||
|
||||
viewportLoc = getUniformLoc("viewport");
|
||||
resolutionLoc = getUniformLoc("resolution");
|
||||
ppixelsLoc = getUniformLoc("ppixels");
|
||||
|
||||
normalMatLoc = getUniformLoc("normalMatrix");
|
||||
@@ -1199,6 +1201,12 @@ public class PShader implements PConstants {
|
||||
setUniformValue(viewportLoc, x, y, w, h);
|
||||
}
|
||||
|
||||
if (-1 < resolutionLoc) {
|
||||
float w = currentPG.viewport.get(2);
|
||||
float h = currentPG.viewport.get(3);
|
||||
setUniformValue(resolutionLoc, w, h);
|
||||
}
|
||||
|
||||
if (-1 < ppixelsLoc) {
|
||||
ppixelsUnit = getLastTexUnit() + 1;
|
||||
setUniformValue(ppixelsLoc, ppixelsUnit);
|
||||
|
||||
Reference in New Issue
Block a user