use of io.xol.chunkstories.api.rendering.textures.Texture2D in project chunkstories-core by Hugobros3.
the class DefaultItemRenderer method renderItemInWorld.
@Override
public void renderItemInWorld(RenderingInterface renderingInterface, ItemPile pile, World world, Location location, Matrix4f handTransformation) {
Matrix4f handTransformation2 = new Matrix4f(handTransformation);
handTransformation2.rotate((float) (Math.PI / 2f), new Vector3f(0.0f, 0.0f, 1.0f));
handTransformation2.rotate((float) (Math.PI / 2f), new Vector3f(0.0f, 1.0f, 0.0f));
handTransformation2.translate(new Vector3f(-0.0f, 0.0f, 0.2f));
// handTransformation2.translate(new Vector3f(-0.00f, -0.15f, 0.0f));
handTransformation2.scale(new Vector3f(1.0f, 0.20f * pile.getItem().getDefinition().getSlotsWidth(), 0.20f * pile.getItem().getDefinition().getSlotsHeight()));
renderingInterface.setObjectMatrix(handTransformation2);
textures.getTexture(pile.getTextureName()).setLinearFiltering(false);
Texture2D texture = textures.getTexture(pile.getTextureName());
if (texture == null)
texture = textures.getTexture("items/icons/notex.png");
texture.setLinearFiltering(false);
renderingInterface.bindAlbedoTexture(texture);
draw3DPlane(renderingInterface);
}
use of io.xol.chunkstories.api.rendering.textures.Texture2D in project chunkstories-core by Hugobros3.
the class DefaultItemRenderer method renderItemInInventory.
@Override
public void renderItemInInventory(RenderingInterface renderingInterface, ItemPile pile, float screenPositionX, float screenPositionY, int scaling) {
int slotSize = 24 * 2;
// System.out.println(((ClientContent) this.itemType.store().parent()).textures());
if (textures == null)
return;
textures.getTexture(pile.getTextureName()).setLinearFiltering(false);
Texture2D texture = textures.getTexture(pile.getTextureName());
if (texture == null)
texture = textures.getTexture("items/icons/notex.png");
int width = slotSize * pile.getItem().getDefinition().getSlotsWidth();
int height = slotSize * pile.getItem().getDefinition().getSlotsHeight();
renderingInterface.getGuiRenderer().drawBoxWindowsSpaceWithSize(screenPositionX, screenPositionY, width, height, 0, 1, 1, 0, texture, true, true, null);
}
use of io.xol.chunkstories.api.rendering.textures.Texture2D in project chunkstories-core by Hugobros3.
the class BreakingBlockDecal method render.
public void render(RenderingInterface renderingInterface) {
Shader decalsShader = renderingInterface.useShader("decal_cracking");
renderingInterface.getCamera().setupShader(decalsShader);
renderingInterface.setCullingMode(CullingMode.DISABLED);
renderingInterface.setBlendMode(BlendMode.MIX);
renderingInterface.getRenderTargetManager().setDepthMask(false);
int phases = 6;
int phase = (int) (phases * miningProgress.progress);
decalsShader.setUniform1f("textureScale", 1f / 6);
decalsShader.setUniform1f("textureStart", 1f / 6 * phase);
// decalType.getTexture();
Texture2D diffuseTexture = renderingInterface.textures().getTexture("./textures/voxel_cracking.png");
diffuseTexture.setTextureWrapping(true);
diffuseTexture.setLinearFiltering(false);
renderingInterface.bindAlbedoTexture(diffuseTexture);
renderingInterface.bindAttribute("vertexIn", vertexBuffer.asAttributeSource(VertexFormat.FLOAT, 3, 4 * (3 + 2), 0));
renderingInterface.bindAttribute("texCoordIn", vertexBuffer.asAttributeSource(VertexFormat.FLOAT, 2, 4 * (3 + 2), 4 * 3));
renderingInterface.draw(Primitive.TRIANGLE, 0, size);
renderingInterface.getRenderTargetManager().setDepthMask(true);
}
use of io.xol.chunkstories.api.rendering.textures.Texture2D in project chunkstories-core by Hugobros3.
the class GBuffersOpaquePass method render.
@Override
public void render(RenderingInterface renderingInterface) {
if (fbo != null) {
GameWindow gameWindow = pipeline.getRenderingInterface().getWindow();
renderingInterface.getRenderTargetManager().setConfiguration(fbo);
renderingInterface.getRenderTargetManager().clearBoundRenderTargetAll();
// Set fixed-function parameters
renderingInterface.setDepthTestMode(DepthTestMode.LESS_OR_EQUAL);
renderingInterface.setBlendMode(BlendMode.DISABLED);
renderingInterface.setCullingMode(CullingMode.COUNTERCLOCKWISE);
Shader opaqueBlocksShader = renderingInterface.useShader("blocks_opaque");
Texture2D blocksAlbedoTexture = gameWindow.getClient().getContent().voxels().textures().getDiffuseAtlasTexture();
Texture2D blocksNormalTexture = gameWindow.getClient().getContent().voxels().textures().getNormalAtlasTexture();
Texture2D blocksMaterialTexture = gameWindow.getClient().getContent().voxels().textures().getMaterialAtlasTexture();
renderingInterface.bindAlbedoTexture(blocksAlbedoTexture);
renderingInterface.bindNormalTexture(blocksNormalTexture);
renderingInterface.bindMaterialTexture(blocksMaterialTexture);
renderingInterface.bindTexture2D("lightColors", renderingInterface.textures().getTexture("./textures/environement/light.png"));
renderingInterface.bindTexture2D("vegetationColorTexture", worldRenderer.getWorld().getGenerator().getEnvironment().getGrassTexture(renderingInterface));
// renderingInterface.bindTexture2D("vegetationColorTexture", getGrassTexture());
// Set texturing arguments
blocksAlbedoTexture.setTextureWrapping(false);
blocksAlbedoTexture.setLinearFiltering(false);
blocksAlbedoTexture.setMipMapping(false);
blocksAlbedoTexture.setMipmapLevelsRange(0, 4);
blocksNormalTexture.setTextureWrapping(false);
blocksNormalTexture.setLinearFiltering(false);
blocksNormalTexture.setMipMapping(false);
blocksNormalTexture.setMipmapLevelsRange(0, 4);
blocksMaterialTexture.setTextureWrapping(false);
blocksMaterialTexture.setLinearFiltering(false);
blocksMaterialTexture.setMipMapping(false);
blocksMaterialTexture.setMipmapLevelsRange(0, 4);
// World stuff
opaqueBlocksShader.setUniform1f("mapSize", world.getSizeInChunks() * 32);
opaqueBlocksShader.setUniform1f("overcastFactor", world.getWeather());
opaqueBlocksShader.setUniform1f("wetness", world.getGenerator().getEnvironment().getWorldWetness(renderingInterface.getCamera().getCameraPosition()));
opaqueBlocksShader.setUniform1f("time", worldRenderer.getAnimationTimer());
opaqueBlocksShader.setUniform1f("animationTimer", worldRenderer.getAnimationTimer());
opaqueBlocksShader.setUniform2f("screenSize", gameWindow.getWidth(), gameWindow.getHeight());
renderingInterface.getCamera().setupShader(opaqueBlocksShader);
renderingInterface.setObjectMatrix(new Matrix4f());
worldRenderer.getChunksRenderer().renderChunks(renderingInterface);
worldRenderer.getChunksRenderer().renderChunksExtras(renderingInterface);
worldRenderer.getEntitiesRenderer().renderEntities(renderingInterface);
worldRenderer.getParticlesRenderer().renderParticles(renderingInterface);
}
}
use of io.xol.chunkstories.api.rendering.textures.Texture2D in project chunkstories-api by Hugobros3.
the class BaseButton method render.
@Override
public void render(RenderingInterface renderer) {
float width = getWidth();
String localizedText = layer.getGameWindow().getClient().getContent().localization().localize(text);
Texture2D buttonTexture = renderer.textures().getTexture("./textures/gui/scalableButton2.png");
if (isFocused() || isMouseOver())
buttonTexture = renderer.textures().getTexture("./textures/gui/scalableButtonOver2.png");
buttonTexture.setLinearFiltering(false);
renderer.getGuiRenderer().drawCorneredBoxTiled(xPosition, yPosition, width, getHeight(), 4 * scale(), buttonTexture, 32, scale());
// new Vector4f(76/255f, 76/255f, 76/255f, 1));
renderer.getFontRenderer().drawString(font, xPosition + 4 * scale(), yPosition, localizedText, fontScaler * scale(), new Vector4f(0, 0, 0, 1));
}
Aggregations