processing.core.PConstants Java Examples

The following examples show how to use processing.core.PConstants. 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: UITextInput.java    From haxademic with MIT License 6 votes vote down vote up
public void keyEvent(KeyEvent e) {
	if(active == false) return;
	if(ACTIVE_INPUT != this) return;
	if(e.getAction() == KeyEvent.PRESS) {
		char key = e.getKey();
		int keyCode = e.getKeyCode();
		// P.out(keyCode, PConstants.SHIFT);
		if(key == PConstants.BACKSPACE) {
			if(value.length() > 0) {
				value = value.substring( 0, value.length() - 1 );
			}
		} else if(key == PConstants.RETURN || key == PConstants.ENTER || keyCode == PConstants.SHIFT || key == PConstants.TAB) {
			// do nothing for special keys
		} else {
			value += key;
			if(filter != null) value = value.replaceAll(filter, "");
		}
	}
}
 
Example #2
Source File: TextureAppFrameEq2d.java    From haxademic with MIT License 6 votes vote down vote up
public void updateDraw() {
	_texture.clear();
	
	PG.resetGlobalProps( _texture );
	_texture.pushMatrix();
	
	_texture.noStroke();
	_texture.fill( 0 );
	
	_texture.rectMode(PConstants.CENTER);

	// draw bars
	_texture.pushMatrix();
	drawBars();
	_texture.popMatrix();

	_texture.pushMatrix();
	_texture.translate( 0, height );
	_texture.rotateX( (float) Math.PI );

	drawBars();
	_texture.popMatrix();
	
	_texture.popMatrix();
}
 
Example #3
Source File: Utility.java    From Project-16x16 with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Scales a PImage object by a given amount.
 *
 * @param pBuffer Image to scale.
 * @param scaling Times to scale.
 * @return new PImage object transformed.
 */
public static PImage scale(PImage pBuffer, int scaling) {
	PImage originalImage = pBuffer;
	PImage tempImage = applet.createImage(PApplet.parseInt(originalImage.width * scaling),
			PApplet.parseInt(originalImage.height * scaling), PConstants.ARGB);
	tempImage.loadPixels();
	originalImage.loadPixels();
	for (int i = 0; i < originalImage.pixels.length; i++) {
		tempImage.pixels[i * scaling] = originalImage.pixels[i];
		tempImage.pixels[i * scaling + 1] = originalImage.pixels[i];
		tempImage.pixels[i * scaling + originalImage.width] = originalImage.pixels[i];
		tempImage.pixels[i * scaling + originalImage.width + 1] = originalImage.pixels[i];
	}
	tempImage.updatePixels();
	return pg(tempImage).get();
}
 
Example #4
Source File: DwHalfEdge.java    From PixelFlow with MIT License 6 votes vote down vote up
private void displayPolygons(PGraphics3D pg, DwHalfEdge.Edge edge){
  DwStack<DwHalfEdge.Edge> stack = new DwStack<DwHalfEdge.Edge>();
  stack.push(edge);
  float[][] verts = ifs.getVerts();
  float[] v;
  while(!stack.isEmpty()){
    edge = stack.pop();
    if(edge != null && getFLAG_display(edge)){
      DwHalfEdge.Edge iter = edge;
      pg.beginShape();
      do {
        v = verts[iter.vert.idx]; pg.vertex(v[0], v[1], v[2]); 
      } while((iter = iter.next) != edge);
      pg.endShape(PConstants.CLOSE);
      
      // recursively draw neighbors
      do {
        setFLAG_display(iter);
        stack.push(iter.pair); 
      } while((iter = iter.next) != edge);
    }
  }
}
 
Example #5
Source File: ConstellationLineMarker.java    From constellation with Apache License 2.0 6 votes vote down vote up
@Override
public boolean draw(final PGraphics graphics, final List<MapPosition> positions, final UnfoldingMap map) {
    if (positions.isEmpty() || isHidden()) {
        return false;
    }

    graphics.pushStyle();
    graphics.noFill();
    graphics.strokeWeight(size == MarkerUtilities.DEFAULT_SIZE ? strokeWeight : size);
    graphics.stroke(getFillColor());
    graphics.smooth();

    graphics.beginShape(PConstants.LINES);
    for (int i = 0; i < positions.size() - 1; ++i) {
        final MapPosition lastPosition = positions.get(i);
        final MapPosition currentPosition = positions.get(i + 1);
        graphics.vertex(lastPosition.x, lastPosition.y);
        graphics.vertex(currentPosition.x, currentPosition.y);
    }
    graphics.endShape();
    graphics.popStyle();

    return true;
}
 
Example #6
Source File: TextureFractalPolygons.java    From haxademic with MIT License 6 votes vote down vote up
public void updateDraw() {
//		_texture.clear();
		_texture.background(0);
		
//		PG.resetGlobalProps( _texture );
		PG.setBasicLights( _texture );
		PG.setCenterScreen( _texture );
		PG.setDrawCenter(_texture);

		_texture.pushMatrix();
		_texture.rectMode(PConstants.CORNER);
				
		// ease rotations & set center
		_curRotation = MathUtil.easeTo(_curRotation, _rotationTarget, 10);
		_curRotX = MathUtil.easeTo(_curRotX, _rotXTarget, 10);
		_texture.rotate( _curRotation );
		
		drawShapes();
		_texture.popMatrix();
	}
 
Example #7
Source File: ConstellationPointMarker.java    From constellation with Apache License 2.0 6 votes vote down vote up
private void createImages() {
    try {
        final File templateImageFile = ConstellationInstalledFileLocator.locate(
                "modules/ext/data/" + TEMPLATE_IMAGE_PATH,
                "au.gov.asd.tac.constellation.views.mapview",
                false, ConstellationPointMarker.class.getProtectionDomain());
        final BufferedImage templateImage = ImageIO.read(templateImageFile);
        TEMPLATE_IMAGE = new PImage(templateImage.getWidth(), templateImage.getHeight(), PConstants.ARGB);
        TEMPLATE_IMAGE.loadPixels();
        templateImage.getRGB(0, 0, TEMPLATE_IMAGE.width, TEMPLATE_IMAGE.height, TEMPLATE_IMAGE.pixels, 0, TEMPLATE_IMAGE.width);
        TEMPLATE_IMAGE.updatePixels();

        POINT_X_OFFSET = TEMPLATE_IMAGE.width / 2;
        POINT_Y_OFFSET = TEMPLATE_IMAGE.height;
    } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
Example #8
Source File: PVector.java    From CPE552-Java with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Make a new 3D unit vector with a random direction
 * @return the random PVector
 */
static public PVector random3D(PVector target, PApplet parent) {
  float angle;
  float vz;
  if (parent == null) {
    angle = (float) (Math.random()*Math.PI*2);
    vz    = (float) (Math.random()*2-1);
  } else {
    angle = parent.random(PConstants.TWO_PI);
    vz    = parent.random(-1,1);
  }
  float vx = (float) (Math.sqrt(1-vz*vz)*Math.cos(angle));
  float vy = (float) (Math.sqrt(1-vz*vz)*Math.sin(angle));
  if (target == null) {
    target = new PVector(vx, vy, vz);
    //target.normalize(); // Should be unnecessary
  } else {
    target.set(vx,vy,vz);
  }
  return target;
}
 
Example #9
Source File: SketchRunner.java    From Processing.R with GNU General Public License v3.0 6 votes vote down vote up
public SketchRunner(final String id, final ModeService modeService) {
  this.id = id;
  this.modeService = modeService;
  if (PApplet.platform == PConstants.MACOSX) {
    try {
      OSXAdapter.setQuitHandler(this, this.getClass().getMethod("preventUserQuit"));
    } catch (final Throwable e) {
      System.err.println(e.getMessage());
    }
  }
  // new Thread(new Runnable() {
  // @Override
  // public void run() {
  // Runner.warmup();
  // }
  // }, "SketchRunner Warmup Thread").start();
}
 
Example #10
Source File: GifRenderEllo015InfiniteScrollLoader.java    From haxademic with MIT License 6 votes vote down vote up
protected void drawApp() {
		p.background(255);
		p.noStroke();
		
		float frameRadians = PConstants.TWO_PI / _frames;
		float percentComplete = ((float)(p.frameCount%_frames)/_frames);
		float easedPercent = Penner.easeInOutQuart(percentComplete, 0, 1, 1);

		float frameOsc = P.sin( PConstants.TWO_PI * percentComplete);
		float scale = 0.95f;
		float oscSize = 0.1f;
		float elloSize = (float)(p.width * (scale - oscSize + oscSize * frameOsc));
//		float elloSize = (float)(40 * (scale - oscSize + oscSize * frameOsc));	// with padding
		
		PG.setDrawCenter(p);
		
		p.translate(p.width/2, p.height/2);
//		p.rotate(frameRadians * p.frameCount);
//		p.rotate(easedPercent * PConstants.TWO_PI);
		p.fill(ColorUtil.colorFromHex("#DFDFDF"));
		p.stroke(0,0);
		p.ellipse(0, 0, elloSize, elloSize);
	}
 
Example #11
Source File: DwUtils.java    From PixelFlow with MIT License 6 votes vote down vote up
static public PImage createSprite(PApplet papplet, int size, float exp1, float exp2, float mult){
  PImage pimg = papplet.createImage(size, size, PConstants.ARGB);
  pimg.loadPixels();
  for(int y = 0; y < size; y++){
    for(int x = 0; x < size; x++){
      int pid = y * size + x;
      
      float xn = ((x + 0.5f) / (float)size) * 2f - 1f;
      float yn = ((y + 0.5f) / (float)size) * 2f - 1f;
      float dd = (float) Math.sqrt(xn*xn + yn*yn);
      
      dd = clamp(dd, 0, 1);
      dd = (float) Math.pow(dd, exp1);
      dd = 1.0f - dd;
      dd = (float) Math.pow(dd, exp2);
      dd *= mult;
      dd = clamp(dd, 0, 1);
      pimg.pixels[pid] = ((int)(dd * 255)) << 24 | 0x00FFFFFF;
    }
  }
  pimg.updatePixels();
  return pimg;
}
 
Example #12
Source File: DwMagnifier.java    From PixelFlow with MIT License 6 votes vote down vote up
public void displayTool(){
    if(pg_mag == null){
      return;
    }
      
    boolean offscreen = pg_mag != papplet.g;
    if(offscreen) pg_mag.beginDraw();
    DwUtils.beginScreen2D(pg_mag);
    {
//      pg_mag.pushStyle(); // TODO
      pg_mag.blendMode(PConstants.EXCLUSION);
      pg_mag.rectMode(PConstants.CORNER);
      pg_mag.noFill();
      pg_mag.stroke(255, 128);
      pg_mag.strokeWeight(1);
      pg_mag.rect(mag_px+0.5f, mag_py+0.5f,  pg_region.width, pg_region.height);
//      pg_mag.popStyle();
    }
    DwUtils.endScreen2D(pg_mag);
    if(offscreen) pg_mag.endDraw();
  }
 
Example #13
Source File: ParticleSystem.java    From PixelFlow with MIT License 6 votes vote down vote up
public PShape createParticleShape(DwParticle3D particle){
   
    PShape shp_particle = papplet.createShape(PShape.GEOMETRY);
    
    shp_particle.resetMatrix();
    shp_particle.translate(particle.cx, particle.cy, particle.cz);
    shp_particle.rotateX(papplet.random(PConstants.TWO_PI));
    shp_particle.rotateY(papplet.random(PConstants.TWO_PI));
    shp_particle.rotateZ(papplet.random(PConstants.TWO_PI));
    shp_particle.setStroke(false);
//    shp_particle.setFill(papplet.color(160));
    
    if(ifs == null) ifs = new DwIcosahedron(1);
//    if(ifs == null) ifs = new DwCube(1);
    DwMeshUtils.createPolyhedronShape(shp_particle, ifs, 1, 3, true);

    return shp_particle;
  }
 
Example #14
Source File: DwUtils.java    From PixelFlow with MIT License 6 votes vote down vote up
static public PGraphics2D changeTextureSize(PApplet papplet, PGraphics2D pg, int w, int h, int smooth, boolean[] resized)
{   
  if(pg == null){
    pg = (PGraphics2D) papplet.createGraphics(w, h, PConstants.P2D);
    pg.smooth(smooth);
    resized[0] |= true;
  } else {
    resized[0] |= changeTextureSize(pg, w, h);
  }
  
  if(resized[0]){
    pg.loadTexture();
  }
  
  return pg;
}
 
Example #15
Source File: ShirtDesignParticles.java    From haxademic with MIT License 6 votes vote down vote up
protected void drawApp() {
		p.background(0);
//		PG.setDrawCorner(p);
//		p.fill(0, 20);
//		p.rect(0, 0, p.width, p.height);
		PG.setDrawCenter(p);
		
		p.blendMode(PConstants.ADD);
		for(int i=0; i < _particles.size(); i++) {
			Attractor closestAttractor = getClosestAttractorToParticle(_particles.get(i));
			_particles.get(i).update(closestAttractor.position.x, closestAttractor.position.y);
		}
		for(int i=0; i < _attractors.size(); i++) _attractors.get(i).update();

		// post-process effects
//		p.filter(_fxaa);
//		p.filter(_fxaa);
//		p.filter(_fxaa);
//		p.filter(_fxaa);
	}
 
Example #16
Source File: DwSoftBody3D.java    From PixelFlow with MIT License 6 votes vote down vote up
private PShape createShape(PApplet papplet, float radius, boolean icosahedron){
    PShape shape;
    
    if(!icosahedron){
      shape = papplet.createShape(PConstants.POINT, 0, 0);
      shape.setStroke(true);
      shape.setStrokeWeight(1);
    } else {
      if(ifs == null){
        ifs = new DwIcosahedron(1);
//        ifs = new DwCube(1);
      }
      shape = papplet.createShape(PShape.GEOMETRY);
      shape.setStroke(false);
      shape.setFill(true);
      DwMeshUtils.createPolyhedronShape(shape, ifs, radius, 3, true);
    }

    return shape;
  }
 
Example #17
Source File: DwSoftGrid2D.java    From PixelFlow with MIT License 6 votes vote down vote up
private void displayGridXY(PShape pg, PGraphics2D tex){
  pg.beginShape(PConstants.TRIANGLE_STRIP);
  pg.textureMode(PConstants.NORMAL);
  pg.texture(tex);
  pg.fill(material_color);
  pg.noStroke();
  int ix, iy;
  for(iy = 0; iy < nodes_y-1; iy++){
    for(ix = 0; ix < nodes_x; ix++){
      vertex(pg, getNode(ix, iy+0), ix * tx_inv, (iy+0) * ty_inv);
      vertex(pg, getNode(ix, iy+1), ix * tx_inv, (iy+1) * ty_inv);
    }
    ix -= 1; vertex(pg, getNode(ix, iy+1), 0, 0);
    ix  = 0; vertex(pg, getNode(ix, iy+1), 0, 0);
  }
  pg.endShape();
}
 
Example #18
Source File: DwFluidParticleSystem2D.java    From PixelFlow with MIT License 6 votes vote down vote up
public void render(PGraphics2D dst, PImage sprite, int display_mode){
    int[] sprite_tex_handle = new int[1];
    if(sprite != null){
      sprite_tex_handle[0] = dst.getTexture(sprite).glName;
    }

    int w = dst.width;
    int h = dst.height;

    dst.beginDraw();
//    dst.blendMode(PConstants.BLEND);
    dst.blendMode(PConstants.ADD);

    context.begin();
    shader_particleRender.begin();
    shader_particleRender.uniform2f     ("wh_viewport", w, h);
    shader_particleRender.uniform2i     ("num_particles", particles_x, particles_y);
    shader_particleRender.uniformTexture("tex_particles", tex_particles.src);
    shader_particleRender.uniformTexture("tex_sprite"   , sprite_tex_handle[0]);
    shader_particleRender.uniform1i     ("display_mode" , display_mode); // 0 ... 1px points, 1 = sprite texture,  2 ... falloff points
    shader_particleRender.drawFullScreenPoints(particles_x * particles_y);
    shader_particleRender.end();
    context.end("ParticleSystem.render");
    
    dst.endDraw();
  }
 
Example #19
Source File: DwSoftGrid3D.java    From PixelFlow with MIT License 6 votes vote down vote up
private void displayGridXY(PShape pg, float[][] normals, int iz, PGraphics2D tex){
  pg.beginShape(PConstants.TRIANGLE_STRIP);
  pg.textureMode(PConstants.NORMAL);
  pg.texture(tex);
  pg.fill(material_color);
  int ix, iy;
  for(iy = 0; iy < nodes_y-1; iy++){
    for(ix = 0; ix < nodes_x; ix++){
      vertex(pg, getNode3D(ix, iy+0, iz), normals[(iy+0)*nodes_x+ix], ix * tx_inv, (iy+0) * ty_inv);
      vertex(pg, getNode3D(ix, iy+1, iz), normals[(iy+1)*nodes_x+ix], ix * tx_inv, (iy+1) * ty_inv);
    }
    ix -= 1; vertex(pg, getNode3D(ix, iy+1, iz), normals[(iy+1)*nodes_x+ix], 0, 0);
    ix  = 0; vertex(pg, getNode3D(ix, iy+1, iz), normals[(iy+1)*nodes_x+ix], 0, 0);
  }
  pg.endShape();
}
 
Example #20
Source File: DwSoftGrid3D.java    From PixelFlow with MIT License 6 votes vote down vote up
private void displayGridYZ(PShape pg, float[][] normals, int ix, PGraphics2D tex){
  pg.beginShape(PConstants.TRIANGLE_STRIP);
  pg.textureMode(PConstants.NORMAL);
  pg.texture(tex);
  pg.fill(material_color);
  int iz, iy;
  for(iz = 0; iz < nodes_z-1; iz++){
    for(iy = 0; iy < nodes_y; iy++){
      vertex(pg, getNode3D(ix, iy, iz+0), normals[(iz+0)*nodes_y+iy], iy * ty_inv, (iz+0) * tz_inv);
      vertex(pg, getNode3D(ix, iy, iz+1), normals[(iz+1)*nodes_y+iy], iy * ty_inv, (iz+1) * tz_inv);
    }
    iy -= 1; vertex(pg, getNode3D(ix, iy, iz+1), normals[(iz+1)*nodes_y+iy], 0, 0);
    iy  = 0; vertex(pg, getNode3D(ix, iy, iz+1), normals[(iz+1)*nodes_y+iy], 0, 0);
  }
  pg.endShape();
}
 
Example #21
Source File: DwSoftGrid3D.java    From PixelFlow with MIT License 6 votes vote down vote up
private void displayGridXZ(PShape pg, float[][] normals, int iy, PGraphics2D tex){
  pg.beginShape(PConstants.TRIANGLE_STRIP);
  pg.textureMode(PConstants.NORMAL);
  pg.texture(tex);
  pg.fill(material_color);
  int iz, ix;
  for(iz = 0; iz < nodes_z-1; iz++){
    for(ix = 0; ix < nodes_x; ix++){
      vertex(pg, getNode3D(ix, iy, iz+0), normals[(iz+0)*nodes_x+ix], ix * tx_inv, (iz+0) * tz_inv);
      vertex(pg, getNode3D(ix, iy, iz+1), normals[(iz+1)*nodes_x+ix], ix * tx_inv, (iz+1) * tz_inv);
    }
    ix -= 1; vertex(pg, getNode3D(ix, iy, iz+1), normals[(iz+1)*nodes_x+ix], 0, 0);
    ix  = 0; vertex(pg, getNode3D(ix, iy, iz+1), normals[(iz+1)*nodes_x+ix], 0, 0);
  }
  pg.endShape();
}
 
Example #22
Source File: DwSoftGrid3D.java    From PixelFlow with MIT License 6 votes vote down vote up
private PShape createShape(PGraphics pg){
  PShape shp = pg.createShape(PConstants.GROUP);

  PShape[] shp_grid = new PShape[6];
  for(int i = 0; i < shp_grid.length; i++){
    shp_grid[i] = pg.createShape();
    shp.addChild(shp_grid[i]);
  }
  
  shp_grid[0].setName("gridXYp");
  shp_grid[1].setName("gridXYn");
  shp_grid[2].setName("gridYZp");
  shp_grid[3].setName("gridYZn");
  shp_grid[4].setName("gridXZp");
  shp_grid[5].setName("gridXZn");

                  displayGridXY(shp_grid[0], normals[0], 0        , texture_XYp);
  if(nodes_z > 1) displayGridXY(shp_grid[1], normals[1], nodes_z-1, texture_XYn);
                  displayGridYZ(shp_grid[2], normals[2], 0        , texture_YZp);
  if(nodes_x > 1) displayGridYZ(shp_grid[3], normals[3], nodes_x-1, texture_YZn);
                  displayGridXZ(shp_grid[4], normals[4], 0        , texture_XZp);
  if(nodes_y > 1) displayGridXZ(shp_grid[5], normals[5], nodes_y-1, texture_XZn);
  return shp;
}
 
Example #23
Source File: DwColorPicker.java    From PixelFlow with MIT License 6 votes vote down vote up
public void updateCanvas(){
  canvas.beginDraw();
  canvas.clear();
  canvas.blendMode(PConstants.REPLACE);
  canvas.image(canvas_img,0,0);
  // draw cursor over selected bin
  if(selected_color_idx != -1){
    int x = selected_color_idx % num_x;
    int y = selected_color_idx / num_x;
    int px = (int) ((x + 0.5f) * res_x);
    int py = (int) ((y + 0.5f) * res_y);
    canvas.blendMode(PConstants.EXCLUSION);
    canvas.strokeCap(PConstants.SQUARE);
    canvas.strokeWeight(1);
    canvas.stroke(255, 100);
    canvas.line(px   , py-10, px   , py+10);
    canvas.line(px-10, py   , px+10, py   );
  }
  canvas.endDraw();
}
 
Example #24
Source File: Demo_TexturedPointSheet.java    From haxademic with MIT License 6 votes vote down vote up
protected void firstFrame() {
	// build points shape
	pointsShape = p.createShape();
	pointsShape.beginShape(PConstants.POINTS);
	pointsShape.noFill();
	float spread = 5f; 
	pointsShape.strokeWeight(spread * 0.75f);
	PImage img = DemoAssets.smallTexture();
	for (int x = 0; x < img.width; x++) {
		for (int y = 0; y < img.height; y++) {
			int pixelColor = ImageUtil.getPixelColor(img, x, y);
			pointsShape.stroke(pixelColor);
			pointsShape.vertex(x * spread, y * spread);
		}
	}
	pointsShape.endShape();
}
 
Example #25
Source File: DwSoftGrid3D.java    From PixelFlow with MIT License 5 votes vote down vote up
private void displayNormalsXZ(PGraphics pg, float[][] normals, int iy, float nlen){
  pg.beginShape(PConstants.LINES);
  for(int iz = 0; iz < nodes_z; iz++){
    for(int ix = 0; ix < nodes_x; ix++){
      normal(pg, getNode3D(ix, iy, iz), normals[iz * nodes_x + ix], nlen);
    }
  }
  pg.endShape();
}
 
Example #26
Source File: DwSoftGrid3D.java    From PixelFlow with MIT License 5 votes vote down vote up
private void displayNormalsXY(PGraphics pg, float[][] normals, int iz, float nlen){
  pg.beginShape(PConstants.LINES);
  for(int iy = 0; iy < nodes_y; iy++){
    for(int ix = 0; ix < nodes_x; ix++){
      normal(pg, getNode3D(ix, iy, iz), normals[iy * nodes_x + ix], nlen);
    }
  }
  pg.endShape();
}
 
Example #27
Source File: CameraBasic.java    From haxademic with MIT License 5 votes vote down vote up
public void update()
{
	// move camera
	_curX = p.width/2.0f + cameraXSpeed * curFrameCount;
	_curY = p.height/2.0f + cameraYSpeed * curFrameCount;
	_curZ = ( p.height/2.0f ) / P.tan( PConstants.PI * 60.0f / 360.0f ) + cameraZSpeed * curFrameCount;
	// aim camera
	super.update();
	//curFrameCount++;
	if( curFrameCount >= recycleAfterNumFrames )
	{
		curFrameCount = 0;
		//init();
	}
}
 
Example #28
Source File: DwShadowMap.java    From PixelFlow with MIT License 5 votes vote down vote up
public void update(){
    pg_shadowmap.beginDraw();
    // saves quite some time compared to background(0xFFFFFFFF);
    pg_shadowmap.pgl.clearColor(1, 1, 1, 1);
    pg_shadowmap.pgl.clearDepth(1);
    pg_shadowmap.pgl.clear(PGL.COLOR_BUFFER_BIT | PGL.DEPTH_BUFFER_BIT);
    
//  pg_shadowmap.background(0xFFFFFFFF);
    pg_shadowmap.blendMode(PConstants.REPLACE);
    pg_shadowmap.noStroke();
    pg_shadowmap.applyMatrix(mat_scene_bounds);
    pg_shadowmap.shader(shader_shadow);
    scene_display.display(pg_shadowmap);
    pg_shadowmap.endDraw();
  }
 
Example #29
Source File: DwSoftBody.java    From PixelFlow with MIT License 5 votes vote down vote up
protected void setShapeWireframe(PApplet pg, PShape child){
  if(shp_wireframe == null){
    shp_wireframe = pg.createShape(PConstants.GROUP);
    shp_wireframe.setName("shp_wireframe (root)");
  } else {
    removeChilds(shp_wireframe);
  }
  child.setName("shp_wireframe");
  shp_wireframe.addChild(child);
}
 
Example #30
Source File: ToxiclibsSupport.java    From toxiclibs with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Draws a 2D line strip using all points in the given list of vectors.
 * 
 * @param points
 *            point list
 */
public final void lineStrip2D(List<? extends Vec2D> points) {
    boolean isFilled = gfx.fill;
    gfx.fill = false;
    processVertices2D(points.iterator(), PConstants.POLYGON, false);
    gfx.fill = isFilled;
}