Skip to content

Commit

Permalink
Added NoAlphaTest to buffer material
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin113D committed Nov 6, 2024
1 parent e8e6b77 commit 1d49125
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/SA3D.Modeling/Mesh/Buffer/BufferMaterial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,17 @@ public bool BackfaceCulling
set => SetAttributes(MaterialAttributes.BackfaceCulling, value);
}

/// <summary>
/// Disable alpha testing
/// <br/> Wrapper around flag in <see cref="Attributes"/>.
/// </summary>
public bool NoAlphaTest
{
readonly get => HasAttributes(MaterialAttributes.NoAlphaTest);
set => SetAttributes(MaterialAttributes.NoAlphaTest, value);
}


#endregion

#region Gamecube Properties
Expand Down
5 changes: 5 additions & 0 deletions src/SA3D.Modeling/Mesh/Buffer/MaterialAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,10 @@ public enum MaterialAttributes : ushort
/// Enables backface culling.
/// </summary>
BackfaceCulling = Flag16.B12,

/// <summary>
/// Disables alpha testing
/// </summary>
NoAlphaTest = Flag16.B13
}
}
2 changes: 1 addition & 1 deletion src/SA3D.Modeling/Mesh/Chunk/PolyChunks/StripChunk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public bool EnvironmentMapping
}

/// <summary>
/// Disables Alpha Test
/// Disable alpha testing
/// <br/> 0x80 in <see cref="PolyChunk.Attributes"/>.
/// </summary>
public bool NoAlphaTest
Expand Down
1 change: 1 addition & 0 deletions src/SA3D.Modeling/Mesh/Converters/ChunkConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@ public static void BufferChunkModel(Node model, bool optimize)
material.UseTexture = stripChunk.TexcoordCount > 0 || stripChunk.EnvironmentMapping;
material.UseAlpha = stripChunk.UseAlpha;
material.BackfaceCulling = !stripChunk.DoubleSide;
material.NoAlphaTest = stripChunk.NoAlphaTest;

BufferCorner[] corners = ConvertStripChunk(stripChunk, vertexCache);

Expand Down
5 changes: 4 additions & 1 deletion src/SA3D.Modeling/PublicAPI/net8.0/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
SA3D.Modeling.Mesh.Chunk.PolyChunks.StripChunk.NoAlphaTest.get -> bool
SA3D.Modeling.Mesh.Buffer.BufferMaterial.NoAlphaTest.get -> bool
SA3D.Modeling.Mesh.Buffer.BufferMaterial.NoAlphaTest.set -> void
SA3D.Modeling.Mesh.Buffer.MaterialAttributes.NoAlphaTest = 8192 -> SA3D.Modeling.Mesh.Buffer.MaterialAttributes
SA3D.Modeling.Mesh.Chunk.PolyChunks.StripChunk.NoAlphaTest.get -> bool
SA3D.Modeling.Mesh.Chunk.PolyChunks.StripChunk.NoAlphaTest.set -> void
SA3D.Modeling.ObjectData.Enums.NodeAttributes.ApplyCachedRotation = 4096 -> SA3D.Modeling.ObjectData.Enums.NodeAttributes
SA3D.Modeling.ObjectData.Enums.NodeAttributes.CacheRotation = 2048 -> SA3D.Modeling.ObjectData.Enums.NodeAttributes
Expand Down

0 comments on commit 1d49125

Please sign in to comment.