mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 02:36:59 +00:00
Hmmmmm
This commit is contained in:
parent
ddd29529ea
commit
c0991e46ec
@ -3,6 +3,7 @@ package com.volmit.iris;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.EventQueue;
|
import java.awt.EventQueue;
|
||||||
|
import java.awt.Font;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
@ -28,6 +29,7 @@ import com.volmit.iris.noise.CNG;
|
|||||||
import com.volmit.iris.object.NoiseStyle;
|
import com.volmit.iris.object.NoiseStyle;
|
||||||
import com.volmit.iris.util.Function2;
|
import com.volmit.iris.util.Function2;
|
||||||
import com.volmit.iris.util.GroupedExecutor;
|
import com.volmit.iris.util.GroupedExecutor;
|
||||||
|
import com.volmit.iris.util.J;
|
||||||
import com.volmit.iris.util.KList;
|
import com.volmit.iris.util.KList;
|
||||||
import com.volmit.iris.util.M;
|
import com.volmit.iris.util.M;
|
||||||
import com.volmit.iris.util.PrecisionStopwatch;
|
import com.volmit.iris.util.PrecisionStopwatch;
|
||||||
@ -39,11 +41,11 @@ public class NoiseView extends JPanel implements MouseWheelListener {
|
|||||||
private static final long serialVersionUID = 2094606939770332040L;
|
private static final long serialVersionUID = 2094606939770332040L;
|
||||||
|
|
||||||
static JComboBox<String> combo;
|
static JComboBox<String> combo;
|
||||||
RollingSequence r = new RollingSequence(20);
|
RollingSequence r = new RollingSequence(90);
|
||||||
boolean colorMode = true;
|
boolean colorMode = true;
|
||||||
double scale = 1;
|
double scale = 1;
|
||||||
static boolean hd = false;
|
static boolean hd = false;
|
||||||
double ascale = 10;
|
static double ascale = 10;
|
||||||
CNG cng = NoiseStyle.STATIC.create(new RNG(RNG.r.nextLong()));
|
CNG cng = NoiseStyle.STATIC.create(new RNG(RNG.r.nextLong()));
|
||||||
GroupedExecutor gx = new GroupedExecutor(Runtime.getRuntime().availableProcessors(), Thread.MAX_PRIORITY,
|
GroupedExecutor gx = new GroupedExecutor(Runtime.getRuntime().availableProcessors(), Thread.MAX_PRIORITY,
|
||||||
"Iris Renderer");
|
"Iris Renderer");
|
||||||
@ -52,11 +54,15 @@ public class NoiseView extends JPanel implements MouseWheelListener {
|
|||||||
int w = 0;
|
int w = 0;
|
||||||
int h = 0;
|
int h = 0;
|
||||||
static Function2<Double, Double, Color> renderer;
|
static Function2<Double, Double, Color> renderer;
|
||||||
double oxp = 0;
|
static double oxp = 0;
|
||||||
double ozp = 0;
|
static double ozp = 0;
|
||||||
double ox = 0;
|
double ox = 0;
|
||||||
double oz = 0;
|
double oz = 0;
|
||||||
boolean down = false;
|
double mx = 0;
|
||||||
|
double mz = 0;
|
||||||
|
static double mxx = 0;
|
||||||
|
static double mzz = 0;
|
||||||
|
static boolean down = false;
|
||||||
|
|
||||||
double lx = Double.MAX_VALUE;
|
double lx = Double.MAX_VALUE;
|
||||||
double lz = Double.MAX_VALUE;
|
double lz = Double.MAX_VALUE;
|
||||||
@ -74,6 +80,8 @@ public class NoiseView extends JPanel implements MouseWheelListener {
|
|||||||
|
|
||||||
lx = (cp.getX());
|
lx = (cp.getX());
|
||||||
lz = (cp.getY());
|
lz = (cp.getY());
|
||||||
|
mx = lx;
|
||||||
|
mz = lz;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -83,6 +91,7 @@ public class NoiseView extends JPanel implements MouseWheelListener {
|
|||||||
oz += (lz - cp.getY()) * scale;
|
oz += (lz - cp.getY()) * scale;
|
||||||
lx = cp.getX();
|
lx = cp.getX();
|
||||||
lz = cp.getY();
|
lz = cp.getY();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -134,10 +143,28 @@ public class NoiseView extends JPanel implements MouseWheelListener {
|
|||||||
ozp += Math.abs(ozp - oz) * 0.16;
|
ozp += Math.abs(ozp - oz) * 0.16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mx < mxx) {
|
||||||
|
mxx -= Math.abs(mx - mxx) * 0.16;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mx > mxx) {
|
||||||
|
mxx += Math.abs(mxx - mx) * 0.16;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mz < mzz) {
|
||||||
|
mzz -= Math.abs(mz - mzz) * 0.16;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mz > mzz) {
|
||||||
|
mzz += Math.abs(mzz - mz) * 0.16;
|
||||||
|
}
|
||||||
|
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
int accuracy = hd ? 1 : M.clip((r.getAverage() / 8D) + 1, 1D, 128D).intValue();
|
int accuracy = hd ? 1 : M.clip((r.getAverage() / 6D), 1D, 128D).intValue();
|
||||||
accuracy = down ? accuracy * 4 : accuracy;
|
accuracy = down ? accuracy * 4 : accuracy;
|
||||||
int v = 150;
|
int v = 1000;
|
||||||
|
|
||||||
|
Iris.proj.getCurrentProject().getCache().targetChunk(0, 0);
|
||||||
|
|
||||||
if (g instanceof Graphics2D) {
|
if (g instanceof Graphics2D) {
|
||||||
Graphics2D gg = (Graphics2D) g;
|
Graphics2D gg = (Graphics2D) g;
|
||||||
@ -183,22 +210,24 @@ public class NoiseView extends JPanel implements MouseWheelListener {
|
|||||||
|
|
||||||
gx.waitFor("a");
|
gx.waitFor("a");
|
||||||
|
|
||||||
if (p.getMilliseconds() > v) {
|
if (hd && p.getMilliseconds() > v) {
|
||||||
v += 50;
|
break;
|
||||||
accuracy++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (down && renderer != null) {
|
|
||||||
Iris.proj.getCurrentProject().getCache().targetChunk(0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int x = 0; x < getParent().getWidth(); x += accuracy) {
|
for (int x = 0; x < getParent().getWidth(); x += accuracy) {
|
||||||
for (int z = 0; z < getParent().getHeight(); z += accuracy) {
|
for (int z = 0; z < getParent().getHeight(); z += accuracy) {
|
||||||
gg.setColor(new Color(co[x][z]));
|
gg.setColor(new Color(co[x][z]));
|
||||||
gg.fillRect(x, z, accuracy, accuracy);
|
gg.fillRect(x, z, accuracy, accuracy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (renderer != null) {
|
||||||
|
String text = Iris.proj.getCurrentProject().textFor((mxx * ascale) + oxp, (mzz * ascale) + ozp);
|
||||||
|
gg.setColor(Color.black);
|
||||||
|
gg.setFont(new Font("TimesRoman", Font.PLAIN, 24));
|
||||||
|
gg.drawString(text, (float) mxx, (float) mzz);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p.end();
|
p.end();
|
||||||
@ -219,12 +248,13 @@ public class NoiseView extends JPanel implements MouseWheelListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EventQueue.invokeLater(() -> {
|
EventQueue.invokeLater(() -> {
|
||||||
|
J.sleep((long) Math.max(0, 32 - r.getAverage()));
|
||||||
repaint();
|
repaint();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void createAndShowGUI(IrisChunkGenerator g) {
|
private static void createAndShowGUI(IrisChunkGenerator g) {
|
||||||
JFrame frame = new JFrame("Iris");
|
JFrame frame = new JFrame("Vision");
|
||||||
NoiseView nv = new NoiseView();
|
NoiseView nv = new NoiseView();
|
||||||
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
||||||
KList<String> li = new KList<NoiseStyle>(NoiseStyle.values()).toStringList().qadd("PROJECT");
|
KList<String> li = new KList<NoiseStyle>(NoiseStyle.values()).toStringList().qadd("PROJECT");
|
||||||
@ -235,6 +265,7 @@ public class NoiseView extends JPanel implements MouseWheelListener {
|
|||||||
renderer = Iris.proj.getCurrentProject().createRenderer();
|
renderer = Iris.proj.getCurrentProject().createRenderer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
combo.setFocusable(false);
|
||||||
combo.addActionListener(new ActionListener() {
|
combo.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user