Fixes #2532: Work around bug in Forge lighting pipeline and UnpackedBakedQuad.
This commit is contained in:
parent
53c32cc296
commit
c2b5a58dd2
|
@ -88,8 +88,23 @@ public class AutoRotatingModel implements IBakedModel
|
|||
builder.setQuadOrientation( null );
|
||||
|
||||
}
|
||||
BakedQuad q = builder.build();
|
||||
rotated.add( q );
|
||||
BakedQuad unpackedQuad = builder.build();
|
||||
|
||||
// Make a copy of it to resolve the vertex data and throw away the unpacked stuff
|
||||
// This also fixes a bug in Forge's UnpackedBakedQuad, which unpacks a byte-based normal like 0,0,-1
|
||||
// to 0,0,-0.99607843. We replace these normals with the proper 0,0,-1 when rotation, which
|
||||
// causes a bug in the AO lighter, if an unpacked quad pipes this value back to it.
|
||||
// Packing it back to the vanilla vertex format will fix this inconsistency because it converts
|
||||
// the normal back to a byte-based format, which then re-applies Forge's own bug when piping it
|
||||
// to the AO lighter, thus fixing our problem.
|
||||
BakedQuad packedQuad = new BakedQuad( unpackedQuad.getVertexData(),
|
||||
quad.getTintIndex(),
|
||||
unpackedQuad.getFace(),
|
||||
quad.getSprite(),
|
||||
quad.shouldApplyDiffuseLighting(),
|
||||
quad.getFormat()
|
||||
);
|
||||
rotated.add( packedQuad );
|
||||
}
|
||||
return rotated;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue