From fd0d864cb8bd547b40fe295e4cb4416ee9efbb4a Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 8 Oct 2025 08:14:57 +0900 Subject: [PATCH] Fixed icosphere generator --- core/assets/shaders/unlit.vert | 4 ++-- core/src/mindustry/graphics/g3d/MeshBuilder.java | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/assets/shaders/unlit.vert b/core/assets/shaders/unlit.vert index a75a12fe59..83c20e9864 100755 --- a/core/assets/shaders/unlit.vert +++ b/core/assets/shaders/unlit.vert @@ -8,6 +8,6 @@ uniform mat4 u_trans; varying vec4 v_col; void main(){ - v_col = a_color; - gl_Position = u_proj * u_trans * a_position; + v_col = a_color; + gl_Position = u_proj * u_trans * a_position; } diff --git a/core/src/mindustry/graphics/g3d/MeshBuilder.java b/core/src/mindustry/graphics/g3d/MeshBuilder.java index 11ac762e61..a7c82787f4 100644 --- a/core/src/mindustry/graphics/g3d/MeshBuilder.java +++ b/core/src/mindustry/graphics/g3d/MeshBuilder.java @@ -15,7 +15,7 @@ public class MeshBuilder{ public static Mesh buildIcosphere(int divisions, float radius){ MeshResult result = Icosphere.create(divisions); - Mesh mesh = begin(result.vertices.size / 3, result.indices.size, false, false); + Mesh mesh = begin(result.vertices.size / 3, result.indices.size, false, false, false); if(result.vertices.size >= 65535) throw new RuntimeException("Due to index size limits, only meshes with a maximum of 65535 vertices are supported. If you want more than that, make your own non-indexed mesh builder."); @@ -193,6 +193,10 @@ public class MeshBuilder{ } private static Mesh begin(int vertices, int indices, boolean normal, boolean emissive){ + return begin(vertices, indices, normal, emissive, true); + } + + private static Mesh begin(int vertices, int indices, boolean normal, boolean emissive, boolean color){ Seq attributes = Seq.with( VertexAttribute.position3 ); @@ -202,7 +206,9 @@ public class MeshBuilder{ attributes.add(packNormals ? VertexAttribute.packedNormal : VertexAttribute.normal); } - attributes.add(VertexAttribute.color); + if(color){ + attributes.add(VertexAttribute.color); + } if(emissive){ attributes.add(new VertexAttribute(4, GL20.GL_UNSIGNED_BYTE, true, "a_emissive"));