Skip to content

Adds lots of stuff to Scene objects and adds Layout level staining support.#1727

Draft
universalconquistador wants to merge 4 commits intoaers:mainfrom
universalconquistador:scene-additions-and-stains
Draft

Adds lots of stuff to Scene objects and adds Layout level staining support.#1727
universalconquistador wants to merge 4 commits intoaers:mainfrom
universalconquistador:scene-additions-and-stains

Conversation

@universalconquistador
Copy link

@universalconquistador universalconquistador commented Feb 18, 2026

  • Adds Common::Math::SphereBounds, Common::Math::OrientedBounds, and Common::Math::AxisAlignedBounds math types. I did not update the few places that use Vector4 for sphere bounds instead of SphereBounds.

  • Adds vfuncs for Scene object updates, computing the 3 types of bounds, hit testing, working with attach bones, and dither transparency. Also added an enum for the Dtor mode so we can standardize that a bit. Tested the 3 bounds querying (some cases are wonky e.g. characters with oriented and aligned bounds, but I believe that's a sqenix problem), both hit test methods, and dither transparency (SE only implemented it for BgObjects). Did not test the attach bone stuff.

  • Adds the static Create helpers for BgObject and VfxObject, stain support for BgObject, and some VFX fields from OGT. Tested that I can create and destroy both, and set VFX color and BgObject stain.

  • Adds support for staining SharedGroupLayoutInstances and in general via ILayoutInstance.ApplyStain. I have not tested these myself.

@universalconquistador universalconquistador marked this pull request as draft February 18, 2026 14:02
@github-actions
Copy link
Contributor

Field overlap detected in Common::Math::SphereBounds with field Radius

@github-actions github-actions bot added the requested changes Changes requested through comments label Feb 18, 2026
@universalconquistador
Copy link
Author

Field overlap detected in Common::Math::SphereBounds with field Radius

yes thank you that's by design

Copy link
Collaborator

@Haselnussbomber Haselnussbomber left a comment

Choose a reason for hiding this comment

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

Just a quick glance at it.
It would also require you to add the functions and vfuncs to the data.yml once you're good with the names.

Comment on lines +16 to +17
[MemberFunction("E8 ?? ?? ?? ?? 48 89 43 30 48 8B D7")]
public static partial BgObject* Create(byte* modelGamePath, byte* pool, BgObject* existingAllocation);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Using our generator will allow to pass strings directly to this method.
Since the last parameter can be optional, just default it to null here (nullptr).

Suggested change
[MemberFunction("E8 ?? ?? ?? ?? 48 89 43 30 48 8B D7")]
public static partial BgObject* Create(byte* modelGamePath, byte* pool, BgObject* existingAllocation);
[MemberFunction("E8 ?? ?? ?? ?? 48 89 43 30 48 8B D7"), GenerateStringOverloads]
public static partial BgObject* Create(CStringPointer modelGamePath, CStringPointer pool, BgObject* existingAllocation = null);

Comment on lines +30 to +31
[MemberFunction("E8 ?? ?? ?? ?? F3 0F 10 35 ?? ?? ?? ?? 48 89 43 08")]
public static partial VfxObject* Create(byte* vfxGamePath, byte* pool);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
[MemberFunction("E8 ?? ?? ?? ?? F3 0F 10 35 ?? ?? ?? ?? 48 89 43 08")]
public static partial VfxObject* Create(byte* vfxGamePath, byte* pool);
[MemberFunction("E8 ?? ?? ?? ?? F3 0F 10 35 ?? ?? ?? ?? 48 89 43 08"), GenerateStringOverloads]
public static partial VfxObject* Create(CStringPointer vfxGamePath, CStringPointer pool);

/// <param name="stainIndex">The object stain index to look up the color of.</param>
/// <returns>The sRGB color for the given object stain.</returns>
[MemberFunction("33 C0 81 F9 ?? ?? ?? ?? 0F 42 C1")]
public static partial ByteColor GetObjectStainColorByIndex(byte stainIndex);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This returns a pointer: &byte_1429A88BC.

Suggested change
public static partial ByteColor GetObjectStainColorByIndex(byte stainIndex);
public static partial ByteColor* GetObjectStainColorByIndex(byte stainIndex);

public partial bool WantToBeActive();

[VirtualFunction(58)]
public partial ByteColor ApplyStain(ByteColor* stainColorSrgb);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure that actually returns anything. Would have to look at the call sites, but it doesn't move anything into RAX register before returning.

Copy link
Collaborator

Choose a reason for hiding this comment

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

it does not yeah (1406dced2 and 1406e14da if you want to check call sites)

public static partial VfxObject* Create(byte* vfxGamePath, byte* pool);

[MemberFunction("E8 ?? ?? ?? ?? ?? ?? ?? 8B 4A ?? 85 C9")]
public partial uint Update(float deltaSeconds, uint flags = uint.MaxValue);
Copy link
Collaborator

@Haselnussbomber Haselnussbomber Feb 18, 2026

Choose a reason for hiding this comment

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

I think "flags" is not really correct here. I don't know what it's used for, but it looks like it should be int (-1) as it checks a3 >= 0 and a2 <= 7 in the function it passes it to.

Also doesn't return anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requested changes Changes requested through comments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments