本文整理汇总了Java中org.lwjgl.opengl.GL11.glVertex3d方法的典型用法代码示例。如果您正苦于以下问题:Java GL11.glVertex3d方法的具体用法?Java GL11.glVertex3d怎么用?Java GL11.glVertex3d使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.GL11
的用法示例。
在下文中一共展示了GL11.glVertex3d方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawLine
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
protected void drawLine(Vec3d p1, Vec3d p2, int colour, float alpha, float width)
{
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_DEPTH_TEST);
float[] rgb = MathHelper.intToRGB(colour);
GL11.glColor4f(rgb[0], rgb[1], rgb[2], alpha);
GL11.glLineWidth(width);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBegin(GL11.GL_LINE_LOOP);
GL11.glVertex3d(p1.x,p1.y,p1.z);
GL11.glVertex3d(p2.x,p2.y,p2.z);
GL11.glEnd();
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
示例2: highLightMob
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void highLightMob(Entity entity, double heat, float partialTicks){
double[] c = Graphical.heatToColor(heat);
GL11.glColor4d(c[0],c[1],c[2],0.6);
double pX;
double pY;
double pZ;
if(entity.isDead) {
pX = entity.posX;
pY = entity.posY;
pZ = entity.posZ;
}else{
pX = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks;
pY = entity.prevPosY + (entity.posY - entity.prevPosY) * partialTicks;
pZ = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks;
}
GL11.glVertex3d(pX, pY , pZ);
GL11.glVertex3d(pX, pY + 2.3 , pZ);
}
示例3: drawCircle
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Draw a circle in the x,y or z plane.
* @param c - Centre of circle.
* @param r - Radius of circle.
* @param plane - 0,1,2 for x,y and z.
*/
private void drawCircle(Vec3d c, double r, int plane, int colour, float width, float alpha)
{
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_DEPTH_TEST);
float[] rgb = MathHelper.intToRGB(colour);
GL11.glColor4f(rgb[0], rgb[1], rgb[2], alpha);
GL11.glLineWidth(width);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBegin(GL11.GL_LINE_LOOP);
for(int i = 0; i < 360; i++)
{
double rad = i/180F*Math.PI;
double x = c.x,y = c.y,z = c.z;
switch(plane)
{
case 0:
y = c.y + r*Math.sin(rad);
z = c.z + r*Math.cos(rad);
break;
case 1:
x = c.x + r*Math.sin(rad);
z = c.z + r*Math.cos(rad);
break;
case 2:
x = c.x + r*Math.sin(rad);
y = c.y + r*Math.cos(rad);
break;
}
GL11.glVertex3d(x,y,z);
}
GL11.glEnd();
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
示例4: drawLine3D
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawLine3D(double x1, double y1, double z1, double x2, double y2, double z2, int color,
boolean depthOff) {
enableRender3D(depthOff);
glColor(color);
GL11.glBegin(1);
GL11.glVertex3d(x1, y1, z1);
GL11.glVertex3d(x2, y2, z2);
GL11.glEnd();
disableRender3D(depthOff);
}
示例5: drawBoxOutline
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawBoxOutline(AxisAlignedBB boundingBox, int color, boolean depthOff) {
if (boundingBox == null) return;
enableRender3D(depthOff);
glColor(color);
GL11.glBegin(3);
GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72338_b, boundingBox.field_72339_c);
GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72338_b, boundingBox.field_72339_c);
GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72338_b, boundingBox.field_72334_f);
GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72338_b, boundingBox.field_72334_f);
GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72338_b, boundingBox.field_72339_c);
GL11.glEnd();
GL11.glBegin(3);
GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72337_e, boundingBox.field_72339_c);
GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72337_e, boundingBox.field_72339_c);
GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72337_e, boundingBox.field_72334_f);
GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72337_e, boundingBox.field_72334_f);
GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72337_e, boundingBox.field_72339_c);
GL11.glEnd();
GL11.glBegin(1);
GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72338_b, boundingBox.field_72339_c);
GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72337_e, boundingBox.field_72339_c);
GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72338_b, boundingBox.field_72339_c);
GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72337_e, boundingBox.field_72339_c);
GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72338_b, boundingBox.field_72334_f);
GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72337_e, boundingBox.field_72334_f);
GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72338_b, boundingBox.field_72334_f);
GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72337_e, boundingBox.field_72334_f);
GL11.glEnd();
disableRender3D(depthOff);
}
示例6: onRender
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void onRender(float partialTicks)
{
// GL settings
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glColor4f(1F, 0F, 0F, 0.15F);
GL11.glPushMatrix();
GL11.glTranslated(-mc.getRenderManager().renderPosX,
-mc.getRenderManager().renderPosY,
-mc.getRenderManager().renderPosZ);
// vertices
GL11.glBegin(GL11.GL_QUADS);
{
for(int[] vertex : vertices)
GL11.glVertex3d(vertex[0], vertex[1], vertex[2]);
}
GL11.glEnd();
GL11.glPopMatrix();
// GL resets
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
}
示例7: tracerLine
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void tracerLine(Entity entity, int mode) {
RenderUtils.fixDarkLight();
GlStateManager.resetColor();
double x = entity.posX - Minecraft.getMinecraft().getRenderManager().renderPosX;
double y = entity.posY + entity.height / 2.0F - Minecraft.getMinecraft().getRenderManager().renderPosY;
double z = entity.posZ - Minecraft.getMinecraft().getRenderManager().renderPosZ;
GL11.glBlendFunc(770, 771);
GL11.glEnable(3042);
GL11.glLineWidth(2.0F);
GL11.glDisable(3553);
GL11.glDisable(2929);
GL11.glDepthMask(false);
if (mode == 0) {
GL11.glColor4d(1.0F - Minecraft.getMinecraft().player.getDistanceToEntity(entity) / 40.0F,
Minecraft.getMinecraft().player.getDistanceToEntity(entity) / 40.0F, 0.0D, 0.5D);
} else if (mode == 1) {
GL11.glColor4d(0.0D, 0.0D, 1.0D, 0.5D);
} else if (mode == 2) {
GL11.glColor4d(1.0D, 1.0D, 0.0D, 0.5D);
} else if (mode == 3) {
GL11.glColor4d(1.0D, 0.0D, 0.0D, 0.5D);
} else if (mode == 4) {
GL11.glColor4d(0.0D, 1.0D, 0.0D, 0.5D);
}
Vec3d eyes = new Vec3d(0.0D, 0.0D, 1.0D)
.rotatePitch(-(float) Math.toRadians(Minecraft.getMinecraft().player.rotationPitch))
.rotateYaw(-(float) Math.toRadians(Minecraft.getMinecraft().player.rotationYaw));
GL11.glBegin(1);
GL11.glVertex3d(eyes.xCoord, Minecraft.getMinecraft().player.getEyeHeight() + eyes.yCoord, eyes.zCoord);
GL11.glVertex3d(x, y, z);
GL11.glEnd();
GL11.glEnable(3553);
GL11.glEnable(2929);
GL11.glDepthMask(true);
GL11.glDisable(3042);
}
示例8: drawOutlinedBox
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawOutlinedBox(AxisAlignedBB boundingBox) {
if (boundingBox == null) {
return;
}
GL11.glBegin((int)3);
GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glVertex3d((double)boundingBox.maxZ, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glVertex3d((double)boundingBox.maxZ, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glEnd();
GL11.glBegin((int)3);
GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glVertex3d((double)boundingBox.maxZ, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glVertex3d((double)boundingBox.maxZ, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glEnd();
GL11.glBegin((int)1);
GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glVertex3d((double)boundingBox.maxZ, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glVertex3d((double)boundingBox.maxZ, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glVertex3d((double)boundingBox.maxZ, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glVertex3d((double)boundingBox.maxZ, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
GL11.glEnd();
}
示例9: drawLogoutSpotTracer
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawLogoutSpotTracer(LogoutSpot l)
{
try
{
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDepthMask(false);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
GL11.glLineWidth(1.5F);
GL11.glColor3d(l.red, l.green, l.blue);
GL11.glBegin(GL11.GL_LINE_LOOP);
GL11.glVertex3d(0, 0, 0);
GL11.glVertex3d(l.dX + 0.5, l.dY + 0.5, l.dZ + 0.5);
GL11.glEnd();
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glPopMatrix();
}catch(Exception e) {}
}
示例10: drawWayPointTracer
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawWayPointTracer(Waypoint w)
{
try
{
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDepthMask(false);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
GL11.glLineWidth(1.5F);
GL11.glColor3d(w.red, w.green, w.blue);
GL11.glBegin(GL11.GL_LINE_LOOP);
Vec3d eyes = new Vec3d(0, 0, 1).rotatePitch(-(float) Math.toRadians(Wrapper.getPlayer().rotationPitch)).rotateYaw(-(float) Math.toRadians(Wrapper.getPlayer().rotationYaw));
GL11.glVertex3d(eyes.xCoord, Wrapper.getPlayer().getEyeHeight() + eyes.yCoord, eyes.zCoord);
GL11.glVertex3d(w.dX + 0.5, w.dY + 0.5, w.dZ + 0.5);
GL11.glEnd();
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glPopMatrix();
}catch(Exception e) {}
}
示例11: drawRailEndCaps
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Draws the end caps of rails.
*
* @param texPoint - Position to render the caps at.
* @param vertices - Rail shape vertices, as returned by {@link openflextrack.api.IRailType#getRailVertices() getRailVertices()}.
* @param texScale - {@link openflextrack.api.IRailType#getTextureScale() Texture scale} of the rail segment.
* @param holographic - {@code true} if the track is a hologram.
*/
private static void drawRailEndCaps(float[] texPoint, Vec3f[][] vertices, float texScale, boolean holographic) {
/* Backup face mode. */
final int glFaceMode = GL11.glGetInteger(GL11.GL_FRONT_FACE);
for (byte b = 1; b > -2; b-=2)
{
GL11.glPushMatrix();
GL11.glScalef(texPoint[4], 1.0F, texPoint[3]);
/* If we're rendering the second cap, invert front face mode and scale.
* This will mirror the cap without the need to render vertices in different order. */
if (b == -1) {
GL11.glScalef(-1, 1, -1);
if (glFaceMode == GL11.GL_CCW) {
GL11.glFrontFace(GL11.GL_CW);
}
else {
GL11.glFrontFace(GL11.GL_CCW);
}
}
/* Actually render face. */
GL11.glBegin(GL11.GL_QUADS);
{
if (!holographic) {
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, texPoint[6]%65536, texPoint[6]/65536);
}
for (Vec3f[] verts : vertices)
{
/* The fourth vertex (index 3; bottom left of texture)
* defines x offset and minumum y value,
* and is the first point of the rectangle. */
final float xOff = (verts[3].x-verts[0].x);
final float yMin = verts[3].z;
GL11.glTexCoord2d(0.0F, yMin + (verts[0].y-verts[3].y)*texScale);
GL11.glVertex3d(verts[3].x, verts[3].y, verts[3].x);
GL11.glTexCoord2d((verts[3].x-verts[2].x), yMin - (verts[3].y-verts[2].y)*texScale + (verts[1].y-verts[2].y)*texScale);
GL11.glVertex3d(verts[2].x, verts[2].y, verts[2].x);
GL11.glTexCoord2d(xOff + (verts[0].x-verts[1].x), yMin + (verts[0].y-verts[1].y)*texScale);
GL11.glVertex3d(verts[1].x, verts[1].y, verts[1].x);
GL11.glTexCoord2d(xOff, yMin);
GL11.glVertex3d(verts[0].x, verts[0].y, verts[0].x);
}
}
GL11.glEnd();
GL11.glPopMatrix();
}
/* Reset face mode. */
GL11.glFrontFace(glFaceMode);
}
示例12: drawRailSegment
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Draws a rail segment with the given coordinates.
*
* @param texPoints
* @param w1 - X-coordinate of first vertex.
* @param w2 - X-coordinate of second vertex.
* @param h1 - Y-coordinate of first vertex.
* @param h2 - Y-coordinate of second vertex.
* @param t1 - Y-texture offset of first vertex.
* @param texScale - {@link openflextrack.api.IRailType#getTextureScale() Texture scale} of the rail segment.
* @param holographic - {@code true} if the track is holographic.
*/
private static void drawRailSegment(List<float[]> texPoints, float w1, float w2, float h1, float h2, float t1, float texScale, boolean holographic) {
/* Backup face mode. */
final int glFaceMode = GL11.glGetInteger(GL11.GL_FRONT_FACE);
final float t2 = t1 + (Math.abs(w2-w1) + Math.abs(h2-h1)) * texScale;
for (byte b = 1; b > -2; b-=2)
{
GL11.glPushMatrix();
/* If we're rendering the second rail, invert front face mode and scale.
* This will mirror the rail without the need to render vertices in different order. */
if (b == -1) {
if (glFaceMode == GL11.GL_CCW) {
GL11.glFrontFace(GL11.GL_CW);
}
else {
GL11.glFrontFace(GL11.GL_CCW);
}
}
/* Actually render the rail. */
GL11.glBegin(GL11.GL_QUAD_STRIP);
{
for (float[] point : texPoints) {
if (!holographic) {
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, point[6]%65536, point[6]/65536);
}
GL11.glTexCoord2d(point[5], t2);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3d(point[0] + b*w1*point[4], point[1] + h1, point[2] + b*w1*point[3]);
GL11.glTexCoord2d(point[5], t1);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3d(point[0] + b*w2*point[4], point[1] + h2, point[2] + b*w2*point[3]);
}
}
GL11.glEnd();
GL11.glPopMatrix();
}
/* Reset face mode. */
GL11.glFrontFace(glFaceMode);
}
示例13: onWorldLastRender
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@SubscribeEvent
public void onWorldLastRender(RenderWorldLastEvent evt)
{
World world = Minecraft.getMinecraft().theWorld;
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
double x = player.lastTickPosX + (player.posX - player.lastTickPosX) * evt.partialTicks;
double y = player.lastTickPosY + (player.posY - player.lastTickPosY) * evt.partialTicks;
double z = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * evt.partialTicks;
GlStateManager.pushMatrix();
GlStateManager.pushAttrib();
GL11.glTranslated(-x, -y, -z);
GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
int shade_model = GL11.glGetInteger(GL11.GL_SHADE_MODEL);
GlStateManager.shadeModel(GL11.GL_SMOOTH);
GL11.glLineWidth(3);
GL11.glBegin(GL11.GL_LINES);
//display link process
PlayerProperties props = (PlayerProperties)player.getExtendedProperties(PlayerProperties.ID);
if(props != null && props.p_link != null
&& props.p_link.distanceSq(x,y+1,z) <= FundamentalChemistry.MAX_RELAY_DISTANCE-1f){ //distance check with some margin
GlStateManager.color(0f,1f,0.5f,1f);
GL11.glVertex3d(props.p_link.getX()+0.5, props.p_link.getY()+FundamentalChemistry.LASER_HEIGHT, props.p_link.getZ()+0.5);
GlStateManager.color(0f,0.5f,1f,1f);
GL11.glVertex3d(x, y+1, z);
}
for(TileEntity te : world.loadedTileEntityList){
if(te instanceof TileLaserRelay){
TileLaserRelay ent = (TileLaserRelay)te;
// change matrix for absolute coordinates
BlockPos cpos = ent.getPos();
for(BlockPos pos : ent.inputs){
TileEntity ce = te.getWorld().getTileEntity(pos);
if(ce != null && ce instanceof TileLaserRelay && (player.getPosition().distanceSq(pos.getX(),pos.getY(),pos.getZ()) <= 500
|| player.getPosition().distanceSq(cpos.getX(),cpos.getY(),cpos.getZ()) <= 500)){
//add height shift if it is a circular connections
TileLaserRelay cent = (TileLaserRelay)ce;
float shift = 0;
if(cent.inputs.contains(cpos) && cpos.hashCode() < pos.hashCode())
shift = 1/16.0f*2;
//draw connection
GlStateManager.color(0f,0.5f,1f,1f);
GL11.glVertex3d(cpos.getX()+0.5, cpos.getY()+FundamentalChemistry.LASER_HEIGHT-shift, cpos.getZ()+0.5);
GlStateManager.color(0f,1f,0.5f,1f);
GL11.glVertex3d(pos.getX()+0.5, pos.getY()+FundamentalChemistry.LASER_HEIGHT-shift, pos.getZ()+0.5);
}
}
}
}
GL11.glEnd();
GlStateManager.shadeModel(shade_model);
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
GlStateManager.popAttrib();
}
示例14: onRender
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void onRender(float partialTicks)
{
if(pos == null)
return;
// GL settings
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glLineWidth(2);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glPushMatrix();
GL11.glTranslated(-mc.getRenderManager().renderPosX,
-mc.getRenderManager().renderPosY,
-mc.getRenderManager().renderPosZ);
// generate rainbow color
float x = System.currentTimeMillis() % 2000 / 1000F;
float red = 0.5F + 0.5F * WMath.sin(x * (float)Math.PI);
float green = 0.5F + 0.5F * WMath.sin((x + 4F / 3F) * (float)Math.PI);
float blue = 0.5F + 0.5F * WMath.sin((x + 8F / 3F) * (float)Math.PI);
GL11.glColor4f(red, green, blue, 0.5F);
// tracer line
GL11.glBegin(GL11.GL_LINES);
{
// set start position
Vec3d start = RotationUtils.getClientLookVec()
.addVector(0, WMinecraft.getPlayer().getEyeHeight(), 0)
.addVector(mc.getRenderManager().renderPosX,
mc.getRenderManager().renderPosY,
mc.getRenderManager().renderPosZ);
// set end position
Vec3d end = new Vec3d(pos).addVector(0.5, 0.5, 0.5);
// draw line
GL11.glVertex3d(start.xCoord, start.yCoord, start.zCoord);
GL11.glVertex3d(end.xCoord, end.yCoord, end.zCoord);
}
GL11.glEnd();
// block box
{
GL11.glPushMatrix();
GL11.glTranslated(pos.getX(), pos.getY(), pos.getZ());
RenderUtils.drawOutlinedBox();
GL11.glColor4f(red, green, blue, 0.25F);
RenderUtils.drawSolidBox();
GL11.glPopMatrix();
}
GL11.glPopMatrix();
// GL resets
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
示例15: onRender
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@EventTarget
private void onRender(final Render3DEvent event) {
GlStateManager.pushMatrix();
final float[] rainbowArray = this.getRainbow();
for (Object o : this.mc.theWorld.loadedEntityList) {
Entity ent = (Entity)o;
if (!this.farmHunt) {
if (!(ent instanceof EntityPlayer) && !(ent instanceof EntityMob)) {
continue;
}
if (ent instanceof EntityPlayer && !this.players) {
continue;
}
if (ent instanceof EntityMob && !this.monsters) {
continue;
}
}
if ((!(ent instanceof EntityLivingBase) || ((EntityLivingBase)ent).getMaxHealth() <= 20.0f || ((EntityLivingBase)ent).isInvisible() || ent instanceof EntityHorse) && this.farmHunt) {
continue;
}
if (!ent.isEntityAlive()) {
continue;
}
final double x = this.getDiff(ent.lastTickPosX, ent.posX, event.partialTicks, RenderManager.renderPosX);
final double y = this.getDiff(ent.lastTickPosY, ent.posY, event.partialTicks, RenderManager.renderPosY);
final double z = this.getDiff(ent.lastTickPosZ, ent.posZ, event.partialTicks, RenderManager.renderPosZ);
if (FriendManager.isFriend(ent.getName())) {
GL11.glColor3f(0.27f, 0.7f, 0.92f);
if (this.rainbow) {
GL11.glColor3f(rainbowArray[0], rainbowArray[1], rainbowArray[2]);
}
}
else {
final float distance = this.mc.thePlayer.getDistanceToEntity(ent);
if (distance <= 32.0f) {
GL11.glColor3f(distance / 32.0f, 0.0f, 0.0f);
}
else {
GL11.glColor3f(0.9f, 0.0f, 0.0f);
}
}
GL11.glLoadIdentity();
final boolean bobbing = this.mc.gameSettings.viewBobbing;
this.mc.gameSettings.viewBobbing = false;
this.mc.entityRenderer.orientCamera(event.partialTicks);
GL11.glLineWidth(1.2f);
GL11.glBegin(3);
GL11.glVertex3d(0.0, (double)this.mc.thePlayer.getEyeHeight(), 0.0);
GL11.glVertex3d(x, y, z);
GL11.glVertex3d(x, y + ent.getEyeHeight(), z);
GL11.glEnd();
this.mc.gameSettings.viewBobbing = bobbing;
}
GlStateManager.popMatrix();
}