mirror of
https://github.com/GTNewHorizons/EnderCore.git
synced 2026-11-27 23:33:12 +00:00
prepare for vertex array usage (#21)
* prepare for vertex array usage * spotlessApply (#22) Co-authored-by: GitHub GTNH Actions <> * use c style for loop --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
2 files changed
+59
No files matched your search
@@ -376,6 +376,24 @@ public class RenderUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void addVerticesToTessellator(Vertex[] vertices, Tessellator tes) {
|
||||
for (int i = 0; i < vertices.length; i++) {
|
||||
if (vertices[i].brightness != -1) {
|
||||
tes.setBrightness(vertices[i].brightness);
|
||||
}
|
||||
if (vertices[i].color != null) {
|
||||
tes.setColorRGBA_F(vertices[i].r(), vertices[i].g(), vertices[i].b(), vertices[i].a());
|
||||
}
|
||||
if (vertices[i].uv != null) {
|
||||
tes.setTextureUV(vertices[i].u(), vertices[i].v());
|
||||
}
|
||||
if (vertices[i].normal != null) {
|
||||
tes.setNormal(vertices[i].nx(), vertices[i].ny(), vertices[i].nz());
|
||||
}
|
||||
tes.addVertex(vertices[i].x(), vertices[i].y(), vertices[i].z());
|
||||
}
|
||||
}
|
||||
|
||||
public static void renderConnectedTextureFace(IBlockAccess blockAccess, Block block, int x, int y, int z,
|
||||
ForgeDirection face, IIcon texture, boolean forceAllEdges) {
|
||||
renderConnectedTextureFace(blockAccess, block, x, y, z, face, texture, forceAllEdges, true, true);
|
||||
|
||||
@@ -3,6 +3,11 @@ package com.enderio.core.common.vecmath;
|
||||
public class Vertex {
|
||||
|
||||
public Vector3d xyz = new Vector3d();
|
||||
|
||||
/*
|
||||
* some parts of EIO are relying on nulls as special values, can't just pre allocate new objects and set them when
|
||||
* required, unless everything relying on nulls is rewritten
|
||||
*/
|
||||
public Vector2f uv = null;
|
||||
public Vector3f normal = null;
|
||||
public Vector4f color = null;
|
||||
@@ -76,6 +81,42 @@ public class Vertex {
|
||||
this.brightness = brightness;
|
||||
}
|
||||
|
||||
public void set(Vertex other) {
|
||||
xyz.set(other.xyz);
|
||||
|
||||
if (other.uv != null) {
|
||||
if (uv == null) {
|
||||
uv = new Vector2f(other.uv);
|
||||
} else {
|
||||
uv.set(other.uv);
|
||||
}
|
||||
} else {
|
||||
uv = null;
|
||||
}
|
||||
|
||||
if (other.normal != null) {
|
||||
if (normal == null) {
|
||||
normal = new Vector3f(other.normal);
|
||||
} else {
|
||||
normal.set(other.normal);
|
||||
}
|
||||
} else {
|
||||
normal = null;
|
||||
}
|
||||
|
||||
if (other.color != null) {
|
||||
if (color == null) {
|
||||
color = new Vector4f(other.color);
|
||||
} else {
|
||||
color.set(other.color);
|
||||
}
|
||||
} else {
|
||||
color = null;
|
||||
}
|
||||
|
||||
brightness = other.brightness;
|
||||
}
|
||||
|
||||
public Vector4f getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user