Example usage for org.lwjgl.opengl GL11 glRotatef

List of usage examples for org.lwjgl.opengl GL11 glRotatef

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glRotatef.

Prototype

public static native void glRotatef(@NativeType("GLfloat") float angle, @NativeType("GLfloat") float x,
        @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);

Source Link

Document

Manipulates the current matrix with a rotation matrix.

Usage

From source file:io.github.javamatrix.randomtech.renderers.RenderSmithy.java

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
    // Grab the cast-down entity.
    TileSmithy smithy = (TileSmithy) te;

    // First we'll render the metal.
    if (smithy.state == 1) {
        ResourceLocation texture = new ResourceLocation("This is just so Eclipse doesn't freak.");

        if (smithy.metalType == 1) {
            texture = new ResourceLocation("randomtech", "textures/blocks/oreCubeIron.png");
        } else if (smithy.metalType == 2) {
            texture = new ResourceLocation("randomtech", "textures/blocks/oreCubeGold.png");
        } else if (smithy.metalType == 3) {
            texture = new ResourceLocation("randomtech", "textures/blocks/oreCubeNullium.png");
        }// w  ww.j  a  v  a2 s  . c  o m

        ModelOreCube model = new ModelOreCube();

        boolean airAbove = smithy.getWorldObj().getBlock(smithy.xCoord, smithy.yCoord + 1, smithy.zCoord)
                .getMaterial() == Material.air;

        GL11.glPushMatrix();
        GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
        Minecraft.getMinecraft().renderEngine.bindTexture(texture);
        GL11.glPushMatrix();

        GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
        if (!airAbove) {
            GL11.glScalef(0.75f, 0.75f, 0.75f);
            GL11.glTranslatef(0.0f, 3.0f / 16.0f, 0.0f);
        }

        float maxProgress = 200.0f;

        if (smithy.metalType == 3) {
            // Nullium takes longer to melt.
            maxProgress = 600.0f;
        }

        float p = smithy.getProgress() / maxProgress;
        GL11.glColor3f(1, 1 - p / 1.5F, 1 - p);
        model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
        GL11.glColor3f(1, 1, 1);
        GL11.glPopMatrix();
        GL11.glPopMatrix();
    } else if (smithy.state == 2) {
        GL11.glPushMatrix();
        float var10 = (float) (x - 0.5F);
        float var11 = (float) (y - 0.5F);
        float var12 = (float) (z - 0.5F);
        GL11.glTranslatef(var10, var11 + 0.05f, var12);
        renderItem(smithy, new ItemStack(RandomTechItems.moltenIngot));
        GL11.glPopMatrix();
    } else if (smithy.state == 3) {
        GL11.glPushMatrix();
        float var10 = (float) (x - 0.5F);
        float var11 = (float) (y - 0.5F);
        float var12 = (float) (z - 0.5F);
        GL11.glTranslatef(var10, var11 + 0.05f, var12);
        if (smithy.metalType == 1) {
            renderItem(smithy, new ItemStack(RandomTechItems.hardenedMetalIngot));
        } else if (smithy.metalType == 2) {
            renderItem(smithy, new ItemStack(RandomTechItems.hardenedMagicalIngot));
        }
        GL11.glPopMatrix();
    }
}

From source file:io.github.javamatrix.randomtech.renderers.RenderSmithy.java

void renderItem(TileSmithy smithy, ItemStack stack) {
    FancyEntityItem entityitem = new FancyEntityItem(smithy.getWorldObj(), stack);
    entityitem.getEntityItem().stackSize = 1;
    entityitem.hoverStart = 0.0F;/*from ww  w .ja v a2  s  . c  o m*/
    GL11.glPushMatrix();
    GL11.glTranslatef(1F, 1.5F, 0.6F);
    GL11.glRotatef(90F, 1, 0F, 0F);
    GL11.glScalef(1.8F, 1.8F, 1.8F);
    if (stack.getItem() instanceof ItemBlock) {
        GL11.glRotatef(90F, -1, 0F, 0F);
        GL11.glTranslatef(0F, -0.1F, 0.2275F);
    }

    RenderItem.renderInFrame = true;
    RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
    RenderItem.renderInFrame = false;

    GL11.glPopMatrix();
}

From source file:io.github.SolidStudiosTeam.Flicker.engine.camera.FirstPersonCamera.java

License:Open Source License

public void lookThrough() {
    //roatate the pitch around the X axis
    GL11.glRotatef(pitch, 1.0f, 0.0f, 0.0f);
    //roatate the yaw around the Y axis
    GL11.glRotatef(yaw, 0.0f, 1.0f, 0.0f);
    //translate to the position vector's location
    GL11.glTranslatef(position.x, position.y, position.z);
}

From source file:io.root.gfx.glutils.GL.java

License:Apache License

public static void glRotatef(float angle, float x, float y, float z) {
    GL11.glRotatef(angle, x, y, z);
}

From source file:ion2d.INNode.java

License:Open Source License

/**
 * Applies the transformation for the current node
 *///from   ww w  .  j  av  a 2 s .c  om
public void transform() {
    GL11.glMultMatrix(INMath.AffineToGL(this.nodeToParentTransform()));

    if (this.vertexZ >= 0 || this.vertexZ <= 0) {
        GL11.glTranslatef(0, 0, this.vertexZ);
    }

    if (this.camera != null && !(this.grid != null && this.grid.getActive())) {
        boolean translate = (this.anchorPointInPixel.x != 0.0f || this.anchorPointInPixel.y != 0.0f);

        if (translate) {
            GL11.glTranslatef(this.anchorPointInPixel.x, this.anchorPointInPixel.y, 0);
        }

        this.camera.locate();

        if (translate) {
            GL11.glTranslatef(-this.anchorPointInPixel.x, -this.anchorPointInPixel.y, 0);
        }
    } else {
        if (this.isRelativeAnchorePoint && (this.anchorPointInPixel.x != 0 || this.anchorPointInPixel.y != 0)) {
            GL11.glTranslatef(-this.anchorPointInPixel.x, -this.anchorPointInPixel.y, 0);
        }

        if (this.anchorPointInPixel.x != 0 || this.anchorPointInPixel.y != 0) {
            GL11.glTranslatef(this.position.x + this.anchorPointInPixel.x,
                    this.position.y + this.anchorPointInPixel.y, this.vertexZ);
        } else if (this.position.x != 0 || this.position.y != 0 || this.vertexZ != 0) {
            GL11.glTranslatef(this.position.x, this.position.y, this.vertexZ);
        }

        if (this.rotation != 0.0f) {
            GL11.glRotatef(-this.rotation, 0.0f, 0.0f, 1.0f);
        }

        if (this.scaleX != 1.0f || this.scaleY != 1.0f) {
            GL11.glScalef(this.scaleX, this.scaleY, 1.0f);
        }

        if (this.camera != null && !(this.grid != null && this.grid.getActive())) {
            this.camera.locate();
        }

        if (this.anchorPointInPixel.x != 0.0f || this.anchorPointInPixel.y != 0.0f) {
            GL11.glTranslatef(-this.anchorPointInPixel.x, -this.anchorPointInPixel.y, 0);
        }
    }
}

From source file:ivorius.ivtoolkit.bezier.IvBezierPath3DRendererText.java

License:Apache License

public void render(IvBezierPath3D path) {
    if (path.isDirty()) {
        path.buildDistances();/*from   w  ww  .  jav a2  s  . com*/
    }

    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);

    String plainText = "";
    ArrayList<String> modifiers = new ArrayList<>();
    modifiers.add("");

    for (int i = 0; i < text.length(); i++) {
        char character = text.charAt(i);

        if (character == '\u00A7' && i + 1 < text.length()) {
            modifiers.set(modifiers.size() - 1, modifiers.get(modifiers.size() - 1) + text.substring(i, i + 2));
            i++;
        } else {
            plainText = plainText + character;
            modifiers.add(modifiers.get(modifiers.size() - 1));
        }
    }

    for (int i = 0; i < plainText.length(); i++) {
        int charIndex = inwards ? i : plainText.length() - i - 1;
        char character = plainText.charAt(charIndex);

        if (character != ' ') {
            double totalProgress = (spreadToFill ? ((double) i / (double) text.length()) : (i * 0.5)) + shift;
            double finalProgress = ((totalProgress % 1.0) + 1.0) % 1.0;

            if (finalProgress >= capBottom && finalProgress <= capTop) {
                IvBezierPoint3DCachedStep cachedStep = path.getCachedStep(finalProgress);
                double[] position = cachedStep.getPosition();
                double[] rotation = path.getNaturalRotation(cachedStep, 0.01);

                double red = IvMathHelper.mix(cachedStep.getLeftPoint().getRed(),
                        cachedStep.getRightPoint().getRed(), cachedStep.getInnerProgress());
                double green = IvMathHelper.mix(cachedStep.getLeftPoint().getGreen(),
                        cachedStep.getRightPoint().getGreen(), cachedStep.getInnerProgress());
                double blue = IvMathHelper.mix(cachedStep.getLeftPoint().getBlue(),
                        cachedStep.getRightPoint().getBlue(), cachedStep.getInnerProgress());
                double alpha = IvMathHelper.mix(cachedStep.getLeftPoint().getAlpha(),
                        cachedStep.getRightPoint().getAlpha(), cachedStep.getInnerProgress());

                double textSize = IvMathHelper.mix(cachedStep.getLeftPoint().getFontSize(),
                        cachedStep.getRightPoint().getFontSize(), cachedStep.getInnerProgress());

                GL11.glPushMatrix();
                GL11.glTranslated(position[0], position[1], position[2]);
                GL11.glScaled(-textSize / 12.0, -textSize / 12.0, -textSize / 12.0);
                GL11.glRotatef((float) rotation[0] + (inwards ? 0.0f : 180.0f), 0.0f, 1.0f, 0.0f);
                GL11.glRotatef((float) rotation[1], 1.0f, 0.0f, 0.0f);
                fontRenderer.drawString(modifiers.get(charIndex) + character, 0, 0,
                        ((int) (red * 255.0) << 16) + ((int) (green * 255.0) << 8) + ((int) (blue * 255.0)));
                GL11.glPopMatrix();
            }
        }
    }

    GL11.glDisable(GL11.GL_BLEND);
}

From source file:ivorius.ivtoolkit.blocks.IvMultiBlockRenderHelper.java

License:Apache License

public static void transformFor(IvTileEntityMultiBlock tileEntity, double renderX, double renderY,
        double renderZ) {
    double[] center = tileEntity.getActiveCenterCoords();

    GL11.glTranslated(renderX + center[0] - tileEntity.xCoord, renderY + center[1] - tileEntity.yCoord,
            renderZ + center[2] - tileEntity.zCoord);
    GL11.glRotatef(-90.0f * tileEntity.direction + 180.0f, 0.0f, 1.0f, 0.0f);
}

From source file:ivorius.ivtoolkit.blocks.IvRotatableBlockRenderHelper.java

License:Apache License

public static void transformFor(IvTileEntityRotatable tileEntity, double renderX, double renderY,
        double renderZ) {
    GL11.glTranslated(renderX + 0.5, renderY + 0.5, renderZ + 0.5);
    GL11.glRotatef(-90.0f * tileEntity.direction + 180.0f, 0.0f, 1.0f, 0.0f);
}

From source file:ivorius.ivtoolkit.items.IvItemRendererModel.java

License:Apache License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();/*from w  w w  .  j  a v a 2 s .c  o  m*/

    if (type == ItemRenderType.ENTITY)
        GL11.glTranslated(0.0, 1.0, 0.0);
    else if (type == ItemRenderType.INVENTORY)
        GL11.glTranslated(0.0, 0.3, 0.0);
    else
        GL11.glTranslated(0.5, 1.0, 0.5);

    GL11.glTranslatef(translation[0], translation[1] + 1.0f, translation[2]);

    if (type != ItemRenderType.ENTITY) {
        float modelScale = 1.0f / modelSize;
        GL11.glScalef(modelScale, modelScale, modelScale);
    }

    GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
    GL11.glRotatef(rotation[0], 1.0f, 0.0f, 0.0f);
    GL11.glRotatef(rotation[1], 0.0f, 1.0f, 0.0f);
    GL11.glRotatef(rotation[2], 0.0f, 0.0f, 1.0f);

    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);

    Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
    model.render(item);

    GL11.glPopMatrix();
}

From source file:ivorius.ivtoolkit.items.IvItemRendererModelCustom.java

License:Apache License

@Override
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();/*  w  w w  . ja  v a 2  s  .c  o m*/

    if (type == IItemRenderer.ItemRenderType.ENTITY)
        GL11.glTranslated(0.0, 1.0, 0.0);
    else if (type == IItemRenderer.ItemRenderType.INVENTORY)
        GL11.glTranslated(0.0, 0.3, 0.0);
    else
        GL11.glTranslated(0.5, 1.0, 0.5);

    GL11.glTranslatef(translation[0], translation[1] + 1.0f, translation[2]);

    if (type != IItemRenderer.ItemRenderType.ENTITY) {
        float modelScale = 1.0f / modelSize;
        GL11.glScalef(modelScale, modelScale, modelScale);
    }

    GL11.glRotatef(rotation[0], 1.0f, 0.0f, 0.0f);
    GL11.glRotatef(rotation[1], 0.0f, 1.0f, 0.0f);
    GL11.glRotatef(rotation[2], 0.0f, 0.0f, 1.0f);

    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);

    Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
    model.render(item);

    GL11.glPopMatrix();
}