Java Code Examples for processing.core.PGraphics#shape()

The following examples show how to use processing.core.PGraphics#shape() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ParticleLauncherGPU.java    From haxademic with MIT License 6 votes vote down vote up
public void renderTo(PGraphics buffer) {
		// update vertex/rendering shader props
		PShader renderShader = particlesRenderHotSwap.shader();
		renderShader.set("width", (float) buffer.width);
		renderShader.set("height", (float) buffer.height);
		renderShader.set("depth", (float) buffer.width);
		renderShader.set("colorTexture", colorBuffer);
		renderShader.set("colorTexture", DemoAssets.justin());
		renderShader.set("positionTexture", positionBuffer);
		renderShader.set("pointSize", 2f);
		
		buffer.shader(renderShader);	// set vertex shader
		buffer.shape(shape);			// draw particles
		buffer.resetShader();

		// recompile if needed & show shader compile error messages
		positionShaderHotSwap.update();
		particlesRenderHotSwap.update();
//		positionShaderHotSwap.showShaderStatus(buffer);
	}
 
Example 2
Source File: WashHands.java    From haxademic with MIT License 6 votes vote down vote up
public void update(PGraphics pg) {
	pg.push();
	pg.translate(pg.width * x, pg.height * y, 0);	// -0.25f   -0.33f
	if(FrameLoop.isTick()) {
		if(FrameLoop.curTick() == tickShow) wordWashEase.setInc(0.07f).setTarget(1);
		if(FrameLoop.curTick() == tickShow + 4) wordWashEase.setInc(0.04f).setTarget(0);
		if(tickShow == 4 && FrameLoop.curTick() % 8 == 0)  wordWashEase.setInc(0.04f).setTarget(0);
	}
	wordWashEase.update();
	float easedProgress = Penner.easeInOutExpo(wordWashEase.value());
	pg.rotateY(rotY + FrameLoop.osc(0.125f, -0.2f, 0.2f));  // 0.4f
	if(tickShow != 4) pg.rotateX(rotX + FrameLoop.osc(0.225f, -0.05f, 0.05f));  // -0.1f
	else pg.rotateX(rotX*1.5f);
	pg.scale(easedProgress);
	pg.shape(wordWash);
	pg.pop();
}
 
Example 3
Source File: GifRenderEllo025LoadingAnimationV3.java    From haxademic with MIT License 6 votes vote down vote up
public void drawGraphics(PGraphics pg) {
		
		float frameRadians = PConstants.TWO_PI / _frames;
		float percentComplete = ((float)(p.frameCount%_frames)/_frames);
//		float easedPercent = Penner.easeInOutExpo(percentComplete, 0, 1, 1);
//		float easedPercent = Penner.easeInOutQuart(percentComplete, 0, 1, 1);
		float easedPercent = Penner.easeInOutCubic(percentComplete, 0, 1, 1);

		float frameOsc = P.sin( PConstants.TWO_PI * percentComplete);
		float elloSize = (float)(p.width);
		
		PG.setDrawCenter(pg);
		pg.beginDraw();
		pg.clear();
		pg.background(255);
		pg.noStroke();

		pg.translate(pg.width/2, pg.height/2);
		float rotations = 2;
		pg.rotate(easedPercent * PConstants.TWO_PI * rotations);
		pg.shape(_logo, 0, 0, elloSize, elloSize);

		pg.endDraw();
	}
 
Example 4
Source File: ImageUtil.java    From haxademic with MIT License 5 votes vote down vote up
public static PGraphics shapeToGraphics(PShape shape, float scale, int bgColor) {
	PGraphics pg = P.p.createGraphics(P.ceil((float) shape.width * scale), P.ceil((float) shape.height * scale));
	pg.beginDraw();
	if(bgColor != -999) pg.background(bgColor);
	pg.shape(shape, 0, 0, pg.width, pg.height);
	pg.endDraw();
	return pg;
}
 
Example 5
Source File: Particle3d.java    From haxademic with MIT License 5 votes vote down vote up
public void update(PGraphics pg) {
	if(available()) return;
	
	// update position
	if(gravity.mag() > 0) speed.add(gravity);
	if(acceleration != 1) speed.mult(acceleration);
	pos.add(speed);
	rotation.add(rotationSpeed);
	
	// update size
	sizeProgress.update();
	float curSize = size * Penner.easeOutSine(sizeProgress.value());
	if(sizeProgress.value() == 1) sizeProgress.setTarget(0);
	
	// draw image
	pg.pushMatrix();
	pg.translate(pos.x, pos.y, pos.z);
	pg.rotateX(rotation.x);
	pg.rotateY(rotation.y);
	pg.rotateZ(rotation.z);
	pg.fill(color);
	if(customShape != null) {
		pg.pushMatrix();
		pg.scale(Penner.easeOutExpo(sizeProgress.value()) * curSize / customShape.getHeight());
		pg.shape(customShape);
		pg.popMatrix();
	} else {
		if(isSphere) {
			pg.sphere(curSize/2f);
		} else {
			pg.box(curSize, curSize, curSize);
		}
	}
	pg.fill(255);
	pg.popMatrix();
}
 
Example 6
Source File: SvgImageRedraw.java    From haxademic with MIT License 5 votes vote down vote up
public void draw(PGraphics canvas, float x, float y, float drawSize) {
	if(scale < 1.0f) {
		if(isWhite) {
			canvas.shape(_whiteDot.shape, x, y, drawSize, drawSize);
		} else {
			canvas.shape(_blackDot.shape, x, y, drawSize, drawSize);
		}
	}
	canvas.pushMatrix();
	canvas.translate(x, y);
	canvas.shape(shape, 0, 0, drawSize * scale, drawSize * scale);
	canvas.popMatrix();
}
 
Example 7
Source File: SvgImageRedrawCollections.java    From haxademic with MIT License 5 votes vote down vote up
public void draw(PGraphics canvas, float x, float y, float drawSize) {
	if(scale < 1.0f) {
		if(isWhite) {
			canvas.shape(_whiteDot.shape, x, y, drawSize, drawSize);
		} else {
			canvas.shape(_blackDot.shape, x, y, drawSize, drawSize);
		}
	}
	canvas.pushMatrix();
	canvas.translate(x, y);
	canvas.shape(shape, 0, 0, drawSize * scale, drawSize * scale);
	canvas.popMatrix();
}
 
Example 8
Source File: Clocktower.java    From haxademic with MIT License 5 votes vote down vote up
protected void drawTemplateOverlay(PGraphics pg) {
	pg.beginDraw();
	pg.blendMode(PBlendModes.BLEND);
	PG.resetPImageAlpha(pg);
	PG.setDrawCorner(pg);
	pg.shape(template, 0, 0);
	pg.endDraw();
}
 
Example 9
Source File: DwSoftBody.java    From PixelFlow with MIT License 4 votes vote down vote up
public final void displayWireframe(PGraphics pg){
  if(shp_wireframe != null){
    pg.shape(shp_wireframe);
  }
}
 
Example 10
Source File: ParticleSystem.java    From PixelFlow with MIT License 4 votes vote down vote up
void display(PGraphics pg) {
  if(PARTICLE_SHAPE_IDX != -1){
    pg.shape(shp_particlesystem);
  }
}
 
Example 11
Source File: DwSoftBody.java    From PixelFlow with MIT License 4 votes vote down vote up
public final void displayMesh(PGraphics pg){
  if(shp_mesh != null){
    pg.shape(shp_mesh);
  }
}
 
Example 12
Source File: DwSoftBody.java    From PixelFlow with MIT License 4 votes vote down vote up
public final void displayParticles(PGraphics pg){
  if(shp_particles != null){
    pg.shape(shp_particles);
  }
}
 
Example 13
Source File: Skylight_Basic.java    From PixelFlow with MIT License 4 votes vote down vote up
public void displayScene(PGraphics canvas){
  if(canvas == skylight.renderer.pg_render){
    canvas.background(32);
  }
  canvas.shape(shape);
}
 
Example 14
Source File: ParticleSystem.java    From PixelFlow with MIT License 4 votes vote down vote up
void display(PGraphics pg) {
  pg.shape(shp_particlesystem);
}
 
Example 15
Source File: ParticleSystem.java    From PixelFlow with MIT License 4 votes vote down vote up
void display(PGraphics pg) {
  pg.shape(shp_particlesystem);
}
 
Example 16
Source File: ParticleSystem.java    From PixelFlow with MIT License 4 votes vote down vote up
void display(PGraphics pg) {
  pg.shape(shp_particlesystem);
}
 
Example 17
Source File: ParticleSystem.java    From PixelFlow with MIT License 4 votes vote down vote up
void display(PGraphics pg) {
  if(PARTICLE_SHAPE_IDX != -1){
    pg.shape(shp_particlesystem);
  }
}