1
0
mirror of https://github.com/chylex/Hardcore-Ender-Expansion-2.git synced 2025-04-11 03:15:44 +02:00

Add GL.color that takes a Vec3d & update existing code

This commit is contained in:
chylex 2020-05-22 13:51:32 +02:00
parent f20f7eb7e3
commit 0214bfe15f
4 changed files with 7 additions and 18 deletions
src/main/java/chylex/hee/client/render

View File

@ -11,9 +11,6 @@ import chylex.hee.system.migration.Facing.WEST
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.util.color.IntColor.Companion.RGB
import chylex.hee.system.util.component1
import chylex.hee.system.util.component2
import chylex.hee.system.util.component3
import chylex.hee.system.util.facades.Resource
import chylex.hee.system.util.floorToInt
import chylex.hee.system.util.getState
@ -90,9 +87,7 @@ object RenderTileIgneousPlate : TileEntityRenderer<TileEntityIgneousPlate>(){
if (destroyStage < 0){
ModelBlockIgneousPlate.renderOuterBox()
val (r, g, b) = getInnerBoxColor(tile.clientCombinedHeat)
GL.color(r.toFloat(), g.toFloat(), b.toFloat())
GL.color(getInnerBoxColor(tile.clientCombinedHeat))
}
GL.disableLighting()

View File

@ -34,11 +34,6 @@ abstract class SkyCubeBase : IRenderHandler{
@Sided(Side.CLIENT)
override fun render(ticks: Int, partialTicks: Float, world: ClientWorld, mc: Minecraft){
val dist = distance.coerceAtMost(18.5 * mc.gameSettings.renderDistanceChunks)
val col = color
val red = col.x.toFloat()
val green = col.y.toFloat()
val blue = col.z.toFloat()
GL.enableBlend()
GL.blendFunc(SF_SRC_ALPHA, DF_ONE_MINUS_SRC_ALPHA, SF_ONE, DF_ZERO)
@ -47,7 +42,7 @@ abstract class SkyCubeBase : IRenderHandler{
GL.disableFog()
RenderHelper.disableStandardItemLighting()
GL.color(red, green, blue, alpha * EnvironmentRenderer.currentSkyAlpha)
GL.color(color, alpha * EnvironmentRenderer.currentSkyAlpha)
MC.textureManager.bindTexture(texture)
for(side in 0..5){

View File

@ -40,11 +40,6 @@ abstract class SunBase : IRenderHandler{
override fun render(ticks: Int, partialTicks: Float, world: ClientWorld, mc: Minecraft){
val width = size
val dist = distance
val col = color
val red = col.x.toFloat()
val green = col.y.toFloat()
val blue = col.z.toFloat()
GL.enableBlend()
GL.blendFunc(SF_SRC_ALPHA, DF_ONE, SF_ONE, DF_ZERO)
@ -55,7 +50,7 @@ abstract class SunBase : IRenderHandler{
setRotation(world, partialTicks)
GL.color(red, green, blue, alpha)
GL.color(color, alpha)
MC.textureManager.bindTexture(texture)
TESSELLATOR.draw(GL_QUADS, DefaultVertexFormats.POSITION_TEX){

View File

@ -7,6 +7,7 @@ import com.mojang.blaze3d.platform.GlStateManager.DestFactor
import com.mojang.blaze3d.platform.GlStateManager.FogMode
import com.mojang.blaze3d.platform.GlStateManager.SourceFactor
import com.mojang.blaze3d.platform.GlStateManager.TexGen
import net.minecraft.util.math.Vec3d
import java.nio.FloatBuffer
typealias GLSM = GlStateManager
@ -78,6 +79,9 @@ object GL{
fun color(red: Float, green: Float, blue: Float) = GLSM.color3f(red, green, blue)
fun color(red: Float, green: Float, blue: Float, alpha: Float) = GLSM.color4f(red, green, blue, alpha)
fun color(color: Vec3d) = GLSM.color3f(color.x.toFloat(), color.y.toFloat(), color.z.toFloat())
fun color(color: Vec3d, alpha: Float) = GLSM.color4f(color.x.toFloat(), color.y.toFloat(), color.z.toFloat(), alpha)
// Texture
fun enableTexture() = GLSM.enableTexture()