本文整理汇总了Java中processing.core.PShape.noStroke方法的典型用法代码示例。如果您正苦于以下问题:Java PShape.noStroke方法的具体用法?Java PShape.noStroke怎么用?Java PShape.noStroke使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.core.PShape
的用法示例。
在下文中一共展示了PShape.noStroke方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayGridXY
import processing.core.PShape; //导入方法依赖的package包/类
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();
}
示例2: updateShapesCount
import processing.core.PShape; //导入方法依赖的package包/类
protected void updateShapesCount(){
if(particle_num == 0){
return;
}
// synchronize buffer size
int shp_count = shp_particles.getChildCount();
if(shp_count != particle_num){
// remove shapes, in case group is bigger than actual number
for(int i = shp_count - 1; i >= particle_num; i--){
shp_particles.removeChild(i);
}
// add shapes, in case group is smaller then actual number
for(int i = shp_count; i < particle_num; i++){
PShape shp_particle = papplet.createShape();
shp_particle.beginShape(PConstants.QUADS);
shp_particle.noFill();
shp_particle.noStroke();
shp_particle.textureMode(PConstants.NORMAL); // TODO: report issue
shp_particle.texture(param.tex_sprite); // TODO: report issue
shp_particle.vertex(-1, -1, 0, 0);
shp_particle.vertex(+1, -1, 1, 0);
shp_particle.vertex(+1, +1, 1, 1);
shp_particle.vertex(-1, +1, 0, 1);
shp_particle.endShape();
shp_particles.addChild(shp_particle);
}
}
}
示例3: calculateMesh
import processing.core.PShape; //导入方法依赖的package包/类
/**
* Calculates the mesh formed by the section points
*
* @param p the parent Processing applet
* @param color the mesh color
* @return the section mesh
*/
public PShape calculateMesh(PApplet p, int color) {
PShape mesh = p.createShape();
mesh.beginShape();
mesh.noStroke();
mesh.fill(color);
for (Vec3D point : points) {
mesh.vertex(point.x, point.y, point.z);
}
mesh.endShape(PApplet.CLOSE);
return mesh;
}
示例4: createParticleShape
import processing.core.PShape; //导入方法依赖的package包/类
public PShape createParticleShape(DwParticle2D particle, PImage pimg_sprite){
final float rad = 2;
PShape shp_sprite = papplet.createShape();
shp_sprite.beginShape(PConstants.QUADS);
shp_sprite.noStroke();
shp_sprite.noFill();
shp_sprite.tint(255,10,10);
if(particle.idx == IDX_MOUSE_PARTICLE){
shp_sprite.tint(200,100,100);
} else {
float r = 0 + papplet.random(-30, 30);
float g = 100;
float b = 100;
shp_sprite.tint(r,g,b);
}
shp_sprite.textureMode(PConstants.NORMAL);
shp_sprite.texture(pimg_sprite);
shp_sprite.normal(0, 0, 1);
shp_sprite.vertex(-rad, -rad, 0, 0);
shp_sprite.vertex(+rad, -rad, 1, 0);
shp_sprite.vertex(+rad, +rad, 1, 1);
shp_sprite.vertex(-rad, +rad, 0, 1);
shp_sprite.endShape();
return shp_sprite;
}
示例5: createShape
import processing.core.PShape; //导入方法依赖的package包/类
private PShape createShape(PGraphics pg){
int faces_count = mesh.ifs.getFacesCount();
int[][] faces = mesh.ifs.getFaces();
float[] n = new float[3]; // normal buffer
PShape shp = pg.createShape();
shp.beginShape(PConstants.TRIANGLES);
shp.noStroke();
shp.fill(material_color);
for(int i = 0; i < faces_count; i++){
int v0 = faces[i][0];
int v1 = faces[i][1];
int v2 = faces[i][2];
DwParticle3D p0 = particles[v0]; if(p0.all_springs_deactivated) continue;
DwParticle3D p1 = particles[v1]; if(p1.all_springs_deactivated) continue;
DwParticle3D p2 = particles[v2]; if(p2.all_springs_deactivated) continue;
if(FLAT_SHADING){
n[0] = n[1] = n[2] = 0;
DwParticle3D.crossAccum(p0, p1, p2, n);
shp.normal(n[0], n[1], n[2]);
shp.vertex(p0.cx, p0.cy, p0.cz);
shp.vertex(p1.cx, p1.cy, p1.cz);
shp.vertex(p2.cx, p2.cy, p2.cz);
} else {
n = normals[v0]; shp.normal(n[0], n[1], n[2]); shp.vertex(p0.cx, p0.cy, p0.cz);
n = normals[v1]; shp.normal(n[0], n[1], n[2]); shp.vertex(p1.cx, p1.cy, p1.cz);
n = normals[v2]; shp.normal(n[0], n[1], n[2]); shp.vertex(p2.cx, p2.cy, p2.cz);
}
}
shp.endShape();
return shp;
}
示例6: createShape
import processing.core.PShape; //导入方法依赖的package包/类
private PShape createShape(PGraphics pg) {
PShape shp = pg.createShape();
shp.beginShape();
shp.fill(material_color);
shp.noStroke();
for(int i = 0; i < num_nodes; i++){
DwParticle2D pa = particles[i];
if(pa.all_springs_deactivated) continue;
shp.vertex(pa.cx, pa.cy);
}
shp.endShape();
return shp;
}
示例7: displayMesh
import processing.core.PShape; //导入方法依赖的package包/类
public void displayMesh(PShape pg, DwIndexedFaceSet ifs){
// pg.beginShape(PConstants.TRIANGLES);
pg.textureMode(PConstants.NORMAL);
pg.texture(DEF.style.texture);
pg.noStroke();
int s0,s1,s2;
int i0,i1,i2;
float[] t0,t1,t2;
float[] v0,v1,v2;
for(int i = 0; i < DEF.FACES_COUNT; i++){
i0 = faces[i][0]; v0 = ifs.verts[i0];
i1 = faces[i][1]; v1 = ifs.verts[i1];
i2 = faces[i][2]; v2 = ifs.verts[i2];
i0 = DEF.FACES[i][0]; s0 = DEF.HILO[i0]; t0 = DEF.TEX_COORDS[i0];
i1 = DEF.FACES[i][1]; s1 = DEF.HILO[i1]; t1 = DEF.TEX_COORDS[i1];
i2 = DEF.FACES[i][2]; s2 = DEF.HILO[i2]; t2 = DEF.TEX_COORDS[i2];
int ci = DEF.FACES_COL[i];
if(DEF.style.texture != null){
DwDisplayUtils.vertex(pg, v0, t0);
DwDisplayUtils.vertex(pg, v1, t1);
DwDisplayUtils.vertex(pg, v2, t2);
} else {
// pg.fill(DEF.style.COL[s0]); DwDisplayUtils.vertex(pg, v0);
// pg.fill(DEF.style.COL[s1]); DwDisplayUtils.vertex(pg, v1);
// pg.fill(DEF.style.COL[s2]); DwDisplayUtils.vertex(pg, v2);
pg.fill(DEF.style.RGBS[ci][s0]); DwDisplayUtils.vertex(pg, v0);
pg.fill(DEF.style.RGBS[ci][s1]); DwDisplayUtils.vertex(pg, v1);
pg.fill(DEF.style.RGBS[ci][s2]); DwDisplayUtils.vertex(pg, v2);
}
}
// pg.endShape();
}
示例8: calculateMesh
import processing.core.PShape; //导入方法依赖的package包/类
/**
* Calculates the sculpture mesh
*/
protected void calculateMesh() {
if (sections.size() > 1) {
// Create the sculpture mesh
mesh = p.createShape(PApplet.GROUP);
mesh.fill(meshColor);
// Add the front side
mesh.addChild(sections.get(0).calculateMesh(p, meshColor));
// Calculate and add the mesh surface
PShape surface = p.createShape();
surface.beginShape(PApplet.TRIANGLES);
surface.noStroke();
surface.fill(meshColor);
for (int i = 0; i < sections.size() - 1; i++) {
SculptureSection section1 = sections.get(i);
SculptureSection section2 = sections.get(i + 1);
for (int j = 0; j < section1.points.length - 1; j++) {
Vec3D point1 = section1.points[j];
Vec3D point2 = section1.points[j + 1];
Vec3D point3 = section2.points[j];
Vec3D point4 = section2.points[j + 1];
surface.vertex(point1.x, point1.y, point1.z);
surface.vertex(point2.x, point2.y, point2.z);
surface.vertex(point3.x, point3.y, point3.z);
surface.vertex(point2.x, point2.y, point2.z);
surface.vertex(point4.x, point4.y, point4.z);
surface.vertex(point3.x, point3.y, point3.z);
}
Vec3D closePoint1 = section1.points[section1.points.length - 1];
Vec3D closePoint2 = section1.points[0];
Vec3D closePoint3 = section2.points[section1.points.length - 1];
Vec3D closePoint4 = section2.points[0];
surface.vertex(closePoint1.x, closePoint1.y, closePoint1.z);
surface.vertex(closePoint2.x, closePoint2.y, closePoint2.z);
surface.vertex(closePoint3.x, closePoint3.y, closePoint3.z);
surface.vertex(closePoint2.x, closePoint2.y, closePoint2.z);
surface.vertex(closePoint4.x, closePoint4.y, closePoint4.z);
surface.vertex(closePoint3.x, closePoint3.y, closePoint3.z);
}
surface.endShape();
mesh.addChild(surface);
// Add the back side
mesh.addChild(sections.get(sections.size() - 1).calculateMesh(p, meshColor));
}
}
示例9: createParticleShape
import processing.core.PShape; //导入方法依赖的package包/类
public PShape createParticleShape(DwParticle2D particle, PImage sprite_img){
final float rad = particle.rad;
PShape shp_particle = papplet.createShape(PShape.GROUP);
if( PARTICLE_SHAPE_IDX >= 0 && PARTICLE_SHAPE_IDX < 4){
PShape sprite = papplet.createShape(PShape.GEOMETRY);
sprite.beginShape(PConstants.QUAD);
sprite.noStroke();
sprite.noFill();
sprite.textureMode(PConstants.NORMAL);
sprite.texture(sprite_img);
sprite.normal(0, 0, 1);
sprite.vertex(-rad, -rad, 0, 0);
sprite.vertex(+rad, -rad, 1, 0);
sprite.vertex(+rad, +rad, 1, 1);
sprite.vertex(-rad, +rad, 0, 1);
sprite.endShape();
shp_particle.addChild(sprite);
}
else if( PARTICLE_SHAPE_IDX == 4){
float threshold1 = 1; // radius shortening for arc segments
float threshold2 = 140; // arc between segments
double arc1 = Math.acos(Math.max((rad-threshold1), 0) / rad);
double arc2 = (180 - threshold2) * Math.PI / 180;
double arc = Math.min(arc1, arc2);
int num_vtx = (int)Math.ceil(2*Math.PI/arc);
// System.out.println(num_vtx);
PShape circle = papplet.createShape(PShape.GEOMETRY);
circle.beginShape();
circle.noStroke();
circle.fill(200,100);
for(int i = 0; i < num_vtx; i++){
float vx = (float) Math.cos(i * 2*Math.PI/num_vtx) * rad;
float vy = (float) Math.sin(i * 2*Math.PI/num_vtx) * rad;
circle.vertex(vx, vy);
}
circle.endShape(PConstants.CLOSE);
PShape line = papplet.createShape(PShape.GEOMETRY);
line.beginShape(PConstants.LINES);
line.stroke(0, 100);
line.strokeWeight(1);
line.vertex(0, 0);
line.vertex(-(rad-1), 0);
line.endShape();
// PShape circle = papplet.createShape(PConstants.ELLIPSE, 0, 0, rad*2, rad*2);
// circle.setStroke(false);
// circle.setFill(papplet.color(200,100));
//
// PShape line = papplet.createShape(PConstants.LINE, 0, 0, -(rad-1), 0);
// line.setStroke(papplet.color(0,200));
// line.setStrokeWeight(1);
shp_particle.addChild(circle);
shp_particle.addChild(line);
}
return shp_particle;
}
示例10: createParticleShape
import processing.core.PShape; //导入方法依赖的package包/类
public PShape createParticleShape(DwParticle2D particle){
final float rad = particle.rad;
PShape shp_particle = papplet.createShape(PShape.GROUP);
// compute circle resolution, depending on the radius we reduce/increase
// the number of vertices we need to render
float threshold1 = 1; // radius shortening for arc segments
float threshold2 = 140; // arc between segments
double arc1 = Math.acos(Math.max((rad-threshold1), 0) / rad);
double arc2 = (180 - threshold2) * Math.PI / 180;
double arc = Math.min(arc1, arc2);
int num_vtx = (int)Math.ceil(2*Math.PI/arc);
// actual circle
PShape circle = papplet.createShape(PShape.GEOMETRY);
circle.beginShape();
circle.noStroke();
circle.fill(200,100);
for(int i = 0; i < num_vtx; i++){
float vx = (float) Math.cos(i * 2*Math.PI/num_vtx) * 1;
float vy = (float) Math.sin(i * 2*Math.PI/num_vtx) * 1;
circle.vertex(vx, vy);
}
circle.endShape(PConstants.CLOSE);
// line, to indicate the velocity-direction of the particle
PShape line = papplet.createShape(PShape.GEOMETRY);
line.beginShape(PConstants.LINES);
line.stroke(255, 100);
line.strokeWeight(1f/rad);
line.vertex(0, 0);
line.vertex(-1, 0);
line.endShape();
shp_particle.addChild(circle);
shp_particle.addChild(line);
return shp_particle;
}