本文整理汇总了Java中net.minecraft.client.model.PositionTextureVertex类的典型用法代码示例。如果您正苦于以下问题:Java PositionTextureVertex类的具体用法?Java PositionTextureVertex怎么用?Java PositionTextureVertex使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PositionTextureVertex类属于net.minecraft.client.model包,在下文中一共展示了PositionTextureVertex类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: draw
import net.minecraft.client.model.PositionTextureVertex; //导入依赖的package包/类
/**
* Draw this primitve. This is typically called only once as the generated drawing instructions are saved by the
* renderer and reused later.
*/
@SideOnly(Side.CLIENT)
public void draw(BufferBuilder renderer, float scale)
{
Vec3d vec3d = this.vertexPositions[1].vector3D.subtractReverse(this.vertexPositions[0].vector3D);
Vec3d vec3d1 = this.vertexPositions[1].vector3D.subtractReverse(this.vertexPositions[2].vector3D);
Vec3d vec3d2 = vec3d1.crossProduct(vec3d).normalize();
float f = (float)vec3d2.x;
float f1 = (float)vec3d2.y;
float f2 = (float)vec3d2.z;
renderer.begin(7, DefaultVertexFormats.POSITION_TEX);
for (int i = 0; i < 3; ++i)
{
PositionTextureVertex positiontexturevertex = this.vertexPositions[i];
renderer.pos(positiontexturevertex.vector3D.x * (double)scale, positiontexturevertex.vector3D.y * (double)scale, positiontexturevertex.vector3D.z * (double)scale).tex((double)positiontexturevertex.texturePositionX, (double)positiontexturevertex.texturePositionY).endVertex();
}
renderer.pos(this.vertexPositions[0].vector3D.x * (double)scale, this.vertexPositions[0].vector3D.y * (double)scale, this.vertexPositions[0].vector3D.z * (double)scale).endVertex();
Tessellator.getInstance().draw();
}
示例2: getVerticesForRect
import net.minecraft.client.model.PositionTextureVertex; //导入依赖的package包/类
/**
* Calculate the PositionTextureVertex from a rectangular box.
*
* @param x
* The X coordinate of the starting point of the box.
* @param y
* The Y coordinate of the starting point of the box.
* @param z
* The Z coordinate of the starting point of the box.
* @param dx
* The length of the box on the X axis.
* @param dy
* The length of the box on the Y axis.
* @param dz
* The length of the box on the Z axis.
* @param mirror
* True if the texture should be mirrored, False if it shouldn't.
* @return A 8 long array of PositionTextureVertex that can be used to
* create a rectangular box.
*/
public static PositionTextureVertex[] getVerticesForRect(float x, float y, float z, float dx, float dy, float dz, boolean mirror) {
PositionTextureVertex[] positionTextureVertex = new PositionTextureVertex[8];
float endX = x + dx;
float endY = y + dy;
float endZ = z + dz;
if (mirror) {
float buffer = endX;
endX = x;
x = buffer;
}
positionTextureVertex[0] = new PositionTextureVertex(x, y, z, 0.0F, 0.0F);
positionTextureVertex[1] = new PositionTextureVertex(endX, y, z, 0.0F, 0.0F);
positionTextureVertex[2] = new PositionTextureVertex(endX, endY, z, 0.0F, 0.0F);
positionTextureVertex[3] = new PositionTextureVertex(x, endY, z, 0.0F, 0.0F);
positionTextureVertex[4] = new PositionTextureVertex(x, y, endZ, 0.0F, 0.0F);
positionTextureVertex[5] = new PositionTextureVertex(endX, y, endZ, 0.0F, 0.0F);
positionTextureVertex[6] = new PositionTextureVertex(endX, endY, endZ, 0.0F, 0.0F);
positionTextureVertex[7] = new PositionTextureVertex(x, endY, endZ, 0.0F, 0.0F);
return positionTextureVertex;
}
示例3: generateCSModelRend
import net.minecraft.client.model.PositionTextureVertex; //导入依赖的package包/类
/** Generate CSModelRenderer from readed model block */
private CSModelRenderer generateCSModelRend(CSReadedModelBlock rBlock) {
CSModelRenderer modelRend = new CSModelRenderer(this, rBlock.getName(), rBlock.getTexOffset()[0], rBlock.getTexOffset()[1]);
if (rBlock.getVertex() != null) {
PositionTextureVertex vertices[] = new PositionTextureVertex[8];
for (int i = 0; i < 8; i++)
vertices[i] = new PositionTextureVertex(rBlock.getVertex()[i][0], rBlock.getVertex()[i][1], rBlock.getVertex()[i][2], 0.0F, 0.0F);
modelRend.addBox(vertices, CSModelBox.getTextureUVsForRect(rBlock.getTexOffset()[0], rBlock.getTexOffset()[1], rBlock.getSize().x,
rBlock.getSize().y, rBlock.getSize().z));
}
else
modelRend.addBox(-rBlock.getSize().x / 2, -rBlock.getSize().y / 2, -rBlock.getSize().z / 2, rBlock.getSize().x, rBlock.getSize().y,
rBlock.getSize().z);
modelRend.setDefaultRotationPoint(rBlock.getRotationPoint().x, rBlock.getRotationPoint().y, rBlock.getRotationPoint().z);
modelRend.setInitialRotationMatrix(rBlock.getRotation().x, rBlock.getRotation().y, rBlock.getRotation().z);
modelRend.setDefaultOffset(rBlock.getOffset().x, rBlock.getOffset().y, rBlock.getOffset().z);
modelRend.setDefaultStretch(rBlock.getStretch().x, rBlock.getStretch().y, rBlock.getStretch().z);
modelRend.setTextureSize(this.textureWidth, this.textureHeight);
return modelRend;
}
示例4: ModelRendererTurbo
import net.minecraft.client.model.PositionTextureVertex; //导入依赖的package包/类
public ModelRendererTurbo(ModelBase modelbase, String s) {
super(modelbase, s);
this.flip = false;
this.compiled = false;
this.displayList = 0;
this.mirror = false;
this.showModel = true;
this.field_1402_i = false;
this.vertices = new PositionTextureVertex[0];
this.faces = new TexturedPolygon[0];
this.forcedRecompile = false;
this.transformGroup = new HashMap<>();
this.transformGroup.put("0", new TransformGroupBone(new Bone(0, 0, 0, 0), 1D));
this.textureGroup = new HashMap<>();
this.textureGroup.put("0", new TextureGroup());
this.currentTextureGroup = this.textureGroup.get("0");
this.boxName = s;
this.defaultTexture = "";
this.useLegacyCompiler = false;
}
示例5: func_78236_a
import net.minecraft.client.model.PositionTextureVertex; //导入依赖的package包/类
public void func_78236_a(Tessellator p_78236_1_, float p_78236_2_) {
Vec3 var3 = this.field_78239_a[1].field_78243_a.func_72444_a(this.field_78239_a[0].field_78243_a);
Vec3 var4 = this.field_78239_a[1].field_78243_a.func_72444_a(this.field_78239_a[2].field_78243_a);
Vec3 var5 = var4.func_72431_c(var3).func_72432_b();
p_78236_1_.func_78382_b();
if(this.field_78238_c) {
p_78236_1_.func_78375_b(-((float)var5.field_72450_a), -((float)var5.field_72448_b), -((float)var5.field_72449_c));
} else {
p_78236_1_.func_78375_b((float)var5.field_72450_a, (float)var5.field_72448_b, (float)var5.field_72449_c);
}
for(int var6 = 0; var6 < 4; ++var6) {
PositionTextureVertex var7 = this.field_78239_a[var6];
p_78236_1_.func_78374_a((double)((float)var7.field_78243_a.field_72450_a * p_78236_2_), (double)((float)var7.field_78243_a.field_72448_b * p_78236_2_), (double)((float)var7.field_78243_a.field_72449_c * p_78236_2_), (double)var7.field_78241_b, (double)var7.field_78242_c);
}
p_78236_1_.func_78381_a();
}
示例6: draw
import net.minecraft.client.model.PositionTextureVertex; //导入依赖的package包/类
public void draw(final Tessellator par1Tessellator, final float par2, final IIcon icon)
{
final Vec3 vec3 = vertexPositions[1].vector3D.subtract(vertexPositions[0].vector3D);
final Vec3 vec31 = vertexPositions[1].vector3D.subtract(vertexPositions[2].vector3D);
final Vec3 vec32 = vec31.crossProduct(vec3).normalize();
par1Tessellator.startDrawingQuads();
if (invertNormal)
{
par1Tessellator.setNormal(-((float) vec32.xCoord), -((float) vec32.yCoord), -((float) vec32.zCoord));
}
else
{
par1Tessellator.setNormal((float) vec32.xCoord, (float) vec32.yCoord, (float) vec32.zCoord);
}
for (int i = 0; i < 4; ++i)
{
final PositionTextureVertex positiontexturevertex = vertexPositions[i];
par1Tessellator.addVertexWithUV((float) positiontexturevertex.vector3D.xCoord * par2, (float) positiontexturevertex.vector3D.yCoord * par2, (float) positiontexturevertex.vector3D.zCoord * par2, icon.getMinU(), icon.getMaxV());
}
par1Tessellator.draw();
}
示例7: draw
import net.minecraft.client.model.PositionTextureVertex; //导入依赖的package包/类
public void draw(final Tessellator par1Tessellator, final float par2, final Icon icon)
{
final Vec3 vec3 = vertexPositions[1].vector3D.subtract(vertexPositions[0].vector3D);
final Vec3 vec31 = vertexPositions[1].vector3D.subtract(vertexPositions[2].vector3D);
final Vec3 vec32 = vec31.crossProduct(vec3).normalize();
par1Tessellator.startDrawingQuads();
if (invertNormal)
{
par1Tessellator.setNormal(-((float) vec32.xCoord), -((float) vec32.yCoord), -((float) vec32.zCoord));
}
else
{
par1Tessellator.setNormal((float) vec32.xCoord, (float) vec32.yCoord, (float) vec32.zCoord);
}
for (int i = 0; i < 4; ++i)
{
final PositionTextureVertex positiontexturevertex = vertexPositions[i];
par1Tessellator.addVertexWithUV((float) positiontexturevertex.vector3D.xCoord * par2, (float) positiontexturevertex.vector3D.yCoord * par2, (float) positiontexturevertex.vector3D.zCoord * par2, icon.getMinU(), icon.getMaxV());
}
par1Tessellator.draw();
}
示例8: PositionTransformVertex
import net.minecraft.client.model.PositionTextureVertex; //导入依赖的package包/类
public PositionTransformVertex(PositionTextureVertex vertex, float u, float v) {
super(vertex, u, v);
if (vertex instanceof PositionTransformVertex)
this.neutralVector = ((PositionTransformVertex) vertex).neutralVector;
else
this.neutralVector = new Vec3d(vertex.vector3D.xCoord, vertex.vector3D.yCoord, vertex.vector3D.zCoord);
}
示例9: addPolygon
import net.minecraft.client.model.PositionTextureVertex; //导入依赖的package包/类
/**
* Creates a new polygon, and adds UV mapping to it.
*
* @param verts an array of vertices
* @param uv an array of UV coordinates
*/
public void addPolygon (PositionTextureVertex[] verts, int[][] uv) {
try {
for (int i = 0; i < verts.length; i++)
verts[i] = verts[i].setTexturePosition(uv[i][0] / this.textureWidth, uv[i][1] / this.textureHeight);
}
finally {
this.addPolygon(verts);
}
}
示例10: addRectShape
import net.minecraft.client.model.PositionTextureVertex; //导入依赖的package包/类
/**
* Adds a rectangular shape. Basically, you can make any eight-pointed shape you want, as
* the method requires eight vector coordinates.
*
* @param v a float array with three values, the x, y and z coordinates of the vertex
* @param v1 a float array with three values, the x, y and z coordinates of the vertex
* @param v2 a float array with three values, the x, y and z coordinates of the vertex
* @param v3 a float array with three values, the x, y and z coordinates of the vertex
* @param v4 a float array with three values, the x, y and z coordinates of the vertex
* @param v5 a float array with three values, the x, y and z coordinates of the vertex
* @param v6 a float array with three values, the x, y and z coordinates of the vertex
* @param v7 a float array with three values, the x, y and z coordinates of the vertex
* @param w the width of the shape, used in determining the texture
* @param h the height of the shape, used in determining the texture
* @param d the depth of the shape, used in determining the texture
*/
public void addRectShape (float[] v, float[] v1, float[] v2, float[] v3, float[] v4, float[] v5, float[] v6, float[] v7, int w, int h, int d) {
final PositionTextureVertex[] verts = new PositionTextureVertex[8];
final TexturedPolygon[] poly = new TexturedPolygon[6];
final PositionTextureVertex positionTexturevertex = new PositionTextureVertex(v[0], v[1], v[2], 0.0F, 0.0F);
final PositionTextureVertex positionTexturevertex1 = new PositionTextureVertex(v1[0], v1[1], v1[2], 0.0F, 8F);
final PositionTextureVertex positionTexturevertex2 = new PositionTextureVertex(v2[0], v2[1], v2[2], 8F, 8F);
final PositionTextureVertex positionTexturevertex3 = new PositionTextureVertex(v3[0], v3[1], v3[2], 8F, 0.0F);
final PositionTextureVertex positionTexturevertex4 = new PositionTextureVertex(v4[0], v4[1], v4[2], 0.0F, 0.0F);
final PositionTextureVertex positionTexturevertex5 = new PositionTextureVertex(v5[0], v5[1], v5[2], 0.0F, 8F);
final PositionTextureVertex positionTexturevertex6 = new PositionTextureVertex(v6[0], v6[1], v6[2], 8F, 8F);
final PositionTextureVertex positionTexturevertex7 = new PositionTextureVertex(v7[0], v7[1], v7[2], 8F, 0.0F);
verts[0] = positionTexturevertex;
verts[1] = positionTexturevertex1;
verts[2] = positionTexturevertex2;
verts[3] = positionTexturevertex3;
verts[4] = positionTexturevertex4;
verts[5] = positionTexturevertex5;
verts[6] = positionTexturevertex6;
verts[7] = positionTexturevertex7;
poly[0] = this.addPolygonReturn(new PositionTextureVertex[] { positionTexturevertex5, positionTexturevertex1, positionTexturevertex2, positionTexturevertex6 }, this.textureOffsetX + d + w, this.textureOffsetY + d, this.textureOffsetX + d + w + d, this.textureOffsetY + d + h);
poly[1] = this.addPolygonReturn(new PositionTextureVertex[] { positionTexturevertex, positionTexturevertex4, positionTexturevertex7, positionTexturevertex3 }, this.textureOffsetX + 0, this.textureOffsetY + d, this.textureOffsetX + d, this.textureOffsetY + d + h);
poly[2] = this.addPolygonReturn(new PositionTextureVertex[] { positionTexturevertex5, positionTexturevertex4, positionTexturevertex, positionTexturevertex1 }, this.textureOffsetX + d, this.textureOffsetY + 0, this.textureOffsetX + d + w, this.textureOffsetY + d);
poly[3] = this.addPolygonReturn(new PositionTextureVertex[] { positionTexturevertex2, positionTexturevertex3, positionTexturevertex7, positionTexturevertex6 }, this.textureOffsetX + d + w, this.textureOffsetY + 0, this.textureOffsetX + d + w + w, this.textureOffsetY + d);
poly[4] = this.addPolygonReturn(new PositionTextureVertex[] { positionTexturevertex1, positionTexturevertex, positionTexturevertex3, positionTexturevertex2 }, this.textureOffsetX + d, this.textureOffsetY + d, this.textureOffsetX + d + w, this.textureOffsetY + d + h);
poly[5] = this.addPolygonReturn(new PositionTextureVertex[] { positionTexturevertex4, positionTexturevertex5, positionTexturevertex6, positionTexturevertex7 }, this.textureOffsetX + d + w + d, this.textureOffsetY + d, this.textureOffsetX + d + w + d + w, this.textureOffsetY + d + h);
if (this.mirror ^ this.flip)
for (final TexturedPolygon element : poly)
element.flipFace();
this.copyTo(verts, poly);
}
示例11: addPixel
import net.minecraft.client.model.PositionTextureVertex; //导入依赖的package包/类
/**
* Adds a cube the size of one pixel. It will take a pixel from the texture and uses that
* as the texture of said cube. The accurate name would actually be "addVoxel". It will not
* overwrite the model data, but rather, it will add to the model.
*
* @param x the starting x-position
* @param y the starting y-position
* @param z the starting z-position
* @param scale the "scale" of the cube, where scale is a float integer consisting of three
* values
* @param w the x-coordinate on the texture
* @param h the y-coordinate on the texture
*/
public void addPixel (float x, float y, float z, float[] scale, int w, int h) {
final PositionTextureVertex[] verts = new PositionTextureVertex[8];
final TexturedPolygon[] poly = new TexturedPolygon[6];
final float x1 = x + scale[0];
final float y1 = y + scale[1];
final float z1 = z + scale[2];
final float[] f = { x, y, z };
final float[] f1 = { x1, y, z };
final float[] f2 = { x1, y1, z };
final float[] f3 = { x, y1, z };
final float[] f4 = { x, y, z1 };
final float[] f5 = { x1, y, z1 };
final float[] f6 = { x1, y1, z1 };
final float[] f7 = { x, y1, z1 };
final PositionTextureVertex positionTexturevertex = new PositionTextureVertex(f[0], f[1], f[2], 0.0F, 0.0F);
final PositionTextureVertex positionTexturevertex1 = new PositionTextureVertex(f1[0], f1[1], f1[2], 0.0F, 8F);
final PositionTextureVertex positionTexturevertex2 = new PositionTextureVertex(f2[0], f2[1], f2[2], 8F, 8F);
final PositionTextureVertex positionTexturevertex3 = new PositionTextureVertex(f3[0], f3[1], f3[2], 8F, 0.0F);
final PositionTextureVertex positionTexturevertex4 = new PositionTextureVertex(f4[0], f4[1], f4[2], 0.0F, 0.0F);
final PositionTextureVertex positionTexturevertex5 = new PositionTextureVertex(f5[0], f5[1], f5[2], 0.0F, 8F);
final PositionTextureVertex positionTexturevertex6 = new PositionTextureVertex(f6[0], f6[1], f6[2], 8F, 8F);
final PositionTextureVertex positionTexturevertex7 = new PositionTextureVertex(f7[0], f7[1], f7[2], 8F, 0.0F);
verts[0] = positionTexturevertex;
verts[1] = positionTexturevertex1;
verts[2] = positionTexturevertex2;
verts[3] = positionTexturevertex3;
verts[4] = positionTexturevertex4;
verts[5] = positionTexturevertex5;
verts[6] = positionTexturevertex6;
verts[7] = positionTexturevertex7;
poly[0] = this.addPolygonReturn(new PositionTextureVertex[] { positionTexturevertex5, positionTexturevertex1, positionTexturevertex2, positionTexturevertex6 }, w, h, w + 1, h + 1);
poly[1] = this.addPolygonReturn(new PositionTextureVertex[] { positionTexturevertex, positionTexturevertex4, positionTexturevertex7, positionTexturevertex3 }, w, h, w + 1, h + 1);
poly[2] = this.addPolygonReturn(new PositionTextureVertex[] { positionTexturevertex5, positionTexturevertex4, positionTexturevertex, positionTexturevertex1 }, w, h, w + 1, h + 1);
poly[3] = this.addPolygonReturn(new PositionTextureVertex[] { positionTexturevertex2, positionTexturevertex3, positionTexturevertex7, positionTexturevertex6 }, w, h, w + 1, h + 1);
poly[4] = this.addPolygonReturn(new PositionTextureVertex[] { positionTexturevertex1, positionTexturevertex, positionTexturevertex3, positionTexturevertex2 }, w, h, w + 1, h + 1);
poly[5] = this.addPolygonReturn(new PositionTextureVertex[] { positionTexturevertex4, positionTexturevertex5, positionTexturevertex6, positionTexturevertex7 }, w, h, w + 1, h + 1);
this.copyTo(verts, poly);
}
示例12: addModel
import net.minecraft.client.model.PositionTextureVertex; //导入依赖的package包/类
/**
* Adds model format support. Model files use the entire texture file.
*
* @param file the location of the model file. The location is relative to the base
* directories, which are either resources/models or resources/mods/models.
* @param modelFormat the class of the model format interpreter
*/
public void addModel (String file, Class modelFormat) {
final ModelPoolEntry entry = ModelPool.addFile(file, modelFormat, this.transformGroup, this.textureGroup);
if (entry == null)
return;
final PositionTextureVertex[] verts = Arrays.copyOf(entry.vertices, entry.vertices.length);
final TexturedPolygon[] poly = Arrays.copyOf(entry.faces, entry.faces.length);
if (this.flip)
for (final TexturedPolygon face : this.faces)
face.flipFace();
this.copyTo(verts, poly, false);
}
示例13: addModelF
import net.minecraft.client.model.PositionTextureVertex; //导入依赖的package包/类
public void addModelF (String file, Class modelFormat) throws IOException {
final ModelPoolEntry entry = ModelPool.addFileF(file, modelFormat, this.transformGroup, this.textureGroup);
if (entry == null)
return;
final PositionTextureVertex[] verts = Arrays.copyOf(entry.vertices, entry.vertices.length);
final TexturedPolygon[] poly = Arrays.copyOf(entry.faces, entry.faces.length);
if (this.flip)
for (final TexturedPolygon face : this.faces)
face.flipFace();
this.copyTo(verts, poly, false);
}
示例14: doMirror
import net.minecraft.client.model.PositionTextureVertex; //导入依赖的package包/类
/**
* Mirrors the model in any direction.
*
* @param x whether the model should be mirrored in the x-direction
* @param y whether the model should be mirrored in the y-direction
* @param z whether the model should be mirrored in the z-direction
*/
public void doMirror (boolean x, boolean y, boolean z) {
for (final TexturedPolygon face : this.faces) {
final PositionTextureVertex[] verts = face.vertexPositions;
for (final PositionTextureVertex vert : verts)
/*
* verts[j].vector3D.xCoord *= (x ? -1 : 1); verts[j].vector3D.yCoord *= (y ?
* -1 : 1); verts[j].vector3D.zCoord *= (z ? -1 : 1);
*/
vert.vector3D.addVector(vert.vector3D.xCoord * (x ? -1 : 1), vert.vector3D.xCoord * (y ? -1 : 1), vert.vector3D.xCoord * (z ? -1 : 1));
if (x ^ y ^ z)
face.flipFace();
}
}
示例15: clear
import net.minecraft.client.model.PositionTextureVertex; //导入依赖的package包/类
/**
* Clears the current shape. Since all shapes are stacked into one shape, you can't just
* replace a shape by overwriting the shape with another one. In this case you would need
* to clear the shape first.
*/
public void clear () {
this.vertices = new PositionTextureVertex[0];
this.faces = new TexturedPolygon[0];
this.transformGroup.clear();
this.transformGroup.put("0", new TransformGroupBone(new Bone(0, 0, 0, 0), 1D));
this.currentGroup = this.transformGroup.get("0");
}