use of net.silentchaos512.gear.client.model.BakedPerspectiveModel in project Silent-Gear by SilentChaos512.
the class FragmentModel method bake.
@SuppressWarnings("MethodWithTooManyParameters")
public BakedModel bake(List<MaterialLayer> layers, IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, ModelState modelTransform, FragmentModelOverrideList fragmentModelOverrideList, ResourceLocation modelLocation) {
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
Transformation rotation = modelTransform.getRotation();
ImmutableMap<ItemTransforms.TransformType, Transformation> transforms = PerspectiveMapWrapper.getTransforms(modelTransform);
for (int i = 0; i < layers.size(); i++) {
MaterialLayer layer = layers.get(i);
TextureAtlasSprite texture = spriteGetter.apply(new Material(InventoryMenu.BLOCK_ATLAS, layer.getTexture(GearType.FRAGMENT, 0)));
builder.addAll(getQuadsForSprite(i, texture, rotation, layer.getColor()));
}
// No layers?
if (layers.isEmpty()) {
if (Const.Materials.EXAMPLE.isPresent()) {
buildFakeModel(spriteGetter, builder, rotation, Const.Materials.EXAMPLE.get());
} else {
// Shouldn't happen, but...
SilentGear.LOGGER.error("Example material is missing?");
TextureAtlasSprite texture = spriteGetter.apply(new Material(InventoryMenu.BLOCK_ATLAS, SilentGear.getId("item/error")));
builder.addAll(getQuadsForSprite(0, texture, rotation, 0xFFFFFF));
}
}
TextureAtlasSprite particle = spriteGetter.apply(owner.resolveTexture("particle"));
return new BakedPerspectiveModel(builder.build(), particle, transforms, overrideList, rotation.isIdentity(), owner.isSideLit(), cameraTransforms);
}
use of net.silentchaos512.gear.client.model.BakedPerspectiveModel in project Silent-Gear by SilentChaos512.
the class CompoundPartModel method bake.
@SuppressWarnings("MethodWithTooManyParameters")
public BakedModel bake(List<MaterialLayer> layers, String transformVariant, IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, ModelState modelTransform, ItemOverrides overrideList, ResourceLocation modelLocation) {
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
Transformation rotation = modelTransform.getRotation();
ImmutableMap<ItemTransforms.TransformType, Transformation> transforms = PerspectiveMapWrapper.getTransforms(modelTransform);
for (int i = 0; i < layers.size(); i++) {
MaterialLayer layer = layers.get(i);
TextureAtlasSprite texture = spriteGetter.apply(new Material(InventoryMenu.BLOCK_ATLAS, layer.getTexture(this.texturePath, 0)));
builder.addAll(getQuadsForSprite(i, texture, rotation, layer.getColor()));
}
// No layers?
if (layers.isEmpty()) {
if (Const.Materials.EXAMPLE.isPresent()) {
buildFakeModel(spriteGetter, builder, rotation, Const.Materials.EXAMPLE.get());
} else {
// Shouldn't happen, but...
SilentGear.LOGGER.error("Example material is missing?");
TextureAtlasSprite texture = spriteGetter.apply(new Material(InventoryMenu.BLOCK_ATLAS, SilentGear.getId("item/error")));
builder.addAll(getQuadsForSprite(0, texture, rotation, Color.VALUE_WHITE));
}
}
// Extras
for (int i = 0; i < this.extraLayers.size(); i++) {
ResourceLocation texture = this.extraLayers.get(i);
builder.addAll(getQuadsForSprite(layers.size() + i, spriteGetter.apply(new Material(InventoryMenu.BLOCK_ATLAS, new StaticLayer(texture).getTexture())), rotation, Color.VALUE_WHITE));
}
builder.addAll(getQuadsForSprite(layers.size(), spriteGetter.apply(new Material(InventoryMenu.BLOCK_ATLAS, new StaticLayer(PART_MARKER_TEXTURE).getTexture())), rotation, Color.LIGHTSKYBLUE.getColor()));
TextureAtlasSprite particle = spriteGetter.apply(owner.resolveTexture("particle"));
return new BakedPerspectiveModel(builder.build(), particle, transforms, overrideList, rotation.isIdentity(), owner.isSideLit(), getCameraTransforms(transformVariant));
}
use of net.silentchaos512.gear.client.model.BakedPerspectiveModel in project Silent-Gear by SilentChaos512.
the class GearModel method bake.
@SuppressWarnings("MethodWithTooManyParameters")
public BakedModel bake(ItemStack stack, List<MaterialLayer> layers, int animationFrame, String transformVariant, IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, ModelState modelTransform, ItemOverrides overrideList, ResourceLocation modelLocation) {
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
Transformation rotation = modelTransform.getRotation();
ImmutableMap<ItemTransforms.TransformType, Transformation> transforms = PerspectiveMapWrapper.getTransforms(modelTransform);
boolean broken = GearHelper.isBroken(stack);
for (int i = 0; i < layers.size(); i++) {
MaterialLayer layer = layers.get(i);
Material renderMaterial = getTexture(layer, animationFrame, broken);
TextureAtlasSprite texture = spriteGetter.apply(renderMaterial);
builder.addAll(getQuadsForSprite(i, texture, rotation, layer.getColor()));
if (GearModelOverrideList.isDebugLoggingEnabled()) {
SilentGear.LOGGER.info(" - {} -> {}", layer.getTextureId(), renderMaterial.texture());
}
}
// No layers?
if (layers.isEmpty()) {
if (Const.Materials.EXAMPLE.isPresent()) {
buildFakeModel(spriteGetter, builder, rotation, Const.Materials.EXAMPLE.get());
} else {
// Shouldn't happen, but...
SilentGear.LOGGER.error("Example material is missing?");
TextureAtlasSprite texture = spriteGetter.apply(new Material(InventoryMenu.BLOCK_ATLAS, SilentGear.getId("item/error")));
builder.addAll(getQuadsForSprite(0, texture, rotation, 0xFFFFFF));
}
}
TextureAtlasSprite particle = spriteGetter.apply(owner.resolveTexture("particle"));
return new BakedPerspectiveModel(builder.build(), particle, transforms, overrideList, rotation.isIdentity(), owner.isSideLit(), getCameraTransforms(transformVariant));
}
Aggregations