Search in sources :

Example 1 with RenderingInterface

use of io.xol.chunkstories.api.rendering.RenderingInterface in project chunkstories-core by Hugobros3.

the class ParticleFireLight method getRenderer.

@Override
public ParticleTypeRenderer getRenderer(ParticlesRenderer particlesRenderer) {
    return new ParticleTypeRenderer(particlesRenderer) {

        @Override
        public void beginRenderingForType(RenderingInterface renderingContext) {
            super.beginRenderingForType(renderingContext);
            renderingContext.setBlendMode(BlendMode.PREMULT_ALPHA);
            renderingContext.getRenderTargetManager().setDepthMask(false);
            // renderingContext.setDepthTestMode(DepthTestMode.DISABLED);
            // System.out.println("k");
            String temp_scale = "./textures/particles/fire_temp_scale_expl.png";
            renderingContext.bindTexture2D("colorTempSampler", particlesRenderer.getContent().textures().getTexture(temp_scale));
            particlesRenderer.getContent().textures().getTexture(temp_scale).setLinearFiltering(true);
            particlesRenderer.getContent().textures().getTexture(temp_scale).setTextureWrapping(false);
            getAlbedoTexture().setMipMapping(true);
            getAlbedoTexture().setLinearFiltering(true);
            getAlbedoTexture().setTextureWrapping(false);
        }

        @Override
        public void forEach_Rendering(RenderingInterface renderingContext, ParticleData data) {
            ParticleFireData b = (ParticleFireData) data;
            renderingContext.getLightsRenderer().queueLight(new Light(new Vector3f(1.0f, 252f / 255f, 1 / 255f), new Vector3f((float) data.x(), (float) data.y(), (float) data.z()), 25f * Math2.clamp((float) (double) b.vel.x() * 5000, 0.0, 1.0)));
            // System.out.println("k");
            /*data.setY((float) (data.y() + (Math.random() - 0.1) * 0.0015));
				data.setX((float) (data.x() + (Math.random() - 0.5) * 0.0015));
				data.setZ((float) (data.z() + (Math.random() - 0.5) * 0.0015));
				*/
            ((ParticleFireData) data).timer--;
            if (((ParticleFireData) data).timer < 0)
                data.destroy();
        }

        @Override
        public void destroy() {
        }
    };
}
Also used : Light(io.xol.chunkstories.api.rendering.lightning.Light) Vector3f(org.joml.Vector3f) RenderingInterface(io.xol.chunkstories.api.rendering.RenderingInterface)

Example 2 with RenderingInterface

use of io.xol.chunkstories.api.rendering.RenderingInterface in project chunkstories-core by Hugobros3.

the class ParticleLightningStrike method getRenderer.

@Override
public ParticleTypeRenderer getRenderer(ParticlesRenderer particlesRenderer) {
    return new ParticleTypeRenderer(particlesRenderer) {

        @Override
        public void forEach_Rendering(RenderingInterface renderingContext, ParticleData data) {
            Content content = ParticleLightningStrike.this.getType().store().parent();
            if (content instanceof ClientContent) {
                ClientContent clientContent = (ClientContent) content;
                LocalPlayer player = clientContent.getContext().getPlayer();
                Entity entity = player.getControlledEntity();
                if (entity != null) {
                    Location loc = entity.getLocation();
                    data.set((float) (double) data.x(), (float) (double) loc.y() + 1024, (float) (double) data.z());
                }
            }
            renderingContext.getLightsRenderer().queueLight(new Light(new Vector3f(226 / 255f, 255 / 255f, 226 / 255f).mul((float) (1f + Math.random())), new Vector3f((float) data.x(), (float) data.y(), (float) data.z()), 102004f + (float) Math.random() * 5f));
        }

        @Override
        public void destroy() {
        }
    };
}
Also used : Entity(io.xol.chunkstories.api.entity.Entity) ClientContent(io.xol.chunkstories.api.client.ClientContent) Content(io.xol.chunkstories.api.content.Content) LocalPlayer(io.xol.chunkstories.api.client.LocalPlayer) Light(io.xol.chunkstories.api.rendering.lightning.Light) Vector3f(org.joml.Vector3f) RenderingInterface(io.xol.chunkstories.api.rendering.RenderingInterface) ClientContent(io.xol.chunkstories.api.client.ClientContent) Location(io.xol.chunkstories.api.Location)

Example 3 with RenderingInterface

use of io.xol.chunkstories.api.rendering.RenderingInterface in project chunkstories-core by Hugobros3.

the class ParticleLight method getRenderer.

@Override
public ParticleTypeRenderer getRenderer(ParticlesRenderer particlesRenderer) {
    return new ParticleTypeRenderer(particlesRenderer) {

        @Override
        public void forEach_Rendering(RenderingInterface renderingContext, ParticleData data2) {
            ParticleLightData data = (ParticleLightData) data2;
            renderingContext.getLightsRenderer().queueLight(new Light(new Vector3f(1.0f, 181f / 255f, 79 / 255f), new Vector3f((float) data.c.x(), (float) data.c.y(), (float) data.c.z()), 15f + (float) Math.random() * 5f));
        }

        @Override
        public void destroy() {
        }
    };
}
Also used : Light(io.xol.chunkstories.api.rendering.lightning.Light) Vector3f(org.joml.Vector3f) RenderingInterface(io.xol.chunkstories.api.rendering.RenderingInterface)

Aggregations

RenderingInterface (io.xol.chunkstories.api.rendering.RenderingInterface)3 Light (io.xol.chunkstories.api.rendering.lightning.Light)3 Vector3f (org.joml.Vector3f)3 Location (io.xol.chunkstories.api.Location)1 ClientContent (io.xol.chunkstories.api.client.ClientContent)1 LocalPlayer (io.xol.chunkstories.api.client.LocalPlayer)1 Content (io.xol.chunkstories.api.content.Content)1 Entity (io.xol.chunkstories.api.entity.Entity)1