use of com.enderio.core.client.render.BoundingBox in project EnderIO by SleepyTrousers.
the class PowerConduitRenderer method addConduitQuads.
@Override
protected void addConduitQuads(@Nonnull IConduitBundle bundle, @Nonnull IConduit conduit, @Nonnull TextureAtlasSprite tex, @Nonnull CollidableComponent component, float selfIllum, BlockRenderLayer layer, @Nonnull List<BakedQuad> quads) {
if (IPowerConduit.COLOR_CONTROLLER_ID.equals(component.data)) {
IPowerConduit pc = (IPowerConduit) conduit;
ConnectionMode conMode = pc.getConnectionMode(component.dir);
if (conduit.containsExternalConnection(component.dir) && pc.getExtractionRedstoneMode(component.dir) != RedstoneControlMode.IGNORE && conMode != ConnectionMode.DISABLED) {
int cInt = ((IPowerConduit) conduit).getExtractionSignalColor(component.dir).getColor();
Vector4f col = ColorUtil.toFloat4(cInt);
BoundingBox bound = component.bound;
if (conMode != ConnectionMode.IN_OUT && conMode != ConnectionMode.NOT_SET) {
Vector3d trans = ForgeDirectionOffsets.offsetScaled(component.dir, -0.12);
bound = bound.translate(trans);
}
addQuadsForSection(bound, tex, component.dir, quads, col);
}
return;
}
super.addConduitQuads(bundle, conduit, tex, component, selfIllum, layer, quads);
if (component.dir == null) {
return;
}
IPowerConduit pc = (IPowerConduit) conduit;
ConnectionMode mode = pc.getConnectionMode(component.dir);
if (mode != ConnectionMode.INPUT && mode != ConnectionMode.OUTPUT) {
return;
}
if (mode == ConnectionMode.INPUT) {
tex = pc.getTextureForInputMode();
} else {
tex = pc.getTextureForOutputMode();
}
Offset offset = bundle.getOffset(IPowerConduit.class, component.dir);
ConnectionModeGeometry.addModeConnectorQuads(component.dir, offset, tex, null, quads);
}
use of com.enderio.core.client.render.BoundingBox in project EnderIO by SleepyTrousers.
the class ConduitBundleRenderer method addConduitQuads.
private void addConduitQuads(@Nonnull IBlockStateWrapper state, @Nonnull IConduitBundle bundle, float brightness, @Nonnull BlockRenderLayer layer, @Nonnull List<BakedQuad> quads) {
// Conduits
Set<EnumFacing> externals = new HashSet<EnumFacing>();
List<BoundingBox> wireBounds = new ArrayList<BoundingBox>();
if (bundle.hasFacade() && state.getYetaDisplayMode().isHideFacades()) {
wireBounds.add(BoundingBox.UNIT_CUBE);
}
for (IClientConduit c : bundle.getClientConduits()) {
// TODO Temporary Workaround
IClientConduit.WithDefaultRendering con = (IClientConduit.WithDefaultRendering) c;
if (state.getYetaDisplayMode().renderConduit(con)) {
IConduitRenderer renderer = getRendererForConduit(con);
renderer.addBakedQuads(this, bundle, con, brightness, layer, quads);
Set<EnumFacing> extCons = con.getExternalConnections();
for (EnumFacing dir : extCons) {
if (con.getConnectionMode(dir) != ConnectionMode.DISABLED && con.getConnectionMode(dir) != ConnectionMode.NOT_SET) {
externals.add(dir);
}
}
} else if (con != null) {
Collection<CollidableComponent> components = con.getCollidableComponents();
for (CollidableComponent component : components) {
addWireBounds(wireBounds, component);
}
}
}
// Internal connectors between conduits
List<CollidableComponent> connectors = bundle.getConnectors();
for (CollidableComponent component : connectors) {
if (component != null) {
if (component.conduitType != null) {
// TODO Make an actual check before assuming a default render
IClientConduit.WithDefaultRendering conduit = (IClientConduit.WithDefaultRendering) bundle.getConduit(component.conduitType);
if (conduit != null) {
if (state.getYetaDisplayMode().renderConduit(component.conduitType)) {
TextureAtlasSprite tex = conduit.getTextureForState(component);
if (tex == null) {
tex = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
}
BakedQuadBuilder.addBakedQuads(quads, component.bound, tex);
} else {
addWireBounds(wireBounds, component);
}
}
} else if (state.getYetaDisplayMode().getDisplayMode().isAll()) {
TextureAtlasSprite tex = ConduitBundleRenderManager.instance.getConnectorIcon(component.data);
BakedQuadBuilder.addBakedQuads(quads, component.bound, tex);
}
}
}
// render these after the 'normal' conduits so help with proper blending
for (BoundingBox wireBound : wireBounds) {
BakedQuadBuilder.addBakedQuads(quads, wireBound, ConduitBundleRenderManager.instance.getWireFrameIcon());
}
// External connection terminations
for (EnumFacing dir : externals) {
addQuadsForExternalConnection(dir, quads);
}
if (quads.isEmpty() && !bundle.hasFacade()) {
BakedQuadBuilder.addBakedQuads(quads, BoundingBox.UNIT_CUBE.scale(.10), ConduitBundleRenderManager.instance.getWireFrameIcon());
BakedQuadBuilder.addBakedQuads(quads, BoundingBox.UNIT_CUBE.scale(.15), ConduitBundleRenderManager.instance.getWireFrameIcon());
BakedQuadBuilder.addBakedQuads(quads, BoundingBox.UNIT_CUBE.scale(.20), ConduitBundleRenderManager.instance.getWireFrameIcon());
BakedQuadBuilder.addBakedQuads(quads, BoundingBox.UNIT_CUBE.scale(.25), ConduitBundleRenderManager.instance.getWireFrameIcon());
}
}
use of com.enderio.core.client.render.BoundingBox in project EnderIO by SleepyTrousers.
the class ConduitBundleRenderer method addQuadsForExternalConnection.
private void addQuadsForExternalConnection(@Nonnull EnumFacing dir, @Nonnull List<BakedQuad> quads) {
TextureAtlasSprite tex = ConduitBundleRenderManager.instance.getConnectorIcon(ConduitConnectorType.EXTERNAL);
BoundingBox[] bbs = ConduitGeometryUtil.instance.getExternalConnectorBoundingBoxes(dir);
for (BoundingBox bb : bbs) {
BakedQuadBuilder.addBakedQuads(quads, bb, tex);
}
}
use of com.enderio.core.client.render.BoundingBox in project EnderIO by SleepyTrousers.
the class DefaultConduitRenderer method addConduitQuads.
protected void addConduitQuads(@Nonnull IConduitBundle bundle, @Nonnull IConduit conduit, @Nonnull TextureAtlasSprite tex, @Nonnull CollidableComponent component, float selfIllum, BlockRenderLayer layer, @Nonnull List<BakedQuad> quads) {
if (isNSEWUD(component.dir)) {
if (layer == null) {
// TODO? null is the blockbreaking animation
return;
}
float scaleFactor = 0.75f;
float xLen = Math.abs(component.dir.getFrontOffsetX()) == 1 ? 1 : scaleFactor;
float yLen = Math.abs(component.dir.getFrontOffsetY()) == 1 ? 1 : scaleFactor;
float zLen = Math.abs(component.dir.getFrontOffsetZ()) == 1 ? 1 : scaleFactor;
BoundingBox cube = component.bound;
BoundingBox bb = cube.scale(xLen, yLen, zLen);
addQuadsForSection(bb, tex, component.dir, quads);
if (conduit.getConnectionMode(component.dir) == ConnectionMode.DISABLED) {
tex = ConduitBundleRenderManager.instance.getConnectorIcon(component.data);
BakedQuadBuilder.addBakedQuadForFace(quads, bb, tex, component.dir);
}
} else {
BakedQuadBuilder.addBakedQuads(quads, component.bound, tex);
}
}
use of com.enderio.core.client.render.BoundingBox in project EnderIO by SleepyTrousers.
the class DefaultConduitRenderer method addTransmissionQuads.
protected void addTransmissionQuads(TextureAtlasSprite tex, Vector4f color, IConduit conduit, CollidableComponent component, float selfIllum, List<BakedQuad> quads) {
float scaleFactor = 0.6f;
float xLen = Math.abs(component.dir.getFrontOffsetX()) == 1 ? 1 : scaleFactor;
float yLen = Math.abs(component.dir.getFrontOffsetY()) == 1 ? 1 : scaleFactor;
float zLen = Math.abs(component.dir.getFrontOffsetZ()) == 1 ? 1 : scaleFactor;
BoundingBox cube = component.bound;
BoundingBox bb = cube.scale(xLen, yLen, zLen);
addQuadsForSection(bb, tex, component.dir, quads, color);
}
Aggregations