Compare commits

..

359 Commits

Author SHA1 Message Date
James Seibel 1e6eb4c096 Add complete multidraw 2024-07-17 17:39:52 -05:00
James Seibel 618707533b add multidraw 2024-07-17 17:09:56 -05:00
James Seibel 2d7e2e2444 Merge render VBOs 2024-07-17 15:15:43 -05:00
James Seibel 4f2b8e6d8d VBO handler commenting 2024-07-15 20:22:29 -05:00
James Seibel 7165c086e4 Remove render param from DhApiAfterRenderEvent
This was causing confussion if deferred rendering (iris shaders) was enabled since the render parameters would change.
2024-07-14 09:30:56 -05:00
James Seibel fa22a4f27b Add a optional memory cache to the IDhApiTerrainDataRepo 2024-07-14 08:41:18 -05:00
James Seibel 9c0f5865f6 add missing genericRendering to IDhApiGraphicsConfig 2024-07-14 07:25:45 -05:00
James Seibel 1d0cb048cd Default logging to only write errors to chat 2024-07-13 12:54:21 -05:00
James Seibel 641d399a8e Merge branch 'distant-horizons-core-main' 2024-07-13 12:30:06 -05:00
James Seibel 32861e757d Add shader uniform "u" prefix 2024-07-13 12:04:05 -05:00
James Seibel 634738a1fc Remove minimum near fog distance and rename fog uniforms 2024-07-13 11:35:25 -05:00
James Seibel 859cbb6161 Fix fog reading/writing to the same buffer 2024-07-13 11:09:49 -05:00
James Seibel 6c960a81c0 testDisable beacon SSAO 2024-07-13 11:07:44 -05:00
James Seibel 1695c41ef2 Increase default fog start distance 2024-07-13 08:14:29 -05:00
James Seibel 8eabc6ad4c make clouds smaller and thinner 2024-07-12 21:47:06 -05:00
James Seibel a153ca1fe1 Fix repo connections not getting closed 2024-07-12 20:21:57 -05:00
James Seibel cab9f7c830 Clone API event parameters to reduce listener contamination 2024-07-12 19:22:20 -05:00
James Seibel 6bb832a488 Add renderEventParam to generic rendering shader binding by IMS request 2024-07-12 17:27:17 -05:00
James Seibel e7dda9590a Add generic object setup/cleanup events 2024-07-12 07:15:57 -05:00
James Seibel 0483edd2f3 Fix material typo 2 2024-07-11 22:51:37 -05:00
James Seibel 122ef4dce0 Fix material typo 2024-07-11 22:07:09 -05:00
James Seibel e9d254f8c4 Add generic object materials 2024-07-11 18:12:58 -05:00
James Seibel 17aa85ad24 Add EDhApiBlockMaterial 2024-07-11 17:57:54 -05:00
James Seibel 8e1dfd688e Fix inverting gener rendering event cancling 2024-07-11 17:57:30 -05:00
James Seibel 691d5caded Add api for generic rendering config 2024-07-11 17:38:51 -05:00
James Seibel 31c089f82f Add DhApiBeforeGenericObjectRenderEvent 2024-07-11 17:32:17 -05:00
James Seibel 8eceeb0226 Add namespace/path to generic rendering (including F3 piechart) 2024-07-11 17:20:02 -05:00
James Seibel c178afa4b9 Minor refactoring/renaming 2024-07-11 16:40:32 -05:00
James Seibel 116df0d999 Add IDhApiGenericObjectShaderProgram 2024-07-11 16:35:38 -05:00
James Seibel ef3cd4b43d Add "IP Only" to multiplayer tooltip 2024-07-10 07:45:07 -05:00
James Seibel 4b27f39a04 Fix generic rendering at extreme distances 2024-07-10 07:37:11 -05:00
James Seibel 53a2bf1748 mark ConfigLinkedEntry localization broken 2024-07-09 19:31:14 -05:00
James Seibel edec8bc0a2 Update localization 2024-07-09 19:30:59 -05:00
James Seibel 066b23c785 Add toggleable logging for GL Buffer garbage collection
Will need to be tested by someone who is experiencing issue #718, so far I've been unable to reproduce anything meaningful.
2024-07-09 17:40:21 -05:00
James Seibel 1f74f19cd9 minor cleanup 2024-07-09 07:49:56 -05:00
James Seibel 232c727b4f Move IBlockStateWrapper constants into LodUtil 2024-07-09 07:38:45 -05:00
James Seibel cd5da82d0c Add a TODO to LevelWrapper 2024-07-09 07:33:56 -05:00
James Seibel b762c0561d Add beacon colors 2024-07-09 07:33:17 -05:00
James Seibel f144a9ebc1 Optimize beacon detection 2024-07-08 20:20:48 -05:00
James Seibel 29ef95387c Shrink cloud texture to improve performance 2024-07-08 19:56:20 -05:00
James Seibel 0d79a856b2 Add cloud greedy meshing 2024-07-08 18:45:42 -05:00
James Seibel bd5054e762 re-arrange the generic rendering config 2024-07-08 07:44:41 -05:00
James Seibel 63dea2515e Add generic rendering US localization 2024-07-08 07:42:56 -05:00
James Seibel baa89edd03 Add a few missing items from beacon render handler 2024-07-08 07:35:34 -05:00
James Seibel c45f9f442f Clean up beacon render handling logic 2024-07-08 07:32:29 -05:00
James Seibel 9e13b27197 Fix double unloading beacons 2024-07-07 19:54:17 -05:00
James Seibel 3c173685ea Fix beacons disappearing when unloading LODs 2024-07-07 19:45:27 -05:00
James Seibel 8eb70cbaed fix unloading chunks removing beacon beams 2024-07-07 19:18:40 -05:00
James Seibel 22167081f0 Fix generic render un-binding when moving between levels 2024-07-07 19:16:33 -05:00
James Seibel 23d07aa92d Disable cloud rendering if instanced rendering isn't available 2024-07-07 18:42:11 -05:00
James Seibel 578a9f9309 add directional shading to direct generic rendering 2024-07-07 18:31:43 -05:00
James Seibel bacdfa96e3 rename ILevelWrapper.getHeight -> getMaxHeight 2024-07-07 18:16:00 -05:00
James Seibel c73c3f8490 Add missing generic rendering config options 2024-07-07 18:11:18 -05:00
James Seibel f4a8bfeb0a Add cloud rendering 2024-07-07 18:02:43 -05:00
James Seibel 197e6e8178 add vec3f distance methods 2024-07-07 14:52:30 -05:00
James Seibel c2c8bf8613 minor generic render refactor 2024-07-05 06:56:46 -05:00
James Seibel fce703579f Fix concurrent modification for GenericObjectRenderer 2024-07-04 21:41:57 -05:00
James Seibel e98f17f63b Remove useless IServerLevelWrapper.tryGetClientLevelWrapper() 2024-07-04 16:23:39 -05:00
James Seibel 120dddf844 Fix Api client level not containing the generic renderer 2024-07-04 16:14:32 -05:00
James Seibel ca711bbc72 Instance beacon rendering 2024-07-04 14:34:12 -05:00
James Seibel cc4cb10307 Fix uploading generic objects crashing 2024-07-04 14:34:01 -05:00
James Seibel 88db5c9594 re-add generic rendering to the API 2024-07-03 22:37:52 -05:00
James Seibel 81bfa9a02b Add generic rendering to the F3 menu 2024-07-03 20:46:11 -05:00
James Seibel ae72e627c5 Add a config to use pre-existing lighting 2024-07-03 20:30:49 -05:00
James Seibel 131b2835e5 Make generic renderer level dependent 2024-07-02 22:11:06 -05:00
James Seibel 5b905a9ab3 minor LodRenderer refactor 2024-07-02 19:23:02 -05:00
James Seibel e90c7cd8a0 Add beacon activation logic from merge 60
Closes !60
2024-07-02 17:50:25 -05:00
James Seibel 3b4a0ff4bc test 2024-07-02 17:08:55 -05:00
James Seibel 55cb4595bd Fix beacons un-loading incorrectly in some situations
Specifically neighboring chunks updating and in some cases flying away too fast
2024-07-02 07:50:21 -05:00
James Seibel e91afc17a3 Fix beacon beams for loaded chunks 2024-07-01 19:02:36 -05:00
James Seibel 6a398e6514 Start adding beacon beam repo handling 2024-07-01 07:51:08 -05:00
James Seibel 51de347bdd Add temporary proof-of-concept beacon rendering 2024-06-30 18:08:47 -05:00
James Seibel 72d6cb9697 Disable debug generic object rendering 2024-06-30 18:08:00 -05:00
James Seibel 4a025de9d6 Add generic object sky/block light 2024-06-30 17:45:50 -05:00
James Seibel 6c8060fa87 Up API version 2.1.0 -> 3.0.0 2024-06-30 16:33:54 -05:00
James Seibel 0c0987b66b Replace Vec3f and Mat4f in API with API versions 2024-06-30 16:33:38 -05:00
James Seibel 5a71e4015c Add javadocs to generic rendering objects 2024-06-30 15:28:00 -05:00
James Seibel f68edcbfea Add debug render code toggle 2024-06-30 14:38:35 -05:00
James Seibel aefa0d6797 generic renderable active flag and renaming cube -> box 2024-06-30 14:27:09 -05:00
James Seibel 305a6bb459 Improve generic rendering pos objects 2024-06-30 14:02:44 -05:00
James Seibel 28c8614550 Store generic object instance VBOs if possible 2024-06-30 13:46:03 -05:00
James Seibel f282d78fb9 minor generic obj cleanup 2024-06-30 09:31:45 -05:00
James Seibel 7f8b5579c5 Add generic rendering profilers and move some vertex attribs to uniforms 2024-06-30 09:25:12 -05:00
yeshi db786290e8 tell user to restart the game if the renderer dies 2024-06-29 21:56:38 +02:00
James Seibel 2c71d97c15 fix instanced generic duplicate rendering 2024-06-29 11:00:53 -06:00
James Seibel bf1361c7c3 GenericObjectRenderer forgot cached uniform location 2024-06-29 10:34:58 -06:00
James Seibel f2bba7f3df Add instanced and direct genericObject rendering 2024-06-29 10:29:30 -06:00
James Seibel 62e5183c54 Improve GLProxy creation validation/logging 2024-06-29 10:18:27 -06:00
James Seibel c1a90c9350 Add instanced generic object rendering 2024-06-29 09:11:49 -06:00
James Seibel 0d0826f319 Separate out Generic object rendering 2024-06-28 16:53:05 -06:00
James Seibel 6bfa3a422e Move generic cube rendering into it's own class 2024-06-27 06:36:30 -06:00
James Seibel 352abc40e6 Add proof-of-concept cube rendering 2024-06-27 06:22:15 -06:00
James Seibel 58d26dedd6 Show overloaded message in chat and increase message timeout 5 -> 30 sec 2024-06-26 12:58:18 -05:00
James Seibel 321afa2a9e Up version 2.1.2 -> 2.1.3-dev 2024-06-25 19:25:30 -05:00
James Seibel 71ffbfb7b9 add "warning" to the low memory warning message 2024-06-25 19:24:07 -05:00
James Seibel 2ab7949ce5 Fix database file paths 2024-06-25 19:23:53 -05:00
James Seibel 28e1eaae77 Up version 2.1.1-dev -> 2.1.2 2024-06-24 20:53:36 -05:00
James Seibel 30dda058fe Throw an exception if the file handler can't read/write to the DB 2024-06-23 08:22:35 -05:00
James Seibel 0d16c037f5 Increase default world gen timeout to 3 minutes (from 60 sec) 2024-06-18 07:11:48 -05:00
James Seibel 7f50de17c0 Fix file handler tooltip 2024-06-17 07:40:49 -05:00
James Seibel 67819b30eb Improve F3 menu logic and visuals 2024-06-15 19:20:20 -05:00
James Seibel ad38722304 add a todo to shared api 2024-06-15 11:26:46 -05:00
James Seibel 4da48c4c55 Lower the default CPU presets 2024-06-15 11:26:01 -05:00
James Seibel 6542e9e889 comment out unused showMigrationChatWarning 2024-06-15 11:04:56 -05:00
James Seibel 2f7e3d43d1 Add a startup low memory warning 2024-06-15 11:04:43 -05:00
James Seibel edaafb5cf0 Fix saving the chunk hash incorrectly 2024-06-15 10:37:59 -05:00
James Seibel 81d1ed419e Prevent creating LODs for already processed chunks 2024-06-15 09:42:43 -05:00
James Seibel 385e3dc964 Add ChunkWrapper BlockBiome HashCode 2024-06-15 08:11:16 -05:00
James Seibel 9592cd80f3 Improve position error logging 2024-06-15 07:20:38 -05:00
James Seibel 7b153a8aad Fix SelfUpdater list logging 2024-06-14 07:11:06 -05:00
James Seibel 54c2213eb6 Merge in JustALittleWolf's optimizations 2024-06-13 07:30:17 -05:00
JustAlittleWolf 1274a8e097 Directly access childNodes in LodQuadTree
This changes `LodQuadTree::recursivelyUpdateRenderSectionNode` to directly iterate on the children, instead of creating a childpositerator, and searching for the sectionpos. This lowers memory usage, as the iterators add quite a lot of object garbage (see https://i.imgur.com/r0qlxzc.png)
2024-06-13 13:15:39 +02:00
JustAlittleWolf bd1d0063e5 Change iterator Queue from LinkedList to ArrayDequeue
This improves performance and memory allocation, whenever the iterators are used. See https://docs.oracle.com/javase/8/docs/api/java/util/ArrayDeque.html
2024-06-13 13:14:30 +02:00
James Seibel af9b55ad6c Add lighting engine unit tests 2024-06-11 19:33:08 -05:00
James Seibel 97b86d69c4 Move shared ChunkWrapper code form Main to Core 2024-06-11 18:34:57 -05:00
James Seibel c6b4eacf03 Improve the overloaded chunk loading message 2024-06-11 07:35:28 -05:00
James Seibel e011ce3ee0 Remove OpenGL multithreading 2024-06-08 12:49:08 -05:00
James Seibel 1dd6359c89 Try changing LZMA preset from 4 -> 3 (faster, less compressed) 2024-06-08 11:06:26 -05:00
James Seibel e41abdd176 Improve config comment spacing 2024-06-08 08:33:32 -05:00
James Seibel b7a5bfd274 Add update branch config "auto" 2024-06-08 08:11:09 -05:00
James Seibel c3abfb123d Up the version number 2.1.0-a -> 2.1.1-a-dev 2024-06-07 17:42:36 -05:00
James Seibel 76f28e648c Up the version number 2.0.4-a-dev -> 2.1.0-a 2024-05-30 20:13:55 -05:00
James Seibel f49a79b54a remove unused lightmapBindingIndex in DhApiRenderParam 2024-05-27 17:57:45 -05:00
James Seibel 3cf385c2a2 Potentially fix memory leaks when rendering is disabled 2024-05-27 17:37:52 -05:00
James Seibel 8c91a84795 Fix LZ4 in retail MC 2024-05-21 07:43:33 -05:00
James Seibel 4af63758f2 Add error logging to stream wrappers 2024-05-21 07:42:22 -05:00
James Seibel 969b02dc18 Put config button hide option only in file 2024-05-20 22:15:38 -05:00
Ran 2111ad64c4 Properly shade libraries when using Java version Ω 2024-05-21 02:09:04 +00:00
James Seibel e02deb2fb0 Merge branch 'main' into 'main'
thing part 2 (last mr didn't include core)

See merge request jeseibel/distant-horizons-core!57
2024-05-20 19:57:16 +00:00
Yeshi0 410e34b147 remove unnecessary reference to zstd 2024-05-20 17:53:02 +02:00
James Seibel 9cebd7ee54 Add ConfigBasedLogger.errorAndThrow() 2024-05-18 08:07:41 -05:00
James Seibel cfec32746d Fix shading for MC 1.20.6 IE Java 21 2024-05-18 07:27:17 -05:00
James Seibel fabe5d77ea Merge branch 'SectionPosRewrite' 2024-05-16 22:15:03 -05:00
James Seibel 894a2dbe7d Fix incorrect DhSectionPos method var order 2024-05-16 22:14:34 -05:00
James Seibel 172e7560fd Replace DhSectionPos with long primitives to reduce GC 2024-05-16 22:07:57 -05:00
James Seibel c67712d973 Merge branch 'main' of https://gitlab.com/jeseibel/distant-horizons-core 2024-05-15 18:57:53 -05:00
James Seibel cd5ff8ce35 Start adding new DhSectionPos and unit tests 2024-05-15 18:48:25 -05:00
James Seibel 6e717a383d Remove unused OldSectionPos methods and add serialize methods to V1 repo 2024-05-15 18:47:51 -05:00
James Seibel bef873b875 Add comments to EDhDirection 2024-05-15 18:47:09 -05:00
James Seibel 331d75a3bc Rename DhSectionPos -> OldDhSectionPos before rewrite 2024-05-15 07:50:52 -04:00
James Seibel cec6438602 Replace QuadTree iterator linked list with ArrayDeque
Thanks JustALittleWolf!
2024-05-15 07:36:32 -04:00
James Seibel f5e0c112e3 Revert max world gen tasks 2 -> 20
I was hoping it would fix LODs not appearing, although it appears there was a different problem which has since been fixed.
2024-05-11 16:23:20 -05:00
James Seibel 899c4aca91 Add Quad Tree Render Status debug wireframe 2024-05-11 16:21:53 -05:00
James Seibel a4ac483e5b Potentially fix LODs not loading in 2024-05-11 16:19:10 -05:00
James Seibel 723f67ea0c Attempt to prevent thread starvation due to world gen
Hopefully this should help prevent issues on low end machines not loading in LODs
2024-05-10 22:27:22 -05:00
James Seibel 4575701bd4 disable sql timeout 2024-05-09 23:21:35 -05:00
James Seibel 7cfcfb0695 Handle missing/corrupted block/biome ID's in the full data 2024-05-09 19:45:54 -05:00
James Seibel f33bfa1d69 Fix monoliths due to duplicate IDs
This would specifically happen if moving from one MC version that has more blockstate attributes to one with fewer. If that was done then the both blockstates would act like they were the same, screwing up the ID map.
2024-05-09 19:44:33 -05:00
James Seibel a3c1f1563d minor FullDataToRenderDataTransformer reformat 2024-05-09 19:35:43 -05:00
James Seibel 361d197c5e Add DataCorruptedException(message, exception) constructor 2024-05-09 19:04:07 -05:00
James Seibel 04379691bc Potential fix for NaN multiverse similarity 2024-05-09 07:34:47 -05:00
James Seibel 7e45a98e8f Up the API version 1.1.0 -> 2.0.0
There were several breaking changes and I forgot to up the major version number appropriately.
2024-05-04 18:16:19 -05:00
James Seibel e1ca398b8f Fix updating chunk count not clearing on world close 2024-05-04 15:35:29 -05:00
James Seibel f34e67e6bb Fix F3 levels not closing with multiverse 2024-05-04 15:12:26 -05:00
James Seibel aad095ca1a Fix #670 Remove outdated world gen options from tooltip 2024-05-04 09:48:35 -05:00
James Seibel 950c951c2d minor ConfigBasedLogger cleanup 2024-05-02 17:31:53 -05:00
cola98765 37eaa2656a Update file FullDataToRenderDataTransformer.java 2024-05-01 10:31:43 +00:00
James Seibel 945853d014 Improve nightly build warning message 2024-04-30 21:53:00 -05:00
James Seibel 6bb38ad500 Improve migration queue messages 2024-04-30 21:52:13 -05:00
James Seibel 980086c533 Fix debug wireframes rendering on top of LODs 2024-04-30 21:23:54 -05:00
James Seibel c8f1154831 Remove ZStd compression option
Any ZStd data will be automatically deleted and re-generated
2024-04-30 21:17:26 -05:00
James Seibel 9196480e50 Remove references to FastUtil 8.5.13 2024-04-30 20:28:34 -05:00
James Seibel f0506d28e5 Fix incorrect refernce to fastutil in LzmaArrayCache 2024-04-30 20:26:34 -05:00
James Seibel 8ecd5dd9cb Fix optifine 1.16 support 2024-04-30 18:57:07 -05:00
James Seibel c83140a2d0 add IClientLevelWrapper.getPlainsBiomeWrapper() 2024-04-28 17:31:08 -05:00
James Seibel 3b600ce800 Add corrupt data read handling 2024-04-28 15:52:08 -05:00
James Seibel 7f874b4dc5 Revert a613540b 2024-04-27 12:56:08 -05:00
James Seibel 23e857a20d Fix some lib shading issues 2024-04-27 11:35:08 -05:00
James Seibel 2298ef0e0d up the version number 2.0.3 -> 2.0.4 2024-04-26 07:33:42 -05:00
James Seibel 7470455e50 Fix issues with compressors not appearing at runtime 2024-04-26 07:33:14 -05:00
James Seibel 614884c29e Merge Data_source_rewrite into main 2024-04-26 07:21:48 -05:00
James Seibel b41e54e6a6 shade in apache.logging for the standalone jar 2024-04-25 22:09:51 -05:00
James Seibel 2cc6c8d840 Change Initializer compressor test class 2024-04-25 21:52:44 -05:00
James Seibel a613540b6a Move most libraries from the main script to core 2024-04-25 21:51:48 -05:00
Cutiepie c89fcb094a Add core to gradle 2024-04-22 18:53:31 +10:00
James Seibel 10014d3729 Change default grass side rendering to fade_to_dirt 2024-04-20 19:00:33 -05:00
James Seibel 88ff9e7cde Drop high and extreme horizontal quality enums 2024-04-20 12:36:19 -05:00
James Seibel 459bc5fc0c Ops, forgot to remove this unused override in DataSourceProvider 2024-04-20 12:35:48 -05:00
James Seibel 3826c83d89 Remove "new" from AbstractDataSourceHandler's name 2024-04-20 11:41:02 -05:00
James Seibel 382917033a Fix a few warnings 2024-04-20 11:38:52 -05:00
James Seibel 37381896bc Fix warnings about updating empty maps 2024-04-20 11:38:31 -05:00
James Seibel 22f4757aae Fix rendering holes 2024-04-20 11:02:52 -05:00
James Seibel 57cd143009 Fix LodRenderSections not stopping load futures when closed 2024-04-20 08:49:44 -05:00
James Seibel 031742a951 speed up initial LOD loading 2024-04-18 21:06:25 -05:00
James Seibel a2e2559b26 Fix transparent blocks glowing (thanks IMS) 2024-04-18 07:47:42 -05:00
James Seibel 6e0071a046 Fix migration chat message not appearing 2024-04-13 17:30:39 -05:00
James Seibel 352a59838d Fix double sending migration messages 2024-04-13 17:02:31 -05:00
James Seibel 63371e8111 improve migration deletion logic and add F3 logging 2024-04-13 16:58:52 -05:00
James Seibel 383ab1121d Fix migration getter SQL 2024-04-13 16:58:33 -05:00
James Seibel c9a7527bcb Improve migration message 2024-04-13 16:52:09 -05:00
James Seibel 7d4d899226 log migration status in F3 menu and chat 2024-04-13 14:25:28 -05:00
James Seibel 169429fe48 improve client level load logging 2024-04-13 13:35:04 -05:00
James Seibel 94304eb055 speed up initial loading when DB migration is necessary 2024-04-13 12:12:50 -05:00
James Seibel 4a40e19b34 suppress unchecked warning in LodRenderSection 2024-04-13 09:45:49 -05:00
James Seibel 22422321ab Remove unhelpful data source pooling in LodRenderSection 2024-04-13 08:22:36 -05:00
James Seibel eafaf2b4cd Fix compiler error in FullDataSourceV2 and minor reformat 2024-04-13 07:42:32 -05:00
James Seibel 281c85c283 Merge branch 'Data_Source_Rewrite' of https://gitlab.com/jeseibel/distant-horizons-core into Data_Source_Rewrite 2024-04-13 07:40:17 -05:00
James Seibel 8cecdebc05 Disable cave culling for any detail level above 0 2024-04-13 07:40:15 -05:00
James Seibel cba55aa643 Improve LOD load order 2024-04-12 22:40:08 -05:00
James Seibel f7c5b5725f Fix LodRenderSection adjacent source indicies 2024-04-12 22:39:32 -05:00
James Seibel 07b495d48c Increase file handler thread pool default runtime ratio 2024-04-12 22:19:44 -05:00
James Seibel b5d938475a Optimize LodRenderSection loading and data caching 2024-04-12 22:19:28 -05:00
cola98765 f8b127a85d I may not be smart 2024-04-11 09:45:30 +00:00
cola98765 a216ba364d hopefully make old file conversion a bit faster. 2024-04-11 09:43:05 +00:00
James Seibel 6d0ec33316 fix minor line spacing 2024-04-10 18:51:14 -05:00
James Seibel 35681fe9a5 Fix Z-fighting at very high heights 2024-04-10 07:11:23 -05:00
James Seibel e560ddf3dc Fix sqlite database files not being unlocked 2024-04-09 21:29:12 -05:00
James Seibel 77fffb1a9b add a TODO to FullDataSourceProviderV2 2024-04-09 19:31:20 -05:00
James Seibel cf74d17e1b Fix world gen tasks being incorrectly removed from the queue at long distances 2024-04-09 19:27:57 -05:00
James Seibel a0e7bb94c6 Add a ApplyToParent DB index to improve file handling speed 2024-04-09 07:48:31 -05:00
James Seibel e10617ac19 increase update populator thread default run time ratio 2024-04-09 07:13:01 -05:00
James Seibel cd2b5fd668 Speed up world gen queue initial loading 2024-04-09 07:11:59 -05:00
James Seibel 336e8b99ec Reduce update thread pool default counts 2024-04-08 07:43:21 -05:00
James Seibel d8bac9df8c Remove deprecated DhApiScreenResizeEvent 2024-04-08 07:17:17 -05:00
James Seibel 1ff4a56e2d Improve grass side rendering and add a config 2024-04-07 21:42:31 -05:00
James Seibel 7bdafa28cc Fix debug detail render mode 2024-04-07 20:38:59 -05:00
James Seibel 03e11fbe3e Improve migration update timeout message and increase the time 2024-04-07 14:19:55 -05:00
James Seibel 74d193d294 Add a couple full data source null checks 2024-04-07 14:00:03 -05:00
James Seibel 46e3b98b62 Remove near fog option 2024-04-07 13:50:05 -05:00
James Seibel 2d323cef39 remove missed unlimited horizontal quality reference 2024-04-06 18:18:57 -05:00
James Seibel 8846ca5b5e Improve shutdown thread pool handling 2024-04-06 18:18:41 -05:00
James Seibel f310f1b316 Remove Unlimited horizontal quality setting
The setting was un-maintainable and would cause major issues for anything but the smallest render distances.
2024-04-06 18:03:54 -05:00
James Seibel 10d9282df7 Fix a couple FullDataPointUtilV2 references 2024-04-06 12:37:31 -05:00
James Seibel a751507f19 Have grass fade to dirt for walls 2024-04-06 12:37:18 -05:00
James Seibel b4b7738aa6 Fix API enums missing "DhApi" prefix and remove unused Enums/code 2024-04-06 10:06:03 -05:00
James Seibel 8fd37d72c7 Add Sqlite Write Ahead Log to Sqlite 2024-04-06 09:53:28 -05:00
James Seibel f09818e564 Update ELodShading names and descriptions 2024-04-06 08:42:29 -05:00
James Seibel bdd0fbe5ae Merge branch 'change_shading_lang' into Data_Source_Rewrite 2024-04-06 08:30:22 -05:00
James Seibel ddbad36d8a Remove FullDataPointUtilV2
Not sure what happened to make me think we needed to change the data point format, but luckily we don't have to deal with it any more and can just stick with the single file.
2024-04-06 08:17:09 -05:00
James Seibel ae829cbe3e Fix legacy migration conversion column order 2024-04-06 07:54:47 -05:00
James Seibel 5ef6cb2e0d Fix wrong data source Version ref in SubDim Matcher 2024-04-06 07:53:52 -05:00
James Seibel a1a45f50bf Change Sqlite Journaling to WAL to potentially improve concurrent performance 2024-04-04 07:50:02 -05:00
James Seibel 42675abef1 Comment out LodRenderSection neighbor collection 2024-04-04 07:09:17 -05:00
James Seibel 08f0f8ee17 Add a constant for LodRenderSection cache expiration 2024-04-04 07:08:51 -05:00
James Seibel 4e1155f8a7 Improve initial LOD loading speed 2024-04-03 22:07:25 -05:00
James Seibel 4bc7cf1e86 Fix LodRenderSections not disabling rendering 2024-04-03 21:26:05 -05:00
James Seibel 1491487328 Remove unneeded V1 -> V2 data migration validation 2024-04-03 07:28:59 -05:00
James Seibel 750d8b7bc3 Fix crash in 1.16 due to buffer upload happening before rendering is setup 2024-04-03 07:19:34 -05:00
James Seibel b59d505725 Add IP only server folder mode 2024-04-02 07:17:31 -05:00
James Seibel 2cce71cf28 Add non-magic max pooled data source number 2024-04-01 20:26:13 -05:00
James Seibel 964f5feb4b Remove unused data source properties 2024-04-01 20:21:56 -05:00
James Seibel 9835af0845 remove unused ColumnRenderSource.worldGenStep 2024-04-01 20:19:31 -05:00
James Seibel 81f921623e rename IDataSource getSectionPos -> getPos 2024-04-01 20:18:44 -05:00
James Seibel dc5968b0b5 pool columnRenderSources 2024-04-01 20:16:07 -05:00
James Seibel 43392ca0e4 Have LodRenderSection cancel loading on render distance change 2024-03-31 18:57:23 -05:00
James Seibel 88d6092153 Clean up LodRenderSection and fix massive memory use at long render distances 2024-03-31 18:42:46 -05:00
James Seibel 0ddf1dd640 Remove ColumnRenderSourceLoader 2024-03-30 22:07:08 -05:00
James Seibel ddd475d537 Remove AbstractRenderBuffer 2024-03-30 08:07:53 -05:00
James Seibel 543c3ffc54 Fix compiler bugs 2024-03-28 17:14:08 -05:00
cola98765 cf97c08aaf @James check if it doesn't explote; This should help with rendering, and fix the issue with stacking water with 2block resolution 2024-03-28 21:27:01 +00:00
cola98765 ea0a62b6a3 panic fix 2024-03-28 20:14:19 +00:00
cola98765 57f3d44326 Update file FullDataToRenderDataTransformer.java 2024-03-28 19:01:42 +00:00
James Seibel e7eb2ff9cc Remove the DhRenderData DB table 2024-03-28 07:47:07 -05:00
James Seibel 6a3261394f Add compression mode config documentation and missing LodDataBuilder lines 2024-03-28 07:42:53 -05:00
James Seibel d41af88494 Add ColumnWorldCompressionMode to the database 2024-03-28 07:36:02 -05:00
James Seibel e83864fd02 Add world compression config 2024-03-27 19:09:09 -05:00
James Seibel 5722a92dc1 Add broken lossy chunk compression 2024-03-27 15:54:24 -06:00
James Seibel 5249377199 Add data caching to Lzma data compression 2024-03-24 15:11:42 -05:00
James Seibel b3a20fb938 Use native bindings for LZ4 output compression to reduce GC load 2024-03-24 12:17:48 -05:00
James Seibel 74627fdf90 Use automatica Zstd buffer pooling 2024-03-24 12:00:51 -05:00
James Seibel bbe5ae9b7c Fix potential issues when java.awt.headless is true 2024-03-24 11:52:32 -05:00
James Seibel 63b6365128 Add swing headless setup to Initializer 2024-03-24 11:50:45 -05:00
James Seibel ed9cf526cd rename example unit tests to prevent naming issues 2024-03-24 11:38:30 -05:00
coolGi cb0c294df6 Removed test code being included in main repo code 2024-03-24 12:26:10 +10:30
James Seibel 661f286b77 Fix accidentally marking DTOs to update past the max parent detail level 2024-03-23 18:08:35 -05:00
James Seibel 8c5cd7f11f Remove render data file handling and related code 2024-03-23 17:55:59 -05:00
James Seibel b64df318ce Improve error handling in DebugRenderer 2024-03-23 17:18:05 -05:00
James Seibel a1c85d91fc Comment out trace logs
These logs aren't printed and will just increase GC pressure for strings
2024-03-23 16:18:21 -05:00
James Seibel ce95dfb3d1 Reduce some GC pressure in FullDataSourceV2.mergeInputTwoByTwoDataColumn 2024-03-23 16:14:34 -05:00
James Seibel cbfd4f9de3 Pool FullDataPointIdMap Entries and improve hash logic 2024-03-23 15:49:40 -05:00
James Seibel 5d50775932 re-implement data source pooling 2024-03-21 22:07:35 -05:00
James Seibel 18ad241025 Replace datasource v2 long[][] with LongArrayList[] and fix previous implementation 2024-03-21 21:53:15 -05:00
James Seibel 4b98882b41 Revert "Add FullDataSourceV2 pooling and replace long[][] arrays with LongArrayList[]"
This reverts commit f11e9a142f.
2024-03-21 20:12:47 -05:00
James Seibel 3ec9bfca1b comment out potenially unused world gen logic 2024-03-21 20:11:14 -05:00
James Seibel 6f7c46e086 Remove unnecessary async render source updates 2024-03-21 20:09:10 -05:00
James Seibel 7726335413 Fix FullDataSourceV2Repo.getColumnGenerationStepForPos ignoring compression 2024-03-21 19:59:12 -05:00
James Seibel f3d8a749fd Improve DhLodPos.getWidthAtDetail assertion 2024-03-21 18:12:37 -05:00
James Seibel f11e9a142f Add FullDataSourceV2 pooling and replace long[][] arrays with LongArrayList[] 2024-03-21 17:25:37 -05:00
James Seibel 72c601b2db change en_us "Horizontal Quality" -> "LOD Dropoff Distance" 2024-03-21 17:11:04 -05:00
James Seibel 4cdc6c9632 Compress the column gen step in the database 2024-03-20 07:25:38 -05:00
James Seibel 3b9962d7dc Fix transactionScript auto update variable flipped 2024-03-19 21:10:27 -05:00
James Seibel d926d11d3c Reduce string concatenations in assertions 2024-03-19 20:53:07 -05:00
James Seibel 9fb5182b78 Change the SQLite journal mode DELETE -> TRUNCATE 2024-03-19 20:07:21 -05:00
James Seibel a1950ebccc prevent world gen queue until half of the update tasks have finished 2024-03-19 07:28:14 -05:00
James Seibel 8f9caa5d9a Remove vacuum call in createFullDataSourceV2Tables SQL script 2024-03-19 07:27:57 -05:00
cola98765 c537084d07 potential fix to bright blocks when they reach build height limit 2024-03-19 12:27:05 +00:00
James Seibel 9f195231db up the version number 2.0.2 -> 2.0.3 2024-03-19 06:48:26 -05:00
James Seibel 805429722f Fix an issue where downsampling would sometimes corrupt the data souce 2024-03-18 21:14:35 -05:00
James Seibel 5b67f60e6f Fix black block lighting for super flat worlds 2024-03-18 20:05:12 -05:00
James Seibel 6557a1a7bd rename FullDataSourceV2.createFromCompleteDataSource 2024-03-18 20:01:39 -05:00
James Seibel a62ee8b3cf Merge !50 2024-03-17 19:09:01 -05:00
cola98765 7714569251 Merge branch 'blending_change' into 'main'
Update LodRenderer.java

See merge request jeseibel/distant-horizons-core!53
2024-03-17 23:47:26 +00:00
cola98765 8b9e48d4d3 Update LodRenderer.java 2024-03-17 23:47:25 +00:00
James Seibel 94e3426779 Remove ISourceProvider 2024-03-17 17:36:28 -05:00
James Seibel 6b13e9141c rename FullDataFileHandler -> FullDataSourceProvider and Remove IFullDataSourceProvider
IFullDataSourceProvider was removed so legacy providers don't have to implement methods they don't need
2024-03-17 17:32:41 -05:00
James Seibel bf00a23499 Rename IWorldGenerationQueue -> IFullDataSourceRetrievalQueue 2024-03-17 16:46:56 -05:00
James Seibel 569a4b16b4 Improve the nightly build warning text 2024-03-17 16:29:49 -05:00
James Seibel 8ec22189fd remove unneeded casting in RenderSourceFileHandler 2024-03-17 16:24:46 -05:00
James Seibel 9d539c4766 Update several todo comments 2024-03-17 16:15:06 -05:00
James Seibel fada27257c Write FullDataSourceV2 column length as a short instead of a int 2024-03-17 16:14:24 -05:00
James Seibel c55880bcb9 Fix empty data sources not updating and being regenerated 2024-03-16 22:43:22 -05:00
James Seibel cbadfab62a disable cave culling in the end 2024-03-16 22:43:07 -05:00
James Seibel c435b55576 Fix updating empty LODs (IE in the end) 2024-03-16 22:27:11 -05:00
James Seibel 69e3e2bca3 Add a config to render overlapping quad errors 2024-03-16 22:23:20 -05:00
James Seibel b20cbab012 Remove Seamless Overdraw Test
The result wasn't very good due to rendering issues with entities
2024-03-16 21:03:15 -05:00
James Seibel ce4c5db5df Fix incorrect FullDataSourceV2 downsampling for worldGenStep 2024-03-16 20:54:12 -05:00
James Seibel 6d2912e320 Add created and last modified unix time to FullDataSourceV2 2024-03-16 20:32:01 -05:00
James Seibel e14e122b6c Refactor FullDataSourceV2 variables 2024-03-16 20:19:24 -05:00
James Seibel dcd16cb84b rename NewFullDataSource -> FullDataSourceV2 and supporting objects 2024-03-16 19:53:01 -05:00
James Seibel 98183a4e75 Rename CompleteFullDataSource -> FullDataSourceV1 2024-03-16 19:40:36 -05:00
James Seibel 4ec1dea1ba merge CompleteFullDataSource and FullDataArrayAccessor 2024-03-16 19:34:36 -05:00
James Seibel 031bf754e8 Remove SingleColumnFullDataAccessor and IFullDataAccessor 2024-03-16 19:16:50 -05:00
James Seibel c081b6c57c Remove unusused AbstractDhRepo.get(TDTO) 2024-03-16 17:47:06 -05:00
James Seibel 6413e17e4b Add multiple compression options and unit tests 2024-03-16 17:25:15 -05:00
cola98765 9e0046ba83 Update en_us.json 2024-03-15 09:07:24 +00:00
cola98765 150d929a45 Update EVerticalQuality.java 2024-03-15 08:58:26 +00:00
James Seibel d5074feda2 Add aggregate getters to NewFullDataSourceRepo for unit testing 2024-03-14 21:40:36 -05:00
James Seibel 4741e25349 Add NewFullDataSourceDTO.createUnitTestDataSource() 2024-03-14 21:35:52 -05:00
James Seibel c3f99835db Multithread full data migration 2024-03-12 22:00:36 -05:00
James Seibel 996621887c Prevent world gen while migration is running 2024-03-12 21:43:26 -05:00
James Seibel 6f931c66bf Add migration fail capture 2024-03-12 21:42:53 -05:00
James Seibel 024176f97c Fix migrated downsampling light looking weird 2024-03-12 21:15:15 -05:00
James Seibel 968bc9addc Fix incorrect parent updating lock logic 2024-03-12 21:05:45 -05:00
James Seibel e83f7bd62e Add FullDataPointUtilV1 for use with CompleteFullDataSource 2024-03-12 21:00:50 -05:00
James Seibel c5787d0ff2 Add Legacy data source migration 2024-03-12 20:24:57 -05:00
James Seibel 30076f1b60 Minor comments and refactoring 2024-03-12 07:21:56 -05:00
James Seibel 34fdae1c78 remove debug code in NewFullDataSource 2024-03-10 21:50:13 -05:00
James Seibel dd7d7733f0 Rename and remove debug wireframe configs 2024-03-10 21:47:27 -05:00
James Seibel fd1944eb26 Remove unnecessary legacy debug rendering 2024-03-10 21:46:52 -05:00
James Seibel 64fce77a0a Fix repo castring for AbstractNewDataSourceHandler 2024-03-10 21:38:41 -05:00
James Seibel d569ae4052 Deprecate EHorizontalQuality.UNLIMITED 2024-03-10 21:30:59 -05:00
James Seibel 5f8eceee8d Remove unused override in RenderSourceFileHandler 2024-03-10 21:16:03 -05:00
James Seibel b49988af9e Remove an unused method added by Iris 2024-03-10 21:15:45 -05:00
James Seibel 46ba2630f1 Fix LodQuadTree clear render cache not working at extreme distances 2024-03-10 21:15:37 -05:00
James Seibel 02a1445732 Fix render data not regenerating on config change 2024-03-10 21:14:59 -05:00
James Seibel 8bdc4fe779 Add missing changed for 28de6f93 2024-03-10 21:05:13 -05:00
James Seibel 28de6f93af Fix world gen for extreme render distances 2024-03-10 20:44:12 -05:00
James Seibel 20394068b2 Add additional F3 lines for file updating 2024-03-09 17:06:17 -06:00
James Seibel 599340c4e8 Reduce data source update locking and add some data update batching 2024-03-09 17:05:54 -06:00
James Seibel e6c985a189 Add hash code and equals to NewFullDataSource 2024-03-09 09:06:39 -06:00
James Seibel 244d960ec0 minor render data bugfix 2024-03-04 21:34:00 -06:00
James Seibel eea2155e20 Temp fix for 0020 auto update script 2024-03-04 21:25:02 -06:00
James Seibel 8f6ff8c943 Fix data sources not saving correctly 2024-03-04 20:56:48 -06:00
James Seibel 97554ccae6 Increase Vertical Quality settings to hopefully reduce issues with floating islands 2024-03-04 07:13:43 -06:00
James Seibel c866fbfbfd Add update propagator thread pool 2024-03-04 07:10:20 -06:00
James Seibel 0c5c4f3a74 Fix multithreaded save calls to AbstractDhRepo 2024-03-04 07:08:32 -06:00
James Seibel 0f04453134 Make down sampling average values instead of grabbing the value closest to -inf 2024-03-03 19:17:24 -06:00
James Seibel a734bb6a69 Increase AbstractNewDataSourceHandler update lock count 2x -> 4x
Trying to reduce lock collisions.
2024-03-03 19:08:23 -06:00
James Seibel dc687f70ae Add LodUtil light constants 2024-03-03 14:53:10 -06:00
James Seibel e15ffe10c9 Improve FullDataPointUtil parameter names 2024-03-02 21:36:54 -06:00
James Seibel 3d999a1749 Change FullDataPointUtil to get/set sky and block lighting separately
The binary format is identical the only difference is the getter/setter methods
2024-03-02 21:31:21 -06:00
James Seibel 47391028d8 Prevent re-saving unmodified full data 2024-03-02 16:21:32 -06:00
James Seibel b8e03a2144 Deprecate DhApiScreenResizeEvent, replace with DhApiColorDepthTextureCreatedEvent 2024-03-02 15:21:22 -06:00
James Seibel 2a39a4cdc4 Add several TODO comments and minor reformatting 2024-03-02 15:20:51 -06:00
James Seibel 89012711ce rename ThreadPools -> ThreadPoolUtil 2024-03-02 14:02:54 -06:00
James Seibel 9b93125936 Add first draft of the new full data system 2024-03-02 11:44:50 -06:00
James Seibel 113c0f227f Improve debugging for FullDataPointUtil.remap() 2024-03-02 08:05:54 -06:00
James Seibel 28e230a2db Fix DhApiScreenResizeEvent incorrect description 2024-02-25 08:14:25 -06:00
James Seibel bb5dd248d8 Add compound key repo support 2024-02-24 09:04:46 -06:00
330 changed files with 17889 additions and 11287 deletions
+3
View File
@@ -27,3 +27,6 @@ forge*changelog.txt
# Sqlite databases
*.sqlite
*.sqlite-journal
*.sqlite-shm
*.sqlite-wal
+1 -1
View File
@@ -3,7 +3,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id "java"
id "com.github.johnrengelman.shadow" version '7.1.2' apply false
id "com.github.johnrengelman.shadow" version '8.1.1' apply false
}
@@ -23,7 +23,9 @@ import com.seibel.distanthorizons.api.interfaces.events.IDhApiEventInjector;
import com.seibel.distanthorizons.api.interfaces.factories.IDhApiWrapperFactory;
import com.seibel.distanthorizons.api.interfaces.override.IDhApiOverrideable;
import com.seibel.distanthorizons.api.interfaces.override.worldGenerator.IDhApiWorldGeneratorOverrideRegister;
import com.seibel.distanthorizons.api.interfaces.render.IDhApiCustomRenderObjectFactory;
import com.seibel.distanthorizons.api.interfaces.render.IDhApiRenderProxy;
import com.seibel.distanthorizons.api.interfaces.world.IDhApiLevelWrapper;
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiAfterDhInitEvent;
import com.seibel.distanthorizons.api.methods.override.DhApiWorldGeneratorOverrideRegister;
import com.seibel.distanthorizons.coreapi.ModInfo;
@@ -123,10 +125,16 @@ public class DhApi
/**
* Used to create wrappers for Minecraft objects needed by other Distant Horizons API methods.
* @since API 1.1.0
* @since API 2.0.0
*/
public static IDhApiWrapperFactory wrapperFactory = null;
/**
* Used to create custom renderable objects. <br>
* These objects can be added to the renderer in {@link IDhApiLevelWrapper}
* @since API 3.0.0
*/
public static IDhApiCustomRenderObjectFactory customRenderObjectFactory = null;
}
@@ -198,7 +206,7 @@ public class DhApi
/**
* Returns true if the thread this method was called from is owned by Distant Horizons.
* @since API 1.1.0
* @since API 2.0.0
*/
public static boolean isDhThread() { return Thread.currentThread().getName().startsWith(ModInfo.THREAD_NAME_PREFIX); }
@@ -1,56 +0,0 @@
/*
* This file is part of the Distant Horizons mod
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2023 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.enums.config;
/**
* CONSTANT <br>
* FREQUENT <br>
* NORMAL <br>
* RARE <br> <br>
*
* Determines how fast the buffers should be regenerated
*
* @author Leonardo Amato
* @version 9-25-2021
*/
@Deprecated // not currently in use, if the config this enum represents is re-implemented, the deprecated flag can be removed
public enum EBufferRebuildTimes
{
CONSTANT(0, 0, 0, 1),
FREQUENT(1000, 500, 2500, 1),
NORMAL(2000, 1000, 5000, 4),
RARE(5000, 2000, 10000, 16);
public final int playerMoveTimeout;
public final int renderedChunkTimeout;
public final int chunkChangeTimeout;
public final int playerMoveDistance;
EBufferRebuildTimes(int playerMoveTimeout, int renderedChunkTimeout, int chunkChangeTimeout, int playerMoveDistance)
{
this.playerMoveTimeout = playerMoveTimeout;
this.renderedChunkTimeout = renderedChunkTimeout;
this.chunkChangeTimeout = chunkChangeTimeout;
this.playerMoveDistance = playerMoveDistance;
}
}
@@ -23,9 +23,10 @@ package com.seibel.distanthorizons.api.enums.config;
* NONE, <br>
* NON_COLLIDING, <br>
*
* @since API 1.0.0
* @since API 2.0.0
* @version 2024-4-6
*/
public enum EBlocksToAvoid
public enum EDhApiBlocksToAvoid
{
// Reminder:
// when adding items up the API minor version
@@ -36,6 +37,6 @@ public enum EBlocksToAvoid
public final boolean noCollision;
EBlocksToAvoid(boolean noCollision) { this.noCollision = noCollision; }
EDhApiBlocksToAvoid(boolean noCollision) { this.noCollision = noCollision; }
}
@@ -0,0 +1,101 @@
/*
* This file is part of the Distant Horizons mod
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2023 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.enums.config;
/**
* UNCOMPRESSED <br>
* LZ4 <br>
* XZ <br><br>
*
* Note: speed and compression ratios are examples
* and should only be used for estimated comparisons.
*
* @version 2024-3-16
* @since API 2.0.0
*/
public enum EDhApiDataCompressionMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/**
* Should only be used internally and for unit testing. <br><br>
*
* Read Speed: 1.64 MS / DTO <br>
* Write Speed: 12.44 MS / DTO <br>
* Compression ratio: 1.0 <br>
*/
@DisallowSelectingViaConfigGui
UNCOMPRESSED(0),
/**
* Extremely fast (often faster than uncompressed), but generally poor compression. <br><br>
*
* Read Speed: 1.85 MS / DTO <br>
* Write Speed: 9.46 MS / DTO <br>
* Compression ratio: 0.3638 <br>
*/
LZ4(1),
/*
* Decent speed and good compression. <br><br>
*
* Read Speed: 11.78 MS / DTO <br>
* Write Speed: 16.76 MS / DTO <br>
* Compression ratio: 0.2199 <br>
*/
//@Deprecated
//Z_STD(2),
/**
* Extremely slow, but very good compression. <br><br>
*
* Read Speed: 12.25 MS / DTO <br>
* Write Speed: 490.07 MS / DTO <br>
* Compression ratio: 0.1242 <br>
*/
LZMA2(3);
/** More stable than using the ordinal of the enum */
public final byte value;
EDhApiDataCompressionMode(int value) { this.value = (byte) value; }
/** @throws IllegalArgumentException if the value doesn't map to a value */
public static EDhApiDataCompressionMode getFromValue(byte value) throws IllegalArgumentException
{
EDhApiDataCompressionMode[] enumList = EDhApiDataCompressionMode.values();
for (int i = 0; i < enumList.length; i++)
{
if (enumList[i].value == value)
{
return enumList[i];
}
}
throw new IllegalArgumentException("No compression mode with the value ["+value+"]");
}
}
@@ -20,9 +20,10 @@
package com.seibel.distanthorizons.api.enums.config;
/**
* @since API 1.0.0
* @since API 2.0.0
* @version 2024-4-6
*/
public enum EGLErrorHandlingMode
public enum EDhApiGLErrorHandlingMode
{
IGNORE,
LOG,
@@ -20,9 +20,10 @@
package com.seibel.distanthorizons.api.enums.config;
/**
* @since API 1.0.0
* @since API 2.0.0
* @version 2024-4-6
*/
public enum EGlProfileMode
public enum EDhApiGlProfileMode
{
CORE,
COMPAT,
@@ -28,10 +28,10 @@ package com.seibel.distanthorizons.api.enums.config;
*
* @author Leetom
* @author James Seibel
* @version 2022-7-2
* @since API 1.0.0
* @version 2024-4-6
* @since API 2.0.0
*/
public enum EGpuUploadMethod
public enum EDhApiGpuUploadMethod
{
/** Picks the best option based on the GPU the user has. */
AUTO(false, false),
@@ -60,7 +60,7 @@ public enum EGpuUploadMethod
public final boolean useEarlyMapping;
public final boolean useBufferStorage;
EGpuUploadMethod(boolean useEarlyMapping, boolean useBufferStorage)
EDhApiGpuUploadMethod(boolean useEarlyMapping, boolean useBufferStorage)
{
this.useEarlyMapping = useEarlyMapping;
this.useBufferStorage = useBufferStorage;
@@ -20,21 +20,21 @@
package com.seibel.distanthorizons.api.enums.config;
/**
* DISTANT_HORIZONS, <br>
* MINECRAFT,
* AS_GRASS <br>
* FADE_TO_DIRT <br>
* AS_DIRT <br>
*
* @author Leetom
* @version 2023-6-7
* @since API 1.0.0
* @since API 2.0.0
* @version 2024-4-7
*/
public enum ELightGenerationMode
public enum EDhApiGrassSideRendering
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
DISTANT_HORIZONS,
MINECRAFT
AS_GRASS,
FADE_TO_DIRT,
AS_DIRT;
}
@@ -26,9 +26,10 @@ package com.seibel.distanthorizons.api.enums.config;
* HIGH <br>
* UNLIMITED <br>
*
* @since API 1.0.0
* @since API 2.0.0
* @version 2024-4-6
*/
public enum EHorizontalQuality
public enum EDhApiHorizontalQuality
{
// Reminder:
// when adding items up the API minor version
@@ -42,17 +43,16 @@ public enum EHorizontalQuality
LOWEST(2.0f, 4),
LOW(2.0f, 8),
MEDIUM(2.0f, 12),
HIGH(2.2f, 24),
EXTREME(2.4f, 64),
UNLIMITED(-1, -1);
HIGH(2.2f, 16),
EXTREME(2.4f, 32),
;
public final double quadraticBase;
public final int distanceUnitInBlocks;
EHorizontalQuality(double quadraticBase, int distanceUnitInBlocks)
EDhApiHorizontalQuality(double quadraticBase, int distanceUnitInBlocks)
{
this.quadraticBase = quadraticBase;
this.distanceUnitInBlocks = distanceUnitInBlocks;
@@ -20,27 +20,33 @@
package com.seibel.distanthorizons.api.enums.config;
/**
* MINECRAFT <br>
* OLD_LIGHTING <br>
* NONE <br>
* AUTO <br>
* ENABLED <br>
* DISABLED <br>
*
* @since API 1.0.0
* @since API 2.0.0
* @version 2024-4-6
*/
public enum ELodShading
public enum EDhApiLodShading
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/** Uses Minecraft's shading for LODs */
MINECRAFT,
/**
* Simulates Minecraft's shading.
* Uses Minecraft's shading for LODs. <Br>
* This means if Minecraft's shading is disabled DH's shading will be as well.
*/
AUTO,
/**
* Simulates Minecraft's shading. <Br>
* This is most useful for shaders that disable Minecraft's shading
* but still require shading on LODs.
*/
OLD_LIGHTING,
ENABLED,
/** LODs will have no shading */
NONE;
DISABLED;
}
@@ -22,9 +22,10 @@ package com.seibel.distanthorizons.api.enums.config;
import org.apache.logging.log4j.Level;
/**
* @since API 1.0.0
* @since API 2.0.0
* @version 2024-4-6
*/
public enum ELoggerMode
public enum EDhApiLoggerMode
{
DISABLED(Level.OFF, Level.OFF),
LOG_ALL_TO_FILE(Level.ALL, Level.OFF),
@@ -40,11 +41,14 @@ public enum ELoggerMode
LOG_WARNING_TO_CHAT_AND_INFO_TO_FILE(Level.INFO, Level.WARN),
LOG_ERROR_TO_CHAT_AND_INFO_TO_FILE(Level.INFO, Level.ERROR),
;
public final Level levelForFile;
public final Level levelForChat;
ELoggerMode(Level levelForFile, Level levelForChat)
EDhApiLoggerMode(Level levelForFile, Level levelForChat)
{
this.levelForFile = levelForFile;
this.levelForChat = levelForChat;
}
}
@@ -33,10 +33,10 @@ import com.seibel.distanthorizons.coreapi.util.MathUtil;
*
* @author James Seibel
* @author Leonardo Amato
* @version 2023-6-14
* @since API 1.0.0
* @since API 2.0.0
* @version 2024-4-6
*/
public enum EMaxHorizontalResolution
public enum EDhApiMaxHorizontalResolution
{
/** render 256 LODs for each chunk */
BLOCK(16, 0),
@@ -84,12 +84,12 @@ public enum EMaxHorizontalResolution
* 2nd dimension: An array of all LodDetails that are less than or <br>
* equal to that detailLevel
*/
private static EMaxHorizontalResolution[][] lowerDetailArrays;
private static EDhApiMaxHorizontalResolution[][] lowerDetailArrays;
EMaxHorizontalResolution(int newLengthCount, int newDetailLevel)
EDhApiMaxHorizontalResolution(int newLengthCount, int newDetailLevel)
{
this.detailLevel = (byte) newDetailLevel;
this.dataPointLengthCount = newLengthCount;
@@ -129,20 +129,20 @@ public enum EMaxHorizontalResolution
* Returns an array of all LodDetails that have a detail level
* that is less than or equal to the given LodDetail
*/
public static EMaxHorizontalResolution[] getSelfAndLowerDetails(EMaxHorizontalResolution detail)
public static EDhApiMaxHorizontalResolution[] getSelfAndLowerDetails(EDhApiMaxHorizontalResolution detail)
{
if (lowerDetailArrays == null)
{
// run first time setup
lowerDetailArrays = new EMaxHorizontalResolution[EMaxHorizontalResolution.values().length][];
lowerDetailArrays = new EDhApiMaxHorizontalResolution[EDhApiMaxHorizontalResolution.values().length][];
// go through each LodDetail
for (EMaxHorizontalResolution currentDetail : EMaxHorizontalResolution.values())
for (EDhApiMaxHorizontalResolution currentDetail : EDhApiMaxHorizontalResolution.values())
{
ArrayList<EMaxHorizontalResolution> lowerDetails = new ArrayList<>();
ArrayList<EDhApiMaxHorizontalResolution> lowerDetails = new ArrayList<>();
// find the details lower than currentDetail
for (EMaxHorizontalResolution compareDetail : EMaxHorizontalResolution.values())
for (EDhApiMaxHorizontalResolution compareDetail : EDhApiMaxHorizontalResolution.values())
{
if (currentDetail.detailLevel <= compareDetail.detailLevel)
{
@@ -154,7 +154,7 @@ public enum EMaxHorizontalResolution
Collections.sort(lowerDetails);
Collections.reverse(lowerDetails);
lowerDetailArrays[currentDetail.detailLevel] = lowerDetails.toArray(new EMaxHorizontalResolution[lowerDetails.size()]);
lowerDetailArrays[currentDetail.detailLevel] = lowerDetails.toArray(new EDhApiMaxHorizontalResolution[lowerDetails.size()]);
}
}
@@ -162,9 +162,9 @@ public enum EMaxHorizontalResolution
}
/** Returns what detail level should be used at a given distance and maxDistance. */
public static EMaxHorizontalResolution getDetailForDistance(EMaxHorizontalResolution maxDetailLevel, int distance, int maxDistance)
public static EDhApiMaxHorizontalResolution getDetailForDistance(EDhApiMaxHorizontalResolution maxDetailLevel, int distance, int maxDistance)
{
EMaxHorizontalResolution[] lowerDetails = getSelfAndLowerDetails(maxDetailLevel);
EDhApiMaxHorizontalResolution[] lowerDetails = getSelfAndLowerDetails(maxDetailLevel);
int distanceBetweenDetails = maxDistance / lowerDetails.length;
int index = MathUtil.clamp(0, distance / distanceBetweenDetails, lowerDetails.length - 1);
@@ -22,6 +22,7 @@ package com.seibel.distanthorizons.api.enums.config;
/**
* NAME_ONLY, <br>
* IP_ONLY, <br>
* NAME_IP, <br>
* NAME_IP_PORT, <br>
* NAME_IP_PORT_MC_VERSION, <br> <br>
@@ -29,10 +30,10 @@ package com.seibel.distanthorizons.api.enums.config;
* Determines how the multiplayer folders should be named.
*
* @author James Seibel
* @version 2022-7-1
* @since API 1.0.0
* @since API 2.0.0
* @version 2024-4-6
*/
public enum EServerFolderNameMode
public enum EDhApiServerFolderNameMode
{
// Reminder:
// when adding items up the API minor version
@@ -42,6 +43,9 @@ public enum EServerFolderNameMode
/** Only use the server name */
NAME_ONLY,
/** Only use the server IP */
IP_ONLY,
/**
* {SERVER_NAME} IP {IP} <br>
* Example: Minecraft Server IP 192.168.1.40
@@ -0,0 +1,41 @@
package com.seibel.distanthorizons.api.enums.config;
import com.seibel.distanthorizons.coreapi.ModInfo;
/**
* AUTO, <br>
* STABLE, <br>
* NIGHTLY, <br><br>
*
* @since API 2.1.0
* @version 2024-6-8
*/
public enum EDhApiUpdateBranch
{
AUTO,
STABLE,
NIGHTLY;
/**
* If the updateBranch value is {@link EDhApiUpdateBranch#AUTO}
* this method will convert it either to {@link EDhApiUpdateBranch#STABLE} or {@link EDhApiUpdateBranch#NIGHTLY}
* based on this jar's state. <Br><br>
*
* If updateBranch is {@link EDhApiUpdateBranch#STABLE} or {@link EDhApiUpdateBranch#NIGHTLY}
* it just returns.
*/
public static EDhApiUpdateBranch convertAutoToStableOrNightly(EDhApiUpdateBranch updateBranch)
{
if (updateBranch != EDhApiUpdateBranch.AUTO)
{
return updateBranch;
}
else
{
return ModInfo.IS_DEV_BUILD ? EDhApiUpdateBranch.NIGHTLY : EDhApiUpdateBranch.STABLE;
}
}
}
@@ -28,10 +28,11 @@ package com.seibel.distanthorizons.api.enums.config;
* the vanilla Minecraft terrain.
*
* @author James Seibel
* @version 2022-6-30
* @since API 2.0.0
* @version 2024-4-6
*/
@Deprecated // not currently in use, if the config this enum represents is re-implemented, the deprecated flag can be removed
public enum EVanillaOverdraw
public enum EDhApiVanillaOverdraw
{
// Reminder:
// when adding items up the API minor version
@@ -29,23 +29,25 @@ import com.seibel.distanthorizons.coreapi.util.MathUtil;
* EXTREME <br>
*
* @author Leonardo Amato
* @version 2023-2-5
* @since API 1.0.0
* @version 2024-4-6
* @since API 2.0.0
*/
public enum EVerticalQuality
public enum EDhApiVerticalQuality
{
HEIGHT_MAP(new int[]{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}),
LOW(new int[]{4, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}),
MEDIUM(new int[]{6, 4, 3, 2, 2, 1, 1, 1, 1, 1, 1}),
HIGH(new int[]{8, 6, 4, 2, 2, 2, 2, 1, 1, 1, 1}),
EXTREME(new int[]{16, 8, 4, 2, 2, 2, 2, 1, 1, 1, 1});
HEIGHT_MAP( new int[]{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}),
LOW( new int[]{4, 3, 3, 2, 2, 1, 1, 1, 1, 1, 1}),
MEDIUM( new int[]{6, 4, 3, 3, 3, 3, 3, 2, 2, 2, 1}),
HIGH( new int[]{16, 8, 4, 3, 3, 3, 3, 3, 3, 3, 1}),
VERY_HIGH( new int[]{32, 16, 8, 4, 4, 3, 3, 3, 3, 3, 1}),
EXTREME( new int[]{64, 32, 8, 4, 4, 3, 3, 3, 3, 3, 1}),
PIXEL_ART( new int[]{512, 64, 16, 8, 4, 3, 3, 3, 3, 3, 1});
/** represents how many LODs can be rendered in a single vertical slice */
public final int[] maxVerticalData;
EVerticalQuality(int[] maxVerticalData) { this.maxVerticalData = maxVerticalData; }
EDhApiVerticalQuality(int[] maxVerticalData) { this.maxVerticalData = maxVerticalData; }
@@ -0,0 +1,70 @@
/*
* This file is part of the Distant Horizons mod
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2023 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.enums.config;
/**
* MERGE_SAME_BLOCKS <br>
* VISUALLY_EQUAL <br><br>
*
* @version 2024-3-27
* @since API 2.0.0
*/
public enum EDhApiWorldCompressionMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/**
* Every block/biome change is recorded in the database. <br>
* This is what DH 2.0 and 2.0.1 all used by default and will store a lot of data.
*/
MERGE_SAME_BLOCKS(0),
/**
* Only visible block/biome changes are recorded in the database. <Br>
* Hidden blocks (IE ores) are ignored.
*/
VISUALLY_EQUAL(1);
/** More stable than using the ordinal of the enum */
public final byte value;
EDhApiWorldCompressionMode(int value) { this.value = (byte) value; }
public static EDhApiWorldCompressionMode getFromValue(byte value)
{
EDhApiWorldCompressionMode[] enumList = EDhApiWorldCompressionMode.values();
for (int i = 0; i < enumList.length; i++)
{
if (enumList[i].value == value)
{
return enumList[i];
}
}
throw new IllegalArgumentException("No lossy compression mode with the value ["+value+"]");
}
}
@@ -1,48 +0,0 @@
/*
* This file is part of the Distant Horizons mod
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2023 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.enums.config;
/**
* AUTO <br>
* Near_First <br>
* Far_First <br> <br>
*
* Determines which LODs should have priority when generating
* outside the normal view distance.
*
* @author Leonardo Amato
* @version 12-1-2021
*/
@Deprecated // not currently in use, if the config this enum represents is re-implemented, the deprecated flag can be removed
public enum EGenerationPriority
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/** NEAR_FIRST when connected to servers and BALANCED when on single player */
AUTO,
NEAR_FIRST,
BALANCED,
FAR_FIRST
}
@@ -1,51 +0,0 @@
/*
* This file is part of the Distant Horizons mod
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2023 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.enums.config;
/**
* NONE <br>
* LIGHT <br>
* MEDIUM <br>
* HEAVY <br>
*
* CUSTOM <br>
*
* @since API 1.0.0
* @deprecated will be removed when DH updates to MC 1.21 <br>
* After removal a float value will be used to control overdraw instead.
*/
@Deprecated
public enum EOverdrawPrevention
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
NONE,
LIGHT,
MEDIUM,
HEAVY,
/**
* Should not be passed in. <br>
* Is returned if the overdraw value doesn't match any of the enums defined here.
*/
CUSTOM;
}
@@ -1,7 +0,0 @@
package com.seibel.distanthorizons.api.enums.config;
public enum EUpdateBranch
{
STABLE,
NIGHTLY
}
@@ -30,9 +30,10 @@ import com.seibel.distanthorizons.api.enums.config.DisallowSelectingViaConfigGui
* HIGH, <br>
* EXTREME, <br>
*
* @since API 1.0.0
* @since API 2.0.0
* @version 2024-4-6
*/
public enum EQualityPreset
public enum EDhApiQualityPreset
{
// Reminder:
// when adding items up the API minor version
@@ -29,9 +29,10 @@ import com.seibel.distanthorizons.api.enums.config.DisallowSelectingViaConfigGui
* BALANCED, <br>
* AGGRESSIVE, <br>
*
* @since API 1.0.0
* @since API 2.0.0
* @version 2024-4-6
*/
public enum EThreadPreset
public enum EDhApiThreadPreset
{
// Reminder:
// when adding items up the API minor version
@@ -44,8 +45,6 @@ public enum EThreadPreset
LOW_IMPACT,
BALANCED,
AGGRESSIVE,
// temporarily removed due to stability concerns
I_PAID_FOR_THE_WHOLE_CPU,
}
@@ -0,0 +1,67 @@
package com.seibel.distanthorizons.api.enums.rendering;
/**
* contains the indices used by shaders to determine
* how different block types should be rendered. <br><br>
*
* UNKNOWN, <br>
* LEAVES, <br>
* STONE, <br>
* WOOD, <br>
* METAL, <br>
* DIRT, <br>
* LAVA, <br>
* DEEPSLATE, <br>
* SNOW, <br>
* SAND, <br>
* TERRACOTTA, <br>
* NETHER_STONE, <br>
* WATER, <br>
* GRASS, <br>
* AIR, <br>
* ILLUMINATED, <br>
*
* @author James Seibel
* @since API 3.0.0
* @version 2024-7-11
*/
public enum EDhApiBlockMaterial
{
UNKNOWN(0),
LEAVES(1),
STONE(2),
WOOD(3),
METAL(4),
DIRT(5),
LAVA(6),
DEEPSLATE(7),
SNOW(8),
SAND(9),
TERRACOTTA(10),
NETHER_STONE(11),
WATER(12),
GRASS(13),
/** shouldn't normally be needed, but just in case */
AIR(14),
ILLUMINATED(15); // Max value
public final byte index;
EDhApiBlockMaterial(int index) { this.index = (byte)index;}
public static EDhApiBlockMaterial getFromIndex(int index)
{
for(EDhApiBlockMaterial material : EDhApiBlockMaterial.values())
{
if (material.index == index)
{
return material;
}
}
return EDhApiBlockMaterial.UNKNOWN;
}
}
@@ -28,10 +28,10 @@ package com.seibel.distanthorizons.api.enums.rendering;
*
* @author Leetom
* @author James Seibel
* @version 2023-6-7
* @since API 1.0.0
* @version 2024-4-6
* @since API 2.0.0
*/
public enum EDebugRendering
public enum EDhApiDebugRendering
{
// Reminder:
// when adding items up the API minor version
@@ -44,10 +44,6 @@ public enum EDebugRendering
/** LOD colors are based on their detail */
SHOW_DETAIL,
@Deprecated
/** LOD colors are based on their gen mode. */
SHOW_GENMODE,
/** Block Materials are often used by Iris shaders to determine how LODs should be rendered */
SHOW_BLOCK_MATERIAL,
@@ -58,7 +54,7 @@ public enum EDebugRendering
SHOW_RENDER_SOURCE_FLAG;
public static EDebugRendering next(EDebugRendering type)
public static EDhApiDebugRendering next(EDhApiDebugRendering type)
{
switch (type)
{
@@ -75,7 +71,7 @@ public enum EDebugRendering
}
}
public static EDebugRendering previous(EDebugRendering type)
public static EDhApiDebugRendering previous(EDhApiDebugRendering type)
{
switch (type)
{
@@ -84,8 +80,6 @@ public enum EDebugRendering
case SHOW_RENDER_SOURCE_FLAG:
return SHOW_OVERLAPPING_QUADS;
case SHOW_OVERLAPPING_QUADS:
return SHOW_GENMODE;
case SHOW_GENMODE:
return SHOW_DETAIL;
default:
return OFF;
@@ -24,10 +24,10 @@ package com.seibel.distanthorizons.api.enums.rendering;
* USE_SKY_COLOR, <br>
*
* @author James Seibel
* @version 2022-6-9
* @since API 1.0.0
* @version 2024-4-6
* @since API 2.0.0
*/
public enum EFogColorMode
public enum EDhApiFogColorMode
{
// Reminder:
// when adding items: up the API minor version
@@ -44,4 +44,5 @@ public enum EFogColorMode
* https://www.curseforge.com/minecraft/mc-mods/clear-skies-forge-port
*/
USE_SKY_COLOR,
}
@@ -25,10 +25,10 @@ package com.seibel.distanthorizons.api.enums.rendering;
* FOG_DISABLED <br>
*
* @author James Seibel
* @since API 2.0.0
* @version 2022-6-2
* @since API 1.0.0
*/
public enum EFogDrawMode
public enum EDhApiFogDrawMode
{
// Reminder:
// when adding items up the API minor version
@@ -26,9 +26,9 @@ package com.seibel.distanthorizons.api.enums.rendering;
*
* @author Leetom
* @version 2022-6-30
* @since API 1.0.0
* @since API 2.0.0
*/
public enum EFogFalloff
public enum EDhApiFogFalloff
{
// Reminder:
// when adding items up the API minor version
@@ -38,5 +38,5 @@ public enum EFogFalloff
LINEAR,
EXPONENTIAL,
EXPONENTIAL_SQUARED,
// TEXTURE_BASED, // TODO: Impl this
}
@@ -32,10 +32,10 @@ package com.seibel.distanthorizons.api.enums.rendering;
* AVERAGE <br>
*
* @author Leetom
* @version 2022-4-14
* @since API 1.0.0
* @version 2024-4-6
* @since API 2.0.0
*/
public enum EHeightFogMixMode
public enum EDhApiHeightFogMixMode
{
BASIC,
IGNORE_HEIGHT,
@@ -28,10 +28,10 @@ package com.seibel.distanthorizons.api.enums.rendering;
* ABOVE_AND_BELOW_SET_HEIGHT, <br>
*
* @author Leetom
* @version 6-30-2022
* @since API 1.0.0
* @version 2024-4-6
* @since API 2.0.0
*/
public enum EHeightFogMode
public enum EDhApiHeightFogMode
{
// Reminder:
// when adding items up the API minor version
@@ -49,7 +49,7 @@ public enum EHeightFogMode
public final boolean above;
public final boolean below;
EHeightFogMode(boolean basedOnCamera, boolean above, boolean below)
EDhApiHeightFogMode(boolean basedOnCamera, boolean above, boolean below)
{
this.basedOnCamera = basedOnCamera;
this.above = above;
@@ -7,7 +7,7 @@ package com.seibel.distanthorizons.api.enums.rendering;
*
* @author James Seibel
* @version 2024-1-30
* @since API 1.1.0
* @since API 2.0.0
*/
public enum EDhApiRenderPass
{
@@ -24,10 +24,10 @@ package com.seibel.distanthorizons.api.enums.rendering;
* Debug <br>
* Disabled <br>
*
* @version 2022-6-2
* @since API 1.0.0
* @since API 2.0.0
* @version 2024-4-6
*/
public enum ERendererMode
public enum EDhApiRendererMode
{
// Reminder:
// when adding items up the API minor version
@@ -40,7 +40,7 @@ public enum ERendererMode
/** Used by the config GUI to cycle through the available rendering options */
public static ERendererMode next(ERendererMode type)
public static EDhApiRendererMode next(EDhApiRendererMode type)
{
switch (type)
{
@@ -54,7 +54,7 @@ public enum ERendererMode
}
/** Used by the config GUI to cycle through the available rendering options */
public static ERendererMode previous(ERendererMode type)
public static EDhApiRendererMode previous(EDhApiRendererMode type)
{
switch (type)
{
@@ -24,9 +24,10 @@ package com.seibel.distanthorizons.api.enums.rendering;
* FAKE, <br>
* COMPLETE, <br>
*
* @since API 1.0.0
* @since API 2.0.0
* @version 2024-4-6
*/
public enum ETransparency
public enum EDhApiTransparency
{
// Reminder:
// when adding items up the API minor version
@@ -40,7 +41,7 @@ public enum ETransparency
public final boolean transparencyEnabled;
public final boolean fakeTransparencyEnabled;
ETransparency(boolean transparencyEnabled, boolean fakeTransparencyEnabled)
EDhApiTransparency(boolean transparencyEnabled, boolean fakeTransparencyEnabled)
{
this.transparencyEnabled = transparencyEnabled;
this.fakeTransparencyEnabled = fakeTransparencyEnabled;
@@ -1,40 +0,0 @@
/*
* This file is part of the Distant Horizons mod
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2023 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.enums.rendering;
/**
* NEAR, <br>
* FAR, <br>
* NEAR_AND_FAR <br>
*
* @author James Seibel
* @version 2022-6-2
* @since API 1.0.0
*/
public enum EFogDistance
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
NEAR,
FAR,
NEAR_AND_FAR
}
@@ -31,7 +31,7 @@ import java.util.function.Consumer;
*
* @author Builderb0y, James Seibel
* @version 2023-12-21
* @since API 1.1.0
* @since API 2.0.0
*/
public enum EDhApiWorldGeneratorReturnType
{
@@ -40,7 +40,7 @@ public enum EDhApiWorldGeneratorReturnType
* {@link IDhApiWorldGenerator#generateChunks(int, int, byte, byte, EDhApiDistantGeneratorMode, ExecutorService, Consumer)}
* will be used when generating terrain.
*
* @since API 1.1.0
* @since API 2.0.0
*/
VANILLA_CHUNKS,
@@ -49,7 +49,7 @@ public enum EDhApiWorldGeneratorReturnType
* {@link IDhApiWorldGenerator#generateApiChunks(int, int, byte, byte, EDhApiDistantGeneratorMode, ExecutorService, Consumer)}
* will be used when generating terrain.
*
* @since API 1.1.0
* @since API 2.0.0
*/
API_CHUNKS;
@@ -30,12 +30,21 @@ import com.seibel.distanthorizons.api.interfaces.IDhApiUnsafeWrapper;
*/
public interface IDhApiBlockStateWrapper extends IDhApiUnsafeWrapper
{
/** @since API 1.0.0 */
boolean isAir();
/** @since API 1.0.0 */
boolean isSolid();
/** @since API 1.0.0 */
boolean isLiquid();
// TODO:
// boolean hasNoCollision();
// boolean noFaceIsFullFace();
/**
* Returns the full serialized form of the given block
* as defined by DH's serialization methods.
* @since API 3.0.0
*/
String getSerialString();
/** @since API 3.0.0 */
byte getMaterialId();
}
@@ -47,7 +47,7 @@ public interface IDhApiConfigValue<T>
* Returns the value of the config if it was set by the API.
* Returns null if the config hasn't been set by the API.
*
* @since API 1.1.0
* @since API 2.0.0
*/
T getApiValue();
@@ -68,7 +68,7 @@ public interface IDhApiConfigValue<T>
* use the value set in the config menu.
*
* @return true if the value was set, false otherwise.
* @since API 1.1.0
* @since API 2.0.0
*/
boolean clearValue();
@@ -19,7 +19,6 @@
package com.seibel.distanthorizons.api.interfaces.config.both;
import com.seibel.distanthorizons.api.enums.config.ELightGenerationMode;
import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiDistantGeneratorMode;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigGroup;
@@ -19,9 +19,6 @@
package com.seibel.distanthorizons.api.interfaces.config.client;
import com.seibel.distanthorizons.api.enums.rendering.EFogColorMode;
import com.seibel.distanthorizons.api.enums.rendering.EFogDistance;
import com.seibel.distanthorizons.api.enums.rendering.EFogDrawMode;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigGroup;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
@@ -19,7 +19,7 @@
package com.seibel.distanthorizons.api.interfaces.config.client;
import com.seibel.distanthorizons.api.enums.rendering.EDebugRendering;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiDebugRendering;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigGroup;
@@ -33,7 +33,7 @@ import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigGroup;
public interface IDhApiDebuggingConfig extends IDhApiConfigGroup
{
/** Can be used to debug the standard fake chunk rendering. */
IDhApiConfigValue<EDebugRendering> debugRendering();
IDhApiConfigValue<EDhApiDebugRendering> debugRendering();
/** If enabled debug keybindings can be used. */
IDhApiConfigValue<Boolean> debugKeybindings();
@@ -19,8 +19,7 @@
package com.seibel.distanthorizons.api.interfaces.config.client;
import com.seibel.distanthorizons.api.enums.rendering.EFogFalloff;
import com.seibel.distanthorizons.api.enums.rendering.*;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiFogFalloff;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigGroup;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
@@ -64,7 +63,7 @@ public interface IDhApiFarFogConfig extends IDhApiConfigGroup
IDhApiConfigValue<Double> farFogMaxThickness();
/** Defines how the fog changes in thickness. */
IDhApiConfigValue<EFogFalloff> farFogFalloff();
IDhApiConfigValue<EDhApiFogFalloff> farFogFalloff();
/** Defines the fog density. */
IDhApiConfigValue<Double> farFogDensity();
@@ -19,10 +19,8 @@
package com.seibel.distanthorizons.api.interfaces.config.client;
import com.seibel.distanthorizons.api.enums.rendering.EFogColorMode;
import com.seibel.distanthorizons.api.enums.rendering.EFogDistance;
import com.seibel.distanthorizons.api.enums.rendering.EFogDrawMode;
import com.seibel.distanthorizons.api.enums.rendering.*;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiFogColorMode;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiFogDrawMode;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigGroup;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
@@ -58,14 +56,11 @@ public interface IDhApiFogConfig extends IDhApiConfigGroup
// basic fog settings //
//====================//
/** Defines at what distance fog is rendered on fake chunks. */
IDhApiConfigValue<EFogDistance> distance();
/** Should be used to enable/disable fog rendering. */
IDhApiConfigValue<EFogDrawMode> drawMode();
IDhApiConfigValue<EDhApiFogDrawMode> drawMode();
/** Can be used to enable support with mods that change vanilla MC's fog color. */
IDhApiConfigValue<EFogColorMode> color();
IDhApiConfigValue<EDhApiFogColorMode> color();
/**
* If enabled attempts to disable vanilla MC's fog on real chunks. <br>
@@ -0,0 +1,46 @@
/*
* This file is part of the Distant Horizons mod
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2023 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.interfaces.config.client;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigGroup;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
/**
* Distant Horizons' generic rendering configuration. <br><br>
*
* @author James Seibel
* @version 2024-7-11
* @since API 3.0.0
*/
public interface IDhApiGenericRenderingConfig extends IDhApiConfigGroup
{
/**
* If enabled DH will render generic objects into its terrain pass. <br>
* This includes: clouds, beacons, and API added objects.
*/
IDhApiConfigValue<Boolean> renderingEnabled();
/** If enabled DH will render beacon beams. */
IDhApiConfigValue<Boolean> beaconRenderingEnabled();
/** If enabled DH will render clouds. */
IDhApiConfigValue<Boolean> cloudRenderingEnabled();
}
@@ -19,7 +19,7 @@
package com.seibel.distanthorizons.api.interfaces.config.client;
import com.seibel.distanthorizons.api.enums.config.EGpuUploadMethod;
import com.seibel.distanthorizons.api.enums.config.EDhApiGpuUploadMethod;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigGroup;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
@@ -34,15 +34,6 @@ public interface IDhApiGpuBuffersConfig extends IDhApiConfigGroup
{
/** Defines how geometry data is uploaded to the GPU. */
IDhApiConfigValue<EGpuUploadMethod> gpuUploadMethod();
/**
* Defines how long we should wait after uploading one
* Megabyte of geometry data to the GPU before uploading
* the next Megabyte of data. <br>
* This can be set to a non-zero number to reduce stuttering caused by
* uploading buffers to the GPU.
*/
IDhApiConfigValue<Integer> gpuUploadPerMegabyteInMilliseconds();
IDhApiConfigValue<EDhApiGpuUploadMethod> gpuUploadMethod();
}
@@ -20,9 +20,8 @@
package com.seibel.distanthorizons.api.interfaces.config.client;
import com.seibel.distanthorizons.api.enums.config.*;
import com.seibel.distanthorizons.api.enums.config.*;
import com.seibel.distanthorizons.api.enums.rendering.ERendererMode;
import com.seibel.distanthorizons.api.enums.rendering.ETransparency;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiRendererMode;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiTransparency;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigGroup;
@@ -42,6 +41,7 @@ public interface IDhApiGraphicsConfig extends IDhApiConfigGroup
IDhApiFogConfig fog();
IDhApiAmbientOcclusionConfig ambientOcclusion();
IDhApiNoiseTextureConfig noiseTexture();
IDhApiGenericRenderingConfig genericRendering();
@@ -68,7 +68,7 @@ public interface IDhApiGraphicsConfig extends IDhApiConfigGroup
*
* Changing this config also changes {@link IDhApiGraphicsConfig#renderingEnabled()}'s value.
*/
IDhApiConfigValue<ERendererMode> renderingMode();
IDhApiConfigValue<EDhApiRendererMode> renderingMode();
@@ -77,18 +77,18 @@ public interface IDhApiGraphicsConfig extends IDhApiConfigGroup
//==================//
/** Defines how detailed fake chunks are in the horizontal direction */
IDhApiConfigValue<EMaxHorizontalResolution> maxHorizontalResolution();
IDhApiConfigValue<EDhApiMaxHorizontalResolution> maxHorizontalResolution();
/** Defines how detailed fake chunks are in the vertical direction */
IDhApiConfigValue<EVerticalQuality> verticalQuality();
IDhApiConfigValue<EDhApiVerticalQuality> verticalQuality();
/** Modifies the quadratic function fake chunks use for horizontal quality drop-off. */
IDhApiConfigValue<EHorizontalQuality> horizontalQuality();
IDhApiConfigValue<EDhApiHorizontalQuality> horizontalQuality();
IDhApiConfigValue<ETransparency> transparency();
IDhApiConfigValue<EDhApiTransparency> transparency();
/** Defines what blocks won't be rendered as LODs. */
IDhApiConfigValue<EBlocksToAvoid> blocksToAvoid();
IDhApiConfigValue<EDhApiBlocksToAvoid> blocksToAvoid();
/**
* Defines if the color of avoided blocks will color the block below them. <Br>
@@ -112,17 +112,6 @@ public interface IDhApiGraphicsConfig extends IDhApiConfigGroup
// advanced graphic settings //
//===========================//
/**
* Sets the distance used by the near clip plane to reduce
* overdraw. <br>
* Disabling this reduces holes in the world due to the near clip plane
* being too close to the camera and the terrain not being covered by vanilla terrain.
*
* @deprecated Use {@link IDhApiGraphicsConfig#overdrawPreventionRadius()} instead.
*/
@Deprecated
IDhApiConfigValue<EOverdrawPrevention> overdrawPrevention();
/**
* Sets the radius used by the near clip shader to reduce
* overdraw. <br>
@@ -133,7 +122,7 @@ public interface IDhApiGraphicsConfig extends IDhApiConfigGroup
* Setting this to 0 will reduce/prevent holes in the world due to clipping to close to the camera
* but may cause overdraw issues with transparent or non-full blocks.
*
* @since API 1.1.0
* @since API 2.0.0
*/
IDhApiConfigValue<Double> overdrawPreventionRadius();
@@ -170,9 +159,9 @@ public interface IDhApiGraphicsConfig extends IDhApiConfigGroup
/**
* Determines how LODs should be shaded.
*
* @since API 1.1.0
* @since API 2.0.0
*/
IDhApiConfigValue<ELodShading> lodShading();
IDhApiConfigValue<EDhApiLodShading> lodShading();
/**
* Sets whether LODs outside the view frustum culling will
@@ -183,7 +172,7 @@ public interface IDhApiGraphicsConfig extends IDhApiConfigGroup
* start/stop rendering incorrectly based on the camera direction,
* but will also reduce FPS.
*
* @since API 1.1.0
* @since API 2.0.0
* @see IDhApiGraphicsConfig#disableShadowFrustumCulling()
*/
IDhApiConfigValue<Boolean> disableFrustumCulling();
@@ -195,7 +184,7 @@ public interface IDhApiGraphicsConfig extends IDhApiConfigGroup
*
* Disable this if shadows render incorrectly.
*
* @since API 1.1.0
* @since API 2.0.0
* @see IDhApiGraphicsConfig#disableFrustumCulling()
*/
IDhApiConfigValue<Boolean> disableShadowFrustumCulling();
@@ -19,9 +19,9 @@
package com.seibel.distanthorizons.api.interfaces.config.client;
import com.seibel.distanthorizons.api.enums.rendering.EFogFalloff;
import com.seibel.distanthorizons.api.enums.rendering.EHeightFogMixMode;
import com.seibel.distanthorizons.api.enums.rendering.EHeightFogMode;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiFogFalloff;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiHeightFogMixMode;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiHeightFogMode;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigGroup;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
@@ -40,10 +40,10 @@ public interface IDhApiHeightFogConfig extends IDhApiConfigGroup
{
/** Defines how the height fog mixes. */
IDhApiConfigValue<EHeightFogMixMode> heightFogMixMode();
IDhApiConfigValue<EDhApiHeightFogMixMode> heightFogMixMode();
/** Defines how the height fog is drawn relative to the camera or world. */
IDhApiConfigValue<EHeightFogMode> heightFogMode();
IDhApiConfigValue<EDhApiHeightFogMode> heightFogMode();
/**
* Defines the height fog's base height if {@link IDhApiHeightFogConfig#heightFogMode()}
@@ -64,7 +64,7 @@ public interface IDhApiHeightFogConfig extends IDhApiConfigGroup
IDhApiConfigValue<Double> heightFogMaxThickness();
/** Defines how the height fog changes in thickness. */
IDhApiConfigValue<EFogFalloff> heightFogFalloff();
IDhApiConfigValue<EDhApiFogFalloff> heightFogFalloff();
/** Defines the height fog's density. */
IDhApiConfigValue<Double> heightFogDensity();
@@ -20,7 +20,7 @@
package com.seibel.distanthorizons.api.interfaces.config.client;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
import com.seibel.distanthorizons.api.enums.config.EServerFolderNameMode;
import com.seibel.distanthorizons.api.enums.config.EDhApiServerFolderNameMode;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigGroup;
/**
@@ -37,7 +37,7 @@ public interface IDhApiMultiplayerConfig extends IDhApiConfigGroup
* Defines how multiplayer server folders are named. <br>
* Note: Changing this while connected to a multiplayer world will cause undefined behavior!
*/
IDhApiConfigValue<EServerFolderNameMode> folderSavingMode();
IDhApiConfigValue<EDhApiServerFolderNameMode> folderSavingMode();
/**
* Defines the necessary similarity (as a percent) that two potential levels
@@ -0,0 +1,21 @@
package com.seibel.distanthorizons.api.interfaces.data;
/**
* Can be used to drastically speed up repeat read operations in {@link IDhApiTerrainDataRepo}.
*
* @see IDhApiTerrainDataRepo
*
* @author James Seibel
* @version 2024-7-14
* @since API 3.0.0
*/
public interface IDhApiTerrainDataCache
{
/**
* Removes any data that's currently stored in this cache.
* This cane be done to free up memory or invalidate
* the cache so fresh data can be pulled in.
*/
void clear();
}
@@ -29,6 +29,8 @@ import com.seibel.distanthorizons.api.objects.data.DhApiTerrainDataPoint;
/**
* Used to interface with Distant Horizons' terrain data.
*
* @see IDhApiTerrainDataCache
*
* @author James Seibel
* @version 2023-6-22
* @since API 1.0.0
@@ -40,29 +42,50 @@ public interface IDhApiTerrainDataRepo
// getters //
//=========//
/** Returns the terrain datapoint at the given block position, at/or containing the given Y position. */
DhApiResult<DhApiTerrainDataPoint> getSingleDataPointAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosY, int blockPosZ);
/** Returns every datapoint in the column located at the given block X and Z position top to bottom. */
DhApiResult<DhApiTerrainDataPoint[]> getColumnDataAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosZ);
/** @see IDhApiTerrainDataRepo#getSingleDataPointAtBlockPos(IDhApiLevelWrapper, int, int, int, IDhApiTerrainDataCache) */
default DhApiResult<DhApiTerrainDataPoint> getSingleDataPointAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosY, int blockPosZ) { return this.getSingleDataPointAtBlockPos(levelWrapper, blockPosX, blockPosY, blockPosZ, null); }
/**
* Returns the terrain datapoint at the given block position, at/or containing the given Y position.
* @since API 3.0.0
*/
DhApiResult<DhApiTerrainDataPoint> getSingleDataPointAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosY, int blockPosZ, IDhApiTerrainDataCache dataCache);
/** @see IDhApiTerrainDataRepo#getColumnDataAtBlockPos(IDhApiLevelWrapper, int, int, IDhApiTerrainDataCache) */
default DhApiResult<DhApiTerrainDataPoint[]> getColumnDataAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosZ) { return this.getColumnDataAtBlockPos(levelWrapper, blockPosX, blockPosZ, null); }
/**
* Returns every datapoint in the column located at the given block X and Z position top to bottom.
* @since API 3.0.0
*/
DhApiResult<DhApiTerrainDataPoint[]> getColumnDataAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosZ, IDhApiTerrainDataCache dataCache);
/** @see IDhApiTerrainDataRepo#getAllTerrainDataAtChunkPos(IDhApiLevelWrapper, int, int, IDhApiTerrainDataCache) */
default DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtChunkPos(IDhApiLevelWrapper levelWrapper, int chunkPosX, int chunkPosZ) { return this.getAllTerrainDataAtChunkPos(levelWrapper, chunkPosX, chunkPosZ, null); }
/**
* Returns every datapoint in the given chunk's X and Z position. <br><br>
*
* The returned array is ordered: [relativeBlockX][relativeBlockZ][columnIndex] <br>
* RelativeBlockX/Z are relative to the block position closest to negative infinity in the chunk's position. <br>
* The column data is ordered from top to bottom. Note: each column may have a different number of values. <br>
*
* @since API 3.0.0
*/
DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtChunkPos(IDhApiLevelWrapper levelWrapper, int chunkPosX, int chunkPosZ);
DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtChunkPos(IDhApiLevelWrapper levelWrapper, int chunkPosX, int chunkPosZ, IDhApiTerrainDataCache dataCache);
/** @see IDhApiTerrainDataRepo#getAllTerrainDataAtRegionPos(IDhApiLevelWrapper, int, int, IDhApiTerrainDataCache) */
default DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtRegionPos(IDhApiLevelWrapper levelWrapper, int regionPosX, int regionPosZ) { return this.getAllTerrainDataAtRegionPos(levelWrapper, regionPosX, regionPosZ, null); }
/**
* Returns every datapoint in the given region's X and Z position. <br><br>
*
* The returned array is ordered: [relativeBlockX][relativeBlockZ][columnIndex] <br>
* RelativeBlockX/Z are relative to the block position closest to negative infinity in the region's position. <br>
* The column data is ordered from top to bottom. Note: each column may have a different number of values. <br>
*
* @since API 3.0.0
*/
DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtRegionPos(IDhApiLevelWrapper levelWrapper, int regionPosX, int regionPosZ);
DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtRegionPos(IDhApiLevelWrapper levelWrapper, int regionPosX, int regionPosZ, IDhApiTerrainDataCache dataCache);
/** @see IDhApiTerrainDataRepo#getAllTerrainDataAtDetailLevelAndPos(IDhApiLevelWrapper, byte, int, int, IDhApiTerrainDataCache) */
default DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtRegionPos(IDhApiLevelWrapper levelWrapper, byte detailLevel, int posX, int posZ) { return this.getAllTerrainDataAtDetailLevelAndPos(levelWrapper, detailLevel, posX, posZ, null); }
/**
* Returns every datapoint in the column located at the given detail level and X/Z position. <br>
* This can be used to return terrain data for non-standard sizes (IE 2x2 blocks or 2x2 chunks).
@@ -71,20 +94,42 @@ public interface IDhApiTerrainDataRepo
* Every increase doubles the width of the returned area. <br>
* Example values: 0 = block, 1 = 2x2 blocks, 2 = 4x4 blocks, ... 4 = chunk (16x16 blocks), ... 9 = region (512x512 blocks) <br>
* See {@link EDhApiDetailLevel} for more information.
*
* @since API 3.0.0
*/
DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtDetailLevelAndPos(IDhApiLevelWrapper levelWrapper, byte detailLevel, int posX, int posZ);
DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtDetailLevelAndPos(IDhApiLevelWrapper levelWrapper, byte detailLevel, int posX, int posZ, IDhApiTerrainDataCache dataCache);
/** @see IDhApiTerrainDataRepo#raycast(IDhApiLevelWrapper, double, double, double, float, float, float, int, IDhApiTerrainDataCache) */
default DhApiResult<DhApiRaycastResult> raycast(
IDhApiLevelWrapper levelWrapper,
double rayOriginX, double rayOriginY, double rayOriginZ,
float rayDirectionX, float rayDirectionY, float rayDirectionZ,
int maxRayBlockLength)
{
return this.raycast(
levelWrapper,
rayOriginX, rayOriginY, rayOriginZ,
rayDirectionX, rayDirectionY, rayDirectionZ,
maxRayBlockLength,
null);
}
/**
* Returns the datapoint and position of the LOD
* at the end of the given ray. <br><br>
*
* Will return "success" with a null datapoint if the ray reaches the max length without finding any data.
*
* @since API 3.0.0
*/
DhApiResult<DhApiRaycastResult> raycast(
IDhApiLevelWrapper levelWrapper,
double rayOriginX, double rayOriginY, double rayOriginZ,
float rayDirectionX, float rayDirectionY, float rayDirectionZ,
int maxRayBlockLength);
int maxRayBlockLength,
IDhApiTerrainDataCache dataCache);
@@ -98,15 +143,27 @@ public interface IDhApiTerrainDataRepo
* Notes: <br>
* - Only works if the given {@link IDhApiLevelWrapper} points to a loaded level. <br>
* - If the player travels to this chunk, or the chunk is updated in some other way; your data will be replaced
* by whatever the current chunk is. <br>
* - This method may not update the LOD data immediately. Any other chunks have
* been queued to update, they will be handled first.
* by whatever the current chunk is. <br>
* - This method may not update the LOD data immediately. Any other chunks that have
* been queued to update will be handled first.
*
* @param levelWrapper the level wrapper that the chunk should be saved to.
* @param chunkObjectArray see {@link IDhApiWorldGenerator#generateChunks} for what objects are expected.
* @throws ClassCastException if chunkObjectArray doesn't contain the right objects.
* The exception will contain the expected object(s).
*/
public DhApiResult<Void> overwriteChunkDataAsync(IDhApiLevelWrapper levelWrapper, Object[] chunkObjectArray) throws ClassCastException;
DhApiResult<Void> overwriteChunkDataAsync(IDhApiLevelWrapper levelWrapper, Object[] chunkObjectArray) throws ClassCastException;
//=========//
// helpers //
//=========//
/**
* @return a {@link IDhApiTerrainDataCache} backed by {@link java.lang.ref.SoftReference}'s.
* @since API 3.0.0
*/
IDhApiTerrainDataCache getSoftCache();
}
@@ -31,7 +31,7 @@ import java.io.IOException;
*
* @author James Seibel
* @version 2023-12-16
* @since API 1.1.0
* @since API 2.0.0
*/
public interface IDhApiWrapperFactory
{
@@ -50,7 +50,7 @@ public interface IDhApiWrapperFactory
* @throws ClassCastException if any of the given parameters is of the wrong type.
* If thrown the error message will contain the list of expected object types in order.
*
* @since API 1.1.0
* @since API 2.0.0
*/
IDhApiBiomeWrapper getBiomeWrapper(Object[] objectArray, IDhApiLevelWrapper levelWrapper) throws ClassCastException;
@@ -67,13 +67,13 @@ public interface IDhApiWrapperFactory
* @throws ClassCastException if any of the given parameters is of the wrong type.
* If thrown the error message will contain the list of expected object types in order.
*
* @since API 1.1.0
* @since API 2.0.0
*/
IDhApiBlockStateWrapper getBlockStateWrapper(Object[] objectArray, IDhApiLevelWrapper levelWrapper) throws ClassCastException;
/**
* Returns the {@link IDhApiBlockStateWrapper} representing air.
* @since API 1.1.0
* @since API 2.0.0
*/
IDhApiBlockStateWrapper getAirBlockStateWrapper();
@@ -21,7 +21,7 @@ package com.seibel.distanthorizons.api.interfaces.override.rendering;
import com.seibel.distanthorizons.api.enums.EDhApiDetailLevel;
import com.seibel.distanthorizons.api.interfaces.override.IDhApiOverrideable;
import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
import com.seibel.distanthorizons.api.objects.math.DhApiMat4f;
/**
* Used to determine if a LOD should be rendered or is outside the
@@ -29,7 +29,7 @@ import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
*
* @author James Seibel
* @version 2024-2-6
* @since API 1.1.0
* @since API 2.0.0
*/
public interface IDhApiCullingFrustum extends IDhApiOverrideable
{
@@ -41,7 +41,7 @@ public interface IDhApiCullingFrustum extends IDhApiOverrideable
* @param worldMaxBlockY the highest block position this level allows.
* @param worldViewProjection the projection matrix used in this render pass.
*/
void update(int worldMinBlockY, int worldMaxBlockY, Mat4f worldViewProjection);
void update(int worldMinBlockY, int worldMaxBlockY, DhApiMat4f worldViewProjection);
/**
* returns true if the LOD bounds intersect this frustum
@@ -24,7 +24,7 @@ import com.seibel.distanthorizons.api.interfaces.override.IDhApiOverrideable;
/**
* @author James Seibel
* @version 2024-1-24
* @since API 1.1.0
* @since API 2.0.0
*/
public interface IDhApiFramebuffer extends IDhApiOverrideable
{
@@ -0,0 +1,80 @@
/*
* This file is part of the Distant Horizons mod
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2023 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.interfaces.override.rendering;
import com.seibel.distanthorizons.api.interfaces.override.IDhApiOverrideable;
import com.seibel.distanthorizons.api.interfaces.render.IDhApiRenderableBoxGroup;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
import com.seibel.distanthorizons.api.objects.math.DhApiVec3d;
import com.seibel.distanthorizons.api.objects.render.DhApiRenderableBox;
import com.seibel.distanthorizons.api.objects.render.DhApiRenderableBoxGroupShading;
/**
* @see IDhApiShaderProgram
*
* @author James Seibel
* @version 2024-7-11
* @since API 3.0.0
*/
public interface IDhApiGenericObjectShaderProgram extends IDhApiOverrideable
{
/**
* If this method is called that means this program has the highest priority as defined by {@link IDhApiOverrideable#getPriority()}
* and gets to decide if it wants to be used to render this frame or not. <br><br>
*
* If this method returns true then this program will be used for this frame. <br>
* If this returns false then the default DH {@link IDhApiGenericObjectShaderProgram} will be used instead.
*/
boolean overrideThisFrame();
/** @return the OpenGL ID for this shader program */
int getId();
/** Free any OpenGL objects owned by this program. */
void free();
/** Runs any necessary binding this program needs so rendering can be done. */
void bind(DhApiRenderParam renderEventParam);
/** Runs any necessary unbinding this program needs so rendering can be done by another program. */
void unbind();
/** Binds the given Vertex Buffer Object to this shader program for rendering. */
void bindVertexBuffer(int vbo);
/** sets up the necessary uniforms for rendering */
void fillIndirectUniformData(
DhApiRenderParam renderParameters,
DhApiRenderableBoxGroupShading shading, IDhApiRenderableBoxGroup boxGroup,
DhApiVec3d camPos);
/** sets up the necessary uniforms for rendering */
void fillSharedDirectUniformData(
DhApiRenderParam renderParameters,
DhApiRenderableBoxGroupShading shading, IDhApiRenderableBoxGroup boxGroup,
DhApiVec3d camPos);
void fillDirectUniformData(
DhApiRenderParam renderParameters,
IDhApiRenderableBoxGroup boxGroup, DhApiRenderableBox box,
DhApiVec3d camPos);
}
@@ -21,13 +21,14 @@ package com.seibel.distanthorizons.api.interfaces.override.rendering;
import com.seibel.distanthorizons.api.interfaces.override.IDhApiOverrideable;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
import com.seibel.distanthorizons.coreapi.util.math.Vec3f;
import com.seibel.distanthorizons.api.objects.math.DhApiVec3f;
/**
* @see IDhApiGenericObjectShaderProgram
*
* @author James Seibel
* @version 2024-1-24
* @since API 1.1.0
* @since API 2.0.0
*/
public interface IDhApiShaderProgram extends IDhApiOverrideable
{
@@ -57,7 +58,7 @@ public interface IDhApiShaderProgram extends IDhApiOverrideable
void fillUniformData(DhApiRenderParam renderParameters);
/** sets the vec3 that all DH verticies should be offset by when rendering */
void setModelOffsetPos(Vec3f modelPos);
void setModelOffsetPos(DhApiVec3f modelPos);
/** Binds the given Vertex Buffer Object to this shader program for rendering. */
void bindVertexBuffer(int vbo);
@@ -19,10 +19,6 @@
package com.seibel.distanthorizons.api.interfaces.override.rendering;
import com.seibel.distanthorizons.api.enums.EDhApiDetailLevel;
import com.seibel.distanthorizons.api.interfaces.override.IDhApiOverrideable;
import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
/**
* The culling frustum used during Distant Horizons' shadow pass
* if another mod has enabled Distant Horizons' shadow
@@ -35,7 +31,7 @@ import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
*
* @author James Seibel
* @version 2024-2-10
* @since API 1.1.0
* @since API 2.0.0
*/
public interface IDhApiShadowCullingFrustum extends IDhApiCullingFrustum
{
@@ -168,7 +168,7 @@ public interface IDhApiWorldGenerator extends Closeable, IDhApiOverrideable
*
* @return a future that should run on the worldGeneratorThreadPool and complete once the given generation task has completed.
*
* @since API 1.1.0
* @since API 2.0.0
*/
default CompletableFuture<Void> generateApiChunks(
int chunkPosMinX,
@@ -189,7 +189,7 @@ public interface IDhApiWorldGenerator extends Closeable, IDhApiOverrideable
* which means that {@link #generateChunks(int, int, byte, byte, EDhApiDistantGeneratorMode, ExecutorService, Consumer)}
* will be invoked whenever Distant Horizons wants to generate terrain with this world generator.
*
* @since API 1.1.0
* @since API 2.0.0
*/
default EDhApiWorldGeneratorReturnType getReturnType() { return EDhApiWorldGeneratorReturnType.VANILLA_CHUNKS; }
@@ -0,0 +1,67 @@
package com.seibel.distanthorizons.api.interfaces.render;
import com.seibel.distanthorizons.api.objects.math.DhApiVec3d;
import com.seibel.distanthorizons.api.objects.math.DhApiVec3f;
import com.seibel.distanthorizons.api.objects.render.DhApiRenderableBox;
import java.util.List;
/**
* Handles creating
* {@link IDhApiRenderableBoxGroup} objects,
* which can be added via a {@link IDhApiCustomRenderRegister}.
*
* @see IDhApiCustomRenderRegister
* @see IDhApiRenderableBoxGroup
*
* @author James Seibel
* @version 2024-7-3
* @since API 3.0.0
*/
public interface IDhApiCustomRenderObjectFactory
{
/**
* Creates a {@link IDhApiRenderableBoxGroup} from for the given {@link DhApiRenderableBox}
* where the box is positioned relative to the level's origin.
*
* @param resourceLocation A colon separated Resource Location string, similar to vanilla Minecraft, for example: "DistantHorizons:Clouds"
*
* @see DhApiRenderableBox
* @see IDhApiRenderableBoxGroup#getResourceLocationNamespace()
* @see IDhApiRenderableBoxGroup#getResourceLocationPath()
*
* @throws IllegalArgumentException if <code>resourceLocation</code> is null, isn't separated by a colon, or has multiple colons.
*/
IDhApiRenderableBoxGroup createForSingleBox(String resourceLocation, DhApiRenderableBox cube) throws IllegalArgumentException;
/**
* Creates a {@link IDhApiRenderableBoxGroup} from the given list of {@link DhApiRenderableBox} where each
* one is positioned relative to given <code>originBlockPos</code>, which in turn is relative to the level's origin.
*
* @param resourceLocation A colon separated Resource Location string, similar to vanilla Minecraft, for example: "DistantHorizons:Clouds"
* @param originBlockPos The starting position for this {@link IDhApiRenderableBoxGroup}, can be changed during runtime.
*
*
* @see DhApiRenderableBox
* @see IDhApiRenderableBoxGroup#getResourceLocationNamespace()
* @see IDhApiRenderableBoxGroup#getResourceLocationPath()
*
* @throws IllegalArgumentException if <code>resourceLocation</code> is null, isn't separated by a colon, or has multiple colons.
*/
IDhApiRenderableBoxGroup createRelativePositionedGroup(String resourceLocation, DhApiVec3d originBlockPos, List<DhApiRenderableBox> cubeList);
/**
* Creates a {@link IDhApiRenderableBoxGroup} from the given list of {@link DhApiRenderableBox} where each
* one is positioned relative to the level's origin.
*
* @param resourceLocation A colon separated Resource Location string, similar to vanilla Minecraft, for example: "DistantHorizons:Clouds"
*
* @see DhApiRenderableBox
* @see IDhApiRenderableBoxGroup#getResourceLocationNamespace()
* @see IDhApiRenderableBoxGroup#getResourceLocationPath()
*
* @throws IllegalArgumentException if <code>resourceLocation</code> is null, isn't separated by a colon, or has multiple colons.
*/
IDhApiRenderableBoxGroup createAbsolutePositionedGroup(String resourceLocation, List<DhApiRenderableBox> cubeList);
}
@@ -0,0 +1,30 @@
package com.seibel.distanthorizons.api.interfaces.render;
import com.seibel.distanthorizons.api.DhApi;
import com.seibel.distanthorizons.api.interfaces.world.IDhApiLevelWrapper;
import com.seibel.distanthorizons.api.interfaces.world.IDhApiWorldProxy;
/**
* Handles adding and removing
* {@link IDhApiRenderableBoxGroup} objects,
* from DH's renderer. <br><br>
*
* Can be accessed in
* {@link DhApi.Delayed#worldProxy} -> {@link IDhApiLevelWrapper}.
*
* @see IDhApiCustomRenderObjectFactory
* @see IDhApiRenderableBoxGroup
* @see IDhApiWorldProxy
* @see IDhApiLevelWrapper
*
* @author James Seibel
* @version 2024-7-3
* @since API 3.0.0
*/
public interface IDhApiCustomRenderRegister
{
void add(IDhApiRenderableBoxGroup cubeGroup) throws IllegalArgumentException;
IDhApiRenderableBoxGroup remove(long id);
}
@@ -0,0 +1,98 @@
package com.seibel.distanthorizons.api.interfaces.render;
import com.seibel.distanthorizons.api.enums.config.EDhApiLodShading;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
import com.seibel.distanthorizons.api.objects.math.DhApiVec3d;
import com.seibel.distanthorizons.api.objects.math.DhApiVec3f;
import com.seibel.distanthorizons.api.objects.math.DhApiVec3i;
import com.seibel.distanthorizons.api.objects.render.DhApiRenderableBox;
import com.seibel.distanthorizons.api.objects.render.DhApiRenderableBoxGroupShading;
import java.util.List;
import java.util.function.Consumer;
/**
* A list of {@link DhApiRenderableBox}'s that
* can be rendered to DH's terrain pass.
*
* @see DhApiRenderableBox
*
* @author James Seibel
* @version 2024-6-30
* @since API 3.0.0
*/
public interface IDhApiRenderableBoxGroup extends List<DhApiRenderableBox>
{
/**
* A unique numerical ID used by DH during rendering.
* This can also be used to bind/unbind specific {@link IDhApiRenderableBoxGroup}'s from the renderer.
* @return the ID for this specific group
*/
long getId();
/**
* Used to determine which mods have added what to the DH renderer.
* This can be used both by the F3 pie chart so you as a mod developer can profile your code
* or by shader developers who want to render your objects differently. <br><br>
*
* Should be used the same as a vanilla Minecraft ResourceLocation.
* For example if your mod named "Heavy Thunder" adds additional clouds named "Storm Front",
* your Resource Location would be something like "HeavyThunder:StormFront"
* and this method would return "HeavyThunder".
*/
String getResourceLocationNamespace();
/**
* Used to determine what type of object mods have added what to the DH renderer.
* This can be used both by the F3 pie chart so you as a mod developer can profile your code
* or by shader developers who want to render your objects differently. <br><br>
*
* Should be used the same as a vanilla Minecraft ResourceLocation.
* For example if your mod named "Heavy Thunder" adds additional clouds named "Storm Front",
* your Resource Location would be something like "HeavyThunder:StormFront"
* and this method would return "StormFront".
*/
String getResourceLocationPath();
/** Sets whether this group should render or not. */
void setActive(boolean active);
/** @return if active this group will render. */
boolean isActive();
/** Sets whether this group should render with Screen Space Ambient Occlusioning. */
void setSsaoEnabled(boolean ssaoEnabled);
/** @return if active this group will render with Screen Space Ambient Occlusioning. */
boolean isSsaoEnabled();
/** Sets where this group will render in the level. */
void setOriginBlockPos(DhApiVec3d pos);
/** @return the block position in the level that all {@see DhApiRenderableBox} will render relative to. */
DhApiVec3d getOriginBlockPos();
/**
* Called right before this group is rendered. <br>
* This is a good place to change the origin or notify of any box changes.
*/
void setPreRenderFunc(Consumer<DhApiRenderParam> renderEventParam);
void setPostRenderFunc(Consumer<DhApiRenderParam> renderEventParam); // TODO name?
/**
* If a cube's color, position, or other property is changed this method
* must be called for those changes to render. <br><br>
*
* Note: changing the group's position via {@link #setOriginBlockPos} doesn't
* require calling this method.
*/
void triggerBoxChange();
/** Only accepts values between 0 and 15 */
void setSkyLight(int skyLight);
int getSkyLight();
/** Only accepts values between 0 and 15 */
void setBlockLight(int blockLight);
int getBlockLight();
void setShading(DhApiRenderableBoxGroupShading shading);
DhApiRenderableBoxGroupShading getShading();
}
@@ -0,0 +1,18 @@
package com.seibel.distanthorizons.api.interfaces.util;
/**
* Used for objects that need deep clones. <br>
* Replacement for {@link Cloneable}.
*
* @see Cloneable
*
* @author James Seibel
* @version 2024-7-12
* @since API 3.0.0
*/
public interface IDhApiCopyable
{
/** Returns a deep clone of all parameters whenever possible. */
IDhApiCopyable copy();
}
@@ -21,6 +21,7 @@ package com.seibel.distanthorizons.api.interfaces.world;
import com.seibel.distanthorizons.api.interfaces.IDhApiUnsafeWrapper;
import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiLevelType;
import com.seibel.distanthorizons.api.interfaces.render.IDhApiCustomRenderRegister;
/**
* Can be either a Server or Client level.<br>
@@ -41,7 +42,7 @@ public interface IDhApiLevelWrapper extends IDhApiUnsafeWrapper
boolean hasSkyLight();
/** Returns the max block height of the level(?) */
int getHeight();
int getMaxHeight();
/**
* Returns the lowest possible block position for the level. <br>
@@ -49,4 +50,10 @@ public interface IDhApiLevelWrapper extends IDhApiUnsafeWrapper
*/
default int getMinHeight() { return 0; }
/**
* Will return null if called on the server,
* or if called before the renderer has been set up.
*/
IDhApiCustomRenderRegister getRenderRegister();
}
@@ -26,17 +26,20 @@ import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhAp
/**
* Fired after Distant Horizons finishes rendering a frame. <br>
* At this point DH will have also finished cleaning up any modifications it
* did to the OpenGL state, so the state should be back to Minecraft's defaults.
* did to the OpenGL state, so the state should be back to Minecraft's defaults. <br><br>
*
* Note: as of API v 3.0.0 no {@link DhApiRenderParam} is included in this event
* because the specific parameters may change
* depending on whether deferred rendering is enabled or not.
*
* @author James Seibel
* @version 2024-1-31
* @see DhApiRenderParam
* @version 2024-7-14
* @since API 1.0.0
*/
public abstract class DhApiAfterRenderEvent implements IDhApiEvent<DhApiRenderParam>
public abstract class DhApiAfterRenderEvent implements IDhApiEvent<Void>
{
/** Fired after Distant Horizons finishes rendering fake chunks. */
public abstract void afterRender(DhApiEventParam<DhApiRenderParam> event);
public abstract void afterRender(DhApiEventParam<Void> event);
//=========================//
@@ -44,6 +47,6 @@ public abstract class DhApiAfterRenderEvent implements IDhApiEvent<DhApiRenderPa
//=========================//
@Override
public final void fireEvent(DhApiEventParam<DhApiRenderParam> event) { this.afterRender(event); }
public final void fireEvent(DhApiEventParam<Void> event) { this.afterRender(event); }
}
@@ -31,7 +31,7 @@ import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhAp
*
* @author James Seibel
* @version 2024-1-31
* @since API 1.1.0
* @since API 2.0.0
*/
public abstract class DhApiBeforeApplyShaderRenderEvent implements IDhApiCancelableEvent<DhApiRenderParam>
{
@@ -20,9 +20,10 @@
package com.seibel.distanthorizons.api.methods.events.abstractEvents;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiEventParam;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiEventParam;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
import com.seibel.distanthorizons.coreapi.util.math.Vec3f;
import com.seibel.distanthorizons.api.objects.math.DhApiVec3f;
/**
* Called before Distant Horizons starts rendering a buffer. <br>
@@ -30,7 +31,7 @@ import com.seibel.distanthorizons.coreapi.util.math.Vec3f;
*
* @author James Seibel
* @version 2023-1-31
* @since API 1.1.0
* @since API 2.0.0
*
* @see DhApiBeforeRenderEvent
*/
@@ -52,20 +53,29 @@ public abstract class DhApiBeforeBufferRenderEvent implements IDhApiEvent<DhApiB
// parameter object //
//==================//
public static class EventParam extends DhApiRenderParam
public static class EventParam extends DhApiRenderParam implements IDhApiEventParam
{
/**
* Measured in blocks.
* Should be applied to the model view matrix to move the buffer into its proper place.
*/
public final Vec3f modelPos;
public final DhApiVec3f modelPos;
public EventParam(DhApiRenderParam parent, Vec3f modelPos)
public EventParam(DhApiRenderParam parent, DhApiVec3f modelPos)
{
super(parent);
this.modelPos = modelPos;
}
@Override
public EventParam copy()
{
return new EventParam(
this, this.modelPos.copy()
);
}
}
}
@@ -29,7 +29,7 @@ import com.seibel.distanthorizons.api.interfaces.render.IDhApiRenderProxy;
*
* @author James Seibel
* @version 2024-1-22
* @since API 1.1.0
* @since API 2.0.0
*/
public abstract class DhApiBeforeDeferredRenderEvent extends DhApiBeforeRenderEvent
{
@@ -0,0 +1,97 @@
/*
* This file is part of the Distant Horizons mod
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2023 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.methods.events.abstractEvents;
import com.seibel.distanthorizons.api.interfaces.render.IDhApiRenderableBoxGroup;
import com.seibel.distanthorizons.api.interfaces.world.IDhApiLevelWrapper;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiCancelableEvent;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiEventParam;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiCancelableEventParam;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
/**
* Called before Distant Horizons starts rendering a generic object. <br>
* Canceling this event will prevent the triggering {@link IDhApiRenderableBoxGroup} from rendering this frame.
*
* @author James Seibel
* @version 2024-7-11
* @since API 3.0.0
*/
public abstract class DhApiBeforeGenericObjectRenderEvent implements IDhApiCancelableEvent<DhApiBeforeGenericObjectRenderEvent.EventParam>
{
/** Fired before Distant Horizons renders a generic object. */
public abstract void beforeRender(DhApiCancelableEventParam<EventParam> event);
//=========================//
// internal DH API methods //
//=========================//
@Override
public final void fireEvent(DhApiCancelableEventParam<EventParam> input) { this.beforeRender(input); }
//==================//
// parameter object //
//==================//
public static class EventParam extends DhApiRenderParam implements IDhApiEventParam
{
public final long boxGroupId;
public final String resourceLocationNamespace;
public final String resourceLocationPath;
public EventParam(
DhApiRenderParam renderParam,
IDhApiRenderableBoxGroup boxGroup
)
{
super(renderParam);
this.boxGroupId = boxGroup.getId();
this.resourceLocationNamespace = boxGroup.getResourceLocationNamespace();
this.resourceLocationPath = boxGroup.getResourceLocationPath();
}
public EventParam(
DhApiRenderParam renderParam,
long boxGroupId, String resourceLocationNamespace, String resourceLocationPath
)
{
super(renderParam);
this.boxGroupId = boxGroupId;
this.resourceLocationNamespace = resourceLocationNamespace;
this.resourceLocationPath = resourceLocationPath;
}
@Override
public EventParam copy()
{
return new EventParam(
this,
this.boxGroupId, this.resourceLocationNamespace, this.resourceLocationPath
);
}
}
}
@@ -0,0 +1,47 @@
/*
* This file is part of the Distant Horizons mod
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2023 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.methods.events.abstractEvents;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiEventParam;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
/**
* Called before Distant Horizons starts the cleanup process done after rendering generic objects. <br>
* This is called after all generic objects have finished rendering.
*
* @author James Seibel
* @version 2024-7-13
* @since API 3.0.0
*/
public abstract class DhApiBeforeGenericRenderCleanupEvent implements IDhApiEvent<DhApiRenderParam>
{
/** Fired before Distant Horizons starts the cleanup process once rendering has finished. */
public abstract void beforeCleanup(DhApiEventParam<DhApiRenderParam> event);
//=========================//
// internal DH API methods //
//=========================//
@Override
public final void fireEvent(DhApiEventParam<DhApiRenderParam> event) { this.beforeCleanup(event); }
}
@@ -0,0 +1,50 @@
/*
* This file is part of the Distant Horizons mod
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2023 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.methods.events.abstractEvents;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiEventParam;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
/**
* Called before Distant Horizons has started setting up OpenGL objects for rendering generic objects. <br>
* If you want to modify already bound DH OpenGL objects try using {@link DhApiBeforeGenericObjectRenderEvent}.
*
* @author James Seibel
* @version 2024-7-12
* @since API 3.0.0
*
* @see DhApiBeforeGenericObjectRenderEvent
*/
public abstract class DhApiBeforeGenericRenderSetupEvent implements IDhApiEvent<DhApiRenderParam>
{
/** Fired before Distant Horizons has started setting up OpenGL objects for rendering generic objects. */
public abstract void beforeSetup(DhApiEventParam<DhApiRenderParam> input);
//=========================//
// internal DH API methods //
//=========================//
@Override
public final void fireEvent(DhApiEventParam<DhApiRenderParam> input) { this.beforeSetup(input); }
}
@@ -29,11 +29,11 @@ import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhAp
*
* @author James Seibel
* @version 2024-1-31
* @since API 1.1.0
* @since API 2.0.0
*/
public abstract class DhApiBeforeRenderCleanupEvent implements IDhApiEvent<DhApiRenderParam>
{
/** Fired before Distant Horizons renders LODs. */
/** Fired before Distant Horizons starts the cleanup process once rendering has finished. */
public abstract void beforeCleanup(DhApiEventParam<DhApiRenderParam> event);
@@ -31,7 +31,7 @@ import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhAp
*
* @author James Seibel
* @version 2023-1-31
* @since API 1.1.0
* @since API 2.0.0
*
* @see DhApiBeforeRenderEvent
*/
@@ -29,7 +29,7 @@ import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhAp
*
* @author James Seibel
* @version 2024-1-31
* @since API 1.1.0
* @since API 2.0.0
*
* @see DhApiBeforeRenderPassEvent
*/
@@ -31,7 +31,7 @@ import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhAp
*
* @author James Seibel
* @version 2024-1-31
* @since API 1.1.0
* @since API 2.0.0
*/
public abstract class DhApiBeforeTextureClearEvent implements IDhApiCancelableEvent<DhApiRenderParam>
{
@@ -22,6 +22,7 @@ package com.seibel.distanthorizons.api.methods.events.abstractEvents;
import com.seibel.distanthorizons.api.interfaces.data.IDhApiTerrainDataRepo;
import com.seibel.distanthorizons.api.interfaces.world.IDhApiLevelWrapper;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiEventParam;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiEventParam;
/**
@@ -53,7 +54,7 @@ public abstract class DhApiChunkModifiedEvent implements IDhApiEvent<DhApiChunkM
// parameter object //
//==================//
public static class EventParam
public static class EventParam implements IDhApiEventParam
{
/** The saved level. */
public final IDhApiLevelWrapper levelWrapper;
@@ -71,6 +72,15 @@ public abstract class DhApiChunkModifiedEvent implements IDhApiEvent<DhApiChunkM
this.chunkZ = chunkZ;
}
@Override
public EventParam copy()
{
return new EventParam(
this.levelWrapper,
this.chunkX, this.chunkZ
);
}
}
}
@@ -20,19 +20,20 @@
package com.seibel.distanthorizons.api.methods.events.abstractEvents;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiEventParam;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiEventParam;
/**
* Called before Distant Horizons starts rendering a buffer. <br>
* This event cannot be cancelled, use {@link DhApiBeforeRenderEvent} if you want to cancel rendering.
* Called whenever Distant Horizons (re)creates
* the color and depth textures it renders to. <br>
*
* @author James Seibel
* @version 2023-1-23
* @since API 1.1.0
* @version 2024-3-2
* @since API 2.0.0
*/
public abstract class DhApiScreenResizeEvent implements IDhApiEvent<DhApiScreenResizeEvent.EventParam>
public abstract class DhApiColorDepthTextureCreatedEvent implements IDhApiEvent<DhApiColorDepthTextureCreatedEvent.EventParam>
{
/** Fired immediately before Distant Horizons renders any transparent buffers. */
/** Fired before Distant Horizons creates. */
public abstract void onResize(DhApiEventParam<EventParam> event);
@@ -48,7 +49,7 @@ public abstract class DhApiScreenResizeEvent implements IDhApiEvent<DhApiScreenR
// parameter object //
//==================//
public static class EventParam
public static class EventParam implements IDhApiEventParam
{
/** Measured in pixels */
public final int previousWidth;
@@ -72,6 +73,16 @@ public abstract class DhApiScreenResizeEvent implements IDhApiEvent<DhApiScreenR
this.newHeight = newHeight;
}
@Override
public EventParam copy()
{
return new EventParam(
this.previousWidth, this.previousHeight,
this.newWidth, this.newHeight
);
}
}
}
@@ -21,6 +21,7 @@ package com.seibel.distanthorizons.api.methods.events.abstractEvents;
import com.seibel.distanthorizons.api.interfaces.world.IDhApiLevelWrapper;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiEventParam;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiEventParam;
/**
@@ -49,13 +50,16 @@ public abstract class DhApiLevelLoadEvent implements IDhApiEvent<DhApiLevelLoadE
// parameter object //
//==================//
public static class EventParam
public static class EventParam implements IDhApiEventParam
{
/** The newly loaded level. */
public final IDhApiLevelWrapper levelWrapper;
public EventParam(IDhApiLevelWrapper newLevelWrapper) { this.levelWrapper = newLevelWrapper; }
@Override
public EventParam copy() { return new EventParam(this.levelWrapper); }
}
}
@@ -19,9 +19,9 @@
package com.seibel.distanthorizons.api.methods.events.abstractEvents;
import com.seibel.distanthorizons.api.DhApi;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.distanthorizons.api.interfaces.world.IDhApiLevelWrapper;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiEventParam;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiEventParam;
/**
@@ -49,13 +49,16 @@ public abstract class DhApiLevelUnloadEvent implements IDhApiEvent<DhApiLevelUnl
// parameter object //
//==================//
public static class EventParam
public static class EventParam implements IDhApiEventParam
{
/** The recently unloaded level. */
public final IDhApiLevelWrapper levelWrapper;
public EventParam(IDhApiLevelWrapper newLevelWrapper) { this.levelWrapper = newLevelWrapper; }
@Override
public EventParam copy() { return new EventParam(this.levelWrapper); }
}
}
@@ -0,0 +1,13 @@
package com.seibel.distanthorizons.api.methods.events.interfaces;
import com.seibel.distanthorizons.api.interfaces.util.IDhApiCopyable;
/**
* @author James Seibel
* @version 2024-7-12
* @since API 3.0.0
*/
public interface IDhApiEventParam extends IDhApiCopyable
{
}
@@ -20,7 +20,8 @@
package com.seibel.distanthorizons.api.methods.events.sharedParameterObjects;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiRenderPass;
import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiEventParam;
import com.seibel.distanthorizons.api.objects.math.DhApiMat4f;
/**
* Contains information relevant to Distant Horizons and Minecraft rendering.
@@ -29,7 +30,7 @@ import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
* @version 2024-1-31
* @since API 1.0.0
*/
public class DhApiRenderParam
public class DhApiRenderParam implements IDhApiEventParam
{
/** Indicates what render pass DH is currently rendering */
public final EDhApiRenderPass renderPass;
@@ -49,18 +50,15 @@ public class DhApiRenderParam
public final float farClipPlane;
/** The projection matrix Minecraft is using to render this frame. */
public final Mat4f mcProjectionMatrix;
public final DhApiMat4f mcProjectionMatrix;
/** The model view matrix Minecraft is using to render this frame. */
public final Mat4f mcModelViewMatrix;
public final DhApiMat4f mcModelViewMatrix;
/** The projection matrix Distant Horizons is using to render this frame. */
public final Mat4f dhProjectionMatrix;
public final DhApiMat4f dhProjectionMatrix;
/** The model view matrix Distant Horizons is using to render this frame. */
public final Mat4f dhModelViewMatrix;
public final DhApiMat4f dhModelViewMatrix;
public final int lightmapBindingIndex = 0;
// TODO why is this here? wouldn't it make more sense to have this built into the vertex buffer data?
public final int worldYOffset;
@@ -69,24 +67,24 @@ public class DhApiRenderParam
// constructors //
//==============//
public DhApiRenderParam(DhApiRenderParam parent)
{
this(
parent.renderPass,
parent.partialTicks,
parent.nearClipPlane, parent.farClipPlane,
parent.mcProjectionMatrix, parent.mcModelViewMatrix,
parent.dhProjectionMatrix, parent.dhModelViewMatrix,
parent.worldYOffset
);
parent.renderPass,
parent.partialTicks,
parent.nearClipPlane, parent.farClipPlane,
parent.mcProjectionMatrix.copy(), parent.mcModelViewMatrix.copy(),
parent.dhProjectionMatrix.copy(), parent.dhModelViewMatrix.copy(),
parent.worldYOffset
);
}
public DhApiRenderParam(
EDhApiRenderPass renderPass,
float newPartialTicks,
float nearClipPlane, float farClipPlane,
Mat4f newMcProjectionMatrix, Mat4f newMcModelViewMatrix,
Mat4f newDhProjectionMatrix, Mat4f newDhModelViewMatrix,
DhApiMat4f newMcProjectionMatrix, DhApiMat4f newMcModelViewMatrix,
DhApiMat4f newDhProjectionMatrix, DhApiMat4f newDhModelViewMatrix,
int worldYOffset
)
{
@@ -107,4 +105,16 @@ public class DhApiRenderParam
}
//================//
// base overrides //
//================//
@Override
public DhApiRenderParam copy()
{
return new DhApiRenderParam(this);
}
}
@@ -30,7 +30,7 @@ import java.util.List;
*
* @author Builderb0y, James Seibel
* @version 2023-12-21
* @since API 1.1.0
* @since API 2.0.0
*
* @see IDhApiWrapperFactory
* @see DhApiTerrainDataPoint
@@ -20,7 +20,6 @@
package com.seibel.distanthorizons.api.objects.data;
import com.seibel.distanthorizons.api.objects.math.DhApiVec3i;
import com.seibel.distanthorizons.coreapi.util.math.Vec3i;
/**
* Holds a single datapoint of terrain data
@@ -47,7 +46,7 @@ public class DhApiRaycastResult
public DhApiRaycastResult(DhApiTerrainDataPoint dataPoint, Vec3i blockPos)
public DhApiRaycastResult(DhApiTerrainDataPoint dataPoint, DhApiVec3i blockPos)
{
this.dataPoint = dataPoint;
this.pos = blockPos;
@@ -40,7 +40,8 @@ public class DhApiTerrainDataPoint
*/
public final byte detailLevel;
public final int lightLevel;
public final int blockLightLevel;
public final int skyLightLevel;
public final int topYBlockPos;
public final int bottomYBlockPos;
@@ -49,11 +50,12 @@ public class DhApiTerrainDataPoint
public DhApiTerrainDataPoint(byte detailLevel, int lightLevel, int topYBlockPos, int bottomYBlockPos, IDhApiBlockStateWrapper blockStateWrapper, IDhApiBiomeWrapper biomeWrapper)
public DhApiTerrainDataPoint(byte detailLevel, int blockLightLevel, int skyLightLevel, int topYBlockPos, int bottomYBlockPos, IDhApiBlockStateWrapper blockStateWrapper, IDhApiBiomeWrapper biomeWrapper)
{
this.detailLevel = detailLevel;
this.lightLevel = lightLevel;
this.blockLightLevel = blockLightLevel;
this.skyLightLevel = skyLightLevel;
this.topYBlockPos = topYBlockPos;
this.bottomYBlockPos = bottomYBlockPos;
@@ -17,46 +17,55 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.coreapi.util.math;
package com.seibel.distanthorizons.api.objects.math;
import org.joml.Matrix4f;
import org.joml.Matrix4fc;
import java.nio.FloatBuffer;
import com.seibel.distanthorizons.api.interfaces.util.IDhApiCopyable;
/**
* An (almost) exact copy of Minecraft's 1.16.5
* implementation of a 4x4 float matrix.
* implementation of a 4x4 float matrix. <br><br>
*
* <code>
* m00, m10, m20, m30, <br>
* m01, m11, m21, m31, <br>
* m02, m12, m22, m32, <br>
* m03, m13, m23, m33 <br>
* </code>
*
* @author James Seibel
* @version 11-11-2021
* @version 2024-6-30
*/
public class Mat4f
public class DhApiMat4f implements IDhApiCopyable
{
private float m00;
private float m01;
private float m02;
private float m03;
private float m10;
private float m11;
private float m12;
private float m13;
private float m20;
private float m21;
private float m22;
private float m23;
private float m30;
private float m31;
private float m32;
private float m33;
public float m00;
public float m01;
public float m02;
public float m03;
public float m10;
public float m11;
public float m12;
public float m13;
public float m20;
public float m21;
public float m22;
public float m23;
public float m30;
public float m31;
public float m32;
public float m33;
public Mat4f()
{
}
public Mat4f(Mat4f sourceMatrix)
//==============//
// constructors //
//==============//
public DhApiMat4f() { /* all values are 0 */ }
public DhApiMat4f(DhApiMat4f sourceMatrix)
{
this.m00 = sourceMatrix.m00;
this.m01 = sourceMatrix.m01;
@@ -76,163 +85,36 @@ public class Mat4f
this.m33 = sourceMatrix.m33;
}
public Mat4f(Matrix4fc sourceMatrix) { this(convertJomlMatrixToArray(sourceMatrix)); }
private static float[] convertJomlMatrixToArray(Matrix4fc sourceMatrix)
/** Expects the values of the input array to be in row major order (AKA rows then columns) */
public DhApiMat4f(float[] values)
{
FloatBuffer buffer = FloatBuffer.allocate(16);
m00 = values[0];
m01 = values[1];
m02 = values[2];
m03 = values[3];
buffer.put(bufferIndex(0, 0), sourceMatrix.m00());
buffer.put(bufferIndex(0, 1), sourceMatrix.m01());
buffer.put(bufferIndex(0, 2), sourceMatrix.m02());
buffer.put(bufferIndex(0, 3), sourceMatrix.m03());
buffer.put(bufferIndex(1, 0), sourceMatrix.m10());
buffer.put(bufferIndex(1, 1), sourceMatrix.m11());
buffer.put(bufferIndex(1, 2), sourceMatrix.m12());
buffer.put(bufferIndex(1, 3), sourceMatrix.m13());
buffer.put(bufferIndex(2, 0), sourceMatrix.m20());
buffer.put(bufferIndex(2, 1), sourceMatrix.m21());
buffer.put(bufferIndex(2, 2), sourceMatrix.m22());
buffer.put(bufferIndex(2, 3), sourceMatrix.m23());
buffer.put(bufferIndex(3, 0), sourceMatrix.m30());
buffer.put(bufferIndex(3, 1), sourceMatrix.m31());
buffer.put(bufferIndex(3, 2), sourceMatrix.m32());
buffer.put(bufferIndex(3, 3), sourceMatrix.m33());
m10 = values[4];
m11 = values[5];
m12 = values[6];
m13 = values[7];
return buffer.array();
}
/* Quaternions are not currently needed/implemented
public Matrix4float(Quaternion p_i48104_1_)
{
float f = p_i48104_1_.i();
float f1 = p_i48104_1_.j();
float f2 = p_i48104_1_.k();
float f3 = p_i48104_1_.r();
float f4 = 2.0F * f * f;
float f5 = 2.0F * f1 * f1;
float f6 = 2.0F * f2 * f2;
this.m00 = 1.0F - f5 - f6;
this.m11 = 1.0F - f6 - f4;
this.m22 = 1.0F - f4 - f5;
this.m33 = 1.0F;
float f7 = f * f1;
float f8 = f1 * f2;
float f9 = f2 * f;
float f10 = f * f3;
float f11 = f1 * f3;
float f12 = f2 * f3;
this.m10 = 2.0F * (f7 + f12);
this.m01 = 2.0F * (f7 - f12);
this.m20 = 2.0F * (f9 - f11);
this.m02 = 2.0F * (f9 + f11);
this.m21 = 2.0F * (f8 + f10);
this.m12 = 2.0F * (f8 - f10);
}
*/
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
else if (obj != null && this.getClass() == obj.getClass())
{
Mat4f otherMatrix = (Mat4f) obj;
return Float.compare(otherMatrix.m00, this.m00) == 0
&& Float.compare(otherMatrix.m01, this.m01) == 0
&& Float.compare(otherMatrix.m02, this.m02) == 0
&& Float.compare(otherMatrix.m03, this.m03) == 0
&& Float.compare(otherMatrix.m10, this.m10) == 0
&& Float.compare(otherMatrix.m11, this.m11) == 0
&& Float.compare(otherMatrix.m12, this.m12) == 0
&& Float.compare(otherMatrix.m13, this.m13) == 0
&& Float.compare(otherMatrix.m20, this.m20) == 0
&& Float.compare(otherMatrix.m21, this.m21) == 0
&& Float.compare(otherMatrix.m22, this.m22) == 0
&& Float.compare(otherMatrix.m23, this.m23) == 0
&& Float.compare(otherMatrix.m30, this.m30) == 0
&& Float.compare(otherMatrix.m31, this.m31) == 0
&& Float.compare(otherMatrix.m32, this.m32) == 0
&& Float.compare(otherMatrix.m33, this.m33) == 0;
}
else
{
return false;
}
}
@Override
public int hashCode()
{
int i = this.m00 != 0.0F ? Float.floatToIntBits(this.m00) : 0;
i = 31 * i + (this.m01 != 0.0F ? Float.floatToIntBits(this.m01) : 0);
i = 31 * i + (this.m02 != 0.0F ? Float.floatToIntBits(this.m02) : 0);
i = 31 * i + (this.m03 != 0.0F ? Float.floatToIntBits(this.m03) : 0);
i = 31 * i + (this.m10 != 0.0F ? Float.floatToIntBits(this.m10) : 0);
i = 31 * i + (this.m11 != 0.0F ? Float.floatToIntBits(this.m11) : 0);
i = 31 * i + (this.m12 != 0.0F ? Float.floatToIntBits(this.m12) : 0);
i = 31 * i + (this.m13 != 0.0F ? Float.floatToIntBits(this.m13) : 0);
i = 31 * i + (this.m20 != 0.0F ? Float.floatToIntBits(this.m20) : 0);
i = 31 * i + (this.m21 != 0.0F ? Float.floatToIntBits(this.m21) : 0);
i = 31 * i + (this.m22 != 0.0F ? Float.floatToIntBits(this.m22) : 0);
i = 31 * i + (this.m23 != 0.0F ? Float.floatToIntBits(this.m23) : 0);
i = 31 * i + (this.m30 != 0.0F ? Float.floatToIntBits(this.m30) : 0);
i = 31 * i + (this.m31 != 0.0F ? Float.floatToIntBits(this.m31) : 0);
i = 31 * i + (this.m32 != 0.0F ? Float.floatToIntBits(this.m32) : 0);
return 31 * i + (this.m33 != 0.0F ? Float.floatToIntBits(this.m33) : 0);
m20 = values[8];
m21 = values[9];
m22 = values[10];
m23 = values[11];
m30 = values[12];
m31 = values[13];
m32 = values[14];
m33 = values[15];
}
@Override
public String toString()
{
return "Matrix4f:\n" +
this.m00 + " " + this.m01 + " " + this.m02 + " " + this.m03 + "\n" +
this.m10 + " " + this.m11 + " " + this.m12 + " " + this.m13 + "\n" +
this.m20 + " " + this.m21 + " " + this.m22 + " " + this.m23 + "\n" +
this.m30 + " " + this.m31 + " " + this.m32 + " " + this.m33 + "\n";
}
public void store(FloatBuffer floatBuffer)
{
floatBuffer.put(bufferIndex(0, 0), this.m00);
floatBuffer.put(bufferIndex(0, 1), this.m01);
floatBuffer.put(bufferIndex(0, 2), this.m02);
floatBuffer.put(bufferIndex(0, 3), this.m03);
floatBuffer.put(bufferIndex(1, 0), this.m10);
floatBuffer.put(bufferIndex(1, 1), this.m11);
floatBuffer.put(bufferIndex(1, 2), this.m12);
floatBuffer.put(bufferIndex(1, 3), this.m13);
floatBuffer.put(bufferIndex(2, 0), this.m20);
floatBuffer.put(bufferIndex(2, 1), this.m21);
floatBuffer.put(bufferIndex(2, 2), this.m22);
floatBuffer.put(bufferIndex(2, 3), this.m23);
floatBuffer.put(bufferIndex(3, 0), this.m30);
floatBuffer.put(bufferIndex(3, 1), this.m31);
floatBuffer.put(bufferIndex(3, 2), this.m32);
floatBuffer.put(bufferIndex(3, 3), this.m33);
}
public Matrix4f createJomlMatrix()
{
return new Matrix4f(
this.m00, this.m10, this.m20, this.m30,
this.m01, this.m11, this.m21, this.m31,
this.m02, this.m12, this.m22, this.m32,
this.m03, this.m13, this.m23, this.m33
);
}
private static int bufferIndex(int xIndex, int zIndex)
{
return (zIndex * 4) + xIndex;
}
//=========//
// methods //
//=========//
public void setIdentity()
{
@@ -341,7 +223,7 @@ public class Mat4f
}
}
public void multiply(Mat4f multMatrix)
public void multiply(DhApiMat4f multMatrix)
{
float f = this.m00 * multMatrix.m00 + this.m01 * multMatrix.m10 + this.m02 * multMatrix.m20 + this.m03 * multMatrix.m30;
float f1 = this.m00 * multMatrix.m01 + this.m01 * multMatrix.m11 + this.m02 * multMatrix.m21 + this.m03 * multMatrix.m31;
@@ -377,13 +259,6 @@ public class Mat4f
this.m33 = f15;
}
/* Quaternions aren't currently needed/implemented
public void multiply(Quaternion p_226596_1_)
{
this.multiply(new Matrix4f(p_226596_1_));
}
*/
public void multiply(float scalar)
{
this.m00 *= scalar;
@@ -404,81 +279,6 @@ public class Mat4f
this.m33 *= scalar;
}
public static Mat4f perspective(double fov, float widthHeightRatio, float nearClipPlane, float farClipPlane)
{
float f = (float) (1.0D / Math.tan(fov * ((float) Math.PI / 180F) / 2.0D));
Mat4f matrix = new Mat4f();
matrix.m00 = f / widthHeightRatio;
matrix.m11 = f;
matrix.m22 = (farClipPlane + nearClipPlane) / (nearClipPlane - farClipPlane);
matrix.m32 = -1.0F;
matrix.m23 = 2.0F * farClipPlane * nearClipPlane / (nearClipPlane - farClipPlane);
return matrix;
}
/* not currently needed/implemented
* Also the parameter names should be double checked as they may be incorrect
public static Matrix4Float orthographic(float left, float right, float top, float bottom)
{
Matrix4Float matrix4f = new Matrix4Float();
matrix4f.m00 = 2.0F / left;
matrix4f.m11 = 2.0F / right;
float f = bottom - top;
matrix4f.m22 = -2.0F / f;
matrix4f.m33 = 1.0F;
matrix4f.m03 = -1.0F;
matrix4f.m13 = -1.0F;
matrix4f.m23 = -(bottom + top) / f;
return matrix4f;
}
*/
/**
* TODO: what kind of translation is this?
* and how is this different from "multiplyTranslationMatrix"?
* Answer: This is faster and direct (but only if this is pure translation matrix without rotate)
*/
public void translate(Vec3f vec)
{
this.m03 += vec.x;
this.m13 += vec.y;
this.m23 += vec.z;
}
/** originally "translate" from Minecraft's MatrixStack */
public void multiplyTranslationMatrix(double x, double y, double z)
{
multiply(createTranslateMatrix((float) x, (float) y, (float) z));
}
public Mat4f copy()
{
return new Mat4f(this);
}
public static Mat4f createScaleMatrix(float x, float y, float z)
{
Mat4f matrix = new Mat4f();
matrix.m00 = x;
matrix.m11 = y;
matrix.m22 = z;
matrix.m33 = 1.0F;
return matrix;
}
public static Mat4f createTranslateMatrix(float x, float y, float z)
{
Mat4f matrix = new Mat4f();
matrix.m00 = 1.0F;
matrix.m11 = 1.0F;
matrix.m22 = 1.0F;
matrix.m33 = 1.0F;
matrix.m03 = x;
matrix.m13 = y;
matrix.m23 = z;
return matrix;
}
@@ -487,6 +287,8 @@ public class Mat4f
// methods //
//==================//
private static int getArrayIndex(int xIndex, int zIndex) { return (zIndex * 4) + xIndex; }
/** Returns the values of this matrix in row major order (AKA rows then columns) */
public float[] getValuesAsArray()
{
@@ -513,113 +315,77 @@ public class Mat4f
};
}
public Vec3f asNonNormalizedLookForwardVector()
//================//
// base overrides //
//================//
@Override
public boolean equals(Object obj)
{
return new Vec3f(this.m02, this.m12, this.m22);
if (this == obj)
{
return true;
}
else if (obj != null && this.getClass() == obj.getClass())
{
DhApiMat4f otherMatrix = (DhApiMat4f) obj;
return Float.compare(otherMatrix.m00, this.m00) == 0
&& Float.compare(otherMatrix.m01, this.m01) == 0
&& Float.compare(otherMatrix.m02, this.m02) == 0
&& Float.compare(otherMatrix.m03, this.m03) == 0
&& Float.compare(otherMatrix.m10, this.m10) == 0
&& Float.compare(otherMatrix.m11, this.m11) == 0
&& Float.compare(otherMatrix.m12, this.m12) == 0
&& Float.compare(otherMatrix.m13, this.m13) == 0
&& Float.compare(otherMatrix.m20, this.m20) == 0
&& Float.compare(otherMatrix.m21, this.m21) == 0
&& Float.compare(otherMatrix.m22, this.m22) == 0
&& Float.compare(otherMatrix.m23, this.m23) == 0
&& Float.compare(otherMatrix.m30, this.m30) == 0
&& Float.compare(otherMatrix.m31, this.m31) == 0
&& Float.compare(otherMatrix.m32, this.m32) == 0
&& Float.compare(otherMatrix.m33, this.m33) == 0;
}
else
{
return false;
}
}
//===============//
// Forge methods //
//===============//
public Mat4f(float[] values)
@Override
public int hashCode()
{
m00 = values[0];
m01 = values[1];
m02 = values[2];
m03 = values[3];
m10 = values[4];
m11 = values[5];
m12 = values[6];
m13 = values[7];
m20 = values[8];
m21 = values[9];
m22 = values[10];
m23 = values[11];
m30 = values[12];
m31 = values[13];
m32 = values[14];
m33 = values[15];
int i = this.m00 != 0.0F ? Float.floatToIntBits(this.m00) : 0;
i = 31 * i + (this.m01 != 0.0F ? Float.floatToIntBits(this.m01) : 0);
i = 31 * i + (this.m02 != 0.0F ? Float.floatToIntBits(this.m02) : 0);
i = 31 * i + (this.m03 != 0.0F ? Float.floatToIntBits(this.m03) : 0);
i = 31 * i + (this.m10 != 0.0F ? Float.floatToIntBits(this.m10) : 0);
i = 31 * i + (this.m11 != 0.0F ? Float.floatToIntBits(this.m11) : 0);
i = 31 * i + (this.m12 != 0.0F ? Float.floatToIntBits(this.m12) : 0);
i = 31 * i + (this.m13 != 0.0F ? Float.floatToIntBits(this.m13) : 0);
i = 31 * i + (this.m20 != 0.0F ? Float.floatToIntBits(this.m20) : 0);
i = 31 * i + (this.m21 != 0.0F ? Float.floatToIntBits(this.m21) : 0);
i = 31 * i + (this.m22 != 0.0F ? Float.floatToIntBits(this.m22) : 0);
i = 31 * i + (this.m23 != 0.0F ? Float.floatToIntBits(this.m23) : 0);
i = 31 * i + (this.m30 != 0.0F ? Float.floatToIntBits(this.m30) : 0);
i = 31 * i + (this.m31 != 0.0F ? Float.floatToIntBits(this.m31) : 0);
i = 31 * i + (this.m32 != 0.0F ? Float.floatToIntBits(this.m32) : 0);
return 31 * i + (this.m33 != 0.0F ? Float.floatToIntBits(this.m33) : 0);
}
public Mat4f(FloatBuffer buffer)
@Override
public String toString()
{
this(buffer.array());
return "Matrix4f:\n" +
this.m00 + " " + this.m01 + " " + this.m02 + " " + this.m03 + "\n" +
this.m10 + " " + this.m11 + " " + this.m12 + " " + this.m13 + "\n" +
this.m20 + " " + this.m21 + " " + this.m22 + " " + this.m23 + "\n" +
this.m30 + " " + this.m31 + " " + this.m32 + " " + this.m33 + "\n";
}
public void set(Mat4f mat)
{
this.m00 = mat.m00;
this.m01 = mat.m01;
this.m02 = mat.m02;
this.m03 = mat.m03;
this.m10 = mat.m10;
this.m11 = mat.m11;
this.m12 = mat.m12;
this.m13 = mat.m13;
this.m20 = mat.m20;
this.m21 = mat.m21;
this.m22 = mat.m22;
this.m23 = mat.m23;
this.m30 = mat.m30;
this.m31 = mat.m31;
this.m32 = mat.m32;
this.m33 = mat.m33;
}
public void add(Mat4f other)
{
m00 += other.m00;
m01 += other.m01;
m02 += other.m02;
m03 += other.m03;
m10 += other.m10;
m11 += other.m11;
m12 += other.m12;
m13 += other.m13;
m20 += other.m20;
m21 += other.m21;
m22 += other.m22;
m23 += other.m23;
m30 += other.m30;
m31 += other.m31;
m32 += other.m32;
m33 += other.m33;
}
public void multiplyBackward(Mat4f other)
{
Mat4f copy = other.copy();
copy.multiply(this);
this.set(copy);
}
public void setTranslation(float x, float y, float z)
{
this.m00 = 1.0F;
this.m11 = 1.0F;
this.m22 = 1.0F;
this.m33 = 1.0F;
this.m03 = x;
this.m13 = y;
this.m23 = z;
}
/**
* Changes the values that store the clipping planes.
* Formula for calculating matrix values is the same that OpenGL uses when making matrices.
*
* @param nearClip New near clipping plane value.
* @param farClip New far clipping plane value.
*/
public void setClipPlanes(float nearClip, float farClip)
{
//convert to matrix values, formula copied from a textbook / openGL specification.
float matNearClip = -((farClip + nearClip) / (farClip - nearClip));
float matFarClip = -((2 * farClip * nearClip) / (farClip - nearClip));
//set new values for the clip planes.
this.m22 = matNearClip;
this.m23 = matFarClip;
}
@Override
public DhApiMat4f copy() { return new DhApiMat4f(this); }
}
@@ -0,0 +1,94 @@
/*
* This file is part of the Distant Horizons mod
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2023 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.objects.math;
/**
* Often used to store block positions or any other
* position in 3D space.
*
* @author James Seibel
* @version 2024-7-9
* @since API 3.0.0
*/
public class DhApiVec3d
{
public double x;
public double y;
public double z;
/** creates a Vec3 at (0,0,0) */
public DhApiVec3d()
{
this.x = 0;
this.y = 0;
this.z = 0;
}
public DhApiVec3d(double x, double y, double z)
{
this.x = x;
this.y = y;
this.z = z;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
else if (obj != null && this.getClass() == obj.getClass())
{
DhApiVec3d Vec3d = (DhApiVec3d) obj;
if (Double.compare(Vec3d.x, this.x) != 0)
{
return false;
}
else if (Double.compare(Vec3d.y, this.y) != 0)
{
return false;
}
else
{
return Double.compare(Vec3d.z, this.z) == 0;
}
}
else
{
return false;
}
}
@Override
public int hashCode()
{
long i = Double.doubleToLongBits(this.x);
i = 31 * i + Double.doubleToLongBits(this.y);
i = 31 * i + Double.doubleToLongBits(this.z);
return Long.hashCode(i);
}
@Override
public String toString() { return "[" + this.x + ", " + this.y + ", " + this.z + "]"; }
}
@@ -0,0 +1,98 @@
/*
* This file is part of the Distant Horizons mod
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2023 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.objects.math;
import com.seibel.distanthorizons.api.interfaces.util.IDhApiCopyable;
/**
* Often used to store block positions or any other
* position in 3D space.
*
* @author James Seibel
* @version 2024-6-3
* @since API 2.2.0
*/
public class DhApiVec3f implements IDhApiCopyable
{
public float x;
public float y;
public float z;
/** creates a Vec3 at (0,0,0) */
public DhApiVec3f()
{
this.x = 0;
this.y = 0;
this.z = 0;
}
public DhApiVec3f(float x, float y, float z)
{
this.x = x;
this.y = y;
this.z = z;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
else if (obj != null && this.getClass() == obj.getClass())
{
DhApiVec3f Vec3f = (DhApiVec3f) obj;
if (Float.compare(Vec3f.x, this.x) != 0)
{
return false;
}
else if (Float.compare(Vec3f.y, this.y) != 0)
{
return false;
}
else
{
return Float.compare(Vec3f.z, this.z) == 0;
}
}
else
{
return false;
}
}
@Override
public int hashCode()
{
int i = Float.floatToIntBits(this.x);
i = 31 * i + Float.floatToIntBits(this.y);
return 31 * i + Float.floatToIntBits(this.z);
}
@Override
public String toString() { return "[" + this.x + ", " + this.y + ", " + this.z + "]"; }
@Override
public DhApiVec3f copy() { return new DhApiVec3f(this.x, this.y, this.z); }
}
@@ -0,0 +1,52 @@
package com.seibel.distanthorizons.api.objects.render;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiBlockMaterial;
import com.seibel.distanthorizons.api.interfaces.render.IDhApiRenderableBoxGroup;
import com.seibel.distanthorizons.api.objects.math.DhApiVec3d;
import com.seibel.distanthorizons.api.objects.math.DhApiVec3f;
import java.awt.*;
/**
* @see IDhApiRenderableBoxGroup
*
* @author James Seibel
* @version 2024-6-30
* @since API 3.0.0
*/
public class DhApiRenderableBox
{
/** the position closest to (-inf,-inf) */
public DhApiVec3d minPos;
/** the position closest to (+inf,+inf) */
public DhApiVec3d maxPos;
public Color color;
public byte material;
//==============//
// constructors //
//==============//
public DhApiRenderableBox(DhApiVec3d minPos, float width, Color color, EDhApiBlockMaterial material)
{
this(minPos, new DhApiVec3d(
minPos.x + width,
minPos.y + width,
minPos.z + width
), color, material);
}
public DhApiRenderableBox(DhApiVec3d minPos, DhApiVec3d maxPos, Color color, EDhApiBlockMaterial material)
{
this.minPos = minPos;
this.maxPos = maxPos;
this.color = color;
this.material = material.index;
}
}
@@ -0,0 +1,93 @@
package com.seibel.distanthorizons.api.objects.render;
import com.seibel.distanthorizons.api.interfaces.render.IDhApiRenderableBoxGroup;
import com.seibel.distanthorizons.api.objects.math.DhApiVec3f;
import java.awt.*;
/**
* @see IDhApiRenderableBoxGroup
*
* Shading values are multiplied against the color for each direction,
* for example: <br>
* A shading value of 1.0 indicates the color is unchanged. <br>
* A shading value of 0.0 changes the color to black. <br>
*
* @author James Seibel
* @version 2024-7-7
* @since API 3.0.0
*/
public class DhApiRenderableBoxGroupShading
{
/** negative X */
public float north = 1.0f;
/** positive X */
public float south = 1.0f;
/** positive X */
public float east = 1.0f;
/** negative X */
public float west = 1.0f;
/** positive Y */
public float top = 1.0f;
/** negative Y */
public float bottom = 1.0f;
//==============//
// constructors //
//==============//
public static DhApiRenderableBoxGroupShading getDefaultShaded()
{
DhApiRenderableBoxGroupShading shading = new DhApiRenderableBoxGroupShading();
shading.setDefaultShaded();
return shading;
}
public static DhApiRenderableBoxGroupShading getUnshaded()
{
DhApiRenderableBoxGroupShading shading = new DhApiRenderableBoxGroupShading();
shading.setUnshaded();
return shading;
}
//=========//
// methods //
//=========//
/**
* Directions will have different brightness similar to Minecraft blocks. <br>
* This is a good default for un-lit objects.
*/
public void setDefaultShaded()
{
this.north = 0.8f;
this.south = 0.8f;
this.east = 0.6f;
this.west = 0.6f;
this.top = 1.0f;
this.bottom = 0.5f;
}
/**
* All directions render with the same brightness. <br>
* This is best used for glowing objects like beacons.
*/
public void setUnshaded()
{
this.north = 1.0f;
this.south = 1.0f;
this.east = 1.0f;
this.west = 1.0f;
this.top = 1.0f;
this.bottom = 1.0f;
}
}
@@ -22,6 +22,7 @@ package com.seibel.distanthorizons.coreapi.DependencyInjection;
import com.seibel.distanthorizons.api.interfaces.events.IDhApiEventInjector;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiCancelableEvent;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiEventParam;
import com.seibel.distanthorizons.api.methods.events.interfaces.IDhApiOneTimeEvent;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiCancelableEventParam;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiEventParam;
@@ -140,7 +141,26 @@ public class ApiEventInjector extends DependencyInjector<IDhApiEvent> implements
// fire each event and record if any of them
// request to cancel the event.
DhApiEventParam<T> eventParam = createEventParamWrapper(event, eventInput);
// attempt to clone the event input if possible
// this is done to reduce the likely hood that one event listener
// will make change the event parameter for other listeners
T input = eventInput;
if (eventInput instanceof IDhApiEventParam)
{
try
{
//noinspection unchecked
input = (T) ((IDhApiEventParam) eventInput).copy();
}
catch (Exception e)
{
LOGGER.error("Unable to clone event parameter ["+eventInput.getClass().getSimpleName()+"], error: ["+e.getMessage()+"].", e);
}
}
DhApiEventParam<T> eventParam = createEventParamWrapper(event, input);
event.fireEvent(eventParam);
if (eventParam instanceof DhApiCancelableEventParam)
@@ -34,14 +34,14 @@ public final class ModInfo
public static final String NAME = "DistantHorizons";
/** Human-readable version of NAME */
public static final String READABLE_NAME = "Distant Horizons";
public static final String VERSION = "2.0.2-a-dev";
public static final String VERSION = "2.1.3-a-dev";
/** Returns true if the current build is an unstable developer build, false otherwise. */
public static boolean IS_DEV_BUILD = VERSION.toLowerCase().contains("dev");
/** This version should only be updated when breaking changes are introduced to the DH API */
public static final int API_MAJOR_VERSION = 1;
public static final int API_MAJOR_VERSION = 3;
/** This version should be updated whenever new methods are added to the DH API */
public static final int API_MINOR_VERSION = 1;
public static final int API_MINOR_VERSION = 0;
/** This version should be updated whenever non-breaking fixes are added to the DH API */
public static final int API_PATH_VERSION = 0;
@@ -19,7 +19,8 @@
package com.seibel.distanthorizons.coreapi.util;
import java.util.ArrayList;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.util.Arrays;
/**
@@ -85,4 +86,25 @@ public class StringUtil
return new String(hexChars);
}
/**
* Source:
* https://stackoverflow.com/questions/3758606/how-can-i-convert-byte-size-into-a-human-readable-format-in-java#3758880
*/
public static String convertByteCountToHumanReadableSI(long bytes)
{
if (-1000 < bytes && bytes < 1000)
{
return bytes + " B";
}
CharacterIterator ci = new StringCharacterIterator("kMGTPE");
while (bytes <= -999_950 || bytes >= 999_950)
{
bytes /= 1000;
ci.next();
}
return String.format("%.1f %cB", bytes / 1000.0, ci.current());
}
}
@@ -19,7 +19,7 @@
package com.seibel.distanthorizons.coreapi.util.converters;
import com.seibel.distanthorizons.api.enums.rendering.ERendererMode;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiRendererMode;
import com.seibel.distanthorizons.coreapi.interfaces.config.IConverter;
/**
@@ -28,17 +28,17 @@ import com.seibel.distanthorizons.coreapi.interfaces.config.IConverter;
* @author James Seibel
* @version 2022-6-30
*/
public class RenderModeEnabledConverter implements IConverter<ERendererMode, Boolean>
public class RenderModeEnabledConverter implements IConverter<EDhApiRendererMode, Boolean>
{
@Override public ERendererMode convertToCoreType(Boolean renderingEnabled)
@Override public EDhApiRendererMode convertToCoreType(Boolean renderingEnabled)
{
return renderingEnabled ? ERendererMode.DEFAULT : ERendererMode.DISABLED;
return renderingEnabled ? EDhApiRendererMode.DEFAULT : EDhApiRendererMode.DISABLED;
}
@Override public Boolean convertToApiType(ERendererMode renderingMode)
@Override public Boolean convertToApiType(EDhApiRendererMode renderingMode)
{
return renderingMode == ERendererMode.DEFAULT;
return renderingMode == EDhApiRendererMode.DEFAULT;
}
}
@@ -1,263 +0,0 @@
/*
* This file is part of the Distant Horizons mod
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2023 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.coreapi.util.math;
import com.seibel.distanthorizons.coreapi.util.MathUtil;
/**
* A (almost) exact copy of Minecraft's 1.16.5
* implementation of a 3 element float vector.
*
* @author James Seibel
* @version 11-11-2021
*/
public class Vec3f
{
public static Vec3f XNeg = new Vec3f(-1.0F, 0.0F, 0.0F);
public static Vec3f XPos = new Vec3f(1.0F, 0.0F, 0.0F);
public static Vec3f YNeg = new Vec3f(0.0F, -1.0F, 0.0F);
public static Vec3f YPos = new Vec3f(0.0F, 1.0F, 0.0F);
public static Vec3f ZNeg = new Vec3f(0.0F, 0.0F, -1.0F);
public static Vec3f ZPos = new Vec3f(0.0F, 0.0F, 1.0F);
public float x;
public float y;
public float z;
public Vec3f()
{
}
public Vec3f(float x, float y, float z)
{
this.x = x;
this.y = y;
this.z = z;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
else if (obj != null && this.getClass() == obj.getClass())
{
Vec3f Vec3f = (Vec3f) obj;
if (Float.compare(Vec3f.x, this.x) != 0)
{
return false;
}
else if (Float.compare(Vec3f.y, this.y) != 0)
{
return false;
}
else
{
return Float.compare(Vec3f.z, this.z) == 0;
}
}
else
{
return false;
}
}
@Override
public int hashCode()
{
int i = Float.floatToIntBits(this.x);
i = 31 * i + Float.floatToIntBits(this.y);
return 31 * i + Float.floatToIntBits(this.z);
}
public void mul(float scalar)
{
this.x *= scalar;
this.y *= scalar;
this.z *= scalar;
}
public void mul(float x, float y, float z)
{
this.x *= x;
this.y *= y;
this.z *= z;
}
public void clamp(float min, float max)
{
this.x = MathUtil.clamp(min, this.x, max);
this.y = MathUtil.clamp(min, this.y, max);
this.z = MathUtil.clamp(min, this.z, max);
}
public void set(float x, float y, float z)
{
this.x = x;
this.y = y;
this.z = z;
}
public void add(float x, float y, float z)
{
this.x += x;
this.y += y;
this.z += z;
}
public void add(Vec3f vector)
{
this.x += vector.x;
this.y += vector.y;
this.z += vector.z;
}
public void subtract(Vec3f vector)
{
this.x -= vector.x;
this.y -= vector.y;
this.z -= vector.z;
}
public float dotProduct(Vec3f vector)
{
return this.x * vector.x + this.y * vector.y + this.z * vector.z;
}
/** Returns true if normalization had to be done */
public boolean normalize()
{
float squaredSum = this.x * this.x + this.y * this.y + this.z * this.z;
if (squaredSum < 1.0E-5D)
{
return false;
}
else
{
float f1 = MathUtil.fastInvSqrt(squaredSum);
this.x *= f1;
this.y *= f1;
this.z *= f1;
return true;
}
}
public void crossProduct(Vec3f vector)
{
float f = this.x;
float f1 = this.y;
float f2 = this.z;
float f3 = vector.x;
float f4 = vector.y;
float f5 = vector.z;
this.x = f1 * f5 - f2 * f4;
this.y = f2 * f3 - f * f5;
this.z = f * f4 - f1 * f3;
}
/* Matrix3f is not currently needed/implemented
public void transform(Matrix3f p_229188_1_)
{
float f = this.x;
float f1 = this.y;
float f2 = this.z;
this.x = p_229188_1_.m00 * f + p_229188_1_.m01 * f1 + p_229188_1_.m02 * f2;
this.y = p_229188_1_.m10 * f + p_229188_1_.m11 * f1 + p_229188_1_.m12 * f2;
this.z = p_229188_1_.m20 * f + p_229188_1_.m21 * f1 + p_229188_1_.m22 * f2;
}
*/
/* Quaternions are not currently needed/implemented
public void transform(Quaternion p_214905_1_)
{
Quaternion quaternion = new Quaternion(p_214905_1_);
quaternion.mul(new Quaternion(this.x(), this.y(), this.z(), 0.0F));
Quaternion quaternion1 = new Quaternion(p_214905_1_);
quaternion1.conj();
quaternion.mul(quaternion1);
this.set(quaternion.i(), quaternion.j(), quaternion.k());
}
*/
/* not currently needed
* percent may actually be partial ticks (which is available when rendering)
public void linearInterp(Vec3f resultingVector, float percent)
{
float f = 1.0F - percent;
this.x = this.x * f + resultingVector.x * percent;
this.y = this.y * f + resultingVector.y * percent;
this.z = this.z * f + resultingVector.z * percent;
}
*/
/* Quaternions are not currently needed/implemented
public Quaternion rotation(float p_229193_1_)
{
return new Quaternion(this, p_229193_1_, false);
}
@OnlyIn(Dist.CLIENT)
public Quaternion rotationDegrees(float p_229187_1_)
{
return new Quaternion(this, p_229187_1_, true);
}
*/
public Vec3f copy()
{
return new Vec3f(this.x, this.y, this.z);
}
/* not currently needed/implemented
public void map(Float2FloatFunction p_229191_1_)
{
this.x = p_229191_1_.get(this.x);
this.y = p_229191_1_.get(this.y);
this.z = p_229191_1_.get(this.z);
}
*/
@Override
public String toString()
{
return "[" + this.x + ", " + this.y + ", " + this.z + "]";
}
// Forge start
public Vec3f(float[] values)
{
set(values);
}
public void set(float[] values)
{
this.x = values[0];
this.y = values[1];
this.z = values[2];
}
}
@@ -28,7 +28,7 @@ import org.junit.Test;
* @author James Seibel
* @version 2022-9-5
*/
public class ExampleTest
public class ExampleApiTest
{
@Test
+63
View File
@@ -0,0 +1,63 @@
plugins {
id "java"
id "com.github.johnrengelman.shadow" version '8.1.1' apply false // Set this to true if you're using the standalone Core project
}
apply plugin: "application"
application {
mainClass.set("com.seibel.distanthorizons.core.jar.JarMain")
}
configurations {
shadowedArtifact // Used by DH to specify that we want to implement the shadowed core JAR file instead of the regular JAR file
shade
implementation.extendsFrom shade
}
OperatingSystem os = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.currentOperatingSystem;
// Set the OS lwjgl is using to the current os
project.ext.lwjglNatives = "natives-" + os.toFamilyName()
dependencies { // All of these dependencies are in Vanilla Minecraft, but we need to depend on it as we arent importing Minecraft in the core
// Imports most of lwjgl's libraries (well, only the ones that we need)
implementation platform("org.lwjgl:lwjgl-bom:${rootProject.lwjgl_version}") // TODO: Use Minecraft's version for lwjgl_version (which changes in nearly every version) instead of a hard defined version for all versions
// REMEMBER: Dont shadow stuff here, these are just the libs that are included in Minecraft so that the core can use
implementation "org.lwjgl:lwjgl"
implementation "org.lwjgl:lwjgl-assimp"
implementation "org.lwjgl:lwjgl-glfw"
implementation "org.lwjgl:lwjgl-openal"
implementation "org.lwjgl:lwjgl-opengl"
implementation "org.lwjgl:lwjgl-stb"
implementation "org.lwjgl:lwjgl-tinyfd"
runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-assimp::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-openal::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-tinyfd::$lwjglNatives"
// FIXME for some reason this line doesn't actually shade in the library
// shade "it.unimi.dsi:fastutil:${rootProject.fastutil_version}" // Add our own fastutil version
// Some other dependencies
implementation("org.jetbrains:annotations:16.0.2")
implementation("com.google.code.findbugs:jsr305:3.0.2")
implementation("com.google.common:google-collect:0.5")
implementation("com.google.guava:guava:31.1-jre")
}
artifacts {
shadowedArtifact shadowJar // Setup the configuration shadowedArtifact to be the shadowJar
}
shadowJar {
def librariesLocation = "DistantHorizons.libraries"
// relocate "it.unimi.dsi.fastutil", "${librariesLocation}.unimi.dsi.fastutil"
mergeServiceFiles()
}
@@ -20,23 +20,21 @@
package com.seibel.distanthorizons.core;
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
import com.seibel.distanthorizons.core.render.renderer.generic.GenericRenderObjectFactory;
import com.seibel.distanthorizons.core.sql.DatabaseUpdater;
import com.seibel.distanthorizons.core.wrapperInterfaces.IWrapperFactory;
import com.seibel.distanthorizons.coreapi.ModInfo;
import com.seibel.distanthorizons.core.world.DhApiWorldProxy;
import com.seibel.distanthorizons.core.api.external.methods.config.DhApiConfig;
import com.seibel.distanthorizons.core.api.external.methods.data.DhApiTerrainDataRepo;
import com.seibel.distanthorizons.core.dataObjects.fullData.loader.CompleteFullDataSourceLoader;
import com.seibel.distanthorizons.core.dataObjects.fullData.loader.HighDetailIncompleteFullDataSourceLoader;
import com.seibel.distanthorizons.api.DhApi;
import com.seibel.distanthorizons.core.dataObjects.fullData.loader.LowDetailIncompleteFullDataSourceLoader;
import com.seibel.distanthorizons.core.render.DhApiRenderProxy;
//import io.netty.buffer.ByteBuf;
import net.jpountz.lz4.LZ4Compressor;
import net.jpountz.lz4.LZ4FrameOutputStream;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.tukaani.xz.XZOutputStream;
import java.io.InputStream;
import java.awt.*;
/** Handles first time Core setup. */
public class Initializer
@@ -50,13 +48,17 @@ public class Initializer
{
// if any library isn't present in the jar its class
// will throw an error (not an exception)
Class<?> compressor = LZ4Compressor.class;
Class<?> fastCompressor = LZ4FrameOutputStream.class;
Class<?> smallCompressor = XZOutputStream.class;
//Class<?> networking = ByteBuf.class;
Class<?> toml = com.electronwill.nightconfig.core.Config.class;
Class<?> config = com.electronwill.nightconfig.core.Config.class;
Class<?> oldFastUtil = it.unimi.dsi.fastutil.longs.LongArrayList.class; // available in 8.2.1
//Class<?> newFastUtil = it.unimi.dsi.fastutil.ints.IntUnaryOperator.class; // available in 8.5.13
}
catch (NoClassDefFoundError e)
catch (Throwable e)
{
LOGGER.fatal("Critical programmer error: One or more libraries aren't present. Error: [" + e.getMessage() + "].");
// throwing here should crash the game, notifying the developer that something is wrong
throw e;
}
@@ -76,16 +78,23 @@ public class Initializer
}
CompleteFullDataSourceLoader unused2 = new CompleteFullDataSourceLoader(); // Auto register into the loader system
HighDetailIncompleteFullDataSourceLoader unused3 = new HighDetailIncompleteFullDataSourceLoader(); // Auto register
LowDetailIncompleteFullDataSourceLoader unused4 = new LowDetailIncompleteFullDataSourceLoader(); // Auto register
// attempt to setup Swing so we can display dialogs (popup windows)
System.setProperty("java.awt.headless", "false");
if (GraphicsEnvironment.isHeadless())
{
LOGGER.warn("Java.awt.headless is false. This means Distant Horizons can't display error and info dialog windows.");
}
else
{
LOGGER.info("Java.awt.headless set to true. Distant Horizons can correctly display error and info dialog windows.");
}
// link Core's config to the API
DhApi.Delayed.configs = DhApiConfig.INSTANCE;
DhApi.Delayed.terrainRepo = DhApiTerrainDataRepo.INSTANCE;
DhApi.Delayed.worldProxy = DhApiWorldProxy.INSTANCE;
DhApi.Delayed.renderProxy = DhApiRenderProxy.INSTANCE;
DhApi.Delayed.customRenderObjectFactory = GenericRenderObjectFactory.INSTANCE;
DhApi.Delayed.wrapperFactory = SingletonInjector.INSTANCE.get(IWrapperFactory.class);
if (DhApi.Delayed.wrapperFactory == null)
{
@@ -23,7 +23,7 @@ import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
import com.seibel.distanthorizons.api.interfaces.config.client.IDhApiDebuggingConfig;
import com.seibel.distanthorizons.api.objects.config.DhApiConfigValue;
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.api.enums.rendering.EDebugRendering;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiDebugRendering;
public class DhApiDebuggingConfig implements IDhApiDebuggingConfig
{
@@ -33,8 +33,8 @@ public class DhApiDebuggingConfig implements IDhApiDebuggingConfig
public IDhApiConfigValue<EDebugRendering> debugRendering()
{ return new DhApiConfigValue<EDebugRendering, EDebugRendering>(Config.Client.Advanced.Debugging.debugRendering); }
public IDhApiConfigValue<EDhApiDebugRendering> debugRendering()
{ return new DhApiConfigValue<EDhApiDebugRendering, EDhApiDebugRendering>(Config.Client.Advanced.Debugging.debugRendering); }
public IDhApiConfigValue<Boolean> debugKeybindings()
{ return new DhApiConfigValue<Boolean, Boolean>(Config.Client.Advanced.Debugging.enableDebugKeybindings); }
@@ -19,7 +19,7 @@
package com.seibel.distanthorizons.core.api.external.methods.config.client;
import com.seibel.distanthorizons.api.enums.rendering.EFogFalloff;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiFogFalloff;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
import com.seibel.distanthorizons.api.interfaces.config.client.IDhApiFarFogConfig;
import com.seibel.distanthorizons.api.objects.config.DhApiConfigValue;
@@ -50,8 +50,8 @@ public class DhApiFarFogConfig implements IDhApiFarFogConfig
{ return new DhApiConfigValue<Double, Double>(Config.Client.Advanced.Graphics.Fog.AdvancedFog.farFogMax); }
@Override
public IDhApiConfigValue<EFogFalloff> farFogFalloff()
{ return new DhApiConfigValue<EFogFalloff, EFogFalloff>(Config.Client.Advanced.Graphics.Fog.AdvancedFog.farFogFalloff); }
public IDhApiConfigValue<EDhApiFogFalloff> farFogFalloff()
{ return new DhApiConfigValue<EDhApiFogFalloff, EDhApiFogFalloff>(Config.Client.Advanced.Graphics.Fog.AdvancedFog.farFogFalloff); }
@Override
public IDhApiConfigValue<Double> farFogDensity()
@@ -19,9 +19,8 @@
package com.seibel.distanthorizons.core.api.external.methods.config.client;
import com.seibel.distanthorizons.api.enums.rendering.EFogColorMode;
import com.seibel.distanthorizons.api.enums.rendering.EFogDistance;
import com.seibel.distanthorizons.api.enums.rendering.EFogDrawMode;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiFogColorMode;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiFogDrawMode;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
import com.seibel.distanthorizons.api.interfaces.config.client.IDhApiFarFogConfig;
import com.seibel.distanthorizons.api.interfaces.config.client.IDhApiFogConfig;
@@ -53,15 +52,11 @@ public class DhApiFogConfig implements IDhApiFogConfig
//====================//
@Override
public IDhApiConfigValue<EFogDistance> distance()
{ return new DhApiConfigValue<>(Config.Client.Advanced.Graphics.Fog.distance); }
@Override
public IDhApiConfigValue<EFogDrawMode> drawMode()
public IDhApiConfigValue<EDhApiFogDrawMode> drawMode()
{ return new DhApiConfigValue<>(Config.Client.Advanced.Graphics.Fog.drawMode); }
@Override
public IDhApiConfigValue<EFogColorMode> color()
public IDhApiConfigValue<EDhApiFogColorMode> color()
{ return new DhApiConfigValue<>(Config.Client.Advanced.Graphics.Fog.colorMode); }
@Override
@@ -0,0 +1,46 @@
/*
* This file is part of the Distant Horizons mod
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2023 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.core.api.external.methods.config.client;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
import com.seibel.distanthorizons.api.interfaces.config.client.IDhApiGenericRenderingConfig;
import com.seibel.distanthorizons.api.interfaces.config.client.IDhApiNoiseTextureConfig;
import com.seibel.distanthorizons.api.objects.config.DhApiConfigValue;
import com.seibel.distanthorizons.core.config.Config;
public class DhApiGenericRenderingConfig implements IDhApiGenericRenderingConfig
{
public static DhApiGenericRenderingConfig INSTANCE = new DhApiGenericRenderingConfig();
private DhApiGenericRenderingConfig() { }
@Override
public IDhApiConfigValue<Boolean> renderingEnabled()
{ return new DhApiConfigValue<Boolean, Boolean>(Config.Client.Advanced.Graphics.GenericRendering.enableRendering); }
@Override
public IDhApiConfigValue<Boolean> beaconRenderingEnabled()
{ return new DhApiConfigValue<Boolean, Boolean>(Config.Client.Advanced.Graphics.GenericRendering.enableBeaconRendering); }
@Override
public IDhApiConfigValue<Boolean> cloudRenderingEnabled()
{ return new DhApiConfigValue<Boolean, Boolean>(Config.Client.Advanced.Graphics.GenericRendering.enableCloudRendering); }
}

Some files were not shown because too many files have changed in this diff Show More