mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
Fixed quads that don't need diffuse lighting getting it anyway.
This commit is contained in:
1 parent
2c55969ff3
commit
a81dfbc4ef
12 files changed
+73
-17
No files matched your search
@@ -17,6 +17,7 @@ public interface IVertexConsumer
|
||||
|
||||
void setQuadTint(int tint);
|
||||
void setQuadOrientation(EnumFacing orientation);
|
||||
void setApplyDiffuseLighting(boolean diffuse);
|
||||
|
||||
void put(int element, float... data);
|
||||
}
|
||||
@@ -88,6 +88,7 @@ public class LightUtil
|
||||
{
|
||||
consumer.setQuadTint(quad.getTintIndex());
|
||||
}
|
||||
consumer.setApplyDiffuseLighting(quad.shouldApplyDiffuseLighting());
|
||||
//int[] eMap = mapFormats(consumer.getVertexFormat(), DefaultVertexFormats.ITEM);
|
||||
float[] data = new float[4];
|
||||
VertexFormat formatFrom = consumer.getVertexFormat();
|
||||
|
||||
@@ -13,9 +13,9 @@ public class UnpackedBakedQuad extends BakedQuad
|
||||
protected final VertexFormat format;
|
||||
protected boolean packed = false;
|
||||
|
||||
public UnpackedBakedQuad(float[][][] unpackedData, int tint, EnumFacing orientation, TextureAtlasSprite texture, VertexFormat format)
|
||||
public UnpackedBakedQuad(float[][][] unpackedData, int tint, EnumFacing orientation, TextureAtlasSprite texture, boolean applyDiffuseLighting, VertexFormat format)
|
||||
{
|
||||
super(new int[format.getNextOffset() /* / 4 * 4 */], tint, orientation, texture, format);
|
||||
super(new int[format.getNextOffset() /* / 4 * 4 */], tint, orientation, texture, applyDiffuseLighting, format);
|
||||
this.unpackedData = unpackedData;
|
||||
this.format = format;
|
||||
}
|
||||
@@ -70,6 +70,7 @@ public class UnpackedBakedQuad extends BakedQuad
|
||||
private int tint = -1;
|
||||
private EnumFacing orientation;
|
||||
private TextureAtlasSprite texture;
|
||||
private boolean applyDiffuseLighting;
|
||||
|
||||
private int vertices = 0;
|
||||
private int elements = 0;
|
||||
@@ -101,6 +102,11 @@ public class UnpackedBakedQuad extends BakedQuad
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
public void setApplyDiffuseLighting(boolean diffuse)
|
||||
{
|
||||
this.applyDiffuseLighting = diffuse;
|
||||
}
|
||||
|
||||
public void put(int element, float... data)
|
||||
{
|
||||
for(int i = 0; i < 4; i++)
|
||||
@@ -132,7 +138,7 @@ public class UnpackedBakedQuad extends BakedQuad
|
||||
{
|
||||
throw new IllegalStateException("not enough data");
|
||||
}
|
||||
return new UnpackedBakedQuad(unpackedData, tint, orientation, texture, format);
|
||||
return new UnpackedBakedQuad(unpackedData, tint, orientation, texture, applyDiffuseLighting, format);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,4 +57,5 @@ public class VertexBufferConsumer implements IVertexConsumer
|
||||
|
||||
public void setQuadTint(int tint) {}
|
||||
public void setQuadOrientation(EnumFacing orientation) {}
|
||||
public void setApplyDiffuseLighting(boolean diffuse) {}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer
|
||||
{
|
||||
protected final BlockInfo blockInfo;
|
||||
private int tint = -1;
|
||||
private boolean diffuse = true;
|
||||
|
||||
protected int posIndex = -1;
|
||||
protected int normalIndex = -1;
|
||||
@@ -148,10 +149,13 @@ public class VertexLighterFlat extends QuadGatheringTransformer
|
||||
if(skyLight > lightmap[v][1]) lightmap[v][1] = skyLight;
|
||||
}
|
||||
updateColor(normal[v], color[v], x, y, z, tint, multiplier);
|
||||
float diffuse = LightUtil.diffuseLight(normal[v][0], normal[v][1], normal[v][2]);
|
||||
for(int i = 0; i < 3; i++)
|
||||
if(diffuse)
|
||||
{
|
||||
color[v][i] *= diffuse;
|
||||
float d = LightUtil.diffuseLight(normal[v][0], normal[v][1], normal[v][2]);
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
color[v][i] *= d;
|
||||
}
|
||||
}
|
||||
if(EntityRenderer.anaglyphEnable)
|
||||
{
|
||||
@@ -239,6 +243,10 @@ public class VertexLighterFlat extends QuadGatheringTransformer
|
||||
}
|
||||
public void setQuadOrientation(EnumFacing orientation) {}
|
||||
public void setQuadCulled() {}
|
||||
public void setApplyDiffuseLighting(boolean diffuse)
|
||||
{
|
||||
this.diffuse = diffuse;
|
||||
}
|
||||
|
||||
public void setWorld(IBlockAccess world)
|
||||
{
|
||||
|
||||
@@ -27,6 +27,11 @@ public class VertexTransformer implements IVertexConsumer
|
||||
parent.setQuadOrientation(orientation);
|
||||
}
|
||||
|
||||
public void setApplyDiffuseLighting(boolean diffuse)
|
||||
{
|
||||
parent.setApplyDiffuseLighting(diffuse);
|
||||
}
|
||||
|
||||
public void put(int element, float... data)
|
||||
{
|
||||
parent.put(element, data);
|
||||
|
||||
Reference in new issue
Block a user