|
42 | 42 | import java.util.concurrent.TimeUnit; |
43 | 43 | import java.util.function.Function; |
44 | 44 |
|
45 | | -public class KirinoCore { |
| 45 | +public final class KirinoCore { |
46 | 46 | private static final Minecraft MINECRAFT = Minecraft.getMinecraft(); |
47 | 47 | public static final Logger LOGGER = LogManager.getLogger("Kirino Core"); |
48 | 48 | public static final EventBus KIRINO_EVENT_BUS = new EventBus(); |
| 49 | + public static final KirinoConfig KIRINO_CONFIG = new KirinoConfig(); |
49 | 50 | private static CleanECSRuntime ECS_RUNTIME; |
50 | 51 | private static KirinoEngine KIRINO_ENGINE; |
51 | | - |
52 | | - private static boolean unsupported = false; |
53 | | - private final static boolean ENABLE_RENDER_DELEGATE = true; |
| 52 | + private static boolean UNSUPPORTED = false; |
54 | 53 |
|
55 | 54 | public static boolean isEnableRenderDelegate() { |
56 | | - return ENABLE_RENDER_DELEGATE && !unsupported; |
| 55 | + return KIRINO_CONFIG.enableRenderDelegate && !UNSUPPORTED; |
57 | 56 | } |
58 | 57 |
|
59 | 58 | private static MethodHandle setupCameraTransform; |
@@ -399,14 +398,16 @@ public static void init() { |
399 | 398 | rawGLVersion = ""; |
400 | 399 | } |
401 | 400 |
|
| 401 | + LOGGER.info("OpenGL version: " + rawGLVersion); |
| 402 | + |
402 | 403 | if (rawGLVersion.isEmpty() || majorGLVersion == -1 || minorGLVersion == -1) { |
403 | | - unsupported = true; |
404 | | - LOGGER.warn("OpenGL 4.6 not supported. Aborting Kirino initialization."); |
| 404 | + UNSUPPORTED = true; |
| 405 | + LOGGER.warn("Failed to parse OpenGL version. Aborting Kirino initialization."); |
405 | 406 | return; |
406 | 407 | } |
407 | 408 |
|
408 | 409 | if (!(majorGLVersion == 4 && minorGLVersion == 6)) { |
409 | | - unsupported = true; |
| 410 | + UNSUPPORTED = true; |
410 | 411 | LOGGER.warn("OpenGL 4.6 not supported. Aborting Kirino initialization."); |
411 | 412 | return; |
412 | 413 | } |
@@ -471,9 +472,14 @@ public static void init() { |
471 | 472 | stopWatch = StopWatch.createStarted(); |
472 | 473 |
|
473 | 474 | try { |
474 | | - Constructor<KirinoEngine> ctor = KirinoEngine.class.getDeclaredConstructor(EventBus.class, Logger.class, CleanECSRuntime.class); |
| 475 | + Constructor<KirinoEngine> ctor = KirinoEngine.class.getDeclaredConstructor( |
| 476 | + EventBus.class, |
| 477 | + Logger.class, |
| 478 | + CleanECSRuntime.class, |
| 479 | + boolean.class, |
| 480 | + boolean.class); |
475 | 481 | ctor.setAccessible(true); |
476 | | - KIRINO_ENGINE = ctor.newInstance(KIRINO_EVENT_BUS, LOGGER, ECS_RUNTIME); |
| 482 | + KIRINO_ENGINE = ctor.newInstance(KIRINO_EVENT_BUS, LOGGER, ECS_RUNTIME, KIRINO_CONFIG.enableHDR, KIRINO_CONFIG.enablePostProcessing); |
477 | 483 | } catch (Throwable throwable) { |
478 | 484 | throw new RuntimeException("Kirino Engine failed to initialize.", throwable); |
479 | 485 | } |
|
0 commit comments