當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。