This commit is contained in:
Anuken
2021-06-20 09:50:25 -04:00
parent 5d74795c02
commit 448d1e2c77
27 changed files with 63 additions and 84 deletions

View File

@@ -10,27 +10,29 @@ public class IndexedRenderer implements Disposable{
private static final int vsize = 5;
private final Shader program = new Shader(
"attribute vec4 a_position;\n" +
"attribute vec4 a_color;\n" +
"attribute vec2 a_texCoord0;\n" +
"uniform mat4 u_projTrans;\n" +
"varying vec4 v_color;\n" +
"varying vec2 v_texCoords;\n" +
"""
attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;
uniform mat4 u_projTrans;
varying vec4 v_color;
varying vec2 v_texCoords;
void main(){
v_color = a_color;
v_color.a = v_color.a * (255.0/254.0);
v_texCoords = a_texCoord0;
gl_Position = u_projTrans * a_position;
}
""",
"void main(){\n" +
" v_color = a_color;\n" +
" v_color.a = v_color.a * (255.0/254.0);\n" +
" v_texCoords = a_texCoord0;\n" +
" gl_Position = u_projTrans * a_position;\n" +
"}",
"varying lowp vec4 v_color;\n" +
"varying vec2 v_texCoords;\n" +
"uniform sampler2D u_texture;\n" +
"void main(){\n" +
" gl_FragColor = v_color * texture2D(u_texture, v_texCoords);\n" +
"}"
"""
varying lowp vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
void main(){
gl_FragColor = v_color * texture2D(u_texture, v_texCoords);
}
"""
);
private Mesh mesh;
private float[] tmpVerts = new float[vsize * 6];

View File

@@ -396,7 +396,7 @@ public class Voronoi{
private void clipLine(Edge e){
float pxmin, pxmax, pymin, pymax;
Site s1, s2;
float x1 = 0, x2 = 0, y1 = 0, y2 = 0;
float x1, x2, y1, y2;
x1 = e.reg[0].coord.x;
x2 = e.reg[1].coord.x;

View File

@@ -14,7 +14,7 @@ public class NoiseMesh extends HexMesh{
this.mesh = MeshBuilder.buildHex(new HexMesher(){
@Override
public float getHeight(Vec3 position){
return (float)Simplex.noise3d(planet.id + seed, octaves, persistence, scale, 5f + position.x, 5f + position.y, 5f + position.z) * mag;
return Simplex.noise3d(planet.id + seed, octaves, persistence, scale, 5f + position.x, 5f + position.y, 5f + position.z) * mag;
}
@Override