mirror of
https://github.com/processing/processing4.git
synced 2026-02-04 06:09:17 +01:00
add setters for boolean uniforms contributed by AmnonOwed, fixes #1991.
This commit is contained in:
@@ -5230,9 +5230,9 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
|
||||
try {
|
||||
if (0 < x || 0 < y || w < width || h < height) {
|
||||
// The pixels to copy to the texture need to be consecutive, and they
|
||||
// are not in the pixels array, so putting each row one after another
|
||||
// in nativePixels.
|
||||
// The pixels to be copied to the texture need to be consecutive, and
|
||||
// they are not in the pixels array, so putting each row one after
|
||||
// another in nativePixels.
|
||||
int offset0 = y * width + x;
|
||||
int offset1 = 0;
|
||||
|
||||
@@ -5324,6 +5324,17 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
setgetPixels = true;
|
||||
super.setImpl(sourceImage, sourceX, sourceY, sourceWidth, sourceHeight,
|
||||
targetX, targetY);
|
||||
// do we need this?
|
||||
// see https://github.com/processing/processing/issues/2125
|
||||
// if (sourceImage.format == RGB) {
|
||||
// int targetOffset = targetY * width + targetX;
|
||||
// for (int y = sourceY; y < sourceY + sourceHeight; y++) {
|
||||
// for (int x = targetOffset; x < targetOffset + sourceWidth; x++) {
|
||||
// pixels[x] |= 0xff000000;
|
||||
// }
|
||||
// targetOffset += width;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -449,17 +449,20 @@ public class PShader implements PConstants {
|
||||
|
||||
|
||||
public void set(String name, boolean x, boolean y) {
|
||||
setUniformImpl(name, UniformValue.INT2, new int[] { (x)?1:0, (y)?1:0 });
|
||||
setUniformImpl(name, UniformValue.INT2,
|
||||
new int[] { (x)?1:0, (y)?1:0 });
|
||||
}
|
||||
|
||||
|
||||
public void set(String name, boolean x, boolean y, boolean z) {
|
||||
setUniformImpl(name, UniformValue.INT3, new int[] { (x)?1:0, (y)?1:0, (z)?1:0 });
|
||||
setUniformImpl(name, UniformValue.INT3,
|
||||
new int[] { (x)?1:0, (y)?1:0, (z)?1:0 });
|
||||
}
|
||||
|
||||
|
||||
public void set(String name, boolean x, boolean y, boolean z, boolean w) {
|
||||
setUniformImpl(name, UniformValue.INT4, new int[] { (x)?1:0, (y)?1:0, (z)?1:0, (w)?1:0 });
|
||||
setUniformImpl(name, UniformValue.INT4,
|
||||
new int[] { (x)?1:0, (y)?1:0, (z)?1:0, (w)?1:0 });
|
||||
}
|
||||
|
||||
|
||||
@@ -467,6 +470,7 @@ public class PShader implements PConstants {
|
||||
set(name, vec, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ncoords number of coordinates per element, max 4
|
||||
*/
|
||||
@@ -510,6 +514,7 @@ public class PShader implements PConstants {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void set(String name, boolean[] vec) {
|
||||
set(name, vec, 1);
|
||||
}
|
||||
@@ -517,7 +522,7 @@ public class PShader implements PConstants {
|
||||
|
||||
public void set(String name, boolean[] boolvec, int ncoords) {
|
||||
int[] vec = new int[boolvec.length];
|
||||
for (int i=0; i<boolvec.length; i++) {
|
||||
for (int i = 0; i < boolvec.length; i++) {
|
||||
vec[i] = (boolvec[i])?1:0;
|
||||
}
|
||||
set(name, vec, ncoords);
|
||||
|
||||
Reference in New Issue
Block a user