Search in sources :

Example 6 with ModelRenderer

use of net.minecraft.client.model.ModelRenderer in project Engine by VoltzEngine-Project.

the class FixedTechneModel method renderOnlyAroundPivot.

public void renderOnlyAroundPivot(double angle, double rotX, double rotY, double rotZ, String... groupNames) {
    GL11.glPushMatrix();
    setup();
    bindTexture();
    Iterator<Entry<String, ModelRenderer>> it = parts.entrySet().iterator();
    while (it.hasNext()) {
        Entry<String, ModelRenderer> entry = it.next();
        for (String groupName : groupNames) {
            if (entry.getKey().equalsIgnoreCase(groupName)) {
                GL11.glPushMatrix();
                ModelRenderer model = entry.getValue();
                GL11.glTranslatef(model.rotationPointX / 16, model.rotationPointY / 16, model.rotationPointZ / 16);
                GL11.glRotated(angle, rotX, rotY, rotZ);
                GL11.glTranslatef(-model.rotationPointX / 16, -model.rotationPointY / 16, -model.rotationPointZ / 16);
                model.render(0.0625f);
                GL11.glPopMatrix();
            }
        }
    }
    GL11.glPopMatrix();
}
Also used : ZipEntry(java.util.zip.ZipEntry) Entry(java.util.Map.Entry) ModelRenderer(net.minecraft.client.model.ModelRenderer)

Example 7 with ModelRenderer

use of net.minecraft.client.model.ModelRenderer in project Trains-In-Motion-1.7.10 by EternalBlueFlame.

the class Bone method setAnglesToModels.

/**
	 * Sets the current angles of the Bone to the models attached to it.
	 */
public void setAnglesToModels() {
    for (ModelRenderer currentModel : models) {
        Angle3D baseAngles = modelBaseRot.get(currentModel);
        currentModel.rotateAngleX = baseAngles.angleX + absoluteAngles.angleX;
        currentModel.rotateAngleY = baseAngles.angleY + absoluteAngles.angleY;
        currentModel.rotateAngleZ = baseAngles.angleZ + absoluteAngles.angleZ;
        currentModel.rotationPointX = (float) positionVector.xCoord;
        currentModel.rotationPointY = (float) positionVector.yCoord;
        currentModel.rotationPointZ = (float) positionVector.zCoord;
    }
    for (Bone node : childNodes) {
        node.setAnglesToModels();
    }
}
Also used : ModelRenderer(net.minecraft.client.model.ModelRenderer)

Example 8 with ModelRenderer

use of net.minecraft.client.model.ModelRenderer in project Trains-In-Motion-1.7.10 by EternalBlueFlame.

the class ModelRendererTurbo method render.

/**
     * Renders the shape.
     * @param worldScale the scale of the shape. Usually is 0.0625.
     */
public void render(float worldScale) {
    if (field_1402_i & !showModel) {
        return;
    }
    if (!compiled || forcedRecompile) {
        compileDisplayList(worldScale);
    }
    if (rotateAngleX != 0.0F || rotateAngleY != 0.0F || rotateAngleZ != 0.0F) {
        GL11.glPushMatrix();
        GL11.glTranslatef(rotationPointX * worldScale, rotationPointY * worldScale, rotationPointZ * worldScale);
        if (rotateAngleZ != 0.0F) {
            GL11.glRotatef(rotateAngleZ * 57.29578F, 0.0F, 0.0F, 1.0F);
        }
        if (rotateAngleY != 0.0F) {
            GL11.glRotatef(rotateAngleY * 57.29578F, 0.0F, 1.0F, 0.0F);
        }
        if (rotateAngleX != 0.0F) {
            GL11.glRotatef(rotateAngleX * 57.29578F, 1.0F, 0.0F, 0.0F);
        }
        callDisplayList();
        if (childModels != null) {
            for (ModelRenderer model : childModels) {
                model.render(worldScale);
            }
        }
        GL11.glPopMatrix();
    } else if (rotationPointX != 0.0F || rotationPointY != 0.0F || rotationPointZ != 0.0F) {
        GL11.glTranslatef(rotationPointX * worldScale, rotationPointY * worldScale, rotationPointZ * worldScale);
        callDisplayList();
        if (childModels != null) {
            for (ModelRenderer model : childModels) {
                model.render(worldScale);
            }
        }
        GL11.glTranslatef(-rotationPointX * worldScale, -rotationPointY * worldScale, -rotationPointZ * worldScale);
    } else {
        callDisplayList();
        if (childModels != null) {
            for (ModelRenderer model : childModels) {
                model.render(worldScale);
            }
        }
    }
}
Also used : ModelRenderer(net.minecraft.client.model.ModelRenderer)

Example 9 with ModelRenderer

use of net.minecraft.client.model.ModelRenderer in project Railcraft by Railcraft.

the class ModelEngineTrunk method rotate.

public void rotate(float x, float y, float z) {
    for (ModelRenderer renderer : renderers) {
        renderer.rotateAngleX = x;
        renderer.rotateAngleY = y;
        renderer.rotateAngleZ = z;
    }
}
Also used : ModelRenderer(net.minecraft.client.model.ModelRenderer)

Example 10 with ModelRenderer

use of net.minecraft.client.model.ModelRenderer in project Engine by VoltzEngine-Project.

the class FixedTechneModel method renderPart.

@Override
public void renderPart(String partName) {
    ModelRenderer part = parts.get(partName);
    if (part != null) {
        GL11.glPushMatrix();
        setup();
        bindTexture();
        part.render(0.0625f);
        GL11.glPopMatrix();
    }
}
Also used : ModelRenderer(net.minecraft.client.model.ModelRenderer)

Aggregations

ModelRenderer (net.minecraft.client.model.ModelRenderer)10 ZipEntry (java.util.zip.ZipEntry)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 Entry (java.util.Map.Entry)1 ZipException (java.util.zip.ZipException)1 ZipInputStream (java.util.zip.ZipInputStream)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 ModelFormatException (net.minecraftforge.client.model.ModelFormatException)1 Document (org.w3c.dom.Document)1 NamedNodeMap (org.w3c.dom.NamedNodeMap)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1 SAXException (org.xml.sax.SAXException)1