Search in sources :

Example 1 with WorldRenderingDecalsEvent

use of io.xol.chunkstories.api.events.rendering.WorldRenderingDecalsEvent in project chunkstories by Hugobros3.

the class DecalsRendererImplementation method renderDecals.

public void renderDecals(RenderingInterface renderingInterface) {
    for (DecalType decalType : decalsTypes.values()) {
        Texture2D diffuseTexture = decalType.getTexture();
        diffuseTexture.setTextureWrapping(false);
        diffuseTexture.setLinearFiltering(false);
        renderingInterface.bindAlbedoTexture(diffuseTexture);
        if (!decalType.verticesObject.isDataPresent())
            continue;
        renderingInterface.bindAttribute("vertexIn", decalType.verticesObject.asAttributeSource(VertexFormat.FLOAT, 3, 4 * (3 + 2), 0));
        renderingInterface.bindAttribute("texCoordIn", decalType.verticesObject.asAttributeSource(VertexFormat.FLOAT, 2, 4 * (3 + 2), 4 * 3));
        renderingInterface.draw(Primitive.TRIANGLE, 0, decalType.kount);
    }
    WorldRenderingDecalsEvent event = new WorldRenderingDecalsEvent(world, worldRenderer, renderingInterface, this);
    world.getGameContext().getPluginManager().fireEvent(event);
}
Also used : Texture2D(io.xol.chunkstories.api.rendering.textures.Texture2D) WorldRenderingDecalsEvent(io.xol.chunkstories.api.events.rendering.WorldRenderingDecalsEvent)

Aggregations

WorldRenderingDecalsEvent (io.xol.chunkstories.api.events.rendering.WorldRenderingDecalsEvent)1 Texture2D (io.xol.chunkstories.api.rendering.textures.Texture2D)1