mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Updated examples
This commit is contained in:
@@ -25,11 +25,11 @@ void draw() {
|
||||
tint(255, 255);
|
||||
image(pic1, 0, 0, pic1.width, pic1.height);
|
||||
|
||||
blend(selMode);
|
||||
screenBlend(selMode);
|
||||
tint(255, picAlpha);
|
||||
image(pic2, 0, 0, pic2.width, pic2.height);
|
||||
|
||||
noBlend();
|
||||
screenBlend(REPLACE);
|
||||
fill(200, 50, 50);
|
||||
rect(0, height - 50, map(picAlpha, 0, 255, 0, width), 50);
|
||||
fill(255);
|
||||
|
||||
@@ -28,15 +28,16 @@ void setup() {
|
||||
|
||||
// We need trilinear sampling for this texture so it looks good
|
||||
// even when rendered very small.
|
||||
surftex2 = loadImage("mercury.jpg", TRILINEAR);
|
||||
PTexture.Parameters params1 = PTexture.newParameters(ARGB, TRILINEAR);
|
||||
surftex2 = loadImage("mercury.jpg", params1);
|
||||
|
||||
// The clouds texture will "move" having the values of its u
|
||||
// texture coordinates displaced by adding a constant increment
|
||||
// in each frame. This requires REPEAT wrapping mode so texture
|
||||
// coordinates can be larger than 1.
|
||||
PTexture.Parameters params = PTexture.newParameters();
|
||||
params.wrapU = REPEAT;
|
||||
cloudtex = createImage(512, 256, params);
|
||||
PTexture.Parameters params2 = PTexture.newParameters();
|
||||
params2.wrapU = REPEAT;
|
||||
cloudtex = createImage(512, 256, ARGB, params2);
|
||||
|
||||
// Using 3D Perlin noise to generate a clouds texture that is seamless on
|
||||
// its edges so it can be applied on a sphere.
|
||||
|
||||
@@ -43,10 +43,12 @@ void createRibbonModel(ArrayList residues, PShape3D model, ArrayList trj) {
|
||||
}
|
||||
|
||||
if (renderMode == 0) {
|
||||
model = createShape(vertices.size(), LINES, STATIC);
|
||||
PShape3D.Parameters params = PShape3D.newParameters(LINES, STATIC);
|
||||
model = (PShape3D)createShape(vertices.size(), params);
|
||||
model.setVertices(vertices);
|
||||
} else {
|
||||
model = createShape(vertices.size(), TRIANGLES, STATIC);
|
||||
PShape3D.Parameters params = PShape3D.newParameters(TRIANGLES, STATIC);
|
||||
model = (PShape3D)createShape(vertices.size(), params);
|
||||
model.setVertices(vertices);
|
||||
model.setNormals(normals);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ void setup() {
|
||||
|
||||
// The particle system is stored in a PShape3D object set to
|
||||
// POINT_SPRITES mode
|
||||
particles = createShape(numParticlesTotal, POINT_SPRITES, DYNAMIC);
|
||||
particles = (PShape3D)createShape(numParticlesTotal, PShape3D.newParameters(POINT_SPRITES, DYNAMIC));
|
||||
particleLifetime = numParticlesTotal / numParticlesPerFrame;
|
||||
lifetimes = new int[numParticlesTotal];
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ void setup() {
|
||||
// it will hold (this number cannot be changed later). Also, how
|
||||
// the vertices will be connected is specified here (this can be
|
||||
// changed later though).
|
||||
cube = createShape(36, TRIANGLES);
|
||||
cube = (PShape3D)createShape(36, PShape3D.newParameters(TRIANGLES));
|
||||
|
||||
// The vertices array gives access to all the vertex data
|
||||
// in the PShape3D object. It can only be used between
|
||||
|
||||
@@ -30,7 +30,7 @@ void setup() {
|
||||
pg = createGraphics(32, 512, A3D);
|
||||
|
||||
// Initializing particle system
|
||||
particles = createShape(1000, POINT_SPRITES, DYNAMIC);
|
||||
particles = (PShape3D)createShape(1000, PShape3D.newParameters(POINT_SPRITES, DYNAMIC));
|
||||
particles.loadVertices();
|
||||
for (int i = 0; i < particles.getVertexCount(); i++) {
|
||||
particles.set(i, random(0, 10), random(0, 10), 0);
|
||||
@@ -89,10 +89,10 @@ void draw() {
|
||||
if (mode == 0) {
|
||||
trefoil.enableStyle();
|
||||
hint(DISABLE_DEPTH_MASK);
|
||||
blend(ADD);
|
||||
screenBlend(ADD);
|
||||
} else {
|
||||
trefoil.disableStyle();
|
||||
blend(BLEND);
|
||||
screenBlend(BLEND);
|
||||
}
|
||||
|
||||
shape(trefoil);
|
||||
|
||||
Reference in New Issue
Block a user