minecraft-source/src/com/mojang/blaze3d/platform/Lighting.java

48 lines
1.8 KiB
Java
Raw Normal View History

2020-07-22 06:23:34 +01:00
package com.mojang.blaze3d.platform;
2020-07-22 06:32:50 +01:00
import net.minecraft.Util;
2020-07-22 06:25:47 +01:00
import com.mojang.math.Matrix4f;
import com.mojang.blaze3d.systems.RenderSystem;
2020-07-22 06:32:50 +01:00
import com.mojang.math.Vector3f;
2020-07-22 06:23:34 +01:00
public class Lighting {
2020-07-22 06:32:50 +01:00
private static final Vector3f DIFFUSE_LIGHT_0;
private static final Vector3f DIFFUSE_LIGHT_1;
private static final Vector3f NETHER_DIFFUSE_LIGHT_0;
private static final Vector3f NETHER_DIFFUSE_LIGHT_1;
2020-07-22 06:25:47 +01:00
public static void turnBackOn() {
RenderSystem.enableLighting();
RenderSystem.enableColorMaterial();
RenderSystem.colorMaterial(1032, 5634);
2020-07-22 06:23:34 +01:00
}
public static void turnOff() {
2020-07-22 06:25:47 +01:00
RenderSystem.disableLighting();
RenderSystem.disableColorMaterial();
2020-07-22 06:23:34 +01:00
}
2020-07-22 06:32:50 +01:00
public static void setupNetherLevel(final Matrix4f b) {
RenderSystem.setupLevelDiffuseLighting(Lighting.NETHER_DIFFUSE_LIGHT_0, Lighting.NETHER_DIFFUSE_LIGHT_1, b);
}
2020-07-22 06:25:47 +01:00
public static void setupLevel(final Matrix4f b) {
2020-07-22 06:32:50 +01:00
RenderSystem.setupLevelDiffuseLighting(Lighting.DIFFUSE_LIGHT_0, Lighting.DIFFUSE_LIGHT_1, b);
2020-07-22 06:23:34 +01:00
}
2020-07-22 06:25:47 +01:00
public static void setupForFlatItems() {
2020-07-22 06:32:50 +01:00
RenderSystem.setupGuiFlatDiffuseLighting(Lighting.DIFFUSE_LIGHT_0, Lighting.DIFFUSE_LIGHT_1);
2020-07-22 06:23:34 +01:00
}
2020-07-22 06:25:47 +01:00
public static void setupFor3DItems() {
2020-07-22 06:32:50 +01:00
RenderSystem.setupGui3DDiffuseLighting(Lighting.DIFFUSE_LIGHT_0, Lighting.DIFFUSE_LIGHT_1);
}
static {
DIFFUSE_LIGHT_0 = Util.<Vector3f>make(new Vector3f(0.2f, 1.0f, -0.7f), Vector3f::normalize);
DIFFUSE_LIGHT_1 = Util.<Vector3f>make(new Vector3f(-0.2f, 1.0f, 0.7f), Vector3f::normalize);
NETHER_DIFFUSE_LIGHT_0 = Util.<Vector3f>make(new Vector3f(0.2f, 1.0f, -0.7f), Vector3f::normalize);
NETHER_DIFFUSE_LIGHT_1 = Util.<Vector3f>make(new Vector3f(-0.2f, -1.0f, 0.7f), Vector3f::normalize);
2020-07-22 06:23:34 +01:00
}
}