Advertisement
Guest User

Untitled

a guest
Sep 8th, 2017
95
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None
  1. @ConfigSerializable
  2. public class NoiseMapConfiguration {
  3. @Setting
  4. private List<Double> frequencies;
  5. @Setting
  6. private List<Double> weights;
  7. private double[] freq;
  8. private double[] w;
  9. private boolean shouldInit;
  10.  
  11.  
  12. public NoiseMapConfiguration(double[] frequencies, double[] weights) {
  13. this.frequencies = Doubles.asList(frequencies);
  14. this.frequencies = Doubles.asList(weights);
  15. shouldInit = true;
  16. }
  17. private void init() {
  18. if(shouldInit) {
  19. System.out.println(frequencies.toString());
  20. freq = Doubles.toArray(frequencies);
  21. w = Doubles.toArray(weights);
  22. shouldInit=false;
  23. }
  24. }
  25.  
  26. public NoiseMap getMultiFrequencyNoiseMap(long seed) {
  27. init();
  28. return NoiseMapFactory.MakeSimplexNoiseMap(freq, w, seed);
  29. }
  30.  
  31. public NoiseMap getMultiFrequencyNoiseMap(Vector2i vec) {
  32. init();
  33. long seed = HashCodeOperations.createVectorSeed(vec);
  34. return NoiseMapFactory.MakeSimplexNoiseMap(freq, w, seed);
  35. }
Advertisement
RAW Paste Data Copied
Advertisement