private void drawArrow(float progress) {
double arrowBaseWidth = 0.4D;
double arrowBaseLength = 0.8D;
double arrowLength = 1.5D;
double arrowWidth = 0.7D;
double scale = 0.1D;
GL11.glPushMatrix();
GL11.glScaled(scale, scale, scale);
GL11.glTranslatef(0, progress * 4, 0);
BufferBuilder wr = Tessellator.getInstance().getBuffer();
wr.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
wr.pos(-arrowBaseWidth, -arrowLength * 0.5D, 0).endVertex();
wr.pos(-arrowBaseWidth, -arrowLength * 0.5D + arrowBaseLength, 0).endVertex();
wr.pos(-arrowWidth, -arrowLength * 0.5D + arrowBaseLength, 0).endVertex();
wr.pos(0, arrowLength * 0.5D, 0).endVertex();
wr.pos(arrowWidth, -arrowLength * 0.5D + arrowBaseLength, 0).endVertex();
wr.pos(arrowBaseWidth, -arrowLength * 0.5D + arrowBaseLength, 0).endVertex();
wr.pos(arrowBaseWidth, -arrowLength * 0.5D, 0).endVertex();
Tessellator.getInstance().draw();
GL11.glPopMatrix();
}
java类net.minecraft.client.renderer.BufferBuilder的实例源码
RenderBlockArrows.java 文件源码
项目:pnc-repressurized
阅读 18
收藏 0
点赞 0
评论 0
RenderRing.java 文件源码
项目:pnc-repressurized
阅读 20
收藏 0
点赞 0
评论 0
@SideOnly(Side.CLIENT)
public void renderInterpolated(RenderProgressingLine lastTickLine, float partialTick, float rotationYaw, float rotationPitch) {
GL11.glPushMatrix();
double renderProgress = getInter(progress, lastTickLine.progress, partialTick);
GL11.glTranslated((getInter(endX, lastTickLine.endX, partialTick) - startX) * renderProgress, (getInter(endY, lastTickLine.endY, partialTick) - startY) * renderProgress, (getInter(endZ, lastTickLine.endZ, partialTick) - startZ) * renderProgress);
GL11.glRotatef(rotationYaw, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(rotationPitch, 0.0F, 0.0F, 1.0F);
BufferBuilder wr = Tessellator.getInstance().getBuffer();
GL11.glEnable(GL11.GL_LINE_SMOOTH);
wr.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION);
RenderUtils.glColorHex(color);
double size = 5 / 16D;
for (int i = 0; i < PneumaticCraftUtils.circlePoints; i++) {
wr.pos(0, PneumaticCraftUtils.sin[i] * size, PneumaticCraftUtils.cos[i] * size).endVertex();
}
Tessellator.getInstance().draw();
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glPopMatrix();
}
GuiChargingStation.java 文件源码
项目:pnc-repressurized
阅读 19
收藏 0
点赞 0
评论 0
private void renderAirParticle(float particleProgress) {
int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2;
float x = xStart + 117F;
float y = yStart + 50.5F;
if (particleProgress < 0.5F) {
y += particleProgress * 56;
} else if (particleProgress < 0.7F) {
y += 28F;
x -= (particleProgress - 0.5F) * 90;
} else {
y += 28F;
x -= 18;
y -= (particleProgress - 0.7F) * 70;
}
BufferBuilder wr = Tessellator.getInstance().getBuffer();
GL11.glPointSize(5);
wr.begin(GL11.GL_POINTS, DefaultVertexFormats.POSITION);
wr.pos(x, y, zLevel).endVertex();
Tessellator.getInstance().draw();
}
GuiCheckBox.java 文件源码
项目:pnc-repressurized
阅读 23
收藏 0
点赞 0
评论 0
@Override
public void render(int mouseX, int mouseY, float partialTick) {
drawRect(x, y, x + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT, enabled ? 0xFFA0A0A0 : 0xFF999999);
drawRect(x + 1, y + 1, x + CHECKBOX_WIDTH - 1, y + CHECKBOX_HEIGHT - 1, enabled ? 0xFF202020 : 0xFFAAAAAA);
if (checked) {
GlStateManager.disableTexture2D();
if (enabled) {
GlStateManager.color(1, 1, 1, 1);
} else {
GlStateManager.color(0.8f, 0.8f, 0.8f, 1);
}
BufferBuilder wr = Tessellator.getInstance().getBuffer();
wr.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
wr.pos(x + 2, y + 5, zLevel).endVertex();
wr.pos(x + 5, y + 7, zLevel).endVertex();
wr.pos(x + 8, y + 3, zLevel).endVertex();
Tessellator.getInstance().draw();
GlStateManager.enableTexture2D();
GlStateManager.color(0.25f, 0.25f, 0.25f, 1);
}
fontRenderer.drawString(I18n.format(text), x + 1 + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT / 2 - fontRenderer.FONT_HEIGHT / 2, enabled ? color : 0xFF888888);
}
ProgWidget.java 文件源码
项目:pnc-repressurized
阅读 22
收藏 0
点赞 0
评论 0
@Override
public void render() {
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(getTexture());
int width = getWidth() + (getParameters() != null && getParameters().length > 0 ? 10 : 0);
int height = getHeight() + (hasStepOutput() ? 10 : 0);
Pair<Double, Double> maxUV = getMaxUV();
double u = maxUV.getLeft();
double v = maxUV.getRight();
BufferBuilder wr = Tessellator.getInstance().getBuffer();
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
wr.pos(0, 0, 0).tex(0, 0).endVertex();
wr.pos(0, height, 0).tex(0, v).endVertex();
wr.pos(width, height, 0).tex(u, v).endVertex();
wr.pos(width, 0, 0).tex(u, 0).endVertex();
Tessellator.getInstance().draw();
}
ParticleBulletHole.java 文件源码
项目:Mods
阅读 17
收藏 0
点赞 0
评论 0
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
//super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
//System.out.println("rot: "+rotationX+" "+rotationZ+" "+rotationYZ+" "+rotationXY+" "+rotationXZ);
EnumFacing face=this.block.sideHit;
if(face == EnumFacing.UP)
super.renderParticle(buffer, entityIn, partialTicks, 1, 0, 0, 0, 1);
else if(face == EnumFacing.DOWN)
super.renderParticle(buffer, entityIn, partialTicks, 1, 0, 0, 0, -1);
else if(face == EnumFacing.NORTH)
super.renderParticle(buffer, entityIn, partialTicks, 1, 1, 0, 0, 0);
else if(face == EnumFacing.SOUTH)
super.renderParticle(buffer, entityIn, partialTicks, -1, 1, 0, 0, 0);
else if(face == EnumFacing.EAST)
super.renderParticle(buffer, entityIn, partialTicks, 0, 1, 1, 0, 0);
else if(face == EnumFacing.WEST)
super.renderParticle(buffer, entityIn, partialTicks, 0, 1, -1, 0, 0);
}
Render3DPolygon.java 文件源码
项目:HardVox
阅读 18
收藏 0
点赞 0
评论 0
@Override
public void render(Vector3 cameraPos) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buf = tessellator.getBuffer();
for (LineStyle line : this.style.getLines()) {
if (!line.prepare(this.style.getRenderType())) {
continue;
}
buf.begin(GL_LINE_LOOP, DefaultVertexFormats.POSITION);
line.applyColour();
for (Vector3 vertex : this.vertices) {
buf.pos(vertex.getX() - cameraPos.getX(), vertex.getY() - cameraPos.getY(), vertex.getZ() - cameraPos.getZ()).endVertex();
}
tessellator.draw();
}
}
HarshenClientUtils.java 文件源码
项目:harshencastle
阅读 25
收藏 0
点赞 0
评论 0
public static void renderGhostModel(IBakedModel model, BlockPos position, Color color, boolean noDepth, float partialTicks)
{
GlStateManager.enableBlend();
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_DST_COLOR);
BufferBuilder vb;
if(noDepth)
{
GlStateManager.depthFunc(519);
vb = prepRenderBlockDepth(partialTicks, true);
}
else
vb = prepRender(partialTicks, true);
vb.begin(7, DefaultVertexFormats.BLOCK);
World world = Minecraft.getMinecraft().world;
BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
dispatcher.getBlockModelRenderer().renderModel(world, model, Minecraft.getMinecraft().world.getBlockState(position), position.add(0, noDepth ? 500 : 0, 0), vb, false);
for(int i = 0; i < vb.getVertexCount(); i++)
vb.putColorMultiplier(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, i);
vb.color(1, 1, 1, 0.1f);
postRender();
GlStateManager.depthFunc(515);
GlStateManager.disableBlend();
}
Face.java 文件源码
项目:ObsidianSuite
阅读 22
收藏 0
点赞 0
评论 0
@SideOnly(Side.CLIENT)
public void render(BufferBuilder renderer) {
int numVertices = vertices.length;
if(faceNormal == null)
faceNormal = calculateFaceNormal();
renderer.begin(7, DefaultVertexFormats.POSITION_TEX_NORMAL);
for (int i = 0; i < numVertices; ++i) {
Vertex v = vertices[i];
TextureCoordinate tc = textureCoordinates[i];
renderer.pos(v.x, v.y, v.z).tex(tc.u, tc.v).normal(faceNormal.x, faceNormal.y, faceNormal.z).endVertex();
}
//Renderer works with four vertices so add start point again if face is only three vertices.
if(numVertices == 3)
renderer.pos(vertices[0].x, vertices[0].y, vertices[0].z).tex(textureCoordinates[0].u, textureCoordinates[0].v).normal(faceNormal.x, faceNormal.y, faceNormal.z).endVertex();
Tessellator.getInstance().draw();
}
FluidStackRenderer.java 文件源码
项目:FoodCraft-Reloaded
阅读 22
收藏 0
点赞 0
评论 0
private static void drawTextureWithMasking(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) {
double uMin = (double) textureSprite.getMinU();
double uMax = (double) textureSprite.getMaxU();
double vMin = (double) textureSprite.getMinV();
double vMax = (double) textureSprite.getMaxV();
uMax = uMax - (maskRight / 16.0 * (uMax - uMin));
vMax = vMax - (maskTop / 16.0 * (vMax - vMin));
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
bufferBuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
bufferBuilder.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex();
bufferBuilder.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex();
bufferBuilder.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex();
bufferBuilder.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex();
tessellator.draw();
}
ParticleBolt.java 文件源码
项目:Solar
阅读 22
收藏 0
点赞 0
评论 0
void render() {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buff = tessellator.getBuffer();
buff.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
buff.setTranslation(
-TileEntityRendererDispatcher.staticPlayerX,
-TileEntityRendererDispatcher.staticPlayerY,
-TileEntityRendererDispatcher.staticPlayerZ
);
buff.pos(from.x, from.y, from.z).color(getRedColorF(), getGreenColorF(), getBlueColorF(), alpha * particleAlpha)
.endVertex();
buff.pos(to.x, to.y, to.z).color(getRedColorF(), getGreenColorF(), getBlueColorF(), alpha * particleAlpha)
.endVertex();
buff.setTranslation(0,0,0);
tessellator.draw();
}
GeometryTessellator.java 文件源码
项目:ForgeHax
阅读 19
收藏 0
点赞 0
评论 0
private static void drawCuboid(final BufferBuilder buffer, final BlockPos begin, final BlockPos end, final int sides, final int argb, final double delta) {
if (buffer.getDrawMode() == -1 || sides == 0) {
return;
}
final double x0 = begin.getX() - delta;
final double y0 = begin.getY() - delta;
final double z0 = begin.getZ() - delta;
final double x1 = end.getX() + 1 + delta;
final double y1 = end.getY() + 1 + delta;
final double z1 = end.getZ() + 1 + delta;
switch (buffer.getDrawMode()) {
case GL11.GL_QUADS:
drawQuads(buffer, x0, y0, z0, x1, y1, z1, sides, argb);
break;
case GL11.GL_LINES:
drawLines(buffer, x0, y0, z0, x1, y1, z1, sides, argb);
break;
default:
throw new IllegalStateException("Unsupported mode!");
}
}
ParticleBase.java 文件源码
项目:Solar
阅读 19
收藏 0
点赞 0
评论 0
@Override
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
if(sprite != null) {
double uMin = 0F;
double uMax = 1F;
double vMin = 0F;
double vMax = 1F;
if(sprite instanceof FrameSpriteResource) {
FrameSpriteResource framedSprite = ((FrameSpriteResource) sprite);
Tuple<Double, Double> uv = framedSprite.getUVFrame((int) particleAngle);
double uOffset = framedSprite.getU();
double u = uv.getFirst();
double vOffset = framedSprite.getV();
double v = uv.getSecond();
uMin = u;
uMax = u + uOffset;
vMin = v;
vMax = v + vOffset;
}
sprite.bindManager();
renderEasy(buffer, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ, uMin, uMax, vMin, vMax);
}
}
RenderTargetCircle.java 文件源码
项目:pnc-repressurized
阅读 19
收藏 0
点赞 0
评论 0
public void render(double size, float partialTicks) {
double renderRotationAngle = oldRotationAngle + (rotationAngle - oldRotationAngle) * partialTicks;
BufferBuilder wr = Tessellator.getInstance().getBuffer();
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
// GL11.glLineWidth((float)size * 20F);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glRotatef((float) renderRotationAngle, 0, 0, 1);
for (int j = 0; j < 2; j++) {
wr.begin(GL11.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION);
for (int i = 0; i < PneumaticCraftUtils.circlePoints / 4; i++) {
wr.pos(PneumaticCraftUtils.cos[i] * size, PneumaticCraftUtils.sin[i] * size, 0).endVertex();
wr.pos(PneumaticCraftUtils.cos[i] * (size + 0.1D), PneumaticCraftUtils.sin[i] * (size + 0.1D), 0).endVertex();
}
Tessellator.getInstance().draw();
if (renderAsTagged) {
GL11.glColor4d(1, 0, 0, 1);
wr.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION);
for (int i = 0; i < PneumaticCraftUtils.circlePoints / 4; i++) {
wr.pos(PneumaticCraftUtils.cos[i] * size, PneumaticCraftUtils.sin[i] * size, 0).endVertex();
}
for (int i = PneumaticCraftUtils.circlePoints / 4 - 1; i >= 0; i--) {
wr.pos(PneumaticCraftUtils.cos[i] * (size + 0.1D), PneumaticCraftUtils.sin[i] * (size + 0.1D), 0).endVertex();
}
Tessellator.getInstance().draw();
GL11.glColor4d(1, 1, 0, 0.5);
}
GL11.glRotatef(180, 0, 0, 1);
}
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
PhenomenaRenderer.java 文件源码
项目:Solar
阅读 18
收藏 0
点赞 0
评论 0
@Override
public void renderTileEntityFast(@Nonnull TilePhenomena phenomena, double x, double y, double z, float partialTick, int breakStage, float partial, @Nullable BufferBuilder renderer) {
if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
BlockPos pos = phenomena.getPos();
IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(phenomena.getWorld(), pos);
IBlockState state = getState(phenomena, world, pos);
if(state instanceof IExtendedBlockState) {
IExtendedBlockState extendedState = (IExtendedBlockState) state;
if(extendedState.getUnlistedNames().contains(Properties.AnimationProperty)) {
float time = ((20 - phenomena.timer)) / 20F; // Using tile timer instead of world time.
IAnimationStateMachine capability = phenomena.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null);
if(capability != null) {
Pair<IModelState, Iterable<Event>> pair = capability.apply(time);
extendedState = extendedState.withProperty(Properties.AnimationProperty, pair.getLeft());
IBakedModel model = getModel(state);
assert renderer != null;
renderer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ());
blockRenderer.getBlockModelRenderer().renderModel(world, model, extendedState, pos, renderer, false);
}
}
}
}
RenderSearchItemBlock.java 文件源码
项目:pnc-repressurized
阅读 19
收藏 0
点赞 0
评论 0
public static void renderSearch(double x, double y, double z, int itemCount, int totalCount) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glColor4d(0, 1, 0, 0.5D);
GL11.glRotatef(180.0F - Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(180.0F - Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F);
// GL11.glLineWidth(1.0F);
double ratio = (double) itemCount / totalCount;
double diff = (1 - ratio) / 1.5D;
double size = 1 - diff;
/*
for(double i = size; i > 0; i -= 0.06D) {
GL11.glPushMatrix();
GL11.glScaled(i, i, i);
renderCircle();
GL11.glPopMatrix();
}
*/
BufferBuilder wr = Tessellator.getInstance().getBuffer();
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
wr.pos(-size, size, 0).tex(0, 1).endVertex();
wr.pos(-size, -size, 0).tex(0, 0).endVertex();
wr.pos(size, -size, 0).tex(1, 0).endVertex();
wr.pos(size, size, 0).tex(1, 1).endVertex();
Tessellator.getInstance().draw();
GL11.glPopMatrix();
}
RenderLaser.java 文件源码
项目:pnc-repressurized
阅读 20
收藏 0
点赞 0
评论 0
private void renderQuad(int color) {
BufferBuilder wr = Tessellator.getInstance().getBuffer();
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
RenderUtils.glColorHex(color);
wr.pos(-0.5, 0, 0).tex(0, 0).endVertex();
wr.pos(-0.5, 1, 0).tex(0, 1).endVertex();
wr.pos(0.5, 1, 0).tex(1, 1).endVertex();
wr.pos(0.5, 0, 0).tex(1, 0).endVertex();
Tessellator.getInstance().draw();
}
RenderProgressingLine.java 文件源码
项目:pnc-repressurized
阅读 18
收藏 0
点赞 0
评论 0
@SideOnly(Side.CLIENT)
public void renderInterpolated(RenderProgressingLine lastTickLine, float partialTick) {
BufferBuilder wr = Tessellator.getInstance().getBuffer();
wr.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
wr.pos(getInter(startX, lastTickLine.startX, partialTick), getInter(startY, lastTickLine.startY, partialTick), getInter(startZ, lastTickLine.startZ, partialTick)).endVertex();
wr.pos(getInter(startX, lastTickLine.startX, partialTick) + (getInter(endX, lastTickLine.endX, partialTick) - getInter(startX, lastTickLine.startX, partialTick)) * progress, getInter(startY, lastTickLine.startY, partialTick) + (getInter(startY, lastTickLine.startY, partialTick) - getInter(endY, lastTickLine.endY, partialTick)) * progress, getInter(startZ, lastTickLine.startZ, partialTick) + (getInter(endZ, lastTickLine.endZ, partialTick) - getInter(startZ, lastTickLine.startZ, partialTick)) * progress).endVertex();
Tessellator.getInstance().draw();
}
RenderElevatorCaller.java 文件源码
项目:pnc-repressurized
阅读 39
收藏 0
点赞 0
评论 0
@Override
public void render(TileEntityElevatorCaller te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
Tessellator tess = Tessellator.getInstance();
GlStateManager.pushMatrix();
GlStateManager.translate(x + 0.5, y + 1.5, z + 0.5);
GlStateManager.scale(1.0F, -1F, -1F);
PneumaticCraftUtils.rotateMatrixByMetadata(te.getBlockMetadata());
GlStateManager.translate(-1, 0, -1);
FontRenderer fontRenderer = Minecraft.getMinecraft().getRenderManager().getFontRenderer();
for (TileEntityElevatorCaller.ElevatorButton button : te.getFloors()) {
GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.color(button.red, button.green, button.blue, 1F);
BufferBuilder bufferBuilder = tess.getBuffer();
bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
bufferBuilder.pos(button.posX + 0.5D, button.posY + 0.5D, 0.499D).endVertex();
bufferBuilder.pos(button.posX + 0.5D, button.posY + button.height + 0.5D, 0.499D).endVertex();
bufferBuilder.pos(button.posX + button.width + 0.5D, button.posY + button.height + 0.5D, 0.499D).endVertex();
bufferBuilder.pos(button.posX + button.width + 0.5D, button.posY + 0.5D, 0.499D).endVertex();
tess.draw();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
GlStateManager.enableLighting();
GlStateManager.pushMatrix();
GlStateManager.translate(button.posX + 0.5D, button.posY + 0.5D, 0.498);
GlStateManager.translate(button.width / 2, button.height / 2, 0);
float textScale = Math.min((float)button.width / 10F, (float)button.height / 10F);
GlStateManager.scale(textScale, textScale, textScale);
fontRenderer.drawString(button.buttonText, -fontRenderer.getStringWidth(button.buttonText) / 2, -fontRenderer.FONT_HEIGHT / 2, 0xFF000000);
GlStateManager.popMatrix();
}
GlStateManager.popMatrix();
}
EventHandler.java 文件源码
项目:ItemZoom
阅读 25
收藏 0
点赞 0
评论 0
private static void draw(BufferBuilder renderer, int x, int y, int width, int height, int red, int green, int blue, int alpha) {
renderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
renderer.pos((double) (x), (double) (y), 0.0D).color(red, green, blue, alpha).endVertex();
renderer.pos((double) (x), (double) (y + height), 0.0D).color(red, green, blue, alpha).endVertex();
renderer.pos((double) (x + width), (double) (y + height), 0.0D).color(red, green, blue, alpha).endVertex();
renderer.pos((double) (x + width), (double) (y), 0.0D).color(red, green, blue, alpha).endVertex();
Tessellator.getInstance().draw();
}
PlayerInventoryRenderer.java 文件源码
项目:ExPetrum
阅读 22
收藏 0
点赞 0
评论 0
public static void putOutlinedRectangle(BufferBuilder buffer, int x, int y, int w, int h, float... color)
{
putRectangle(buffer, x, y, w, h, color);
float[] colorOutline = new float[4];
System.arraycopy(color, 4, colorOutline, 0, 4);
putRectangle(buffer, x - 1, y - 1, 1, h + 2, colorOutline);
putRectangle(buffer, x + w, y - 1, 1, h + 2, colorOutline);
putRectangle(buffer, x, y - 1, w, 1, colorOutline);
putRectangle(buffer, x, y + h, w, 1, colorOutline);
}
RenderChunkBoundary.java 文件源码
项目:HardVox
阅读 17
收藏 0
点赞 0
评论 0
private void renderChunkBorder(double yMin, double yMax, double xBase, double zBase) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buf = tessellator.getBuffer();
int spacing = 16;
for (LineStyle line : this.style.getLines()) {
if (line.prepare(this.style.getRenderType())) {
buf.begin(GL_LINES, DefaultVertexFormats.POSITION);
line.applyColour();
for (int x = -16; x <= 32; x += spacing) {
for (int z = -16; z <= 32; z += spacing) {
buf.pos(xBase + x, yMin, zBase - z).endVertex();
buf.pos(xBase + x, yMax, zBase - z).endVertex();
}
}
for (double y = yMin; y <= yMax; y += yMax) {
buf.pos(xBase, y, zBase).endVertex();
buf.pos(xBase, y, zBase - 16).endVertex();
buf.pos(xBase, y, zBase - 16).endVertex();
buf.pos(xBase + 16, y, zBase - 16).endVertex();
buf.pos(xBase + 16, y, zBase - 16).endVertex();
buf.pos(xBase + 16, y, zBase).endVertex();
buf.pos(xBase + 16, y, zBase).endVertex();
buf.pos(xBase, y, zBase).endVertex();
}
tessellator.draw();
}
}
}
RenderChunkBoundary.java 文件源码
项目:HardVox
阅读 25
收藏 0
点赞 0
评论 0
private void renderChunkBoundary(int xChunk, int zChunk, double xBase, double zBase) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buf = tessellator.getBuffer();
Chunk chunk = this.mc.world.getChunkFromChunkCoords(xChunk, zChunk);
for (LineStyle line : this.style.getLines()) {
if (line.prepare(this.style.getRenderType())) {
buf.begin(GL_LINES, DefaultVertexFormats.POSITION);
line.applyColour();
int[][] lastHeight = { { -1, -1 }, { -1, -1 } };
for (int i = 0, height = 0; i < 16; i++) {
for (int j = 0; j < 2; j++) {
for (int axis = 0; axis < 2; axis++) {
height = axis == 0 ? chunk.getHeightValue(j * 15, i) : chunk.getHeightValue(i, j * 15);
double xPos = axis == 0 ? xBase + (j * 16) : xBase + i;
double zPos = axis == 0 ? zBase - 16 + i : zBase - 16 + (j * 16);
if (lastHeight[axis][j] > -1 && height != lastHeight[axis][j]) {
buf.pos(xPos, lastHeight[axis][j], zPos).endVertex();
buf.pos(xPos, height, zPos).endVertex();
}
buf.pos(xPos, height, zPos).endVertex();
buf.pos(xPos + axis, height, zPos + (1 - axis)).endVertex();
lastHeight[axis][j] = height;
}
}
}
tessellator.draw();
}
}
}
RenderCylinderBox.java 文件源码
项目:HardVox
阅读 25
收藏 0
点赞 0
评论 0
@Override
public void render(Vector3 cameraPos) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buf = tessellator.getBuffer();
double xPos = this.centreX - cameraPos.getX();
double zPos = this.centreZ - cameraPos.getZ();
for (LineStyle line : this.style.getLines()) {
if (!line.prepare(this.style.getRenderType())) {
continue;
}
double twoPi = Math.PI * 2;
for (int yBlock : new int[] { this.minY, this.maxY + 1 }) {
buf.begin(GL_LINE_LOOP, DefaultVertexFormats.POSITION);
line.applyColour();
for (int i = 0; i <= 75; i++) {
double tempTheta = i * twoPi / 75;
double tempX = this.radX * Math.cos(tempTheta);
double tempZ = this.radZ * Math.sin(tempTheta);
buf.pos(xPos + tempX, yBlock - cameraPos.getY(), zPos + tempZ).endVertex();
}
tessellator.draw();
}
}
}
RenderCylinderCircles.java 文件源码
项目:HardVox
阅读 19
收藏 0
点赞 0
评论 0
@Override
public void render(Vector3 cameraPos) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buf = tessellator.getBuffer();
double xPos = this.centreX - cameraPos.getX();
double zPos = this.centreZ - cameraPos.getZ();
for (LineStyle line : this.style.getLines()) {
if (!line.prepare(this.style.getRenderType())) {
continue;
}
double twoPi = Math.PI * 2;
for (int yBlock = this.minY + 1; yBlock <= this.maxY; yBlock++) {
buf.begin(GL_LINE_LOOP, DefaultVertexFormats.POSITION);
line.applyColour();
for (int i = 0; i <= 75; i++) {
double tempTheta = i * twoPi / 75;
double tempX = this.radX * Math.cos(tempTheta);
double tempZ = this.radZ * Math.sin(tempTheta);
buf.pos(xPos + tempX, yBlock - cameraPos.getY(), zPos + tempZ).endVertex();
}
tessellator.draw();
}
}
}
NickGuiTextField.java 文件源码
项目:Lithium-Forge
阅读 19
收藏 0
点赞 0
评论 0
/**
* Draws the blue selection box.
*/
private void drawSelectionBox(int startX, int startY, int endX, int endY) {
if (startX < endX) {
int i = startX;
startX = endX;
endX = i;
}
if (startY < endY) {
int j = startY;
startY = endY;
endY = j;
}
if (endX > this.x + this.width) {
endX = this.x + this.width;
}
if (startX > this.x + this.width) {
startX = this.x + this.width;
}
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
GlStateManager.color(0.0F, 0.0F, 255.0F, 255.0F);
GlStateManager.disableTexture2D();
GlStateManager.enableColorLogic();
GlStateManager.colorLogicOp(GlStateManager.LogicOp.OR_REVERSE);
bufferbuilder.begin(7, DefaultVertexFormats.POSITION);
bufferbuilder.pos((double) startX, (double) endY, 0.0D).endVertex();
bufferbuilder.pos((double) endX, (double) endY, 0.0D).endVertex();
bufferbuilder.pos((double) endX, (double) startY, 0.0D).endVertex();
bufferbuilder.pos((double) startX, (double) startY, 0.0D).endVertex();
tessellator.draw();
GlStateManager.disableColorLogic();
GlStateManager.enableTexture2D();
}
ModelHandle.java 文件源码
项目:genera
阅读 26
收藏 0
点赞 0
评论 0
private static void renderModel(IBakedModel model, VertexFormat fmt, int color)
{
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
worldrenderer.begin(GL11.GL_QUADS, fmt);
for (BakedQuad bakedquad : model.getQuads(null, null, 0))
{
LightUtil.renderQuadColor(worldrenderer, bakedquad, color);
}
tessellator.draw();
}
EntityFlameEffect.java 文件源码
项目:Mods
阅读 21
收藏 0
点赞 0
评论 0
@Override
public void renderParticle(BufferBuilder p_180434_1_, Entity p_180434_2_, float p_180434_3_, float p_180434_4_,
float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) {
float f6 = (this.particleAge + p_180434_3_) / this.particleMaxAge;
this.particleScale = 1.0F + f6 * f6 * 5.5F;
super.renderParticle(p_180434_1_, p_180434_2_, p_180434_3_, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_,
p_180434_8_);
}
IBrew.java 文件源码
项目:Bewitchment
阅读 20
收藏 0
点赞 0
评论 0
@SideOnly(Side.CLIENT)
default void render(int x, int y, net.minecraft.client.Minecraft mc, int index) {
mc.renderEngine.bindTexture(ResourceLocations.BREW_TEXTURES);
final Tessellator tessellator = Tessellator.getInstance();
final BufferBuilder buf = tessellator.getBuffer();
GlStateManager.color(1F, 1F, 1F, 1F);
final float f = 0.00390625F;
buf.begin(7, DefaultVertexFormats.POSITION_TEX);
buf.pos(x, y + 20, 0).tex(236 * f, (236 + 20) * f).endVertex();
buf.pos(x + 20, y + 20, 0).tex((236 + 20) * f, (236 + 20) * f).endVertex();
buf.pos(x + 20, y, 0).tex((236 + 20) * f, 236 * f).endVertex();
buf.pos(x, y, 0).tex(236 * f, 236 * f).endVertex();
tessellator.draw();
int textureX = index % 14 * 18;
int textureY = index / 14 * 18;
x += 1;
y += 1;
buf.begin(7, DefaultVertexFormats.POSITION_TEX);
buf.pos(x, y + 18, 0).tex(textureX * f, (textureY + 18) * f).endVertex();
buf.pos(x + 18, y + 18, 0).tex((textureX + 18) * f, (textureY + 18) * f).endVertex();
buf.pos(x + 18, y, 0).tex((textureX + 18) * f, textureY * f).endVertex();
buf.pos(x, y, 0).tex(textureX * f, textureY * f).endVertex();
tessellator.draw();
}
ParticleBubble.java 文件源码
项目:Bewitchment
阅读 20
收藏 0
点赞 0
评论 0
@Override
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
int i = (int) (((float) this.life + partialTicks) / (float) this.particleMaxAge);
if (i <= 7) {
this.textureManager.bindTexture(ResourceLocations.BUBBLE);
float minX = 0;
float maxX = minX + 1;
float minY = (float) i / 8F;
float maxY = minY + 0.125F;
float scale = 1.0F * this.particleScale;
float x = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) partialTicks - interpPosX);
float y = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) partialTicks - interpPosY);
float z = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) partialTicks - interpPosZ);
Vec3d vec0 = new Vec3d(-rotationX * scale - rotationXY * scale, -rotationZ * scale, -rotationYZ * scale - rotationXZ * scale);
Vec3d vec1 = new Vec3d(-rotationX * scale + rotationXY * scale, rotationZ * scale, -rotationYZ * scale + rotationXZ * scale);
Vec3d vec2 = new Vec3d(rotationX * scale + rotationXY * scale, rotationZ * scale, rotationYZ * scale + rotationXZ * scale);
Vec3d vec3 = new Vec3d(rotationX * scale - rotationXY * scale, -rotationZ * scale, rotationYZ * scale - rotationXZ * scale);
GlStateManager.color(getRedColorF(), getGreenColorF(), getBlueColorF(), 1.0F);
buffer.begin(7, VERTEX_FORMAT);
buffer.pos((double) x + vec0.x, (double) y + vec0.y, (double) z + vec0.z).tex((double) maxX, (double) maxY).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
buffer.pos((double) x + vec1.x, (double) y + vec1.y, (double) z + vec1.z).tex((double) maxX, (double) minY).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
buffer.pos((double) x + vec2.x, (double) y + vec2.y, (double) z + vec2.z).tex((double) minX, (double) minY).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
buffer.pos((double) x + vec3.x, (double) y + vec3.y, (double) z + vec3.z).tex((double) minX, (double) maxY).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
Tessellator.getInstance().draw();
}
}