This commit is contained in:
Anuken
2020-05-10 13:34:52 -04:00
parent dabc891791
commit 2cb9cfb097
17 changed files with 65 additions and 58 deletions

View File

@@ -2,6 +2,7 @@ package mindustry.graphics.g3d;
import arc.graphics.*;
import arc.math.*;
import arc.util.*;
import mindustry.graphics.*;
import mindustry.graphics.Shaders.*;
import mindustry.type.*;
@@ -9,25 +10,19 @@ import mindustry.type.*;
public class SunMesh extends ShaderSphereMesh{
public int octaves = 5;
public float falloff = 0.5f, scale = 1f, power = 1.3f, magnitude = 0.6f, speed = 99999999999f, spread = 1.3f, seed = Mathf.random(9999f);
public float[] colorValues;
public Texture colors;
public SunMesh(Planet planet, int divisions){
super(planet, Shaders.sun, divisions);
}
public void setColors(Color... colors){
setColors(1f, colors);
}
public void setColors(float scl, Color... colors){
colorValues = new float[colors.length*4];
for(int i = 0; i < colors.length; i ++){
colorValues[i*4] = colors[i].r * scl;
colorValues[i*4 + 1] = colors[i].g * scl;
colorValues[i*4 + 2] = colors[i].b * scl;
colorValues[i*4 + 3] = colors[i].a * scl;
Pixmap pix = new Pixmap(colors.length, 1);
for(int i = 0; i < colors.length; i++){
pix.draw(i, 0, Tmp.c1.set(colors[i]).mul(scl));
}
this.colors = new Texture(pix);
pix.dispose();
}
@Override
@@ -40,6 +35,12 @@ public class SunMesh extends ShaderSphereMesh{
s.magnitude = magnitude;
s.speed = speed;
s.seed = seed;
s.colorValues = colorValues;
s.colors = colors;
}
@Override
public void dispose(){
super.dispose();
colors.dispose();
}
}