public SubSampledNoise2D(Noise2D source, Vector2f zoom, int sampleRate) { this.source = source; this.zoom.set(zoom); this.sampleRate = sampleRate; }
public void setTex(Vector2f v) { activeTex.set(v); }
@Override public void onEmission(TextureOffsetGeneratorComponent component, ParticleData particleData, Random random) { if (component.validOffsets.size() == 0) { return; } final int randomOffsetIndex = random.nextInt(component.validOffsets.size()); final Vector2f randomOffset = component.validOffsets.get(randomOffsetIndex); particleData.textureOffset.set(randomOffset.getX(), randomOffset.getY()); } }
public void resetParams() { activeColor.set(1, 1, 1, 1); activeTex.set(0, 0); lighting.set(1, 1, 1); activeNormal.set(0, 1, 0); }
/** * Creates a new entity for the block damage particle effect. * * If the terrain texture of the damaged block is available, the particles will have the block texture. Otherwise, * the default sprite (smoke) is used. * * @param family the {@link BlockFamily} of the damaged block * @param location the location of the damaged block */ private void createBlockParticleEffect(BlockFamily family, Vector3f location) { EntityBuilder builder = entityManager.newBuilder("core:defaultBlockParticles"); builder.getComponent(LocationComponent.class).setWorldPosition(location); Optional<Texture> terrainTexture = Assets.getTexture("engine:terrain"); if (terrainTexture.isPresent() && terrainTexture.get().isLoaded()) { final BlockAppearance blockAppearance = family.getArchetypeBlock().getPrimaryAppearance(); final float relativeTileSize = worldAtlas.getRelativeTileSize(); final float particleScale = 0.25f; final float spriteSize = relativeTileSize * particleScale; ParticleDataSpriteComponent spriteComponent = builder.getComponent(ParticleDataSpriteComponent.class); spriteComponent.texture = terrainTexture.get(); spriteComponent.textureSize.set(spriteSize, spriteSize); final List<Vector2f> offsets = computeOffsets(blockAppearance, particleScale); TextureOffsetGeneratorComponent textureOffsetGeneratorComponent = builder.getComponent(TextureOffsetGeneratorComponent.class); textureOffsetGeneratorComponent.validOffsets.addAll(offsets); } builder.build(); }
offset.set((float) grid.getGridOffset().x / size.x, (float) grid.getGridOffset().y / size.y);
temporaryParticleData.textureOffset.set( textureOffset[index2 + X_OFFSET], textureOffset[index2 + Y_OFFSET]