本文整理汇总了Java中org.jbox2d.particle.ParticleGroup类的典型用法代码示例。如果您正苦于以下问题:Java ParticleGroup类的具体用法?Java ParticleGroup怎么用?Java ParticleGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParticleGroup类属于org.jbox2d.particle包,在下文中一共展示了ParticleGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: mouseDrag
import org.jbox2d.particle.ParticleGroup; //导入依赖的package包/类
@Override
public void mouseDrag(Vec2 p, int button) {
super.mouseDrag(p, button);
if (m_drawing) {
pshape.m_p.set(p);
pshape.m_radius = 2.0f;
pxf.setIdentity();
m_world.destroyParticlesInShape(pshape, pxf);
ppd.shape = pshape;
ppd.color = color;
ppd.flags = m_particleFlags;
ppd.groupFlags = m_groupFlags;
ParticleGroup group = m_world.createParticleGroup(ppd);
if (m_lastGroup != null && group.getGroupFlags() == m_lastGroup.getGroupFlags()) {
m_world.joinParticleGroups(m_lastGroup, group);
} else {
m_lastGroup = group;
}
mouseTracing = false;
}
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:22,代码来源:DrawingParticles.java
示例2: createParticleGroup
import org.jbox2d.particle.ParticleGroup; //导入依赖的package包/类
/**
* Create a particle group whose properties have been defined. No reference to the definition is
* retained.
*
* @warning This function is locked during callbacks.
*/
public ParticleGroup createParticleGroup(ParticleGroupDef def) {
assert (isLocked() == false);
if (isLocked()) {
return null;
}
ParticleGroup g = m_particleSystem.createParticleGroup(def);
return g;
}
开发者ID:jfcameron,项目名称:G2Dj,代码行数:15,代码来源:World.java
示例3: joinParticleGroups
import org.jbox2d.particle.ParticleGroup; //导入依赖的package包/类
/**
* Join two particle groups.
*
* @param the first group. Expands to encompass the second group.
* @param the second group. It is destroyed.
* @warning This function is locked during callbacks.
*/
public void joinParticleGroups(ParticleGroup groupA, ParticleGroup groupB) {
assert (isLocked() == false);
if (isLocked()) {
return;
}
m_particleSystem.joinParticleGroups(groupA, groupB);
}
开发者ID:jfcameron,项目名称:G2Dj,代码行数:15,代码来源:World.java
示例4: destroyParticlesInGroup
import org.jbox2d.particle.ParticleGroup; //导入依赖的package包/类
/**
* Destroy particles in a group. This function is locked during callbacks.
*
* @param The particle group to destroy.
* @param Whether to call the world b2DestructionListener for each particle is destroyed.
* @warning This function is locked during callbacks.
*/
public void destroyParticlesInGroup(ParticleGroup group, boolean callDestructionListener) {
assert (isLocked() == false);
if (isLocked()) {
return;
}
m_particleSystem.destroyParticlesInGroup(group, callDestructionListener);
}
开发者ID:jfcameron,项目名称:G2Dj,代码行数:15,代码来源:World.java
示例5: generteParticleColors
import org.jbox2d.particle.ParticleGroup; //导入依赖的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: spawn
import org.jbox2d.particle.ParticleGroup; //导入依赖的package包/类
public ParticleGroup spawn(float screen_x, float screen_y){
transform.getScreen2box(screen_x, screen_y, shape_transform.p);
applyShapeTransform();
// destroy particles in group_def.shape
if(destroy_inplace_before_spawn){
pdestroyer.destroyParticles(group_def.shape);
}
// spawn particles in group_def.shape
group_old = group_new;
group_new = world.createParticleGroup(group_def);
revertShapeTransform();
// result stats
spawn_count = group_new.getParticleCount();
spawn_begin = group_new.getBufferIndex();
spawn_end = spawn_begin + spawn_count;
// join groups if its a good idea
if(join_groups){
if (group_old != null && group_new.getGroupFlags() == group_old.getGroupFlags()) {
world.joinParticleGroups(group_old, group_new);
group_new = group_old;
}
}
is_active = true;
return group_new;
}
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:32,代码来源:DwParticleSpawn.java
示例7: particleGroupDestroyed
import org.jbox2d.particle.ParticleGroup; //导入依赖的package包/类
@Override
public void particleGroupDestroyed(ParticleGroup group) {
super.particleGroupDestroyed(group);
if (group == m_lastGroup) {
m_lastGroup = null;
}
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:8,代码来源:DrawingParticles.java
示例8: getParticleGroupBuffer
import org.jbox2d.particle.ParticleGroup; //导入依赖的package包/类
public ParticleGroup[] getParticleGroupBuffer() {
return m_particleSystem.getParticleGroupBuffer();
}
开发者ID:jfcameron,项目名称:G2Dj,代码行数:4,代码来源:World.java
示例9: reset
import org.jbox2d.particle.ParticleGroup; //导入依赖的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
示例10: reset
import org.jbox2d.particle.ParticleGroup; //导入依赖的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
示例11: sayGoodbye
import org.jbox2d.particle.ParticleGroup; //导入依赖的package包/类
@Override
public void sayGoodbye(ParticleGroup group) {
}
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:4,代码来源:DwParticleDestroyer.java
示例12: sayGoodbye
import org.jbox2d.particle.ParticleGroup; //导入依赖的package包/类
/**
* Called when any particle group is about to be destroyed.
*/
void sayGoodbye(ParticleGroup group);
开发者ID:jfcameron,项目名称:G2Dj,代码行数:5,代码来源:ParticleDestructionListener.java
示例13: getParticleGroupList
import org.jbox2d.particle.ParticleGroup; //导入依赖的package包/类
/**
* Get the world particle group list. With the returned group, use ParticleGroup::GetNext to get
* the next group in the world list. A NULL group indicates the end of the list.
*
* @return the head of the world particle group list.
*/
public ParticleGroup[] getParticleGroupList() {
return m_particleSystem.getParticleGroupList();
}
开发者ID:jfcameron,项目名称:G2Dj,代码行数:10,代码来源:World.java
示例14: getRenderGroupIndex
import org.jbox2d.particle.ParticleGroup; //导入依赖的package包/类
public int getRenderGroupIndex(int particle_idx, ParticleGroup group, int particle_flag);
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:2,代码来源:DwParticleRenderGroupCallback.java
示例15: particleGroupDestroyed
import org.jbox2d.particle.ParticleGroup; //导入依赖的package包/类
public void particleGroupDestroyed(ParticleGroup group) {}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:2,代码来源:TestbedTest.java
注:本文中的org.jbox2d.particle.ParticleGroup类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论