change: cleanup + perf experiments

This commit is contained in:
ZtereoHYPE 2022-10-13 11:59:47 +02:00
parent 78acaa90af
commit 49386dd851
5 changed files with 21 additions and 6 deletions

View file

@ -8,7 +8,5 @@ public class ExampleMod implements ModInitializer {
public static SkyManager skyManager = new SkyManager();
@Override
public void onInitialize() {
// skyManager.generateSky(123L);
}
public void onInitialize() {}
}

View file

@ -29,7 +29,7 @@ public abstract class MixinStarRendering {
@Inject(at = @At("HEAD"), method = "createStars", cancellable = true)
private void generateStars(CallbackInfo ci) {
ExampleMod.skyManager.generateSky(123L);
ExampleMod.skyManager.generateSky(321L);
starBuffer = new VertexBuffer();
ExampleMod.skyManager.tick(ticks, starBuffer);
ci.cancel();

View file

@ -9,7 +9,7 @@ import java.awt.*;
public class NebulaSkyboxPainter extends SkyboxPainter {
private static final float SCALING_FACTOR = 1f;
private static final float BASE_NOISE_AMOUNT = 0.7f; // the amount of base noise to keep
private static final float BASE_NOISE_AMOUNT = 0.56f; // the amount of base noise to keep
private final Gradient nebulaGradient;

View file

@ -101,17 +101,34 @@ public class Star {
float ae3 = firstVertexDistance * latitudeCos;
float ae4 = secondVertexDistance * latitudeCos;
// 0
bufferBuilder.vertex(xCoord + ae1 * longitudeSin - secondVertexDistance * longitudeCos, yCoord + firstVertexDistance * latitudeSin, zCoord + secondVertexDistance * longitudeSin + ae1 * longitudeCos)
.color(r, g, b, 255)
.endVertex();
// 1
bufferBuilder.vertex(xCoord + ae2 * longitudeSin - thirdVertexDistance * longitudeCos, yCoord + secondVertexDistance * latitudeSin, zCoord + thirdVertexDistance * longitudeSin + ae2 * longitudeCos)
.color(r, g, b, 255)
.endVertex();
bufferBuilder.vertex(xCoord + ae3 * longitudeSin - fourthVertexDistance * longitudeCos, yCoord + thirdVertexDistance * latitudeSin, zCoord + fourthVertexDistance * longitudeSin + ae3 * longitudeCos)
.color(r, g, b, 255)
.endVertex();
// 3
bufferBuilder.vertex(xCoord + ae4 * longitudeSin - firstVertexDistance * longitudeCos, yCoord + fourthVertexDistance * latitudeSin, zCoord + firstVertexDistance * longitudeSin + ae4 * longitudeCos)
.color(r, g, b, 255)
.endVertex();
// // 1
// bufferBuilder.vertex(xCoord + ae2 * longitudeSin - thirdVertexDistance * longitudeCos, yCoord + secondVertexDistance * latitudeSin, zCoord + thirdVertexDistance * longitudeSin + ae2 * longitudeCos)
// .color(r, g, b, 255)
// .endVertex();
// // 2
// bufferBuilder.vertex(xCoord + ae3 * longitudeSin - fourthVertexDistance * longitudeCos, yCoord + thirdVertexDistance * latitudeSin, zCoord + fourthVertexDistance * longitudeSin + ae3 * longitudeCos)
// .color(r, g, b, 255)
// .endVertex();
// // 3
// bufferBuilder.vertex(xCoord + ae4 * longitudeSin - firstVertexDistance * longitudeCos, yCoord + fourthVertexDistance * latitudeSin, zCoord + firstVertexDistance * longitudeSin + ae4 * longitudeCos)
// .color(r, g, b, 255)
// .endVertex();
}
}

View file

@ -26,7 +26,7 @@ public class Starbox {
generateStars(randomSource);
}
public void generateStars(RandomSource randomSource) {
private void generateStars(RandomSource randomSource) {
ImprovedNoise noise = new ImprovedNoise(randomSource);
for (int i = 0; i < this.stars; ++i) {