Skip to content

Stack/06 texture cache#373

Merged
JucanAndreiDaniel merged 4 commits into
mainfrom
stack/06-texture-cache
Jun 15, 2026
Merged

Stack/06 texture cache#373
JucanAndreiDaniel merged 4 commits into
mainfrom
stack/06-texture-cache

Conversation

@JucanAndreiDaniel

Copy link
Copy Markdown
Contributor

Summary

Refactor the texture cache to allow a material to be in different texture cache arrays (OWODWAT_A0 is used by river materials and by the Old Camp cauldron's soup surface)

How to test

Load into world.zen and check river in front of old camp

Caches TextureArray composition keyed by TextureArrayTypes so only texture creation happens at runtime; SaveGlobalCache now takes the nested per-type dictionary.
@JucanAndreiDaniel JucanAndreiDaniel self-assigned this Jun 15, 2026
@JucanAndreiDaniel JucanAndreiDaniel added the bug Something isn't working label Jun 15, 2026
@JucanAndreiDaniel JucanAndreiDaniel requested a review from JaXt0r June 15, 2026 04:30

@JaXt0r JaXt0r left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments.

// The target array is a pure function of (material group, texture format): registration is
// deterministic and independent of the order in which worlds, VOBs and items are processed.
// Dual-use textures get registered once per referencing side (Water and solid).
if (group == MaterialGroup.Water)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this separate IF is needed. Just put it all together:
IF (Water.contains() || Opaque.Contains() || Transparent.Contains()
Helps better readability.

@JucanAndreiDaniel JucanAndreiDaniel Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now that i think about it the whole if/else if logic is not robust enough, this only checks if a texture with the water material is used in water and other caches. dual-textures can only be in water and either opaque or transparent because of how they are processed later in the function

i need to take a look at this

{
TextureArrayInformation.Add(animationTexture.Key,
new StaticCacheService.TextureInfo(textureArrayType, Math.Max(animationTexture.Value.Width, animationTexture.Value.Height), 0));
// Animation frames must occupy the array slices directly after their base texture.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add more words from your end why this is needed as comment in code. I currently don't understand.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment is to be taken in context with the one from the foreach loop

Comment thread Assets/Gothic-Core/Scripts/Services/Caches/TextureCacheService.cs
@JucanAndreiDaniel JucanAndreiDaniel merged commit 7a3b3fd into main Jun 15, 2026
@JucanAndreiDaniel JucanAndreiDaniel deleted the stack/06-texture-cache branch June 15, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants