• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ParticleColor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jbox2d.particle.ParticleColor的典型用法代码示例。如果您正苦于以下问题:Java ParticleColor类的具体用法?Java ParticleColor怎么用?Java ParticleColor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ParticleColor类属于org.jbox2d.particle包,在下文中一共展示了ParticleColor类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: drawParticleSystem

import org.jbox2d.particle.ParticleColor; //导入依赖的package包/类
private void drawParticleSystem(ParticleSystem system) {
  boolean wireframe = (m_debugDraw.getFlags() & DebugDraw.e_wireframeDrawingBit) != 0;
  int particleCount = system.getParticleCount();
  if (particleCount != 0) {
    float particleRadius = system.getParticleRadius();
    Vec2[] positionBuffer = system.getParticlePositionBuffer();
    ParticleColor[] colorBuffer = null;
    if (system.m_colorBuffer.data != null) {
      colorBuffer = system.getParticleColorBuffer();
    }
    if (wireframe) {
      m_debugDraw.drawParticlesWireframe(positionBuffer, particleRadius, colorBuffer,
          particleCount);
    } else {
      m_debugDraw.drawParticles(positionBuffer, particleRadius, colorBuffer, particleCount);
    }
  }
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:19,代码来源:World.java


示例2: drawParticles

import org.jbox2d.particle.ParticleColor; //导入依赖的package包/类
@Override
public void drawParticles(Vec2[] centers, float radius, ParticleColor[] colors, int count) {
  
  radius *= PARTICLE_RADIUS_SCALE;
  
  canvas.noStroke();
  canvas.noFill();
  canvas.beginShape(PConstants.QUADS);
  canvas.textureMode(PConstants.NORMAL);
  canvas.texture(PARTICLE_SPRITE);
  for(int i = 0; i < count; i++){
    Vec2 pos = centers[i];
    if(colors != null){
      ParticleColor col = colors[i];
      canvas.tint(col.r & 0xFF, col.g & 0xFF, col.b & 0xFF, col.a & 0xFF);
    }
    canvas.vertex(pos.x - radius, pos.y - radius, 0, 0);
    canvas.vertex(pos.x + radius, pos.y - radius, 1, 0);
    canvas.vertex(pos.x + radius, pos.y + radius, 1, 1);
    canvas.vertex(pos.x - radius, pos.y + radius, 0, 1);
    
  }
  canvas.endShape();
  canvas.tint(255);
}
 
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:26,代码来源:DwDebugDraw.java


示例3: drawParticles

import org.jbox2d.particle.ParticleColor; //导入依赖的package包/类
@Override
public void drawParticles(Vec2[] centers, float radius, ParticleColor[] colors, int count) {
  Graphics2D g = getGraphics();
  saveState(g);
  transformGraphics(g, zero);
  g.setStroke(stroke);
  for (int i = 0; i < count; i++) {
    Vec2 center = centers[i];
    Color color;
    if (colors == null) {
      color = pcolorA;
    } else {
      ParticleColor c = colors[i];
      color = cpool.getColor(c.r * 1f / 127, c.g * 1f / 127, c.b * 1f / 127, c.a * 1f / 127);
    }
    AffineTransform old = g.getTransform();
    g.translate(center.x, center.y);
    g.scale(radius, radius);
    g.setColor(color);
    g.fill(circle);
    g.setTransform(old);
  }
  restoreState(g);
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:25,代码来源:DebugDrawJ2D.java


示例4: drawParticlesWireframe

import org.jbox2d.particle.ParticleColor; //导入依赖的package包/类
@Override
public void drawParticlesWireframe(Vec2[] centers, float radius, ParticleColor[] colors, int count) {
  Graphics2D g = getGraphics();
  saveState(g);
  transformGraphics(g, zero);
  g.setStroke(stroke);
  for (int i = 0; i < count; i++) {
    Vec2 center = centers[i];
    Color color;
    // No alpha channel, it slows everything down way too much.
    if (colors == null) {
      color = pcolor;
    } else {
      ParticleColor c = colors[i];
      color = new Color(c.r * 1f / 127, c.g * 1f / 127, c.b * 1f / 127, 1);
    }
    AffineTransform old = g.getTransform();
    g.translate(center.x, center.y);
    g.scale(radius, radius);
    g.setColor(color);
    g.draw(circle);
    g.setTransform(old);
  }
  restoreState(g);
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:26,代码来源:DebugDrawJ2D.java


示例5: generteParticleColors

import org.jbox2d.particle.ParticleColor; //导入依赖的package包/类
public void generteParticleColors(ParticleGroup group, int hue){
  int count = group.getParticleCount();
  int from = group.getBufferIndex();
  int to = from + count;
  
  ParticleColor[] colors = world.getParticleColorBuffer();
  Vec2[] pos = world.getParticlePositionBuffer();
  
  colorMode(HSB, 360, 100, 100, 100);
  
  for(int i = from; i < to; i++){
    float x = pos[i].x / 3f;
    float y = pos[i].y / 3f;
    float noisexy = noise(x, y, i /(float)count) * 2 - 1;
    float rand = random(-1, +1);

    float hsb_h = hue + 90 * rand * noisexy;
    float hsb_s = 100;
    float hsb_b = 100;
    float hsb_a = 50 + noisexy * 50;
    
    hsb_h = (hsb_h + 360) % 360;

    int argb = color(hsb_h, hsb_s, hsb_b, hsb_a);
    
    colors[i].set(argb);
  }
  
  colorMode(RGB, 255);
}
 
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:31,代码来源:liquidfun_ParticleColors_LiquidFx.java


示例6: drawParticlesWireframe

import org.jbox2d.particle.ParticleColor; //导入依赖的package包/类
@Override
public void drawParticlesWireframe(Vec2[] centers, float radius, ParticleColor[] colors, int count) {
  canvas.noFill();
  canvas.strokeWeight(stroke_weight);
  canvas.stroke(0);
  for(int i = 0; i < count; i++){
    Vec2 pos = centers[i];
    if(colors != null){
      ParticleColor col = colors[i];
      canvas.stroke(col.r & 0xFF, col.g & 0xFF, col.b & 0xFF, col.a & 0xFF);
    }
    canvas.ellipse(pos.x, pos.y, radius*2, radius*2);
  }
}
 
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:15,代码来源:DwDebugDraw.java


示例7: drawParticles

import org.jbox2d.particle.ParticleColor; //导入依赖的package包/类
@Override
public void drawParticles(Vec2[] centers, float radius, ParticleColor[] colors, int count) {
  GL2 gl = panel.getGL().getGL2();
  gl.glPushMatrix();
  transformViewport(gl, zero);

  float theta = 2 * MathUtils.PI / NUM_CIRCLE_POINTS;
  float c = MathUtils.cos(theta);
  float s = MathUtils.sin(theta);

  float x = radius;
  float y = 0;

  for (int i = 0; i < count; i++) {
    Vec2 center = centers[i];
    float cx = center.x;
    float cy = center.y;
    gl.glBegin(GL2.GL_TRIANGLE_FAN);
    if (colors == null) {
      gl.glColor4f(1, 1, 1, .4f);
    } else {
      ParticleColor color = colors[i];
      gl.glColor4b(color.r, color.g, color.b, color.a);
    }
    for (int j = 0; j < NUM_CIRCLE_POINTS; j++) {
      gl.glVertex3f(x + cx, y + cy, 0);
      float temp = x;
      x = c * x - s * y;
      y = s * temp + c * y;
    }
    gl.glEnd();
  }
  gl.glPopMatrix();
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:35,代码来源:JoglDebugDraw.java


示例8: drawParticlesWireframe

import org.jbox2d.particle.ParticleColor; //导入依赖的package包/类
@Override
public void drawParticlesWireframe(Vec2[] centers, float radius, ParticleColor[] colors, int count) {
  GL2 gl = panel.getGL().getGL2();
  gl.glPushMatrix();
  transformViewport(gl, zero);

  float theta = 2 * MathUtils.PI / NUM_CIRCLE_POINTS;
  float c = MathUtils.cos(theta);
  float s = MathUtils.sin(theta);

  float x = radius;
  float y = 0;

  for (int i = 0; i < count; i++) {
    Vec2 center = centers[i];
    float cx = center.x;
    float cy = center.y;
    gl.glBegin(GL2.GL_LINE_LOOP);
    if (colors == null) {
      gl.glColor4f(1, 1, 1, 1);
    } else {
      ParticleColor color = colors[i];
      gl.glColor4b(color.r, color.g, color.b, (byte) 127);
    }
    for (int j = 0; j < NUM_CIRCLE_POINTS; j++) {
      gl.glVertex3f(x + cx, y + cy, 0);
      float temp = x;
      x = c * x - s * y;
      y = s * temp + c * y;
    }
    gl.glEnd();
  }
  gl.glPopMatrix();
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:35,代码来源:JoglDebugDraw.java


示例9: drawParticles

import org.jbox2d.particle.ParticleColor; //导入依赖的package包/类
@Override
    public void drawParticles(Vec2[] centers, float radius, ParticleColor[] colors, int count) {
    //    GL2 gl = panel.getGL().getGL2();
    gl.glPushMatrix();
    transformViewport(gl, zero);

    float theta = 2 * MathUtils.PI / NUM_CIRCLE_POINTS;
    float c = MathUtils.cos(theta);
    float s = MathUtils.sin(theta);

    float x = radius;
    float y = 0;

    for (int i = 0; i < count; i++) {
        Vec2 center = centers[i];
        float cx = center.x;
        float cy = center.y;
        gl.glBegin(GL2.GL_TRIANGLE_FAN);
        if (colors == null) {
            gl.glColor4f(1, 1, 1, .4f);
        } else {
            ParticleColor color = colors[i];
            gl.glColor4b(color.r, color.g, color.b, color.a);
        }
        for (int j = 0; j < NUM_CIRCLE_POINTS; j++) {
            gl.glVertex3f(x + cx, y + cy, 0);
            float temp = x;
            x = c * x - s * y;
            y = s * temp + c * y;
        }
        gl.glEnd();
    }
    gl.glPopMatrix();
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:35,代码来源:JoglDebugDraw.java


示例10: drawParticlesWireframe

import org.jbox2d.particle.ParticleColor; //导入依赖的package包/类
@Override
    public void drawParticlesWireframe(Vec2[] centers, float radius, ParticleColor[] colors, int count) {
    //    GL2 gl = panel.getGL().getGL2();
    gl.glPushMatrix();
    transformViewport(gl, zero);

    float theta = 2 * MathUtils.PI / NUM_CIRCLE_POINTS;
    float c = MathUtils.cos(theta);
    float s = MathUtils.sin(theta);

    float x = radius;
    float y = 0;

    for (int i = 0; i < count; i++) {
        Vec2 center = centers[i];
        float cx = center.x;
        float cy = center.y;
        gl.glBegin(GL2.GL_LINE_LOOP);
        if (colors == null) {
            gl.glColor4f(1, 1, 1, 1);
        } else {
            ParticleColor color = colors[i];
            gl.glColor4b(color.r, color.g, color.b, (byte) 127);
        }
        for (int j = 0; j < NUM_CIRCLE_POINTS; j++) {
            gl.glVertex3f(x + cx, y + cy, 0);
            float temp = x;
            x = c * x - s * y;
            y = s * temp + c * y;
        }
        gl.glEnd();
    }
    gl.glPopMatrix();
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:35,代码来源:JoglDebugDraw.java


示例11: getParticleColorBuffer

import org.jbox2d.particle.ParticleColor; //导入依赖的package包/类
public ParticleColor[] getParticleColorBuffer() {
  return m_particleSystem.getParticleColorBuffer();
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:4,代码来源:World.java


示例12: drawParticles

import org.jbox2d.particle.ParticleColor; //导入依赖的package包/类
/**
 * Draw a particle array
 * 
 * @param colors can be null
 */
public abstract void drawParticles(Vec2[] centers, float radius, ParticleColor[] colors, int count);
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:7,代码来源:DebugDraw.java


示例13: drawParticlesWireframe

import org.jbox2d.particle.ParticleColor; //导入依赖的package包/类
/**
 * Draw a particle array
 * 
 * @param colors can be null
 */
public abstract void drawParticlesWireframe(Vec2[] centers, float radius, ParticleColor[] colors,
    int count);
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:8,代码来源:DebugDraw.java


示例14: setParticleColorBuffer

import org.jbox2d.particle.ParticleColor; //导入依赖的package包/类
public void setParticleColorBuffer(ParticleColor[] buffer, int capacity) {
  m_particleSystem.setParticleColorBuffer(buffer, capacity);

}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:5,代码来源:World.java



注:本文中的org.jbox2d.particle.ParticleColor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FilterExpression类代码示例发布时间:2022-05-22
下一篇:
Java Settings类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap