Commit Graph

2327 Commits

Author SHA1 Message Date
PepperCode1
d0c6669a49 Fragments of utility
- Give material fragment shaders a use
  - Add new variables to api/fragment.glsl
  - Add flw_initFragment to context shaders
- Add flw_vertexOverlay
- Normalize flw_vertexLight
  - Values are now [0, 1] where 0 is no light and 1 is max light
  - All light values sent to layout shaders and instance shaders are now
[0, 15] and not normalized
  - Remove util/light.glsl
- Rename program samplers
- Add FileResolution.isWeak()
- Add BackendType.getShortName()
- Tweak default material
- Move ShaderField to parse package
- Organize imports
2022-07-23 17:53:57 -07:00
Jozufozu
e43261302a Merge remote-tracking branch 'origin/1.18/next' into 1.18/next
# Conflicts:
#	src/main/java/com/jozufozu/flywheel/api/material/Material.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/InstancedRenderDispatcher.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/InstancingEngine.java
#	src/main/java/com/jozufozu/flywheel/core/BasicModelSupplier.java
#	src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingRenderer.java
#	src/main/java/com/jozufozu/flywheel/vanilla/BellInstance.java
#	src/main/java/com/jozufozu/flywheel/vanilla/ChestInstance.java
#	src/main/java/com/jozufozu/flywheel/vanilla/MinecartInstance.java
#	src/main/java/com/jozufozu/flywheel/vanilla/ShulkerBoxInstance.java
#	src/main/resources/flywheel.mixins.json
2022-07-22 17:48:40 -07:00
Jozufozu
808933bfc3 Uniformly incomplete
- Initial work on uniform buffer registry
 - Setup skeleton for ComponentRegistry
 - InstancingEngine is no longer generic about the program
 - ProgramCompiler considers ContextShaders as input
 - Support weak file resolutions
 - Temporary GLSL version bump to ease UniformProvider growing pains
 - Centralize component shaders to Components
2022-07-22 17:24:41 -07:00
Jozufozu
84edbbe0f4 Little JOML
- Only bundle the small subset of JOML that Flywheel will actually use
2022-07-22 16:56:05 -07:00
PepperCode1
14d3949134 A Performance on the (Render)Stage
- Add RenderStage enum for better control over when a Material should be
rendered
  - Add getRenderStage method to Material
  - Replace RenderLayerEvent with RenderStageEvent
- Pass more information to RenderContext including camera and projection
matrix
- Pass RenderContext instead of Camera to all beginFrame-related methods
  - Remove RenderContext.CURRENT
- Remove FrustumMixin and CameraMixin
- Remove default BasicModelSupplier constructor
- Convert Material to interface and create SimpleMaterial implementation
- Move API instancer classes to instancer package
- Organize imports
2022-07-22 16:41:39 -07:00
Jozufozu
92c017d680 Small tidying
- Move RenderTypeExtension to util
 - Avoid creating unnecessary material objects in Shuklers
 - Remove vestigial classes
2022-07-19 10:59:29 -07:00
Jozufozu
4405f92639 Merge branch '1.18/dev' into 1.18/next
# Conflicts:
#	.github/ISSUE_TEMPLATE/bug_report.yml
#	build.gradle
#	gradle.properties
#	src/main/java/com/jozufozu/flywheel/Flywheel.java
#	src/main/java/com/jozufozu/flywheel/backend/Backend.java
#	src/main/java/com/jozufozu/flywheel/backend/Loader.java
#	src/main/java/com/jozufozu/flywheel/backend/OptifineHandler.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/AbstractInstance.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceManager.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchedMaterialGroup.java
#	src/main/java/com/jozufozu/flywheel/core/model/BakedModelBuilder.java
#	src/main/java/com/jozufozu/flywheel/core/model/Bufferable.java
#	src/main/java/com/jozufozu/flywheel/core/model/ModelUtil.java
#	src/main/java/com/jozufozu/flywheel/core/model/WorldModel.java
#	src/main/java/com/jozufozu/flywheel/core/model/WorldModelBuilder.java
#	src/main/java/com/jozufozu/flywheel/core/vertex/BlockVertexList.java
#	src/main/java/com/jozufozu/flywheel/core/vertex/BlockVertexListUnsafe.java
#	src/main/java/com/jozufozu/flywheel/core/vertex/PosTexNormalVertexListUnsafe.java
#	src/main/java/com/jozufozu/flywheel/mixin/FrustumMixin.java
2022-07-19 00:19:50 -07:00
Jozufozu
78839fe7eb Too much fun with boids
- Fix tickable instances ticking while paused
 - Fix CME on effect origin shift
 - ExampleEffect is now boids fireflies
 - Better tick/update load distribution with small instance counts
2022-07-18 23:44:30 -07:00
Jozufozu
1fe8297e72 Freestyle instances
- Add Effect instancing
   - Allows mods to create visual effects without (block) entities
   - One effect object maps to many AbstractInstances
   - Effect objects are expected to exist in isolation
 - Refactor InstanceManager to be composable about how its instances are stored
   - EffectInstanceManager uses this to provide a one to many topology
   - This is in need of more iteration, and more aspects of InstanceManager should be made composable in the future
2022-07-17 16:01:30 -05:00
PepperCode1
418672c065 Final fix-ups
- Revert mods.toml version to ${file.jarVersion}
- Fix license not being added to built jars
- Rename LICENCE.md to LICENSE.md
2022-07-15 19:29:42 -07:00
PepperCode1
17d8688fd7 Fix mixins sometimes not remapping
- Compress logo image
2022-07-15 09:42:14 -07:00
PepperCode1
a42c027b6f Scheme-a-version
- Fix Resources not being closed properly
- Change versioning scheme to match Create
- Add LICENSE to built jar
- Fix mods.toml version sync
- Move JOML code to non-src directory
- Update Gradle
- Organize imports
2022-07-15 00:00:54 -07:00
Jozufozu
0a671b8f43 Update changelog and bug report template 2022-07-11 20:55:01 -04:00
Jozufozu
d9cdd361cd One line update
- Add modrinth updateJSONURL
2022-07-11 14:36:54 -04:00
Jozufozu
f01e169954 Reading copy
- All vertex lists extend from AbstractVertexList, which handles copying the input
2022-07-11 14:08:07 -04:00
Jozufozu
faa5652c4c World building exercise
- Yoink the WorldModelBuilder and associated changes from 1.18/next
2022-07-10 19:04:30 -04:00
Jozufozu
273c99619f Oculus compatibility
- Rename OptifineHandler to ShadersModHandler
 - Rename functions to match fabric version
2022-07-10 18:08:59 -04:00
Jozufozu
c3b1a43beb One more thing...
- Missed a level param in LightVolume
 - Public removeAndMark
 - Remove batching warning
 - Bump forge and parchment builds
2022-07-10 15:22:02 -04:00
Jozufozu
055802160f Update light updates
- ... to address the nullpointer with create pulleys
 - LightListeners track their own levels
 - Remove BasicProvider and LightProvider
 - Rename MovingListener to better match functionality
 - Remove ListenerStatus in favor of a boolean
 - Instances keep track of their removal status and properly report it via LightListener#isListenerInvalid
 - Bump version - 0.6.4
2022-07-09 13:25:24 -04:00
Jozufozu
5657e8669e Structless instances
- Instance shaders define their own input variables
 - Input locations are transformed during compilation based on vertex type
2022-07-09 11:32:28 -04:00
Jozufozu
f058b37b13
Update changelog.txt 2022-07-08 12:37:54 -07:00
Jozufozu
0e37a0586f Batch 2
- Re-implement batching under new api topology
 - Lots of duplicated code between instancing and batching, room for abstraction
 - StructTypes now require their type argument to extend InstancedPart
 - Fix crash when re-allocating drawbuffers
 - Disable crumbling pending refactor
 - Separate RenderDispatcher#beginFrame from RenderDispatcher#maintainOriginCoordinate
 - Inline OriginShiftListener
 - Refactor InstancedRenderDispatcher hooks
2022-06-30 14:29:35 -07:00
Jozufozu
e26195169f Closing the blinds
- Prevent LightUpdater from interacting with invalid levels.
 - Bump version - 0.6.3
2022-06-22 13:29:28 -07:00
Jozufozu
aa10930fa8 Misc. tweaks
- Drastically reduce stutter on origin shift (it's still bad)
 - GPUInstancers mark their buffers as dynamic
2022-06-20 19:26:39 -07:00
Jozufozu
1ab1c9e6f6 Better draw call organization
- InstancingEngine takes over tracking individual draw calls
 - Many draw calls are associated with a single ShaderState
 - Each ShaderState will bind one shader program
 - Make Material a record
 - Inline Renderable and move InstancedModel.Layer to DrawCall
2022-06-20 12:16:37 -07:00
Jozufozu
08fff1c125 A little of everything
- Rename InstanceData -> InstancedPart, and subclasses
 - Burger Fences
 - Fix GlStateTracker nuking vao element buffer bindings
 - GlVertexArray tracks element buffer bindings
 - Use vertexAttribPointer offset instead of ..BaseVertex
 - Setup code for better crumbling rendering
 - Move some logic into CoreShaderInfoMap
 - Simplify VertexWriter/VertexList
 - Prefer IEventBus#addListener to @SubscribeEvent
 - Stop using persistent buffers... for now
2022-06-19 23:25:44 -07:00
Jozufozu
d22f715f79 Simply struct
- Inline Instanced* and Batched* StructType
 - flw.dumpShaderSource need only be present
 - Make Backend's static fields screaming snake case
2022-06-09 13:51:50 -07:00
Jozufozu
1765aa74f8 Better buffer binding
- Directly call GlBuffer#bind before raw gl calls
 - Everything else is hidden now
 - GlStateTracker.State implements AutoCloseable for try-with-resources blocks
 - Wrap InstancedModel render calls in a GlStateTracker restore block
 - Improve EBO creation
 - Track CPU memory usage (wish java had ownership concepts)
 - Misc cleanups
2022-06-09 12:44:52 -07:00
PepperCode1
2632cd385c Crumbling away
- Fix and improve crumbling rendering
- Rename Batched to BatchedStructType and Instanced to
InstancedStructType
- Normalize flw_vertexNormal in context/common.vert
- Add TODO and FIXME comments
2022-05-22 14:28:38 -07:00
PepperCode1
9886dca1e2 Fix and simplify
- Fix #130
- Simplify Material and default FileResolution creation
- Add instancing to command block and TNT minecarts
- Add missing 440-460 GLSL versions
2022-05-20 21:14:31 -07:00
Jozufozu
f4e648c057 Cleaner compilation
- Check for errors immediately after loading shaders
   - Done through FileResolution
   - Add class SourceChecks to
 - Throw away GatherContextEvent, do everything on client init
 - Unify FileResolution and Resolver, PartialModel style
 - Pass around error reporter to detect errors during load
2022-05-17 20:22:23 -07:00
PepperCode1
be766ad606 Shaded shader
- Rename MaterialManager -> InstancerManager and Material ->
InstancerFactory
- Create Material class consisting of RenderType and shader files
- Make ModelSuppliers use Materials as keys instead of RenderTypes
- Move diffuse calculation from context shaders to material/shaded.vert
- Merge used templates directly into compilers and remove template
classes
2022-05-15 20:09:47 -07:00
PepperCode1
a11bf3537b Reduced to fragments
- Overhaul shader pipeline
  - Remove VertexType#getShaderHeader in favor of vertex-only "layout
shaders"
  - Remove program specs in favor of vertex-only "instance shaders"
  - Add API GLSL headers for vertex and fragment shaders that store
common values
  - Separate context shaders into vertex and fragment shader files
- Improve import handling
  - Ensure imports are not added more than once
  - Change regex for import directives to be more in line with C-style
directives
- Move some classes and GLSL files
2022-05-15 01:58:33 -07:00
PepperCode1
4c7b035f5d Instant legacy code
- Respect fog shape and type
  - Add uFogShape uniform
  - Add macro for current FogType
- Respect dimension constant ambient light when calculating diffuse
  - Add uConstantAmbientLight uniform
  - Redirect diffuse calculation to FLWDiffuse
  - Do not automatically include diffuse.glsl
- Fill CoreShaderInfoMap with info for vanilla and Forge core shaders
- Use try-with-resources when querying ResourceManager
- Move WorldProgram uniform uploading from bind to uploadUniforms
- Use correct layer when rendering bells (cutout -> solid)
- Update Starlight
2022-05-13 23:58:24 -07:00
PepperCode1
958188fc77 Clean up
- Remove OnlyIn annotations
- Replace JSR305 Nullable and Nonnull with Jetbrains Nullable and
NotNull
- Fix indentation in flywheel.mixins.json
- Organize imports
2022-05-11 18:42:31 -07:00
Jozufozu
be60eae9af Simplifications
- Inline a handful of interfaces that had limited use
 - Removed IndexedModel/VBOModel as a first step in refactoring model uploads
 - InstancedModels/GPUInstancers support multiple VAOs
 - Fix padding issue
2022-05-11 16:32:27 -07:00
Jozufozu
d5e9e044ec Refactor GPUInstancer to separate behavior
- Instancer VAO logic moved to InstancedModel
 - Refactor GlVertexArray for easier debugging
 - Sort of clean up BufferLayout
 - Padding items are broken, needs fix
2022-04-30 19:42:57 -07:00
Jozufozu
a336abe4f4 Stuff renders again
- RenderContext doesn't need to have RenderType
 - Pass RenderTypes separately, clean up refactor
2022-04-24 17:22:22 -07:00
Jozufozu
303a58b277 Better buffering
- Abstract ModelUtil.getBufferBuilder and .getBufferBuilderFromTemplate
 - BakedModelBuilder and WorldModelBuilder as parameter objects for getBufferBuilder
 - WorldModelBuilder supports IModelData
2022-04-19 15:08:41 -07:00
Jozufozu
8e069d9209 Material refactor pt 4
- Begin reworking layer rendering
2022-04-19 13:42:45 -07:00
Jozufozu
f0411fa83f Material refactor pt 3
- Slight simplification to model allocation
 - RenderLayers are no more
 - Add basically empty RenderTypeRegistry, to be filled out as I go
 - Move content of RenderLayerEvent into RenderContext
 - BlockModels have PartialModel names now
 - Futz around with InstancingEngine's render logic
 - Fix invisibility bug caused by not unbinding vaos
2022-04-14 21:20:28 -07:00
Jozufozu
bb8cae6c6d Material refactor pt 2
- Inline all the things
 - Now MaterialManager -> Material -> Instancer
 - ModelSuppliers store RenderType
 - Currently broken, it only renders chunk layers so vanilla instances are invisible
2022-04-11 15:15:39 -07:00
Jozufozu
63d427382f Material refactor pt 1
- User no longer needs to supply a key object to get an instancer
 - Move memoization logic outside of MaterialManager
 - Provide utility class for memoizing models
 - Vanilla instances use static objects for their models
 - PartialModels don't actually need reference states, use air instead
 - Move RenderLayer to api package
 - Kill lazy killable
2022-04-10 17:02:28 -07:00
Jozufozu
af11d1e78b Fix spooky shaded contraptions
- Logic error in GPULightVolume#move
 - Race condition from LightUpdater showing up in LightVolume#initialize
2022-04-08 17:23:02 -07:00
Jozufozu
9a69ed1906 Layoff some workers
- Only one task engine for everything now
 - Fixes crash on LightUpdater init when Flywheel is off
 - Attempt to wrangle InstanceWorld init code
 - Misc. cleanup/renaming
2022-04-07 14:19:36 -07:00
Jozufozu
19d757d702 Moving in parallel
- LightUpdates now uses task engine to update listeners in parallel
 - Basic workgroup system to run something on the main thread after a group of tasks is complete
2022-04-07 13:23:56 -07:00
Jozufozu
e3ceacd6e4 Contraptions were too lit
- Fix bug causing potentially moving contraptions to re-upload their light every tick
 - Reduces tick stutter with large amounts of contraptions
2022-04-07 13:23:56 -07:00
Jozufozu
eb5d3c4b25 Model allocators are passed on init instead of stored 2022-04-07 13:23:56 -07:00
Jozufozu
ec8b831917 Update changelog, make bug report template loader agnostic 2022-04-06 11:51:59 -07:00
PepperCode1
a419eab484 Update to 1.18.2
- Switch to SLF4J logging
- Bump version
- Add 0.6.1 changelog
2022-03-14 10:52:28 -07:00