Fixed sprite not being passed to the quad builder for custom models.
This commit is contained in:
parent
7795570421
commit
ad03581fbe
5 changed files with 14 additions and 6 deletions
|
@ -224,14 +224,14 @@ public final class ItemLayerModel implements IRetexturableModel
|
|||
}
|
||||
}
|
||||
// front
|
||||
builder.add(buildQuad(format, transform, EnumFacing.NORTH, tint,
|
||||
builder.add(buildQuad(format, transform, EnumFacing.NORTH, sprite, tint,
|
||||
0, 0, 7.5f / 16f, sprite.getMinU(), sprite.getMaxV(),
|
||||
0, 1, 7.5f / 16f, sprite.getMinU(), sprite.getMinV(),
|
||||
1, 1, 7.5f / 16f, sprite.getMaxU(), sprite.getMinV(),
|
||||
1, 0, 7.5f / 16f, sprite.getMaxU(), sprite.getMaxV()
|
||||
));
|
||||
// back
|
||||
builder.add(buildQuad(format, transform, EnumFacing.SOUTH, tint,
|
||||
builder.add(buildQuad(format, transform, EnumFacing.SOUTH, sprite, tint,
|
||||
0, 0, 8.5f / 16f, sprite.getMinU(), sprite.getMaxV(),
|
||||
1, 0, 8.5f / 16f, sprite.getMaxU(), sprite.getMaxV(),
|
||||
1, 1, 8.5f / 16f, sprite.getMaxU(), sprite.getMinV(),
|
||||
|
@ -329,7 +329,7 @@ public final class ItemLayerModel implements IRetexturableModel
|
|||
throw new IllegalArgumentException("can't handle z-oriented side");
|
||||
}
|
||||
return buildQuad(
|
||||
format, transform, side.getOpposite(), tint, // getOpposite is related either to the swapping of V direction, or something else
|
||||
format, transform, side.getOpposite(), sprite, tint, // getOpposite is related either to the swapping of V direction, or something else
|
||||
x0, y0, z1, sprite.getInterpolatedU(u0), sprite.getInterpolatedV(v0),
|
||||
x1, y1, z1, sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v1),
|
||||
x1, y1, z2, sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v1),
|
||||
|
@ -338,7 +338,7 @@ public final class ItemLayerModel implements IRetexturableModel
|
|||
}
|
||||
|
||||
private static final BakedQuad buildQuad(
|
||||
VertexFormat format, Optional<TRSRTransformation> transform, EnumFacing side, int tint,
|
||||
VertexFormat format, Optional<TRSRTransformation> transform, EnumFacing side, TextureAtlasSprite sprite, int tint,
|
||||
float x0, float y0, float z0, float u0, float v0,
|
||||
float x1, float y1, float z1, float u1, float v1,
|
||||
float x2, float y2, float z2, float u2, float v2,
|
||||
|
@ -347,6 +347,7 @@ public final class ItemLayerModel implements IRetexturableModel
|
|||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
|
||||
builder.setQuadTint(tint);
|
||||
builder.setQuadOrientation(side);
|
||||
builder.setTexture(sprite);
|
||||
putVertex(builder, format, transform, side, x0, y0, z0, u0, v0);
|
||||
putVertex(builder, format, transform, side, x1, y1, z1, u1, v1);
|
||||
putVertex(builder, format, transform, side, x2, y2, z2, u2, v2);
|
||||
|
|
|
@ -195,10 +195,10 @@ public final class ItemTextureQuadConverter
|
|||
y1 = 1f - y2;
|
||||
y2 = 1f - tmp;
|
||||
|
||||
return putQuad(format, transform, facing, color, x1, y1, x2, y2, z, u1, v1, u2, v2);
|
||||
return putQuad(format, transform, facing, sprite, color, x1, y1, x2, y2, z, u1, v1, u2, v2);
|
||||
}
|
||||
|
||||
private static UnpackedBakedQuad putQuad(VertexFormat format, TRSRTransformation transform, EnumFacing side, int color,
|
||||
private static UnpackedBakedQuad putQuad(VertexFormat format, TRSRTransformation transform, EnumFacing side, TextureAtlasSprite sprite, int color,
|
||||
float x1, float y1, float x2, float y2, float z,
|
||||
float u1, float v1, float u2, float v2)
|
||||
{
|
||||
|
@ -206,6 +206,7 @@ public final class ItemTextureQuadConverter
|
|||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
|
||||
builder.setQuadTint(-1);
|
||||
builder.setQuadOrientation(side);
|
||||
builder.setTexture(sprite);
|
||||
|
||||
if (side == EnumFacing.NORTH)
|
||||
{
|
||||
|
|
|
@ -209,6 +209,7 @@ public final class ModelFluid implements IModelCustomData
|
|||
EnumFacing side = gas ? EnumFacing.DOWN : EnumFacing.UP;
|
||||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
|
||||
builder.setQuadOrientation(side);
|
||||
builder.setTexture(topSprite);
|
||||
for(int i = gas ? 3 : 0; i != (gas ? -1 : 4); i+= (gas ? -1 : 1))
|
||||
{
|
||||
putVertex(
|
||||
|
@ -224,6 +225,7 @@ public final class ModelFluid implements IModelCustomData
|
|||
side = side.getOpposite();
|
||||
builder = new UnpackedBakedQuad.Builder(format);
|
||||
builder.setQuadOrientation(side);
|
||||
builder.setTexture(still);
|
||||
for(int i = gas ? 3 : 0; i != (gas ? -1 : 4); i+= (gas ? -1 : 1))
|
||||
{
|
||||
putVertex(
|
||||
|
@ -245,6 +247,7 @@ public final class ModelFluid implements IModelCustomData
|
|||
{
|
||||
builder = new UnpackedBakedQuad.Builder(format);
|
||||
builder.setQuadOrientation(side);
|
||||
builder.setTexture(flowing);
|
||||
for(int j = 0; j < 4; j++)
|
||||
{
|
||||
int l = (k * 3) + (1 - 2 * k) * j;
|
||||
|
@ -266,6 +269,7 @@ public final class ModelFluid implements IModelCustomData
|
|||
// 1 quad for inventory
|
||||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
|
||||
builder.setQuadOrientation(EnumFacing.UP);
|
||||
builder.setTexture(still);
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
putVertex(
|
||||
|
|
|
@ -723,6 +723,7 @@ public final class B3DLoader implements ICustomModelLoader
|
|||
if(textures == null || textures.isEmpty()) sprite = this.textures.get("missingno");
|
||||
else if(textures.get(0) == B3DModel.Texture.White) sprite = ModelLoader.White.instance;
|
||||
else sprite = this.textures.get(textures.get(0).getPath());
|
||||
quadBuilder.setTexture(sprite);
|
||||
putVertexData(quadBuilder, f.getV1(), f.getNormal(), sprite);
|
||||
putVertexData(quadBuilder, f.getV2(), f.getNormal(), sprite);
|
||||
putVertexData(quadBuilder, f.getV3(), f.getNormal(), sprite);
|
||||
|
|
|
@ -1400,6 +1400,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
|
|||
} else sprite = this.textures.get(f.getMaterialName());
|
||||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
|
||||
builder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z));
|
||||
builder.setTexture(sprite);
|
||||
Normal faceNormal = f.getNormal();
|
||||
putVertexData(builder, f.verts[0], faceNormal, TextureCoordinate.getDefaultUVs()[0], sprite);
|
||||
putVertexData(builder, f.verts[1], faceNormal, TextureCoordinate.getDefaultUVs()[1], sprite);
|
||||
|
|
Loading…
Reference in a new issue