List of usage examples for org.lwjgl.opengl GL11 glTranslatef
public static native void glTranslatef(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java
License:Mozilla Public License
private void drawDepthCube(Node node, float depth) { if (node.isSelected) { loadColor(ColorType.BOUNDS_SELECTION); drawDepth(node, -mDepth, GL11.GL_FILL); loadColor(ColorType.BOUNDS_NORMAL); drawDepth(node, -depth, GL11.GL_LINE); return;// w ww.j ava 2s. c o m } final Drawable background = node.getBackground(); final Drawable content = node.getContent(); final boolean hasBackground = node.isBackgroundShown && (background.displayListId != -1); final boolean hasContent = node.isContentShown && (content.displayListId != -1); if (hasBackground && hasContent) { // Draw both. float halfDepth = mDepth / 2.0f; GL11.glTranslatef(0.0f, 0.0f, -halfDepth); loadColor(ColorType.LAYER_BACKGROUND); drawDepth(node, -halfDepth, GL11.GL_FILL); GL11.glTranslatef(0.0f, 0.0f, halfDepth); loadColor(ColorType.LAYER_CONTENT); drawDepth(node, -halfDepth, GL11.GL_FILL); } else if (hasContent) { loadColor(ColorType.LAYER_CONTENT); drawDepth(node, -mDepth, GL11.GL_FILL); } else if (hasBackground) { loadColor(ColorType.LAYER_BACKGROUND); drawDepth(node, -mDepth, GL11.GL_FILL); } else { loadColor(ColorType.LAYER_NONE); drawDepth(node, -mDepth, GL11.GL_FILL); } // Draw a boundary. loadColor(ColorType.BOUNDS_NORMAL); drawDepth(node, -depth, GL11.GL_LINE); }
From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java
License:Mozilla Public License
private void drawHierarchy(Node node) { if (node == null || node.bounds.width == 0 || node.bounds.height == 0 || !node.isShowing() || !node.isVisible()) {/*from w w w .j a va 2 s. com*/ return; } // Give a 3d depth. GL11.glPushMatrix(); final float depth = node.depth * mDepth; // Node's translation. GL11.glTranslatef(node.bounds.x, -node.bounds.y, depth); final Drawable background = node.getBackground(); final Drawable content = node.getContent(); final boolean hasBackground = node.isBackgroundShown && (background.displayListId != -1); final boolean hasContent = node.isContentShown && (content.displayListId != -1); if (mIsPicking) { GL11.glColor4f(node.pickColor[0], node.pickColor[1], node.pickColor[2], node.pickColor[3]); drawFrontFace(node, 0.0f, GL11.GL_FILL); // Draw the depth, only if we show in actual mode. // If not, if we are splitting content, draw a layer for it. if (mShowDepth) { drawDepth(node, -mDepth, GL11.GL_FILL); } else if (mSplitContent && hasBackground && hasContent) { drawFrontFace(node, -mDepth / 2.0f, GL11.GL_FILL); } } else { if (!mIsOrtho && mShowDepth) { GL11.glPushAttrib(GL11.GL_STENCIL_BUFFER_BIT); GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP); drawDepthCube(node, depth); GL11.glPopAttrib(); } if (hasBackground && hasContent) { // Both background and content are available. // Draw background at a depth if needed. if (mSplitContent) GL11.glTranslatef(0.0f, 0.0f, -mDepth / 2.0f); GL11.glCallList(background.displayListId); if (mSplitContent) GL11.glTranslatef(0.0f, 0.0f, mDepth / 2.0f); GL11.glCallList(content.displayListId); } else if (hasBackground) { GL11.glCallList(background.displayListId); } else if (hasContent) { GL11.glCallList(content.displayListId); } // Stencil shouldn't know about bounds. GL11.glPushAttrib(GL11.GL_STENCIL_BUFFER_BIT | GL11.GL_LINE_BIT); GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP); // Show bounds. if (!mIsOrtho && mShowDepth) { loadColor(ColorType.BOUNDS_NORMAL); } else { if (node.isSelected) { GL11.glLineWidth(2.0f); loadColor(ColorType.BOUNDS_SELECTION); } else { loadColor(ColorType.BOUNDS_NORMAL); } } if (node.isSelected || !mIsOrtho || mShowBounds) { drawFrontFace(node, 0.0f, GL11.GL_LINE); } // Show a bounding box for split content in perspective mode. if (!mIsOrtho && !mShowDepth && mSplitContent && hasBackground && hasContent) { drawFrontFace(node, -mDepth / 2.0f, GL11.GL_LINE); } GL11.glPopAttrib(); } for (Node child : node.children) { drawHierarchy(child); } GL11.glPopMatrix(); }
From source file:com.stormister.rediscovered.RenderBlockChair.java
License:Open Source License
@Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -1.5F, -0.5F); GL11.glScalef(1.0F, 1.0F, 1.0F);/*from w ww.ja v a 2 s.co m*/ TileEntityRendererDispatcher.instance.renderTileEntityAt(this.egg, 0.0D, 1.0D, 0.0D, 0.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); }
From source file:com.stormister.rediscovered.RenderBlockLecternOpen.java
License:Open Source License
@Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -3.0F, -0.5F); GL11.glScalef(1.0F, 1.0F, 1.0F);//from www . jav a2 s.c om TileEntityRendererDispatcher.instance.renderTileEntityAt(this.egg, 0.0D, 1.0D, 0.0D, 0.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); }
From source file:com.stormister.rediscovered.RenderItemRedEgg.java
License:Open Source License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { if (type == IItemRenderer.ItemRenderType.ENTITY) GL11.glTranslatef(-0.5F, 0.0F, -0.5F); this.render.renderTileEntityAt(this.entity, 0.0D, 0.0D, 0.0D, 0.0F); }
From source file:com.stormister.rediscovered.RenderTileEntityChair.java
License:Open Source License
public void renderAModelAt(TileEntityChair tile, double d, double d1, double d2, float f) { int rotation = 0; if (tile != null && tile.hasWorldObj()) { rotation = tile.getBlockMetadata(); }/*ww w .jav a 2 s .c om*/ this.bindTexture(field_110871_a); GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); GL11.glScalef(1.0F, -1F, -1F); GL11.glRotatef(rotation * 90, 0.0F, 1.0F, 0.0F); model.renderAll(); GL11.glPopMatrix(); //end }
From source file:com.stormister.rediscovered.RenderTileEntityLockedChest.java
License:Open Source License
public void renderAModelAt(TileEntityLockedChest tile, double d, double d1, double d2, float f) { int rotation = 0; if (tile != null && tile.hasWorldObj()) { rotation = tile.getBlockMetadata(); }//from w w w .j a v a2 s . c o m this.bindTexture(field_110871_a); GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); GL11.glScalef(1.0F, -1F, -1F); GL11.glRotatef(rotation * 90, 0.0F, 1.0F, 0.0F); model.renderAll(); GL11.glPopMatrix(); //end }
From source file:com.stormister.rediscovered.RenderTileEntityRedEgg.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tile, double d, double d1, double d2, float f) { GL11.glPushMatrix();/* www . j av a 2s.com*/ GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); GL11.glRotatef(180, 0.0F, 0.0F, 1F); this.bindTexture(field_110871_a); GL11.glPushMatrix(); this.model.renderAll(); GL11.glPopMatrix(); GL11.glPopMatrix(); //end }
From source file:com.stormister.rediscovered.RenderTileEntitySpikes.java
License:Open Source License
public void renderAModelAt(TileEntitySpikes tile, double d, double d1, double d2, float f) { int rotation = 0; if (tile != null && tile.hasWorldObj()) { rotation = tile.getBlockMetadata(); }//from ww w .j av a 2 s.co m this.bindTexture(field_110871_a); GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); GL11.glScalef(1.0F, -1F, -1F); GL11.glRotatef(rotation * 90, 0.0F, 1.0F, 0.0F); model.renderAll(); GL11.glPopMatrix(); //end }
From source file:com.stormister.rediscovered.RenderTileEntitySpikesSide.java
License:Open Source License
public void renderAModelAt(TileEntitySpikesSide tile, double d, double d1, double d2, float f) { int rotation = 0; if (tile != null && tile.hasWorldObj()) { rotation = tile.getBlockMetadata(); }/*w w w .j ava 2s .co m*/ this.bindTexture(field_110871_a); GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); GL11.glScalef(1.0F, -1F, -1F); GL11.glRotatef(rotation * 90, 0.0F, 1.0F, 0.0F); model.renderAll(); GL11.glPopMatrix(); //end }