@Override public void allocateChannels () { colorChannel = controller.particles.addChannel(ParticleChannels.Color); } }
/** Adds and returns a channel described by the channel descriptor parameter. If a channel with the same id already exists, no * allocation is performed and that channel is returned. Otherwise a new channel is allocated and initialized with the * initializer. */ public <T extends Channel> T addChannel (ChannelDescriptor channelDescriptor, ChannelInitializer<T> initializer) { T channel = getChannel(channelDescriptor); if (channel == null) { channel = allocateChannel(channelDescriptor); if (initializer != null) initializer.init(channel); arrays.add(channel); } return channel; }
/** Removes the channel with the given id */ public <T> void removeArray (int id) { arrays.removeIndex(findIndex(id)); }
@Override public void allocateChannels () { for (int k = 0; k < velocities.size; ++k) { velocities.items[k].allocateChannels(); } // Hack, shouldn't be done but after all the modifiers allocated their channels // it's possible to check if we need to allocate previous position channel accellerationChannel = controller.particles.getChannel(ParticleChannels.Acceleration); hasAcceleration = accellerationChannel != null; if (hasAcceleration) { positionChannel = controller.particles.addChannel(ParticleChannels.Position); previousPositionChannel = controller.particles.addChannel(ParticleChannels.PreviousPosition); } // Angular velocity check angularVelocityChannel = controller.particles.getChannel(ParticleChannels.AngularVelocity2D); has2dAngularVelocity = angularVelocityChannel != null; if (has2dAngularVelocity) { rotationChannel = controller.particles.addChannel(ParticleChannels.Rotation2D); has3dAngularVelocity = false; } else { angularVelocityChannel = controller.particles.getChannel(ParticleChannels.AngularVelocity3D); has3dAngularVelocity = angularVelocityChannel != null; if (has3dAngularVelocity) rotationChannel = controller.particles.addChannel(ParticleChannels.Rotation3D); } }
@Override public void init () { renderData.modelInstanceChannel = controller.particles.getChannel(ParticleChannels.ModelInstance); renderData.colorChannel = controller.particles.getChannel(ParticleChannels.Color); renderData.scaleChannel = controller.particles.getChannel(ParticleChannels.Scale); renderData.rotationChannel = controller.particles.getChannel(ParticleChannels.Rotation3D); hasColor = renderData.colorChannel != null; hasScale = renderData.scaleChannel != null; hasRotation = renderData.rotationChannel != null; }
protected void allocateChannels (int maxParticleCount) { particles = new ParallelArray(maxParticleCount); // Alloc additional channels emitter.allocateChannels(); for (Influencer influencer : influencers) influencer.allocateChannels(); renderer.allocateChannels(); }
for (int i = 0, k = 0; i < controller.particles.size;) { if ((lifeChannel.data[k + ParticleChannels.CurrentLifeOffset] -= deltaMillis) <= 0) { controller.particles.removeElement(i); continue; } else {
@Override public void init () { renderData.modelInstanceChannel = controller.particles.getChannel(ParticleChannels.ModelInstance); renderData.colorChannel = controller.particles.getChannel(ParticleChannels.Color); renderData.scaleChannel = controller.particles.getChannel(ParticleChannels.Scale); renderData.rotationChannel = controller.particles.getChannel(ParticleChannels.Rotation3D); hasColor = renderData.colorChannel != null; hasScale = renderData.scaleChannel != null; hasRotation = renderData.rotationChannel != null; }
@Override public void allocateChannels () { for (int k = 0; k < velocities.size; ++k) { velocities.items[k].allocateChannels(); } // Hack, shouldn't be done but after all the modifiers allocated their channels // it's possible to check if we need to allocate previous position channel accellerationChannel = controller.particles.getChannel(ParticleChannels.Acceleration); hasAcceleration = accellerationChannel != null; if (hasAcceleration) { positionChannel = controller.particles.addChannel(ParticleChannels.Position); previousPositionChannel = controller.particles.addChannel(ParticleChannels.PreviousPosition); } // Angular velocity check angularVelocityChannel = controller.particles.getChannel(ParticleChannels.AngularVelocity2D); has2dAngularVelocity = angularVelocityChannel != null; if (has2dAngularVelocity) { rotationChannel = controller.particles.addChannel(ParticleChannels.Rotation2D); has3dAngularVelocity = false; } else { angularVelocityChannel = controller.particles.getChannel(ParticleChannels.AngularVelocity3D); has3dAngularVelocity = angularVelocityChannel != null; if (has3dAngularVelocity) rotationChannel = controller.particles.addChannel(ParticleChannels.Rotation3D); } }
protected void allocateChannels (int maxParticleCount) { particles = new ParallelArray(maxParticleCount); // Alloc additional channels emitter.allocateChannels(); for (Influencer influencer : influencers) influencer.allocateChannels(); renderer.allocateChannels(); }
for (int i = 0, k = 0; i < controller.particles.size;) { if ((lifeChannel.data[k + ParticleChannels.CurrentLifeOffset] -= deltaMillis) <= 0) { controller.particles.removeElement(i); continue; } else {
@Override public void allocateChannels () { colorChannel = controller.particles.addChannel(ParticleChannels.Color); } }
@Override public void init () { controllerChannel = controller.particles.getChannel(ParticleChannels.ParticleController); if (controllerChannel == null) throw new GdxRuntimeException( "ParticleController channel not found, specify an influencer which will allocate it please."); scaleChannel = controller.particles.getChannel(ParticleChannels.Scale); rotationChannel = controller.particles.getChannel(ParticleChannels.Rotation3D); hasScale = scaleChannel != null; hasRotation = rotationChannel != null; }
/** Adds and returns a channel described by the channel descriptor parameter. If a channel with the same id already exists, no * allocation is performed and that channel is returned. Otherwise a new channel is allocated and initialized with the * initializer. */ public <T extends Channel> T addChannel (ChannelDescriptor channelDescriptor, ChannelInitializer<T> initializer) { T channel = getChannel(channelDescriptor); if (channel == null) { channel = allocateChannel(channelDescriptor); if (initializer != null) initializer.init(channel); arrays.add(channel); } return channel; }
@Override public void allocateChannels () { for (int k = 0; k < velocities.size; ++k) { velocities.items[k].allocateChannels(); } // Hack, shouldn't be done but after all the modifiers allocated their channels // it's possible to check if we need to allocate previous position channel accellerationChannel = controller.particles.getChannel(ParticleChannels.Acceleration); hasAcceleration = accellerationChannel != null; if (hasAcceleration) { positionChannel = controller.particles.addChannel(ParticleChannels.Position); previousPositionChannel = controller.particles.addChannel(ParticleChannels.PreviousPosition); } // Angular velocity check angularVelocityChannel = controller.particles.getChannel(ParticleChannels.AngularVelocity2D); has2dAngularVelocity = angularVelocityChannel != null; if (has2dAngularVelocity) { rotationChannel = controller.particles.addChannel(ParticleChannels.Rotation2D); has3dAngularVelocity = false; } else { angularVelocityChannel = controller.particles.getChannel(ParticleChannels.AngularVelocity3D); has3dAngularVelocity = angularVelocityChannel != null; if (has3dAngularVelocity) rotationChannel = controller.particles.addChannel(ParticleChannels.Rotation3D); } }
var par_A = new ParallelArray([3,3,3,3]); //returns < 0,1,2,3 > console.log( par_A.combine_par(function(i) {return i} ) );
/** Removes the channel with the given id */ public <T> void removeArray (int id) { arrays.removeIndex(findIndex(id)); }
for (int i = 0, k = 0; i < controller.particles.size;) { if ((lifeChannel.data[k + ParticleChannels.CurrentLifeOffset] -= deltaMillis) <= 0) { controller.particles.removeElement(i); continue; } else {
/** Adds and returns a channel described by the channel descriptor parameter. If a channel with the same id already exists, no * allocation is performed and that channel is returned. */ public <T extends Channel> T addChannel (ChannelDescriptor channelDescriptor) { return addChannel(channelDescriptor, null); }
@Override public void init () { controllerChannel = controller.particles.getChannel(ParticleChannels.ParticleController); if (controllerChannel == null) throw new GdxRuntimeException( "ParticleController channel not found, specify an influencer which will allocate it please."); scaleChannel = controller.particles.getChannel(ParticleChannels.Scale); rotationChannel = controller.particles.getChannel(ParticleChannels.Rotation3D); hasScale = scaleChannel != null; hasRotation = rotationChannel != null; }