当前位置: 首页>>代码示例>>Java>>正文


Java ParticleGroupType类代码示例

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


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

示例1: keyPressed

import org.jbox2d.particle.ParticleGroupType; //导入依赖的package包/类
public void keyPressed(char keyChar, int keyCode) {
  m_drawing = keyChar != 'x';
  m_particleFlags = 0;
  m_groupFlags = 0;
  color.set((byte)127, (byte)127, (byte)127, (byte)50);
  switch (keyChar) {
    case 'e':
      m_particleFlags = ParticleType.b2_elasticParticle;
      m_groupFlags = ParticleGroupType.b2_solidParticleGroup;
      break;
    case 'p':
      m_particleFlags = ParticleType.b2_powderParticle;
      break;
    case 'f':
      m_groupFlags =
          ParticleGroupType.b2_rigidParticleGroup | ParticleGroupType.b2_solidParticleGroup;
      break;
    case 's':
      m_particleFlags = ParticleType.b2_springParticle;
      m_groupFlags = ParticleGroupType.b2_solidParticleGroup;
      break;
    case 't':
      color.set((byte)0, (byte)127, (byte)0, (byte)50);
      m_particleFlags = ParticleType.b2_tensileParticle;
      break;
    case 'v':
      color.set((byte)0, (byte)0, (byte)127, (byte)50);
      m_particleFlags = ParticleType.b2_viscousParticle;
      break;
    case 'w':
      m_particleFlags = ParticleType.b2_wallParticle;
      m_groupFlags = ParticleGroupType.b2_solidParticleGroup;
      break;
    case 'z':
      m_particleFlags = ParticleType.b2_zombieParticle;
      break;
  }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:39,代码来源:DrawingParticles.java

示例2: reset

import org.jbox2d.particle.ParticleGroupType; //导入依赖的package包/类
public void reset(){
  // release old resources
  release();
  
  
  // liquid effect
  pixelflow = new DwPixelFlow(this);
  particle_fluidfx = new DwLiquidFX(pixelflow);
  
  // different render-targets for different bodies/particles/etc...
  pg_liquid = (PGraphics2D) createGraphics(width, height, P2D);
  pg_liquid.smooth(0);

  pg_prigid = (PGraphics2D) createGraphics(width, height, P2D);
  pg_prigid.smooth(0);
  
  pg_bodies = (PGraphics2D) createGraphics(width, height, P2D);
  pg_bodies.smooth(8);
  

  

  // box2d/liquidfun world
  world = new DwWorld(this, 15);
  
  // particle render settings
  
  world.particles.param.falloff_exp1 = 3f;
  world.particles.param.falloff_exp2 = 1f;
  world.particles.param.radius_scale = 2;
  
  // callback to group particles by their properties (flags)
  world.particles.setParticleRenderGroupCallback(new DwParticleRenderGroupCallback() {
    @Override
    public int getRenderGroupIndex(int particle_idx, ParticleGroup group, int particle_flag) {
      int group_flag = group.getGroupFlags();
      
      boolean is_wall  = (particle_flag & ParticleType     .b2_wallParticle      ) != 0;
      boolean is_solid = (group_flag    & ParticleGroupType.b2_solidParticleGroup) != 0;
      boolean is_rigid = (group_flag    & ParticleGroupType.b2_rigidParticleGroup) != 0;

      int group_id = 0;
      if(is_wall || is_solid || is_rigid){
        group_id = 1;
      } else {
        group_id = 0;
      }
      return group_id;
    }
  });
  

 
  setParticleSpawnProperties(spawn_type);
  
  // create scene: rigid bodies, particles, etc ...
  initScene();
}
 
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:59,代码来源:liquidfun_ParticleRenderGroups_LiquidFx.java

示例3: setParticleSpawnProperties

import org.jbox2d.particle.ParticleGroupType; //导入依赖的package包/类
public void setParticleSpawnProperties(int type){
    
    spawn_type = type;

    int COLOR_MIX = 0;
//    COLOR_MIX = ParticleType.b2_colorMixingParticle;
    
    DwParticleSpawn particle_spawn = world.mouse_spawn_particles;
    particle_spawn.join_groups = false;
    particle_spawn.setCircleShape(30);
    
    colorMode(HSB, 360, 100, 100);
    
    float hsb_s = 100;
    float hsb_b = 100;

    switch (type) {
      case 0:
        particle_spawn.group_def.setColor(color(225, hsb_s, hsb_b));
        particle_spawn.group_def.flags = ParticleType.b2_waterParticle | COLOR_MIX;
        particle_spawn.group_def.groupFlags = 0;
        break;
      case 1:
        particle_spawn.group_def.setColor(color(100, hsb_s, hsb_b));
        particle_spawn.group_def.flags = ParticleType.b2_viscousParticle | COLOR_MIX;
        particle_spawn.group_def.groupFlags = 0;
        break;
      case 2:
        particle_spawn.group_def.setColor(color(0, hsb_s, hsb_b));
        particle_spawn.group_def.flags = ParticleType.b2_tensileParticle | COLOR_MIX;
        particle_spawn.group_def.groupFlags = 0;
        break;
      case 3:
        particle_spawn.group_def.setColor(color(60, hsb_s * 0.5f, hsb_b));
        particle_spawn.group_def.flags = ParticleType.b2_powderParticle | COLOR_MIX;
        particle_spawn.group_def.groupFlags = 0;
        break;
      case 4:
        particle_spawn.group_def.setColor(color(330, hsb_s, hsb_b));
        particle_spawn.group_def.flags = ParticleType.b2_wallParticle;
        particle_spawn.group_def.groupFlags = ParticleGroupType.b2_solidParticleGroup;
        particle_spawn.join_groups = true;
        particle_spawn.setCircleShape(20);
        break;
    }
    
    colorMode(RGB, 255);

  }
 
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:50,代码来源:liquidfun_ParticleRenderGroups_LiquidFx.java

示例4: setParticleSpawnProperties

import org.jbox2d.particle.ParticleGroupType; //导入依赖的package包/类
public void setParticleSpawnProperties(int type){
    
    spawn_type = type;

    int COLOR_MIX = 0;
//    COLOR_MIX = ParticleType.b2_colorMixingParticle;
    
    DwParticleSpawn particle_spawn = world.mouse_spawn_particles;
    particle_spawn.join_groups = false;
    particle_spawn.setCircleShape(40);

    colorMode(HSB, 360, 100, 100);
    
    switch (type) {
      case 0:
        particle_spawn.group_def.setColor(color(225, 96, 96));
        particle_spawn.group_def.flags = ParticleType.b2_waterParticle | COLOR_MIX;
        particle_spawn.group_def.groupFlags = 0;
        break;
      case 1:
        particle_spawn.group_def.setColor(color(100, 96, 96));
        particle_spawn.group_def.flags = ParticleType.b2_viscousParticle | COLOR_MIX;
        particle_spawn.group_def.groupFlags = 0;
        break;
      case 2:
        particle_spawn.group_def.setColor(color(5, 96, 96));
        particle_spawn.group_def.flags = ParticleType.b2_tensileParticle | COLOR_MIX;
        particle_spawn.group_def.groupFlags = 0;
        break;
      case 3:
        particle_spawn.group_def.setColor(color(70, 50, 96));
        particle_spawn.group_def.flags = ParticleType.b2_powderParticle | COLOR_MIX;
        particle_spawn.group_def.groupFlags = 0;
        break;
      case 4:
        particle_spawn.group_def.setColor(color(300, 96, 96));
//        particle_spawn.group_def.flags = ParticleType.b2_elasticParticle | ParticleType.b2_springParticle | COLOR_MIX;
        particle_spawn.group_def.flags = ParticleType.b2_elasticParticle | COLOR_MIX;

        particle_spawn.group_def.groupFlags = 0;
        break;
      case 5:
        particle_spawn.group_def.setColor(color(120, 90, 50));
        particle_spawn.group_def.flags = ParticleType.b2_wallParticle;
        particle_spawn.group_def.groupFlags = ParticleGroupType.b2_solidParticleGroup;
        particle_spawn.join_groups = true;
        particle_spawn.setCircleShape(15);
        break;
    }
    
    colorMode(RGB, 255);

  }
 
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:54,代码来源:liquidfun_ParticleTypes.java

示例5: setParticleSpawnProperties

import org.jbox2d.particle.ParticleGroupType; //导入依赖的package包/类
public void setParticleSpawnProperties(int type){
    
    spawn_type = type;

    int COLOR_MIX = 0;
//    COLOR_MIX = ParticleType.b2_colorMixingParticle;
    
    DwParticleSpawn particle_spawn = world.mouse_spawn_particles;
    particle_spawn.join_groups = false;
    particle_spawn.setCircleShape(40);
    
    colorMode(HSB, 360, 100, 100);

    switch (type) {
      case 0:
        particle_spawn.group_def.setColor(color(225, 100, 100));
        particle_spawn.group_def.flags = ParticleType.b2_waterParticle | COLOR_MIX;
        particle_spawn.group_def.groupFlags = 0;
        break;
      case 1:
        particle_spawn.group_def.setColor(color(100, 100, 100));
        particle_spawn.group_def.flags = ParticleType.b2_viscousParticle | COLOR_MIX;
        particle_spawn.group_def.groupFlags = 0;
        break;
      case 2:
        particle_spawn.group_def.setColor(color(0, 100, 100));
        particle_spawn.group_def.flags = ParticleType.b2_tensileParticle | COLOR_MIX;
        particle_spawn.group_def.groupFlags = 0;
        break;
      case 3:
        particle_spawn.group_def.setColor(color(60, 50, 100));
        particle_spawn.group_def.flags = ParticleType.b2_powderParticle | COLOR_MIX;
        particle_spawn.group_def.groupFlags = 0;
        break;
      case 4:
        particle_spawn.group_def.setColor(color(330, 100, 100));
        particle_spawn.group_def.flags = ParticleType.b2_wallParticle;
        particle_spawn.group_def.groupFlags = ParticleGroupType.b2_solidParticleGroup;
        particle_spawn.join_groups = true;
        particle_spawn.setCircleShape(20);
        break;
    }
    
    colorMode(RGB, 255);

  }
 
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:47,代码来源:liquidfun_DrawingParticles_LiquidFx.java

示例6: reset

import org.jbox2d.particle.ParticleGroupType; //导入依赖的package包/类
public void reset(){
    // release old resources
    release();
    
    
    // liquid effect
    pixelflow = new DwPixelFlow(this);
    particle_fluidfx = new DwLiquidFX(pixelflow);
    
    // different render-targets for different bodies/particles/etc...
    pg_liquid = (PGraphics2D) createGraphics(width, height, P2D);
    pg_liquid.smooth(0);

    pg_prigid = (PGraphics2D) createGraphics(width, height, P2D);
    pg_prigid.smooth(0);
    
    pg_bodies = (PGraphics2D) createGraphics(width, height, P2D);
    pg_bodies.smooth(8);
    

    

    // box2d/liquidfun world
//    world.INIT_GL_PARTICLES = false;
    world = new DwWorld(this, 15);
    
    // particle render settings
    
    world.particles.param.falloff_exp1 = 3f;
    world.particles.param.falloff_exp2 = 1f;
    world.particles.param.radius_scale = 2;
    
    // callback to group particles by their properties (flags)
    world.particles.setParticleRenderGroupCallback(new DwParticleRenderGroupCallback() {
      @Override
      public int getRenderGroupIndex(int particle_idx, ParticleGroup group, int particle_flag) {
        int group_flag = group.getGroupFlags();
        
        boolean is_wall  = (particle_flag & ParticleType     .b2_wallParticle      ) != 0;
        boolean is_solid = (group_flag    & ParticleGroupType.b2_solidParticleGroup) != 0;
        boolean is_rigid = (group_flag    & ParticleGroupType.b2_rigidParticleGroup) != 0;

        int group_id = 0;
        if(is_wall || is_solid || is_rigid){
          group_id = 1;
        } else {
          group_id = 0;
        }
        return group_id;
      }
    });
    

   
    setParticleSpawnProperties(spawn_type);
    
    // create scene: rigid bodies, particles, etc ...
    initScene();
  }
 
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:60,代码来源:liquidfun_ParticleRenderGroups_LiquidFxDark.java

示例7: setParticleSpawnProperties

import org.jbox2d.particle.ParticleGroupType; //导入依赖的package包/类
public void setParticleSpawnProperties(int type){
    
    spawn_type = type;

    int COLOR_MIX = 0;
//    COLOR_MIX = ParticleType.b2_colorMixingParticle;
    
    DwParticleSpawn particle_spawn = world.mouse_spawn_particles;
    particle_spawn.join_groups = false;
    particle_spawn.setCircleShape(30);
    
    colorMode(HSB, 360, 100, 100);
    
    float hsb_s = 10;
    float hsb_b = 20;

    switch (type) {
      case 0:
        particle_spawn.group_def.setColor(color(225, hsb_s, hsb_b));
        particle_spawn.group_def.flags = ParticleType.b2_waterParticle | COLOR_MIX;
        particle_spawn.group_def.groupFlags = 0;
        break;
      case 1:
        particle_spawn.group_def.setColor(color(100, hsb_s, hsb_b));
        particle_spawn.group_def.flags = ParticleType.b2_viscousParticle | COLOR_MIX;
        particle_spawn.group_def.groupFlags = 0;
        break;
      case 2:
        particle_spawn.group_def.setColor(color(0, hsb_s, hsb_b));
        particle_spawn.group_def.flags = ParticleType.b2_tensileParticle | COLOR_MIX;
        particle_spawn.group_def.groupFlags = 0;
        break;
      case 3:
        particle_spawn.group_def.setColor(color(60, hsb_s * 0.5f, hsb_b));
        particle_spawn.group_def.flags = ParticleType.b2_powderParticle | COLOR_MIX;
        particle_spawn.group_def.groupFlags = 0;
        break;
      case 4:
        particle_spawn.group_def.setColor(color(330, hsb_s, hsb_b));
        particle_spawn.group_def.flags = ParticleType.b2_wallParticle;
        particle_spawn.group_def.groupFlags = ParticleGroupType.b2_solidParticleGroup;
        particle_spawn.join_groups = true;
        particle_spawn.setCircleShape(20);
        break;
    }
    
    colorMode(RGB, 255);

  }
 
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:50,代码来源:liquidfun_ParticleRenderGroups_LiquidFxDark.java


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