List of usage examples for org.lwjgl.opengl GL11 glRotated
public static native void glRotated(@NativeType("GLdouble") double angle, @NativeType("GLdouble") double x, @NativeType("GLdouble") double y, @NativeType("GLdouble") double z);
From source file:cn.academy.misc.client.render.RendererMagHook.java
License:Open Source License
@Override public void doRender(Entity ent, double x, double y, double z, float a, float b) { EntityMagHook hook = (EntityMagHook) ent; IModelCustom realModel = model;/*from w w w .j a va 2s . co m*/ if (hook.isHit) { realModel = model_open; hook.preRender(); x = hook.posX - RenderManager.renderPosX; y = hook.posY - RenderManager.renderPosY; z = hook.posZ - RenderManager.renderPosZ; } GL11.glPushMatrix(); RenderUtils.loadTexture(ACClientProps.TEX_MDL_MAGHOOK); GL11.glTranslated(x, y, z); GL11.glRotated(-hook.rotationYaw + 90, 0, 1, 0); GL11.glRotated(hook.rotationPitch - 90, 0, 0, 1); double scale = 0.0054; GL11.glScaled(scale, scale, scale); realModel.renderAll(); GL11.glPopMatrix(); }
From source file:cn.academy.misc.client.render.RendererRayBase.java
License:Open Source License
@Override public final void doRender(Entity var1, double x, double y, double z, float h, float a) { long time = Minecraft.getSystemTime(); T er = (T) var1; if (!er.isLoaded()) { return;//www. j ava2 s . co m } er.beforeRender(); x = er.posX - RenderManager.renderPosX; y = er.posY - RenderManager.renderPosY; z = er.posZ - RenderManager.renderPosZ; EntityPlayer clientPlayer = Minecraft.getMinecraft().thePlayer; boolean firstPerson = Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && clientPlayer.equals(er.getSpawner()); double len = er.getDisplayRayLen(); //System.out.println(firstPerson); if (er.doesFollowSpawner()) { //Pos injection, for better viewing effect x = 0; y = 0; z = 0; } GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); if (disableLight) GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); { GL11.glTranslated(x, y, z); GL11.glRotated(er.rotationYaw, 0, -1, 0); GL11.glRotated(er.rotationPitch, 1, 0, 0); GL11.glColor4d(1, 1, 1, alpha * er.getAlpha()); if (firstPerson) { if (er.isNearPlayer()) transformFirstPerson(er, x, y, z); } else { if (er.isNearPlayer()) transformThirdPerson(er, x, y, z); optimizeView(er, x, y, z); } if (disableLight) { OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); Tessellator.instance.setBrightness(15728880); } drawAtOrigin(er, len, firstPerson); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:cn.academy.misc.client.render.RendererRayTiling.java
License:Open Source License
@Override protected void drawAtOrigin(T ent, double len, boolean h) { //len = Math.min(len, 20.0); double width = h ? widthFp : widthTp; double forw = width * ratio; //per billboard forward in distance. int i = 0;/*from w w w . ja va 2 s. c om*/ //System.out.println("d-" + dist); for (double cur = 0.0; cur < len; cur += forw) { RenderUtils.loadTexture(nextTexture(ent, i)); int rotation = i % 2 == 0 ? 30 : 0; GL11.glPushMatrix(); { double u0 = 0.0, u1 = Math.min(1.0, (len - cur) / forw), v0 = 0.0, v1 = 1.0; double z0 = cur, z1 = Math.min(len, cur + forw); sv(verts[0], 0, -0.5 * width, z0); sv(verts[1], 0, 0.5 * width, z0); sv(verts[2], 0, 0.5 * width, z1); sv(verts[3], 0, -0.5 * width, z1); drawPerBillboard(ent, i); billboard(u0, v0, u1, v1); if (crossed) { GL11.glRotated(90, 0, 0, 1); billboard(u0, v0, u1, v1); } i++; } GL11.glPopMatrix(); } }
From source file:cn.academy.misc.client.render.RenderMarker.java
License:Open Source License
@Override public void doRender(Entity ent, double x, double y, double z, float a, float b) { EntityMarker marker = (EntityMarker) ent; Entity targ = marker.target;/* w w w . ja va 2s .co m*/ double width = targ.width, height = targ.height; Tessellator t = Tessellator.instance; if (targ != null) { GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glPushMatrix(); GL11.glTranslated(x - width / 2, y, z - width / 2); GL11.glColor4d(marker.r, marker.g, marker.b, marker.a); for (int i = 0; i < 8; ++i) { GL11.glPushMatrix(); boolean rev = i < 4; double sx = width * mulArray[i][0], sy = height * mulArray[i][1], sz = width * mulArray[i][2]; final double len = 0.2 * width; GL11.glTranslated(sx, sy, sz); GL11.glRotated(rotArray[i], 0, 1, 0); GL11.glColor4d(marker.r, marker.g, marker.b, marker.a); GL11.glLineWidth(3f); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); t.startDrawing(GL11.GL_LINES); t.setBrightness(15728880); t.addVertex(0, 0, 0); t.addVertex(0, rev ? len : -len, 0); t.addVertex(0, 0, 0); t.addVertex(len, 0, 0); t.addVertex(0, 0, 0); t.addVertex(0, 0, len); t.draw(); GL11.glPushMatrix(); GL11.glScaled(0.1, 0.1, 0.1); //ACModels.MDL_SOLAR.renderAll(); GL11.glPopMatrix(); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); } }
From source file:cn.academy.terminal.client.TerminalUI.java
License:GNU General Public License
@Override public void draw(ScaledResolution sr) { //Frame update selection = (int) ((mouseY - 0.01) / MAX_MY * 3) * 3 + (int) ((mouseX - 0.01) / MAX_MX * 3); if (mouseY == 0) { mouseY = 1;// w ww . j av a 2 s.c om if (scroll > 0) scroll--; } if (mouseY == MAX_MY) { mouseY -= 1; if (scroll < getMaxScroll()) scroll++; } //Draw Minecraft mc = Minecraft.getMinecraft(); long time = GameTimer.getTime(); if (lastFrameTime == 0) lastFrameTime = time; long dt = time - lastFrameTime; mouseX += helper.dx * SENSITIVITY; mouseY -= helper.dy * SENSITIVITY; mouseX = Math.max(0, Math.min(MAX_MX, mouseX)); mouseY = Math.max(0, Math.min(MAX_MY, mouseY)); buffX = balance(dt, buffX, mouseX); buffY = balance(dt, buffY, mouseY); helper.dx = helper.dy = 0; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); float aspect = (float) mc.displayWidth / mc.displayHeight; GLU.gluPerspective(50, aspect, 1f, 100); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4d(1, 1, 1, 1); double scale = 1.0 / 310; GL11.glTranslated(.35 * aspect, 1.2, -4); GL11.glTranslated(1, -1.8, 0); GL11.glRotated(-1.6, 0, 0, 1); GL11.glRotated(-18 - 4 * (buffX / MAX_MX - 0.5) + 1 * Math.sin(time / 1000.0), 0, 1, 0); GL11.glRotated(7 + 4 * (buffY / MAX_MY - 0.5), 1, 0, 0); //DEBUG CODE // GL11.glPointSize(20); // GL11.glColor4d(1, 1, 1, 1); // GL11.glDisable(GL11.GL_TEXTURE_2D); // GL11.glBegin(GL11.GL_POINTS); // GL11.glVertex3f(0, 0, 0); // GL11.glEnd(); // GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glTranslated(-1, 1.8, 0); GL11.glScaled(scale, -scale, scale); gui.draw(mouseX, mouseY); { GL11.glPushMatrix(); double csize = (getSelectedApp() == null ? 1 : 1.3) * (20 + Math.sin(time / 300.0) * 2); RenderUtils.loadTexture(CURSOR); GL11.glColor4d(1, 1, 1, .4); GL11.glTranslated(0, 0, -2); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); HudUtils.rect(-csize / 2 + buffX, -csize / 2 + buffY + 120, csize, csize); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glCullFace(GL11.GL_BACK); }
From source file:cn.academy.vanilla.electromaster.client.effect.SubArcHandler.java
License:GNU General Public License
public void drawAll() { Iterator<SubArc> iter = list.iterator(); GL11.glDepthMask(false);//from w w w.j a v a 2 s. c o m while (iter.hasNext()) { SubArc arc = iter.next(); if (!arc.dead && arc.draw) { GL11.glPushMatrix(); RenderUtils.glTranslate(arc.pos); GL11.glRotated(arc.rotZ, 0, 0, 1); GL11.glRotated(arc.rotY, 0, 1, 0); GL11.glRotated(arc.rotX, 1, 0, 0); final double scale = 0.3; GL11.glScaled(scale, scale, scale); GL11.glTranslated(-arcs[arc.texID].length / 2, 0, 0); arcs[arc.texID].draw(); GL11.glPopMatrix(); } } GL11.glDepthMask(true); }
From source file:cn.academy.vanilla.electromaster.client.renderer.RendererCoinThrowing.java
License:GNU General Public License
@Override public void doRender(Entity var1, double x, double y, double z, float var8, float var9) { EntityCoinThrowing etc = (EntityCoinThrowing) var1; EntityPlayer player = etc.player;/*w w w. j av a2 s .com*/ boolean fp = player == Minecraft.getMinecraft().thePlayer && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0; double dt = GameTimer.getTime() % 150; if (etc.player == null) return; //If syncedSingle and in client computer, do not render if (etc.isSync && player == Minecraft.getMinecraft().thePlayer) return; if (etc.posY < player.posY) return; GL11.glPushMatrix(); { //x = player.posX - RenderManager.renderPosX; //y = etc.posY - RenderManager.renderPosY; //z = player.posZ - RenderManager.renderPosZ; if (player == Minecraft.getMinecraft().thePlayer) { x = z = 0; } GL11.glTranslated(x, y, z); if (fp) { GL11.glRotated(player.rotationYaw, 0, -1, 0); } else GL11.glRotated(player.renderYawOffset, 0, -1, 0); GL11.glTranslated(-0.63, -0.60, 0.30); float scale = 0.3F; GL11.glScalef(scale, scale, scale); GL11.glTranslated(0.5, 0.5, 0); GL11.glRotated((dt * 360.0 / 300.0), etc.axis.xCoord, etc.axis.yCoord, etc.axis.zCoord); GL11.glTranslated(-0.5, -0.5, 0); RenderUtils.drawEquippedItem(0.0625, Resources.TEX_COIN_FRONT, Resources.TEX_COIN_BACK); } GL11.glPopMatrix(); }
From source file:cn.academy.vanilla.electromaster.client.renderer.RendererMagHook.java
License:GNU General Public License
@Override public void doRender(Entity ent, double x, double y, double z, float a, float b) { EntityMagHook hook = (EntityMagHook) ent; IModelCustom realModel = model;/*from w ww . ja v a 2s. co m*/ if (hook.isHit) { realModel = model_open; hook.preRender(); x = hook.posX - RenderManager.renderPosX; y = hook.posY - RenderManager.renderPosY; z = hook.posZ - RenderManager.renderPosZ; } GL11.glPushMatrix(); RenderUtils.loadTexture(texture); GL11.glTranslated(x, y, z); GL11.glRotated(-hook.rotationYaw + 90, 0, 1, 0); GL11.glRotated(hook.rotationPitch - 90, 0, 0, 1); double scale = 0.0054; GL11.glScaled(scale, scale, scale); realModel.renderAll(); GL11.glPopMatrix(); }
From source file:cn.academy.vanilla.teleporter.client.MarkRender.java
License:GNU General Public License
@Override public void doRender(Entity ent, double x, double y, double z, float var8, float var9) { if (RenderUtils.isInShadowPass()) return;//from w ww .jav a 2s. c om EntityTPMarking mark = (EntityTPMarking) ent; if (!mark.firstUpdated()) return; int texID = (int) ((mark.ticksExisted / 2.5) % tex.length); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glPushMatrix(); { GL11.glTranslated(x, y, z); GL11.glRotated(-mark.rotationYaw, 0, 1, 0); GL11.glScaled(-1, -1, 1); ShaderSimple.instance().useProgram(); RenderUtils.loadTexture(tex[texID]); if (!mark.available) { GL11.glColor4d(1, 0.2, 0.2, 1); } else { GL11.glColor4d(1, 1, 1, 1); } model.draw(); GL20.glUseProgram(0); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:cn.academy.vanilla.teleporter.client.RenderMarker.java
License:GNU General Public License
protected void renderMark(float width, float height) { for (int i = 0; i < 8; ++i) { GL11.glPushMatrix();/*from w ww . j av a2s . co m*/ boolean rev = i < 4; double sx = width * mulArray[i][0], sy = height * mulArray[i][1], sz = width * mulArray[i][2]; final double len = 0.2 * width; GL11.glTranslated(sx, sy, sz); GL11.glRotated(rotArray[i], 0, 1, 0); GL11.glLineWidth(3f); t.startDrawing(GL11.GL_LINES); t.setBrightness(15728880); t.addVertex(0, 0, 0); t.addVertex(0, rev ? len : -len, 0); t.addVertex(0, 0, 0); t.addVertex(len, 0, 0); t.addVertex(0, 0, 0); t.addVertex(0, 0, len); t.draw(); GL11.glPopMatrix(); } }