public @Nonnull BoundingBox scale(double xyz) { return scale(xyz, xyz, xyz); }
public @Nonnull BoundingBox scale(float xyz) { return scale((double) xyz, (double) xyz, (double) xyz); }
public @Nonnull BoundingBox scale(float x, float y, float z) { return scale((double) x, (double) y, (double) z); }
private void addWireBounds(@Nonnull List<BoundingBox> wireBounds, @Nonnull CollidableComponent component) { if (component.isDirectional()) { final EnumFacing componentDirection = component.getDirection(); double sx = componentDirection.getFrontOffsetX() != 0 ? 1 : 0.7; double sy = componentDirection.getFrontOffsetY() != 0 ? 1 : 0.7; double sz = componentDirection.getFrontOffsetZ() != 0 ? 1 : 0.7; wireBounds.add(component.bound.scale(sx, sy, sz)); } else { wireBounds.add(component.bound); } }
protected void setVerticesForTransmission(@Nonnull BoundingBox bound, @Nonnull EnumFacing dir) { float xs = dir.getFrontOffsetX() == 0 ? transmissionScaleFactor : 1; float ys = dir.getFrontOffsetY() == 0 ? transmissionScaleFactor : 1; float zs = dir.getFrontOffsetZ() == 0 ? transmissionScaleFactor : 1; setupVertices(bound.scale(xs, ys, zs)); }
public @Nonnull BoundingBox createBoundsForConnectionController(@Nonnull EnumFacing dir, @Nonnull Offset offset) { Vector3d nonUniformScale = ForgeDirectionOffsets.forDirCopy(dir); nonUniformScale.scale(0.5); nonUniformScale.x = 0.8 * (1 - Math.abs(nonUniformScale.x)); nonUniformScale.y = 0.8 * (1 - Math.abs(nonUniformScale.y)); nonUniformScale.z = 0.8 * (1 - Math.abs(nonUniformScale.z)); BoundingBox bb = CORE_BOUNDS; bb = bb.scale(nonUniformScale.x, nonUniformScale.y, nonUniformScale.z); double offsetFromEnd = Math.min(bb.sizeX(), bb.sizeY()); offsetFromEnd = Math.min(offsetFromEnd, bb.sizeZ()); offsetFromEnd = Math.max(offsetFromEnd, 0.075); double transMag = 0.5 - (offsetFromEnd * 1.2); Vector3d trans = ForgeDirectionOffsets.forDirCopy(dir); trans.scale(transMag); bb = bb.translate(trans); bb = bb.translate(getTranslation(dir, offset)); return bb; }
@Override protected void renderTileEntity(@Nonnull TileTransceiver te, @Nonnull IBlockState blockState, float partialTicks, int destroyStage) { TextureAtlasSprite icon = ((BlockTransceiver) block_transceiver.getBlockNN()).getPortalIcon(); if (icon == null) { return; } float time = Math.abs(50 - (EnderIO.proxy.getTickCount() % 100)) / 50f; float localScale = scale + 0.05f - time * 0.1f; float alpha = 0.7f + time * 0.25f; BoundingBox bb = BoundingBox.UNIT_CUBE.scale(localScale, localScale, localScale); GlStateManager.color(1, 1, 1, alpha); GlStateManager.enableNormalize(); RenderUtil.renderBoundingBox(bb, icon); GlStateManager.disableNormalize(); }
@Override protected void setVerticesForTransmission(@Nonnull BoundingBox bound, @Nonnull EnumFacing id) { float yScale = getRatioForConnection(id); float scale = 0.7f; float xs = id.getFrontOffsetX() == 0 ? scale : 1; float ys = id.getFrontOffsetY() == 0 ? Math.min(yScale, scale) : yScale; float zs = id.getFrontOffsetZ() == 0 ? scale : 1; double sizeY = bound.sizeY(); bound = bound.scale(xs, ys, zs); double transY = (bound.sizeY() - sizeY) / 2; Vector3d translation = new Vector3d(0, transY + 0.025, 0); setupVertices(bound.translate(translation)); }
protected void renderTransmissionDynamic(@Nonnull IConduit conduit, @Nonnull IConduitTexture tex, @Nullable Vector4f color, @Nonnull CollidableComponent component, float selfIllum) { float scaleFactor = 0.6f; final EnumFacing componentDirection = component.getDirection(); float xLen = Math.abs(componentDirection.getFrontOffsetX()) == 1 ? 1 : scaleFactor; float yLen = Math.abs(componentDirection.getFrontOffsetY()) == 1 ? 1 : scaleFactor; float zLen = Math.abs(componentDirection.getFrontOffsetZ()) == 1 ? 1 : scaleFactor; GlStateManager.color(1, 1, 1); BoundingBox cube = component.bound; BoundingBox bb = cube.scale(xLen, yLen, zLen); TextureAtlasSprite sprite = tex.getSprite(); drawDynamicSection(bb, sprite.getInterpolatedU(tex.getUv().x * 16), sprite.getInterpolatedU(tex.getUv().z * 16), sprite.getInterpolatedV(tex.getUv().y * 16), sprite.getInterpolatedV(tex.getUv().w * 16), color, componentDirection, false); }
bb = bb.scale(1.05, 1.05, 1.05); CollidableComponent cc = new CollidableComponent(null, bb, null, ConduitConnectorType.INTERNAL); cachedConnectors.add(cc); bb = bb.scale(1.05, 1.05, 1.05); CollidableComponent cc = new CollidableComponent(null, bb, null, ConduitConnectorType.INTERNAL); cachedConnectors.add(cc);
double zOff = componentDirection.getFrontOffsetZ() * offSize; bbb = component.bound.scale(xScale, yScale, zScale); bbb = bbb.translate(new Vector3d(xOff, yOff, zOff));
minBB = minBB.translate(dir.getFrontOffsetX() * trans, dir.getFrontOffsetY() * trans, dir.getFrontOffsetZ() * trans); float scale = 0.7f; minBB = minBB.scale(1 + Math.abs(dir.getFrontOffsetX()) * scale, 1 + Math.abs(dir.getFrontOffsetY()) * scale, 1 + Math.abs(dir.getFrontOffsetZ()) * scale); } else { minBB = minBB.scale(1.09, 1.09, 1.09);
protected void renderConduitDynamic(@Nonnull IConduitTexture tex, @Nonnull IClientConduit.WithDefaultRendering conduit, @Nonnull CollidableComponent component, float brightness) { GlStateManager.color(1, 1, 1); if (component.isDirectional() && component.data == null) { final EnumFacing componentDirection = component.getDirection(); float scaleFactor = 0.75f; float xLen = Math.abs(componentDirection.getFrontOffsetX()) == 1 ? 1 : scaleFactor; float yLen = Math.abs(componentDirection.getFrontOffsetY()) == 1 ? 1 : scaleFactor; float zLen = Math.abs(componentDirection.getFrontOffsetZ()) == 1 ? 1 : scaleFactor; BoundingBox cube = component.bound; BoundingBox bb = cube.scale(xLen, yLen, zLen); TextureAtlasSprite sprite = tex.getSprite(); drawDynamicSection(bb, sprite.getInterpolatedU(tex.getUv().x * 16), sprite.getInterpolatedU(tex.getUv().z * 16), sprite.getInterpolatedV(tex.getUv().y * 16), sprite.getInterpolatedV(tex.getUv().w * 16), componentDirection, false, conduit.shouldMirrorTexture()); if (conduit.getConnectionMode(componentDirection) == ConnectionMode.DISABLED) { TextureAtlasSprite tex2 = ConduitBundleRenderManager.instance.getConnectorIcon(component.data); List<Vertex> corners = component.bound.getCornersWithUvForFace(componentDirection, tex2.getMinU(), tex2.getMaxU(), tex2.getMinV(), tex2.getMaxV()); RenderUtil.addVerticesToTessellator(corners, DefaultVertexFormats.POSITION_TEX, false); } } else { // TODO: HL: I commented this out because component.getDirection() (the second to last parameter) is always null in // this else branch and drawDynamicSection() with isTransmission=true (last parameter) would NPE on it. (Not a // mistake in the component.dir encapsulation, this was that way before.) // drawDynamicSection(component.bound, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV(), dir, true); } }
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());
@Override public void renderParticle(@Nonnull BufferBuilder worldRendererIn, @Nonnull Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { if (particleAge < 0) { return; } GlStateManager.pushMatrix(); GlStateManager.enableLighting(); GlStateManager.disableLighting(); GlStateManager.disableCull(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240); RenderUtil.bindBlockTexture(); GlStateManager.depthMask(false); float scale = Math.min((particleAge + partialTicks) / INIT_TIME, 1); float fade = particleAge < FADE_TIME ? 1f : ((particleMaxAge - particleAge) / (float) (particleMaxAge - FADE_TIME)); GlStateManager.translate(-interpPosX, -interpPosY, -interpPosZ); GlStateManager.color(getRedColorF(), getGreenColorF(), getBlueColorF(), particleAlpha * fade); RenderUtil.renderBoundingBox((new BoundingBox(getBoundingBox())).scale(scale), IconUtil.instance.whiteTexture); GlStateManager.depthMask(true); GlStateManager.disableBlend(); GlStateManager.enableCull(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); }