Fix dark spots in fullbright quad rendering.

Fix multi-layer model not declaring dependency on the particle texture.
Fix mistake in 2c054fca which I didn't intend to push when I did.
This commit is contained in:
David Quintana 2020-01-13 23:20:46 +01:00
parent c1840abb0a
commit 983a47a7d6
4 changed files with 17 additions and 12 deletions

View file

@ -9,3 +9,12 @@
vector3f1.func_195901_a(0.0F, 1.0F);
if (f2 > 0.0F) {
float f10 = Math.max(vector3f1.func_195899_a(), Math.max(vector3f1.func_195900_b(), vector3f1.func_195902_c()));
@@ -169,7 +171,7 @@
}
public static int func_228450_a_(int p_228450_0_) {
- return p_228450_0_ >> 4 & '\uffff';
+ return (p_228450_0_ & 0xFFFF) >> 4; // Forge: Fix fullbright quads showing dark artifacts. Reported as MC-169806
}
public static int func_228454_b_(int p_228454_0_) {

View file

@ -70,6 +70,7 @@ public final class MultiLayerModel implements IModelGeometry<MultiLayerModel>
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
{
Set<Material> materials = Sets.newHashSet();
materials.add(owner.resolveTexture("particle"));
for (IUnbakedModel m : models.values())
materials.addAll(m.func_225614_a_(modelGetter, missingTextureErrors));
return materials;

View file

@ -366,16 +366,12 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
builder.setQuadTint(tintIndex);
boolean diffuse = true;
Vec2f uv2 = new Vec2f(0,0);
Vec2f uv2 = new Vec2f(0, 0);
if (ambientToFullbright)
{
int fakeLight = (int) ((ambientColor.getX() + ambientColor.getY() + ambientColor.getZ()) * 15 / 3.0f);
uv2 = new Vec2f((fakeLight << 4) / 32767.0f, (fakeLight << 4) / 32767.0f);
//uv2 = new Vec2f(0, (fakeLight << 4) / 32767.0f);
//uv2 = new Vec2f((fakeLight << 4) / 32767.0f, 0);
builder.setApplyDiffuseLighting(diffuse = (fakeLight > 0));
builder.setApplyDiffuseLighting(fakeLight == 0);
}
boolean hasTransform = !transform.isIdentity();
@ -402,7 +398,6 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
color.getY() * colorTint.getY(),
color.getZ() * colorTint.getZ(),
color.getW() * colorTint.getW());
if (!diffuse) normal = new Vector3f(0,0,0);
putVertexData(builder, position, texCoord, normal, tintedColor, uv2, texture);
pos[i] = position;
norm[i] = normal;

View file

@ -1,6 +1,6 @@
# Rhino
newmtl New material 001 (1)
Ka 0.5 0.5 0.5
Ka 1 1 1
Kd 0.4588 0.3333 0.1882
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
@ -9,7 +9,7 @@ Ns 0
map_Kd #qr
newmtl New material 001
Ka 0.5 0.5 0.5
Ka 1 1 1
Kd 0.6745 0.5216 0.3412
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
@ -18,7 +18,7 @@ Ns 0
map_Kd #qr
newmtl Default
Ka 0.5 0.5 0.5
Ka 1 1 1
Kd 1.0000 1.0000 1.0000
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
@ -27,7 +27,7 @@ Ns 0
map_Kd #qr
newmtl New material 002
Ka 0.5 0.5 0.5
Ka 1 1 1
Kd 0.4118 0.4118 0.4118
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
@ -36,7 +36,7 @@ Ns 0
map_Kd #qr
newmtl New material 003
Ka 0.5 0.5 0.5
Ka 1 1 1
Kd 0.1490 0.1490 0.1490
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000