use of org.jbox2d.particle.ParticleColor in project libgdx by libgdx.
the class WorldRayCastWrapper method drawParticleSystem.
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);
}
}
}
use of org.jbox2d.particle.ParticleColor in project opennars by opennars.
the class DrawPhy2D method drawParticlesWireframe.
@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);
}
use of org.jbox2d.particle.ParticleColor in project opennars by opennars.
the class DrawPhy2D method drawParticles.
@Override
public void drawParticles(final Vec2[] centers, final float radius, ParticleColor[] colors, final 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 = new Color(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);
}
Aggregations