Vixen
02b45cc4
csharp
public sealed class TextureData

A texture in memory: the pixels, and enough to say what they mean.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

One flat buffer with a level table over it, rather than an array of arrays. A texture is written to a file and uploaded to a GPU as a contiguous run of bytes in both cases, and a shape that matches those is one that neither has to copy to reach.

Levels are ordered largest first, which is the order everything except the KTX2 file format uses. Ktx2 reverses on the way out and back on the way in, and that is the only place the other order exists.

Fields and properties (10)

  • public PixelFormat Format

    What the bytes mean.

  • public int Width

    The largest level's width.

  • public int Height

    The largest level's height.

  • public int Depth

    The largest level's depth. One for a 2D texture.

  • public int LayerCount

    How many array layers. One for a plain texture.

  • public int FaceCount

    How many faces. Six for a cube map, one otherwise.

  • public IReadOnlyList<TextureLevel> Levels

    Every level of every face of every layer, largest level first.

  • public int LevelCount

    How many mip levels.

  • public ReadOnlySpan<byte> Pixels

    All of the pixels, in level order.

  • public int ByteLength

    How many bytes the whole texture is.

Methods (4)

  • public TextureData(PixelFormat format, int width, int height, int levelCount = 0, int depth = 1, int layerCount = 1, int faceCount = 1)

    Describes a texture and allocates its buffer.

  • public ReadOnlySpan<byte> Level(int level)

    One level's bytes, for reading.

  • public Span<byte> LevelSpan(int level)

    One level's bytes, for writing.

  • public Span<byte> PixelSpan()

    All of the pixels, for writing.

Used by (30)

  • AssetTextureSourceVixen.Engine.Renderer
  • AssetTextureSourceTestsVixen.Engine.Renderer.Tests
  • BlockCompressorVixen.Core.Imaging
  • BlockCompressorTestsVixen.Core.Imaging.Tests
  • BlockEncoderTestsVixen.Core.Imaging.Tests
  • BrdfLutVixen.Core.Imaging
  • CubeMapVixen.Core.Imaging
  • EntryVixen.Engine.Renderer
  • EnvironmentPrefilterVixen.Core.Imaging
  • IblTestsVixen.Core.Imaging.Tests
  • Ktx2Vixen.Core.Imaging
  • Ktx2TestsVixen.Core.Imaging.Tests
  • MipChainVixen.Core.Imaging
  • MipChainTestsVixen.Core.Imaging.Tests
  • SphericalHarmonicsL2Vixen.Core.Imaging
  • WorldRendererTestsVixen.Engine.Renderer.Tests
  • CubeLutVixen.Editor.Assets
  • CubeLutImporterVixen.Editor.Assets
  • CubeLutTestsVixen.Editor.Assets.Tests
  • IImageDecoderVixen.Editor.Assets
  • Ktx2DecoderVixen.Editor.Assets
  • SpriteSheetViewVixen.Editor.AssetEditors
  • SpriteSlicerVixen.Editor.Assets
  • SpriteSlicerTestsVixen.Editor.Assets.Tests
  • StbImageDecoderVixen.Editor.Assets
  • TextureImportViewVixen.Editor.AssetEditors
  • TextureImporterVixen.Editor.Assets
  • TextureImporterTestsVixen.Editor.Assets.Tests
  • TextureLadderVixen.Editor.AssetEditors
  • ThumbnailCacheVixen.Editor.App