本文整理汇总了Java中net.minecraft.client.renderer.vertex.VertexFormatElement类的典型用法代码示例。如果您正苦于以下问题:Java VertexFormatElement类的具体用法?Java VertexFormatElement怎么用?Java VertexFormatElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VertexFormatElement类属于net.minecraft.client.renderer.vertex包,在下文中一共展示了VertexFormatElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapFormats
import net.minecraft.client.renderer.vertex.VertexFormatElement; //导入依赖的package包/类
public static int[] mapFormats(VertexFormat from, VertexFormat to)
{
int fromCount = from.getElementCount();
int toCount = to.getElementCount();
int[] eMap = new int[fromCount];
for(int e = 0; e < fromCount; e++)
{
VertexFormatElement expected = from.getElement(e);
int e2;
for(e2 = 0; e2 < toCount; e2++)
{
VertexFormatElement current = to.getElement(e2);
if(expected.getUsage() == current.getUsage() && expected.getIndex() == current.getIndex())
{
break;
}
}
eMap[e] = e2;
}
return eMap;
}
示例2: putVertex
import net.minecraft.client.renderer.vertex.VertexFormatElement; //导入依赖的package包/类
private static void putVertex(UnpackedBakedQuad.Builder builder, VertexFormat format, EnumFacing face, Vertex5 vert, Colour colour) {
for (int e = 0; e < format.getElementCount(); e++) {
VertexFormatElement element = format.getElement(e);
switch (element.getUsage()) {
case POSITION:
Vector3 vec = vert.vec;
builder.put(e, (float) vec.x, (float) vec.y, (float) vec.z, 1);
break;
case NORMAL:
builder.put(e, face.getFrontOffsetX(), face.getFrontOffsetY(), face.getFrontOffsetZ(), 0);
break;
case COLOR:
builder.put(e, (colour.r & 0xFF) / 255F, (colour.g & 0xFF) / 255F, (colour.b & 0xFF) / 255F, (colour.a & 0xFF) / 255F);
break;
case UV:
UV uv = vert.uv;
builder.put(e, (float) uv.u, (float) uv.v, 0, 1);
break;
default:
builder.put(e);
break;
}
}
}
示例3: shadeQuadFaces
import net.minecraft.client.renderer.vertex.VertexFormatElement; //导入依赖的package包/类
public static List<BakedQuad> shadeQuadFaces(List<BakedQuad> quads) {
LinkedList<BakedQuad> shadedQuads = new LinkedList<>();
for (BakedQuad quad : quads) {
int[] rawData = quad.getVertexData();
for (int v = 0; v < 4; v++) {
for (int e = 0; e < quad.getFormat().getElementCount(); e++) {
VertexFormatElement element = quad.getFormat().getElement(e);
if (element.getUsage() == EnumUsage.COLOR) {
float[] data = new float[4];
LightUtil.unpack(rawData, data, quad.getFormat(), v, e);
data = diffuseFaceLight(quad.getFace(), data);
LightUtil.pack(data, rawData, quad.getFormat(), v, e);
}
}
}
shadedQuads.add(new BakedQuad(rawData, quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(), quad.getFormat()));
}
return shadedQuads;
}
示例4: applyVertexDataForType
import net.minecraft.client.renderer.vertex.VertexFormatElement; //导入依赖的package包/类
private void applyVertexDataForType(int index, VertexFormatElement.EnumUsage type, UnpackedBakedQuad.Builder builder) {
switch (type) {
case POSITION:
builder.put(index, x, y, z, 1);
break;
case UV:
builder.put(index, u, v, 0, 1);
break;
case COLOR:
builder.put(index, r, g, b, a);
break;
case NORMAL:
builder.put(index, nX, nY, nZ, 0);
break;
case PADDING:
//TODO: figure this one out
builder.put(index);
break;
case GENERIC:
//TODO: figure this one out
builder.put(index);
}
}
示例5: transformUnpackedVertexDataElement
import net.minecraft.client.renderer.vertex.VertexFormatElement; //导入依赖的package包/类
public final void transformUnpackedVertexDataElement(VertexFormatElement.EnumUsage type, float[] data, Vector4f temp) {
switch (type) {
case POSITION:
case NORMAL:
this.matrices.transform(data[0], data[1], data[2], 1, temp);
data[0] = temp.x;
data[1] = temp.y;
data[2] = temp.z;
break;
case COLOR:
data[0] = getRed();
data[1] = getGreen();
data[2] = getBlue();
data[3] = getAlpha();
break;
}
}
示例6: put
import net.minecraft.client.renderer.vertex.VertexFormatElement; //导入依赖的package包/类
@Override
public void put(int elementIndex, float... data) {
ei = elementIndex;
VertexFormatElement element = getVertexFormat().getElement(elementIndex);
if (elementIndex == 0) {
vertex++;
}
/** @see net.minecraftforge.client.model.obj.OBJModel.OBJBakedModel#putVertexData */
if (element == DefaultVertexFormats.POSITION_3F) {
pos(data[0], data[1], data[2]);
} else if (element == DefaultVertexFormats.COLOR_4UB) {
color((char) data[0], (char) data[1], (char) data[2], (char) data[3]);
} else if (element == DefaultVertexFormats.TEX_2F) {
tex(data[0], data[1]);
} else if (element == DefaultVertexFormats.NORMAL_3B) {
normal((byte) data[0], (byte) data[1], (byte) data[2]);
} else {
bakery.put(ei, data);
}
}
示例7: BWBakedModel
import net.minecraft.client.renderer.vertex.VertexFormatElement; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public BWBakedModel(@SuppressWarnings("deprecation") IBakedModel wrapped, VertexFormat format) {
this.wrapped = wrapped;
this.format = format;
this.matrix.translate(-0.5, -0.5, -0.5);
if (!((List<VertexFormatElement>) format.getElements()).stream().anyMatch(VertexFormatElement::isPositionElement))
return; // VertexFormat doesn't have a position
getGeneralQuads().stream()
.map(this::quadToFace)
.forEachOrdered(faces::add);
Arrays.stream(Direction.VALID_DIRECTIONS)
.map(this::getFaceQuads)
.flatMap(Collection::stream)
.map(this::quadToFace)
.forEachOrdered(faces::add);
}
示例8: RenderSkyVC
import net.minecraft.client.renderer.vertex.VertexFormatElement; //导入依赖的package包/类
public RenderSkyVC() {
Minecraft mcIn = Minecraft.getMinecraft();
world = mcIn.theWorld;
this.mc = mcIn;
this.renderManager = mcIn.getRenderManager();
this.renderEngine = mcIn.getTextureManager();
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
GlStateManager.bindTexture(0);
this.vboEnabled = OpenGlHelper.useVbo();
this.vertexBufferFormat = new VertexFormat();
this.vertexBufferFormat.setElement(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3));
this.generateSky();
this.generateSky2();
}
示例9: addQuad
import net.minecraft.client.renderer.vertex.VertexFormatElement; //导入依赖的package包/类
private void addQuad(final UnpackedBakedQuad.Builder builder, EnumFacing face, TextureAtlasSprite sprite, Vertex position, Vertex texture) {
for (int e = 0; e < format.getElementCount(); e++) {
final VertexFormatElement el = format.getElement(e);
switch (el.getUsage()) {
case POSITION:
builder.put(e, position.x, position.y, position.z);
break;
case NORMAL:
builder.put(e, face.getFrontOffsetX(), face.getFrontOffsetY(), face.getFrontOffsetZ());
break;
case COLOR:
builder.put(e, 1, 1, 1, 1);
break;
case UV:
if (el.getIndex() == 0) {
builder.put(e, sprite.getInterpolatedU(16 * texture.u), sprite.getInterpolatedV(16 * texture.v));
} else {
builder.put(e, 0, 0);
}
break;
default:
builder.put(e);
}
}
}
示例10: getElements
import net.minecraft.client.renderer.vertex.VertexFormatElement; //导入依赖的package包/类
public List<RealmsVertexFormatElement> getElements()
{
List<RealmsVertexFormatElement> list = new ArrayList();
for (VertexFormatElement vertexformatelement : this.v.getElements())
{
list.add(new RealmsVertexFormatElement(vertexformatelement));
}
return list;
}
示例11: func_181667_k
import net.minecraft.client.renderer.vertex.VertexFormatElement; //导入依赖的package包/类
private void func_181667_k()
{
++this.field_181678_g;
this.field_181678_g %= this.vertexFormat.getElementCount();
this.field_181677_f = this.vertexFormat.getElement(this.field_181678_g);
if (this.field_181677_f.getUsage() == VertexFormatElement.EnumUsage.PADDING)
{
this.func_181667_k();
}
}
示例12: RenderGlobal
import net.minecraft.client.renderer.vertex.VertexFormatElement; //导入依赖的package包/类
public RenderGlobal(Minecraft mcIn)
{
this.mc = mcIn;
this.renderManager = mcIn.getRenderManager();
this.renderEngine = mcIn.getTextureManager();
this.renderEngine.bindTexture(locationForcefieldPng);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
GlStateManager.bindTexture(0);
this.updateDestroyBlockIcons();
this.vboEnabled = OpenGlHelper.useVbo();
if (this.vboEnabled)
{
this.renderContainer = new VboRenderList();
this.renderChunkFactory = new VboChunkFactory();
}
else
{
this.renderContainer = new RenderList();
this.renderChunkFactory = new ListChunkFactory();
}
this.vertexBufferFormat = new VertexFormat();
this.vertexBufferFormat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3));
this.generateStars();
this.generateSky();
this.generateSky2();
}
示例13: makeDefVertexFormatBlock
import net.minecraft.client.renderer.vertex.VertexFormatElement; //导入依赖的package包/类
public static VertexFormat makeDefVertexFormatBlock()
{
VertexFormat vertexformat = new VertexFormat();
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.COLOR, 4));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2));
vertexformat.func_181721_a(new VertexFormatElement(1, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.UV, 2));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.PADDING, 2));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4));
return vertexformat;
}
示例14: makeDefVertexFormatItem
import net.minecraft.client.renderer.vertex.VertexFormatElement; //导入依赖的package包/类
public static VertexFormat makeDefVertexFormatItem()
{
VertexFormat vertexformat = new VertexFormat();
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.COLOR, 4));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 2));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.PADDING, 2));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4));
return vertexformat;
}
示例15: makeDefVertexFormatTextured
import net.minecraft.client.renderer.vertex.VertexFormatElement; //导入依赖的package包/类
public static VertexFormat makeDefVertexFormatTextured()
{
VertexFormat vertexformat = new VertexFormat();
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.PADDING, 4));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 2));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.PADDING, 2));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4));
return vertexformat;
}