Commit graph

1000 commits

Author SHA1 Message Date
IThundxr
6f946fcedc
Rename class 2024-10-12 15:45:14 -04:00
IThundxr
178dd6c44e
address review 2024-10-12 08:37:52 -04:00
IThundxr
93c116384f
Last fixes 2024-10-10 20:54:25 -04:00
IThundxr
b408191d0f
Build against 1.21.1 2024-10-10 19:25:59 -04:00
Jozufozu
1091a478e1 Pair down parameters per Pepper's pondering
- Flatten TextVisual API to be less of a parameter container
- This is mostly a surface change
- Do not accept x and y positions, instead force the user to translate
  in their matrix
- Track light from light updates to apply when setting up text
- Add (unoptimized) updateLight, backgroundColor, and updateObfuscated
  methods to TextVisual
2024-10-09 21:59:52 -07:00
Jozufozu
c3ac594d37 Dante's printing press
- Move text layer handling to the inner loop of Sink
- Make key methods static and pass layer as a parameter
2024-10-09 21:29:40 -07:00
IThundxr
6cc2b74eef
Fix iris compat 2024-10-06 13:28:43 -04:00
IThundxr
05b82b50ca
Fix sprite UVs being messed up 2024-10-06 13:14:16 -04:00
Jozufozu
47b6648681 20/20 vision
- Calculate actual bounding sphere for glyph meshes
- Cull objects that are less than a pixel on the screen
2024-10-05 21:54:18 -07:00
Jozufozu
39b2508d02 The sad truth, baited
- Fix packed uvs from being saturated
2024-10-05 21:21:21 -07:00
PepperCode1
3dac11899e Improve and polish text utilities 2024-10-05 20:17:13 -07:00
IThundxr
ae4e4e79f5
post merge fixes 2024-10-05 12:59:27 -04:00
IThundxr
08866edf09
Merge branch '1.20/dev' into feat/multi-loader-1.21
# Conflicts:
#	forge/src/main/java/dev/engine_room/flywheel/impl/ForgeFlwConfig.java
2024-10-01 21:02:33 -04:00
Jozufozu
183e2d78b7 Packing up
- Save 8 bytes per glyph instance by switching uvs to
  FloatRepr.NORMALIZED_UNSIGNED_SHORT
- With vanilla's 256x glyph atlases we could technically save another 4
  bytes, but that would make compat with caxton, which uses 4096x
  atlases, much more difficult later
2024-09-29 12:12:27 -07:00
Jozufozu
bd3aab04bc Can't read the signs
- Handle obfuscation in SignVisuals
2024-09-29 12:12:26 -07:00
Jozufozu
9515462d0d Get impl'd
- Move all font/text related mixins into impl
2024-09-29 12:12:26 -07:00
Jozufozu
c0b19a2f01 Laying it on
- TextVisual renders an arbitrary number of layers
- Layers have relatively fine control over how the glyph instances are
  set up
- Encapsulate all fields in TextVisual
- Move Sinks to a thread local
2024-09-29 12:12:26 -07:00
Jozufozu
7aefbee9c1 Glyphing in style
- Fix glowing sign rendering
- Use 2 instances per character
- Move most glyph mesh state into the GlyphMode enum
- GlyphSettings now has a GlyphMode and a bold boolean
- Disable diffuse for text
- Render normal text with polygon offset and bias the instancers for
  normal text so they appear in front of shadows or outlines
- Make sink static
- Fix glyph instance color being unnormalized
2024-09-29 12:12:26 -07:00
Jozufozu
8f9c57783b A fine solution
- Rely on transform matrix for all font vertex position stuffs
- Use a skew matrix for italics
2024-09-29 12:12:26 -07:00
IThundxr
c1bf31856f Overwritten overwrites
- Add mixinextras and remove overwrite
- Merge AsyncFontTexture and FontTexture

Signed-off-by: Jozufozu <jozsefaug@gmail.com>
2024-09-29 12:12:26 -07:00
Jozufozu
71cf582e97 Sign of life
- Move all text handling into the TextVisual class
- Add SignVisual
- Flesh out the glyph model cache
- Render effect glyphs
- Clean up variable names
2024-09-29 12:12:26 -07:00
Jozufozu
9227631c73 Not a hack at all
- Get text instancing minimally working
- Use special glyph instance type to instance all characters under the
  same mesh
- Unfortunately MC's font stuff is not threading friendly so hacks were
  required to allow visuals to query glyphs from their beginFrame
- Mixin to CodePointMap to overwrite most methods and synchronize
- Mixin to FontSet to use a custom AsyncFontTexture that defers texture
  init and upload
- Trying to mixin directly to FontTexture or subclass it is very
  complicated because of the calls to getId, but I think that can be
  improved
2024-09-29 12:12:11 -07:00
Jozufozu
40577420d5 In the right direction
- Use vanilla light directions for diffuse lighting
- Copy mc's glsl code for it, but assume directions are normalized
- Add command/config to toggle use of light directions vs chunk accurate
  diffuse
- Always use shade in getItemMaterial
- Do not reload resource packs when updating light smoothness config,
  we don't need to anymore with lazy compilation
2024-09-29 11:52:35 -07:00
Jozufozu
22b5676e47 Quick thinking
- Decide not to render entities directly in the renderEntity method
- Prevents allocating large lists every frame to filter entities from
  the client level
2024-09-28 23:37:49 -07:00
Jozufozu
0a01b82647 Glimpse of glint
- Add pick glint material and system time uniform
- Move _FlwCullData to beginning of uniform block to ensure alignment
- Add helper to convert item rendertype into flywheel material
2024-09-28 23:27:28 -07:00
Jozufozu
bd0aadf9d9 Streamlined pipelines
- Make UberShaderComponent#build NotNull
- Move index update and key creation logic to PipelineCompiler
- Always update index when a resource location is requested to fix
  MaterialEncoder misses
- Indices trigger pipeline compiler deletion when updated
2024-09-28 22:05:38 -07:00
Jozufozu
ef05f7d3fd Errors galore
- Make everything in the compiler chain's results not null
- Throw errors immediately when encountered
- Log error messages when falling back
- Do not eagerly grab utility programs in IndirectDrawManager so we can
  actually catch errors and fall back
- Remove CompilerStats
2024-09-28 16:00:23 -07:00
Jozufozu
11ce4ac185 Dynamic ubering
- Remove fog shader registry
- Remove Registry and RegistryImpl
- Make shader indices mutable
- Track fog uber component in a static field in PipelineCompiler
- When a new fog source is added, delete the pipeline compilation
  harness and recreate the fog uber component
- Inline SourceLoader
2024-09-28 15:30:10 -07:00
Jozufozu
bce657804a Source of all pain
- Strip out almost all source registries
- Fog will be dealt with in a follow-up commit
- Remove most static #init methods
- Remove old ubershader indices from shaders
2024-09-28 14:48:22 -07:00
Jozufozu
48fdcdb751 DeDelleetete
- Process instancer deletions in parallel
- Give DrawManagers a frame plan
2024-09-28 14:26:15 -07:00
Jozufozu
7bd59f7b14 Not pointing
- Fix occasional npe in PlayerUniforms
- Mark accessor method as Nullable
2024-09-23 11:16:45 -07:00
Jozufozu
36b0ad4cf9 To bug or not to bug
- Disable the debug stuff in the frag shader with compile flags
- Also disable discard and conservative depth with CutoutShaders.OFF
2024-09-22 15:51:37 -07:00
IThundxr
42bdd3693c
port changes to 1.21 2024-09-22 18:20:36 -04:00
IThundxr
a3bb585a15
Merge branch '1.20/dev' into feat/multi-loader-1.21 2024-09-22 18:18:25 -04:00
Jozufozu
897c350f41 Uberstate ready
- Fix material state sorting/equality functions
2024-09-22 13:13:38 -07:00
Jozufozu
ff73e78e21 Visions of visibility
- Add visible/skipDraw getter/setter to InstanceTree
- Minecart finally gets to resolve its TODO!
2024-09-22 13:04:51 -07:00
Jozufozu
ee0f799f60 More statefuler
- Hidden state now tracks the Instance object to keep the handle small
- Make the recreate supplier an explicit record to allow comparisons
- Add setVisible method to Instance
2024-09-22 12:56:49 -07:00
Jozufozu
c5d9abab5f Tasteful stateful handles
- Use state machine interface in InstanceHandleImpl
- 3 states: deleted, visible, hidden
- Visible is directly implemented by AbstractInstancer
- Hidden stores the instancer supplier to recreate an instancer
2024-09-22 12:28:35 -07:00
Jozufozu
6a6d98c0a7 Fewber
- Do not uberize material or cutout shaders
- Add debug log for shader compilations/program links
2024-09-21 15:10:27 -07:00
Jozufozu
27e5b609af Reject eagerness return to lazy
- Eagerly load ALL shaders in ShaderSources, resolving imports there
- Compile and cache programs on-demand
- Move gl state try blocks to EngineImpl
- EngineImpl catches shader exceptions and triggers a fallback
2024-09-21 13:41:55 -07:00
Jozufozu
cb58f6075e Crumbling grumbling
- Fix crumbling on indirect
- Directly use the baseInstance as instance index without indirection
- #define base instance and draw id variables to simplify usage
- Fix null pointer looking up culling group
- Add method to map an instancer's local instance index to a global
  index in the page file
2024-09-21 12:00:09 -07:00
Jozufozu
b7b7cca992 Happy as a clamp
- Fix instances vanishing close to the edge of your screen
2024-09-20 20:07:38 -07:00
Jozufozu
40cfc08025 Mul-ing things over
- Add missing multiply functions to TransformedInstance
2024-09-20 19:28:27 -07:00
Jozufozu
90e088aedc Creation is change
- Indirect instancers mark pages as changed when instances are added
2024-09-20 19:14:50 -07:00
IThundxr
556e11a683
Fix compile errors 2024-09-20 09:47:32 -04:00
IThundxr
e7e3579315
Merge branch '1.20/dev' into feat/multi-loader-1.21
# Conflicts:
#	common/src/lib/java/dev/engine_room/flywheel/lib/model/part/ModelPartConverter.java
#	forge/src/main/java/dev/engine_room/flywheel/impl/ForgeFlwConfig.java
#	gradle.properties
2024-09-20 09:37:06 -04:00
PepperCode1
5b6463b8f1 Regularly scheduled maintenance
- Remove ModelHolder and ModelCache
- Remove lib/util.FlwUtil
- Remove lib/util.Pair and replace usages with com.mojang.datafixers.util.Pair
- Remove lib/util.Unit and replace usages with net.minecraft.util.Unit
- Make ResourceReloadHolder and ResourceReloadCache final and move to util
- Clean up code in backend/glsl
- Move LightSmoothnessArgument to impl
2024-09-19 20:24:58 -07:00
PepperCode1
62a0954381 Home alone
- Remove LoweringVisitor
- Move functionality of four main static methods in LoweringVisitor to new ModelTrees class
  - Return ModelTree directly
  - Accept Material instead of TextureAtlasSprite for efficiency, so visuals don't need to look up the sprite to get the ModelTree
- Use ResourceReloadCache for MeshTree.CACHE
2024-09-19 11:40:41 -07:00
Jozufozu
5a75fe972f First try
- Implement instance hiding by deleting/stealing
- Work around instancer persistence by storing a recreation supplier in
  the instance handle
- Rework instancer ctors to just take an InstancerKey
- Parameterize InstanceHandle by I extends Instance so the steal method
  and the supplier can be safely assigned
2024-09-18 23:43:23 -07:00
Jozufozu
e1b594ac47 Ctrl + Alt + N
- IndirectInstancer#uploadInstances: 46% of render thread to 26%
- Inline #enqueueCopy to avoid allocating LongConsumers
- Do not even bother to track individual changed indices, instead rely
  on just the changedPage set
2024-09-15 21:29:00 -07:00