-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6435914
commit 7d8e9b6
Showing
2 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/main/java/mcp/mobius/betterbarrels/client/render/SurfaceItemRenderHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package mcp.mobius.betterbarrels.client.render; | ||
|
||
import java.nio.FloatBuffer; | ||
|
||
import net.minecraft.client.renderer.GLAllocation; | ||
|
||
import org.lwjgl.opengl.GL11; | ||
|
||
/** | ||
* RenderHelper but no directional light setting | ||
*/ | ||
public class SurfaceItemRenderHelper { | ||
|
||
private static FloatBuffer colorBuffer = GLAllocation.createDirectFloatBuffer(16); | ||
private static FloatBuffer cachedLightSetting = GLAllocation.createDirectFloatBuffer(16); | ||
|
||
public static void disableStandardItemLighting() { | ||
GL11.glDisable(GL11.GL_COLOR_MATERIAL); | ||
GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, cachedLightSetting); | ||
} | ||
|
||
public static void enableStandardItemLighting() { | ||
GL11.glEnable(GL11.GL_COLOR_MATERIAL); | ||
GL11.glColorMaterial(GL11.GL_FRONT_AND_BACK, GL11.GL_AMBIENT_AND_DIFFUSE); | ||
float f = 0.4F; | ||
GL11.glShadeModel(GL11.GL_FLAT); | ||
GL11.glGetFloat(GL11.GL_LIGHT_MODEL_AMBIENT, cachedLightSetting); | ||
GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, setColorBuffer(f, f, f, 1.0F)); | ||
} | ||
|
||
private static FloatBuffer setColorBuffer(float p_74521_0_, float p_74521_1_, float p_74521_2_, float p_74521_3_) { | ||
colorBuffer.clear(); | ||
colorBuffer.put(p_74521_0_).put(p_74521_1_).put(p_74521_2_).put(p_74521_3_); | ||
colorBuffer.flip(); | ||
return colorBuffer; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters