Skip to content

OptimizeFor toSSE: honor withoutNormals when creating bsOptShape#21

Merged
ousnius merged 2 commits intoousnius:mainfrom
MANOLOV02:fix/optimizefor-tosse-respect-without-normals
Apr 25, 2026
Merged

OptimizeFor toSSE: honor withoutNormals when creating bsOptShape#21
ousnius merged 2 commits intoousnius:mainfrom
MANOLOV02:fix/optimizefor-tosse-respect-without-normals

Conversation

@MANOLOV02
Copy link
Copy Markdown
Contributor

The toSSE branch of OptimizeFor always passes geomData.Normals when constructing bsOptShape, even when withoutNormals is true. The toLE branch already uses the correct !withoutNormals ? ... : null pattern; this brings toSSE in line.

C++ reference: nifly/NifFile.cpp:1565-1569 — C++ nulls normals = nullptr before passing it to Create() when removeNormals is true.

Fix: gate the Normals argument on withoutNormals.

Maps to issue #15 item A2.

MANOLOV02 and others added 2 commits April 25, 2026 17:46
The toSSE branch computed `withoutNormals = true` for ModelSpace
shaders but always passed `geomData.Normals` to bsOptShape.Create,
so the flag had no effect. Normals ended up persisted on shapes
that should not carry them.

Matches C++ nifly NifFile.cpp:1565-1569, where the toSSE equivalent
sets the `normals` pointer to `nullptr` before calling Create at
NifFile.cpp:1652. The toLE branch in the same C# file already had
the correct `!withoutNormals ? ... : null` pattern; this brings the
toSSE branch in line.
@ousnius ousnius merged commit 60aafc2 into ousnius:main Apr 25, 2026
1 check passed
@MANOLOV02 MANOLOV02 deleted the fix/optimizefor-tosse-respect-without-normals branch April 25, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants