Commit Graph

763 Commits

Author SHA1 Message Date
Jozufozu
bab0448724 Putting everything in context
- Begin context refactor.
- Rename (old) Context -> ContextShader and remove gl program method.
- Add (new) Context which does not need to be registered.
- Contexts are responsible for binding textures given a material.
- Instancers are created in a specific context.
- Add Shader interface for attaching textures.
- Add Textures interface for fetching textures to pass to a Shader.
- Remove texture related code from MaterialRenderState.
- Key culling groups by context.
- Key DrawSets by context.
2024-02-11 17:49:32 -08:00
Jozufozu
e7d7602941 Lines aren't too bad
- Add LineModelBuilder and use that instead of the manual mesh creation
  in HitboxComponent.
- Clone mojang's line shader, adapted as a flywheel material.
  - Do not scale the view.
  - Set flw_vertexPos by multiplying by the inverse view projection.
- Remove centerline material.
- Use #define make padded vec3 uniforms available as actual vec3s.
- Add flw_viewProjectionInverse to uniforms.
- Minecarts actually delete the stuff from SimpleEntityVisual.
2024-02-02 14:15:36 -08:00
Jozufozu
31148ae9b5 What a view!
- Add entity view vectors to BoundingBoxComponent.
- Add "centerline" material, similar to wireframe.
- Add SmartRecycler to create recyclers based on a parameter.
2024-02-01 20:31:38 -08:00
Jozufozu
b0bc3d3145 Flywheel ECS
- Add SimpleEntityVisual which is composed of many EntityComponents.
- Would be nice to expand on this system, particularly to add components
  when registering visualizers.
- Misc. doc updates.
2024-02-01 20:31:37 -08:00
Jozufozu
39ff643d37 Lines are hard
- Add BoundingBoxComponent for drawing entity bounding boxes.
- Render lines with a wireframe material.
- Add viewport size and default line width uniforms.
2024-02-01 16:56:01 -08:00
Jozufozu
1fb646e9ef Now you see me
- Fix entities sometimes freezing when they first appear.
- Fix bounding sphere calculation for multiple combined meshes.
- Fix shadow bounding sphere transformer outputting incorrect radius.
2024-01-31 21:53:49 -08:00
Jozufozu
57ae19403f It bytes back
- Fix time/constant ambient light flags being written to the wrong
  offsets.
- Align uniform buffer size to 16 instead of the offset alignment.
2024-01-30 18:10:35 -08:00
Jozufozu
47fe905b79 Exit stage left
- InstancerProvider now has an implicit render stage based on the type
  of visual.
  - block entities: AFTER_BLOCK_ENTITIES
  - entities: AFTER_ENTITIES
  - effects: AFTER_PARTICLES
- Engine no longer extends InstancerProvider and instead has the full
  interface that accepts a RenderStage.
- I'm leaving in a few extra render stages for safe keeping.
2024-01-29 23:21:07 -08:00
Jozufozu
a82e3f8dd5 What makes it tick
- Tick visual managers on post LevelTickEvent.
- Remove all field from VisualTickContext, but keep the interface there
  for later review.
- Remove tick update limiter, though apparently we were passing the
  frame limiter to the tick context :lwe:
2024-01-28 20:58:07 -08:00
PepperCode1
af28c39a48 Streamlined internal referencing
- Remove all references to impl from api and lib packages; all internal
interaction with impl now goes through InternalFlywheelApi
- Separate and organize backend and impl mixins and extensions
- Remove camera position component getters from VisualFrameContext
- Improve accuracy of fog data update detection
- Make PoseTransformStack.stack private and add unwrap method
- Rename BackendManager.isOn -> isBackendOn (and associated methods in
other classes)
2024-01-28 15:27:02 -08:00
Jozufozu
e03904e548 This is fine
- Support rendering the fire animation with instances.
- Add scaleX/Y/Z methods to Scale.
- Add Camera to VisualFrameContext.
- Add camera rotation and look vectors to shader uniforms.
2024-01-27 22:27:31 -08:00
Jozufozu
f47eaa53c1 Don't tell me what to do!
- Respect minecraft's entity shadows option.
- Early exit in InstanceRecycler#discardExtra when there's no extra.
- Shadow radius <= 0 disables shadows.
- More documentation in ShadowComponent.
2024-01-27 16:14:04 -08:00
Jozufozu
380e078cb2 Throwing shade
- Add support for entity shadows.
- Create instance type specifically for shadows.
- Add ShadowComponent utility which emulates what EntityRenderDispatcher
  does, but based on top of our instance system.
- Add some missing nullability annotations to MinecartVisual.
- Create InstanceRecycler utility for managing dynamic numbers of
  instances per frame.
2024-01-27 15:25:48 -08:00
Jozufozu
52c31129b0 Bink and it's gone
- Remove jarjar stuffs from gradle script
2024-01-26 16:46:54 -08:00
Jozufozu
db942965a5 Get some bounding spheres at home
- Compute bounding spheres with the AABB method. Should be pretty well
  suited for funny block game.
- Remove Miniball from dependencies.
2024-01-26 16:40:15 -08:00
Jozufozu
80139cf673 A fine change
- Add Affine interface which combines Translate Rotate and Scale without
  directly using matrices.
- Use joml's rotateAround where applicable.
- Add Transform#transform(Pose)
- Only the ctor for PoseTransformStack is internal.
2024-01-26 12:56:25 -08:00
Jozufozu
4698d7b394 Lit beyond bounds
- Add callback to LitVisual to allow LitVisuals to change sections
- Move visual managers' tick/frame plan creation back into
  VisualManagerImpl.
- Some small reorganization in LitVisualStorage.
2024-01-25 21:17:50 -08:00
PepperCode1
e7c27109e5 Explosive changes
- Fix TNT minecarts' contents not receiving overlay and scaling
- Fix all types of minecarts using the body model of the standard
minecart
- Add overlay to ColoredLitInstance
- Make default chunk materials not disable overlay
- Rename *Visualizer.shouldSkipRender -> skipVanillaRender
- Rename Simple*Visualizer.configure -> builder
- Rename Simple*Visualizer.*Config -> Builder
- Make Simple*Visualizer.Builder always skip vanilla render by default
- Remove DiffuseLightCalculator and associated methods in RenderMath
- Add BackendImplemented annotation to Backend
- Mark PoseTransformStack as Internal at the class level
2024-01-25 13:14:39 -08:00
Jozufozu
9b2b2be3a8 Back me up here!
- Add @BackendImplemented annotation to API and use where needed.
- Add @ApiStatus.NonExtendable to interfaces that are missing it.
2024-01-24 12:09:54 -08:00
Jozufozu
6f9cd8c099 A smaller stage
- Cull down RenderStage.
- Simplifies the choice users of flywheel have to make.
- Allows more time for the impl to run things off-thread while the rest
  of the level renders.
2024-01-22 21:35:16 -08:00
Jozufozu
3f8876b073 Don't take this out of context
- Make all context records in the API interfaces.
- Move records to impl package.
- Update *Visual docs.
- Inline TickContext.
2024-01-22 15:49:15 -08:00
Jozufozu
06359c6ea2 Changing assumptions
- The SyncedPlan no longer runs immediately if executed on the main
  thread.
- Update tests/names to reflect this change.
2024-01-22 14:37:30 -08:00
Jozufozu
9f2aaa933f Pretty lit
- Add LitVisual interface.
  - A NON MOVING visual that provides the sections
    it wishes to receive updates for upon creation.
- Cannibalize LightUpdaterImpl into LitVisualStorage.
- Remove everything else related to LightUpdater.
- EntityVisual no longer receives light updates.
- MinecartVisual updates light every tick.
- Add nullability annotations to AbstractVisual#relight.
- Check instanceof before removing from the various lists in Storage.
- Also, don't immediately run SyncedPlan on the main thread. It makes
  profiling too difficult as the call stack for its runnable ends up
  starting from multiple points.
2024-01-22 14:09:29 -08:00
Jozufozu
bc9f156cfd Light refactoring
- Run light updates in parallel to the visual frame plans
- Add null check in AbstractVisual#relight
- Add AbstractVisual#relight taking an iterable.
- Begin frame is after light updates are complete. I tried dividing some
  work to run before, but it doesn't really make a difference.
- Remove LightUpdatedLevel.
- Remove FrameContext.
- LightUpdater no longer runs ticks.
- LightUpdater no longer stores things weakly.
- Fix some docs.
2024-01-22 14:09:20 -08:00
Jozufozu
77fd9dab1e Light updated
- Promote LightUpdater to the API.
- Include LightUpdater in VisualizationContext.
- Explicitly launch a plan to run light updates.
- Misc tweaks:
  - The tick/frame limiters are now shared between visual managers.
  - The VisualizationManager assembles the frame/tick plans itself to
    avoid duplicate context mapping and to allow for reorganization
    in later commits.
2024-01-22 14:09:07 -08:00
PepperCode1
6204acf8bf Automated nullability
- Remove most NotNull annotations
- Automatically generate missing package-info.java files which contain
annotations to establish that everything is not null by default
- Remove CurseForge integration from build script
- Fix some other formatting
2024-01-22 11:12:48 -08:00
PepperCode1
ed47aa226d Revert addition of flw_vertexDiffuse and flw_fragDiffuse 2024-01-22 09:00:18 -08:00
Jozufozu
21549567e7 Store away some classes
- Remove *VisualManager classes, promoting *Storage to the top level.
- AbstractVisualManager -> VisualManagerImpl.
- Parameterize VisualizationManagerImpl by the storage type.
2024-01-19 16:20:42 -08:00
Jozufozu
b49073ebee safety = null
- Do not crash when instances passed to api methods are null.
  - Ignore null crumbling instances.
  - Do not attempt to steal null instances.
- Add nullability annotations where relevant.
- Update docs to indicate null behavior.
2024-01-19 16:20:34 -08:00
Jozufozu
04dff58714 Diewheel
- Remove update json url from mods.toml.
- Change display url to link to github.
2024-01-19 14:08:12 -08:00
Jozufozu
a9dff3aa15 Stop playing hide and seek
- Dump stitched shaders to meaningful paths.
- Simplify dataflow to Compilation.
- Rename some compiler classes to better reflect what they do.
- Inline some utility methods on shader enums.
2024-01-19 13:20:57 -08:00
Jozufozu
0e2a31ccbf Marker?
- Include a marker for each compilation harness in its logs.
- Use a separate instance of logger for compilation stuffs.
- Change CompilerStats info format to log programs before shaders.
2024-01-19 12:29:35 -08:00
Jozufozu
c13b7637c5 Scull
- Add header to define uniforms/other api variables for the cull shader.
2024-01-19 11:52:09 -08:00
Jozufozu
233cf4e7a8 We had lost track of time
- Add some uniforms related to game time.
- Move frustum planes to the top as its better for alignment.
- Make constantAmbientLight a uint.
2024-01-18 18:17:09 -08:00
Jozufozu
5f1d1eccb0 Monster mat
- Tweak the matrix and quaternion utility shaders.
2024-01-18 17:23:18 -08:00
Jozufozu
655712aadf Update uniform providers (again)
- Remove uniform api.
- Do not generate uniform interface blocks.
- Move uniform shader into internal/ and manually include it in the api
  impl headers.
- Add flw_ prefix to existing uniforms.
- Separate fog uniforms into their own UBO, uploaded in FogUpdateMixin.
- Drastically simplify UniformBuffer.
- Do not poll for uniform buffer updates. Instead, do the upload at the
  beginning of a frame when the engine is flushing.
2024-01-18 17:07:10 -08:00
Jozufozu
3376bf9809 We had ConcurrentHashMap at home
- Use ConcurrentHashMap in InstancerStorage.
- Fix exception thrown by stack walking while warning about empty models
2024-01-17 11:55:41 -08:00
PepperCode1
f8b695f1e1 Actually use the provided instance 2024-01-17 10:56:34 -08:00
PepperCode1
80127664d2 Fix crash after compilation error during in-world resource reload
- Store *Programs inside engines to disallow replacement and use
reference counting to delete programs at the appropriate time
- Move CompilationHarness, Compile, and SourceLoader to compile.core
- Fix packed material comments
- Fix pack.mcmeta pack format
- Remove Embeddium version range
2024-01-17 10:37:39 -08:00
Jozufozu
45ba75af78 Feeling empty
- Log a warning and don't allocate any resources when an instancer is
  created with an empty model.
- Log stacktrace starting from the call to InstancerProvider#instancer.
- Revert switch to embeddium dep and comment why the rubidium dep is
  there.
2024-01-16 16:59:15 -08:00
Jozufozu
e582379ab5 Insanity ball
- Publish jarjar artifact as default.
- Publish slim artifact without any fancy stuff.
- Update mods.toml
  - Switch rubidium to embeddium.
  - Set displayURL to modrinth.
  - Change version related stuff to $ variables
- Add processResources step to build.gradle to populate mods.toml.
2024-01-15 17:41:17 -08:00
Jozufozu
60b3d99a43 Frag shader go brr
- Add flw_vertexDiffuse and flw_fragDiffuse to glsl api.
- Compute/apply diffuse in the fragment shader.
- Move common glsl between instancing/indirect to common.vert/.frag.
- Add a pittance more documentation to api spec.
- Sneak in a block to build.gradle to always download sources/javadoc.
2024-01-15 14:09:19 -08:00
Jozufozu
89f0e54717 Write me
- Convert InstanceWriters into lambdas passed directly to the builder.
- It's very nice to have everything in one place like that, will make
  tweaking the layout much easier.
- Also micro-optimize the cull shader for TransformedInstance.
2024-01-08 16:50:22 -08:00
Jozufozu
381288da52 Little things
- Do not store a list of initialized instancers.
- Remove AbstractInstancer#delete. Only InstancedInstancer was using it
  so move instancer deletion to InstancedDrawManager.
- Improve CompilationHarness builder pattern and reusability.
  - Pass compilation keys directly to compileAndReportErrors.
  - Build the harness at the end of the builder chain rather than at the
    beginning.
  - Use same CompilationHarness for apply shader and scatter shader.
- Remove _ prefix from packed struct fields.
- Make element type's byte size 4-aligned.
- Remove byteSize method from Element.
2024-01-08 13:33:50 -08:00
Jozufozu
0deac32fde Layout down to rest
- Remove BufferLayout and associated classes.
- Replace InternalVertex with new Layout.
- Calculate InternalVertex stuff as static final fields.
- Elements track their own byte size.
  - The byte size of an element type is unchanged.
  - The byte size of an element is 4-aligned.
- Layout byte size now accounts for alignment.
- Generated packed fields are now always prefixed with an underscore.
2024-01-05 23:03:09 -08:00
Jozufozu
5276a4456c Divider?
- Fix absolute reference after moving packages
2024-01-05 18:48:04 -08:00
Jozufozu
dd64ac860c The great migration
- Move gl -> backend.gl
- Move glsl -> backend.glsl
- Move lib.layout -> backend.gl.layout
2024-01-05 18:38:57 -08:00
Jozufozu
6047a05ec6 A lot to unpack here
- Elements are 4 byte aligned and store their offset.
- Make all ElementTypeImpls records.
- Implement unpacking for all types/reprs.
- Add many utilities to GlslExpr to facilitate unpacking.
2024-01-05 18:34:28 -08:00
Jozufozu
733ec60216 Instancing with Layouts
- InstancedArraysComponent now fully uses Layouts.
  - Trivial to get the glsl type name of a given Element.
  - Also quite easy to get the attribute count without actually
    creating the attribute list.
- IndirectComponent is WIP because unpacking is hard.
  - Reorganize so all the unpacking stuff is in one loop.
2024-01-04 23:44:35 -08:00
Jozufozu
bd00bdff97 A tribute from layouts
- Add utility to convert a Layout to a list of VertexAttributes.
2024-01-04 22:31:36 -08:00