-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from Soreepeong/feature/texture-planes
Add support for multiple mipmaps/depths for TexFile
- Loading branch information
Showing
13 changed files
with
882 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
|
||
namespace Lumina.Data.Parsing.Tex.Buffers | ||
{ | ||
/// <summary> | ||
/// Represent a face in .tex file, in A8 texture format. | ||
/// </summary> | ||
public class A8TextureBuffer : TextureBuffer | ||
{ | ||
/// <inheritdoc /> | ||
public A8TextureBuffer( bool isDepthConstant, int width, int height, int depth, int[] mipmapAllocations, byte[] buffer ) | ||
: base( isDepthConstant, width, height, depth, mipmapAllocations, buffer ) | ||
{ | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override int NumBytesOfMipmapPerPlane( int mipmapIndex ) => NumPixelsOfMipmapPerPlane( mipmapIndex ); | ||
|
||
/// <inheritdoc /> | ||
protected override unsafe void ConvertToB8G8R8A8( byte[] buffer, int destOffset, int sourceOffset, int width, int height, int depth ) | ||
{ | ||
fixed( byte* dstb = buffer, srcb = RawData ) | ||
{ | ||
var src = new Span< byte >( srcb + sourceOffset, width * height * depth ); | ||
var dst = new Span< uint >( dstb + destOffset, width * height * depth ); | ||
for( var i = 0; i < dst.Length; i++ ) | ||
dst[ i ] = 0x1000000U * src[ i ]; | ||
} | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override TextureBuffer CreateNew( bool isDepthConstant, int width, int height, int depth, int[] mipmapAllocations, byte[] buffer ) | ||
=> new A8TextureBuffer( isDepthConstant, width, height, depth, mipmapAllocations, buffer ); | ||
} | ||
} |
Oops, something went wrong.