use of buildcraft.lib.client.model.json.VariablePartCuboidBase.VariableFaceData in project BuildCraft by BuildCraft.
the class JsonVariableFaceUV method evaluate.
public VariableFaceData evaluate(ITextureGetter spriteLookup) {
VariableFaceData data = new VariableFaceData();
TexturedFace face = spriteLookup.get(texture.evaluate());
data.sprite = face.sprite;
data.rotations = (int) textureRotation.evaluate();
data.uvs.minU = (float) (uv[0].evaluate() / 16.0);
data.uvs.minV = (float) (uv[1].evaluate() / 16.0);
data.uvs.maxU = (float) (uv[2].evaluate() / 16.0);
data.uvs.maxV = (float) (uv[3].evaluate() / 16.0);
data.uvs = data.uvs.inParent(face.faceData);
data.invertNormal = invert.evaluate();
data.bothSides = bothSides.evaluate();
return data;
}
use of buildcraft.lib.client.model.json.VariablePartCuboidBase.VariableFaceData in project BuildCraft by BuildCraft.
the class VariablePartTextureExpand method addQuads.
@Override
public void addQuads(List<MutableQuad> addTo, ITextureGetter spriteLookup) {
if (visible.evaluate()) {
float[] f = bakePosition(from);
float[] t = bakePosition(to);
float[] size = { t[0] - f[0], t[1] - f[1], t[2], f[2] };
boolean s = shade.evaluate();
int l = (int) (light.evaluate() & 15);
int rgba = RenderUtil.swapARGBforABGR((int) colour.evaluate());
VariableFaceData data = faceUv.evaluate(spriteLookup);
// TODO: Use the UV data! (only take part of the texture)
ItemLayerModel model = new ItemLayerModel(ImmutableList.of(new ResourceLocation(".")));
IBakedModel baked = model.bake(ModelRotation.X0_Y0, DefaultVertexFormats.ITEM, (loc) -> data.sprite);
List<BakedQuad> quads = baked.getQuads(null, null, 0);
for (BakedQuad q : quads) {
MutableQuad mut = new MutableQuad();
mut.fromBakedItem(q);
mut.translated(0, 0, -(7.5 / 16.0));
mut.scaled(1, 1, 16);
mut.rotate(EnumFacing.SOUTH, evaluateFace(this.face), 0.5f, 0.5f, 0.5f);
mut.scalef(size[0], size[1], size[2]);
mut.translated(f[0], f[1], f[2]);
mut.setCalculatedNormal();
mut.setShade(s);
mut.lighti(l, 0);
mut.colouri(rgba);
mut.setSprite(data.sprite);
addTo.add(mut);
}
}
}
Aggregations