Commit Graph

796 Commits

Author SHA1 Message Date
Jozufozu
5d142d2f13 Thought I'd need this
- Consolidate common logic from transfer list and scatter list into
  MemoryBuffer
2024-03-03 12:29:25 -08:00
PepperCode1
64aa8d4242 The end of issues with big endianness
- Fix unpacking of some layout elements (only for instancing)
  - All byte backed and short backed elements (incorrect assumption that
system is little endian)
  - All signed byte and signed short elements (missing sign extension)
  - Matrices with byte backed and short backed reprs in some cases
(incorrect assumption that matrix rows are 4 byte aligned)
  - IntegerRepr.INT scalar (invalid implicit cast)
  - FloatRepr.NORMALIZED_INT scalar (missing cast to signed int)
  - IntegerRepr.INT vector (invalid implicit cast)
  - FloatRepr.NORMALIZED_INT vector (missing cast to signed int)
  - FloatRepr.NORMALIZED_SHORT vector (incorrect divisor)
- Add explicit casts from uint to float since some drivers have a bug
where uint over float division is invalid
- Lower GLSL requirement of instancing from 420 to 330
- Fix lib instance writers assuming little endian when writing overlay
and light
- Move overlay clamping to vertex input shader and clamp to 15 instead
of 10
- Create abstract InstanceAssemblerComponent class
- Change return type of SourceComponent.name() to String and improve
implementations
2024-03-03 11:16:38 -08:00
PepperCode1
115aad3d40 Multi-improvements
- Make lib instance shaders multiply color value instead of overriding
it
- Improve MultiBlockModelBuilder
  - Accept an Iterable<BlockPos> instead of a
Collection<StructureBlockInfo> and assume all block state data is
already contained within the render world
  - Accept a Function instead of a Map as the model data lookup
  - Allow enabling fluid rendering (all rendered fluids are currently
unshaded)
- Refactor VirtualEmptyBlockGetter
  - Move elementary implementations into abstract VirtualBlockGetter
class
  - Extract virtual LevelLightEngine into separate VirtualLightEngine
class with ability to lookup light values per pos
  - Turn VirtualEmptyBlockGetter into a class and make all methods final
to ensure instances of this class are actually empty even if subclassed
- Make BakedModelBufferer class package private
- Remove unused VertexTransformations class
- Remove Experimental annotation from
VisualizationContext.createEmbedding
2024-02-29 16:25:20 -08:00
PepperCode1
c3307630b2 A different type of translation
- Display actual backend instead of preferred backend when checking
backend
- Remove engine message and use standard messages that display backend
ID
- Simplify command code
- Replace all literal components with translatable components
- Pass 1 instead of 0 for partialTick on tick
- Extract base AtomicReferenceCounted and ReferenceCounted abstract
classes
- Double buffer capacity instead of adding constant on resize in
VertexWriter
- Move Samplers class from backend.engine to backend
2024-02-28 21:41:16 -08:00
Jozufozu
c931e84b65 More simpler
- Remove Plan#simplify and associated tests
- Neat idea but ineffective in practice
- Should reduce the user burden of implementing plans
2024-02-28 21:23:47 -08:00
Jozufozu
bd70b89621 Backend into a corner
- Make VisualizationContext, InstancerProvider, VisualEmbedding all
  BackendImplemented
- Add Engine#createVisualizationContext
- Remove Engine#instancer and variants
- VisualEmbeddings are created by backends, and data will be pushed into
  them by visuals.
- VisualEmbedding extends VisualizationContext
- The implementation of VisualEmbedding also implements Environment
- Environment is an internal replacement for Context
- Instancers are keyed by Environments
- Default environment is a noop essentially
2024-02-26 18:41:55 -08:00
Jozufozu
4d216b6672 A sample of what's to come
- Clean up texture binder stuff that's no longer needed
- Move all sampler binding to program link time
- Centralize sampler bindings/names to Samplers
- Move diffuse, light, and overlay textures into the api
- Add builder for context shader
- Fix generated_indirect -> generated_instancing
2024-02-26 15:38:11 -08:00
Jozufozu
2c3b4c54ca Stay inline
- Inline all unnecessary context stuff
- Move ContextShaders into backend.compile
- Instancers are parameterized by a nullable VisualEmbedding
  - I don't like this, but the code currently compiles, so I want a
    checkpoint before I try my next idea
2024-02-26 14:50:58 -08:00
Jozufozu
e55d506511 Sanstexts
- Add EmbeddedLevel to api
- Move all context api/lib stuffs into backend
- Move context shaders into internal
- Inline Shader and TextureSource interfaces
- Move matrix bounding sphere transform into util
- Add uniforms to cull shader to allow it to work with embedded levels
- Engine has 2 instancer methods, one that accepts an EmbeddedLevel and
  one without the parameter
- Change VisualizationContext#withContext to #embed
- Remove crumbling stuff from Contexts
2024-02-25 15:42:20 -08:00
Jozufozu
94ae32b9a7 Burning a house to kill a spider
- Fix garbage indices on instancing engine
- glDrawElements* wants indices as a byte offset, we were giving it
  a word offset
- Rename BufferedMesh -> PooledMesh
- PooledMesh no longer stores things it can fetch from the inner mesh
- Use one vao for all drawcalls in instancing engine
- PooledMesh issues *BaseVertex calls
- Move crumbling logic into InstancedDrawManager
- Move programs acquisition into InstancedDrawManager
- Move owned gl objects into InstancedDrawManager
2024-02-25 12:40:39 -08:00
Jozufozu
dd998058a3 Many to many
- Models now return a list of ConfiguredMeshes, i.e. mesh-material pairs
- BufferedMeshes now poll the index pool as needed
- Inline BufferedMesh#write
2024-02-24 17:25:01 -06:00
Jozufozu
d6abe89828 Finally room to breathe
- Expand packed overlay_light attribute into components
- Make light a short backed vec2
- Divide light input by 256 directly instead of discarding lower bits
- Remove debug overlay enum, instead only use OVERRIDE
- Add overlay debug mode
2024-02-22 14:33:57 -06:00
Jozufozu
a504aa1862 Hot links
- Do not specify layout qualifier for vertex attributes
- Bind attribute locations before linking programs
- Delete gl programs when linking fails
2024-02-22 14:02:16 -06:00
Jozufozu
c6ed7c4132 Textures your buffer
- Use texture buffers instead of instanced arrays
- Fixes issues with instance layouts using int elements
- Fixes attribute binding hardware limitations
- Create one texture for the entire instancing engine and bind each
  instancer's vbo when it's time to draw
- Generate glsl to fetch FlwInstances from a usamplerBuffer according to
  the instance layout
- Use RGBA32UI to get the most data from each texel fetch
- Align instance stride to 16 to avoid complexity in unpacking
2024-02-22 13:46:11 -06:00
Jozufozu
17130e22ea Underlay
- Clamp overlay from 0 to 10 rather than 3 to 10 to fix everything
  appearing washed out
- Fix normalized short backed float vectors being unpacked incorrectly
- Set overlay in shadow instance component to fix shadows appearing red
  - Indicative of the ivec issue being present for divisor 0 vertex
    attributes
2024-02-22 12:31:29 -06:00
Jozufozu
1dee5db9a1 Debugging broken overlay/lighting
- Break instance overlay/light back into 2 layout elements
- Write light directly as an int
- Make light a short backed float element
- Clamp overlay coords in common.frag to avoid explosions
- Explosions: integer vertex attributes sometimes blow up to massive
  sizes, greater than Short.MAX_VALUE which should not be possible.
- Reorganize some texture/uniform binding code
2024-02-21 12:37:46 -06:00
Jozufozu
aac12754cc Buffer buffers
- Do not map buffers
- Strip down GlBuffer, so it only contains upload methods
- Remove buffer mapping and copy wrappers
- Add subdata wrapper
2024-02-21 09:29:27 -06:00
Jozufozu
c61feb1c14 Cool and normal
- Reimplement normal debug mode
- Add debug mode for instance ID and light coordinates
- Pass an id into _flw_main
- Allow specifying how the debug color is applied, not sure if I want
  to keep it though
- Do not store the debug mode in config
2024-02-21 09:29:23 -06:00
Jozufozu
c4dcebb203 Pool party!
- Move index buffer logic into IndexPool class, should let us avoid
  unnecessary uploads and make it easier to manage
2024-02-20 11:09:39 -06:00
Jozufozu
aa46f6ceb1 A mesh unbound
- Clear a mesh's set of bound vaos when it's uploaded
- Fixes visual glitches on instancing when removing instances
2024-02-20 10:46:30 -06:00
Jozufozu
068692b4b9 Finding some common ground
- Make MeshPool common between instancing and indirect
- Remove empty instancers and delete meshes on indirect
- Inline IndirectModel into IndirectInstancer since it was basically
  just a thin wrapper
- Share one meshpool between all culling groups
- Always upload draw commands because the mesh may have moved
- No longer need to set the base instance in the apply shader
2024-02-19 16:51:11 -06:00
Jozufozu
e9eb468de9 Eviction notice
- For instancing, remove empty instancers and delete meshes
- Specify in InstancerProvider's contract that instancers should not be
  kept around, but reusing them within one frame in guaranteed to be
  safe
- Do all instancer updates in flush, and remove unnecessary checks that
  would be made later in the frame
- Remove isEmpty from Mesh
- Remove staging buffer param from indirect mesh pool
2024-02-19 10:53:52 -06:00
Jozufozu
456b8b66fe Unbuffers your data
- Fix null check in BakedModelBufferer
2024-02-18 17:05:17 -06:00
Jozufozu
db696f5975 No hacks here no sir
- Add VisualizationContext#withContext to formalize the way contexts are
  "pushed"
- Also push a render origin so contexts have better control over
  visuals' positions
- Make InstancerProvider NonExtendable
2024-02-18 15:27:41 -06:00
Jozufozu
55a88a89bd Revert "Apply directly to the engine!"
This reverts commit f3a88c25d5.
2024-02-18 14:05:24 -06:00
Jozufozu
53c732c3f6 Internalize
- Make *Programs#setInstance package private
2024-02-18 12:06:50 -06:00
Jozufozu
31f4ffe354 Spring cleaning
- Move PlanStorage to lib as PlanMap and add documentation
- Remove FastPlanStorage in favor of ForEachPlan
- Move plan distribution next to other distribution methods
- Rename PlanUtil -> Distribute
2024-02-18 12:03:07 -06:00
Jozufozu
e5a0e35141 Apply directly to the engine!
- Move Engine#intancer to DirectInstancerProvider interface
- InstancerProvider allows access to the DirectInstancerProvider it's
  wrapping. This is to allow mods to change the context or RenderStage
  if they need
- Mark new methods and interfaces as experimental
- Should we mark them for removal in version 2?
- Remove NonExtendable from some context interfaces
2024-02-17 11:36:43 -07:00
Jozufozu
dcecc9672d Plans all the way down
- Remove PlannedVisual
- Dynamic/Tickable visuals create plans
- Add Simple*Visual to lib to replace the old api interfaces
- Better dynamic plan storage, no need to optimize on every change
- Special case the Simple*Visuals in Storage as to not lose performance
- Needs better documentation
- Add RunnablePlan
2024-02-16 21:17:17 -08:00
Jozufozu
464deff42e Oopershaders
- Do not crash when an ubershader'd component is missing
- Reset instancing/indirect programs immediately on reload to invalidate
  them in case ubershader loading fails
2024-02-16 13:58:04 -08:00
Jozufozu
f912be4834 NEA: Not Enough Attributes
- Transformed had snuck up to attribute location 17
- Combine overlay and light attributes into one
- Flip order of overlay and light in instances to be consistent with
  the internal vertex layout
2024-02-16 13:34:34 -08:00
Jozufozu
6dfd5ed563 Taking textures back out of context
- Contexts shouldn't be responsible for binding the api defined textures
- Move light and overlay binding to TextureBinder
- Clean up & standardize material/texture setup/teardown calls
- Revert removal of MaterialRenderState texture stuff
- Add SimpleContext + Builder
- Rename Textures -> TextureSource
- Add API methods to set basic float uniforms, more to come later
- Throw errors if a context tries to set uniforms/textures with reserved
  names.
2024-02-12 23:00:40 -08:00
Jozufozu
1028ca4633 Putting crumbling in context
- Oops didn't actually put everything in last time.
- Create one context per crumbling stage.
- Let contexts handle setting both the diffuse and crumbling texture.
2024-02-11 20:49:30 -08:00
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