Skip to content

package textures

import "kaijuengine.com/rendering/textures"

Constants

FileFormatAstc

astcExtension

FileFormatPng

pngExtension

FileFormatJpeg

jpegExtension

FileFormatRaw

rawFileFormat

BytesInPixel

4

CubeMapSides

6

GenerateUniqueTextureKey

""

Functions

InferFileFormat

func InferFileFormat(nameOrKey string, imgBuff []byte) string

Types

ColorFormat

int

type ColorFormat int

const ( TextureColorFormatRgbaUnorm ColorFormat = iota TextureColorFormatRgbUnorm TextureColorFormatRgbaSrgb TextureColorFormatRgbSrgb TextureColorFormatLuminance )

Dimensions

int

type Dimensions = int

const ( TextureDimensions2 Dimensions = iota TextureDimensions1 TextureDimensions3 TextureDimensionsCube )

Filter

int

type Filter = int

const ( TextureFilterLinear Filter = iota TextureFilterNearest TextureFilterMax )

ImageAstc

struct

type ImageAstc struct{}

ImageAstc.CanRead

func (r ImageAstc) CanRead(path string) bool

ImageAstc.FileFormat

func (r ImageAstc) FileFormat() string

ImageAstc.IsMyType

func (r ImageAstc) IsMyType(pathOrKey string, mem []byte) bool

ImageAstc.Read

func (r ImageAstc) Read(mem []byte) TextureData

ImageJpeg

struct

type ImageJpeg struct{}

ImageJpeg.CanRead

func (r ImageJpeg) CanRead(path string) bool

ImageJpeg.FileFormat

func (r ImageJpeg) FileFormat() string

ImageJpeg.IsMyType

func (r ImageJpeg) IsMyType(pathOrKey string, mem []byte) bool

ImageJpeg.Read

func (r ImageJpeg) Read(mem []byte) TextureData

ImagePng

struct

type ImagePng struct{}

ImagePng.CanRead

func (r ImagePng) CanRead(path string) bool

ImagePng.FileFormat

func (r ImagePng) FileFormat() string

ImagePng.IsMyType

func (r ImagePng) IsMyType(pathOrKey string, mem []byte) bool

ImagePng.Read

func (r ImagePng) Read(mem []byte) TextureData

ImageRaw

struct

type ImageRaw struct{}

ImageRaw.CanRead

func (r ImageRaw) CanRead(path string) bool

ImageRaw.FileFormat

func (r ImageRaw) FileFormat() string

ImageRaw.IsMyType

func (r ImageRaw) IsMyType(pathOrKey string, mem []byte) bool

ImageRaw.Read

func (r ImageRaw) Read(mem []byte) TextureData

ImageReader

interface

type ImageReader interface {
    CanRead(path string) bool
    Read(mem []byte) TextureData
    FileFormat() string
    IsMyType(pathOrKey string, mem []byte) bool
}

InputType

int

type InputType int

const ( TextureInputTypeCompressedRgbaAstc4x4 InputType = iota TextureInputTypeCompressedRgbaAstc5x4 TextureInputTypeCompressedRgbaAstc5x5 TextureInputTypeCompressedRgbaAstc6x5 TextureInputTypeCompressedRgbaAstc6x6 TextureInputTypeCompressedRgbaAstc8x5 TextureInputTypeCompressedRgbaAstc8x6 TextureInputTypeCompressedRgbaAstc8x8 TextureInputTypeCompressedRgbaAstc10x5 TextureInputTypeCompressedRgbaAstc10x6 TextureInputTypeCompressedRgbaAstc10x8 TextureInputTypeCompressedRgbaAstc10x10 TextureInputTypeCompressedRgbaAstc12x10 TextureInputTypeCompressedRgbaAstc12x12 TextureInputTypeRgba8 TextureInputTypeRgb8 TextureInputTypeLuminance )

Kind

uint8

type Kind uint8

const ( Texture1D Kind = iota Texture1DArray Texture2D Texture2DArray Texture3D TextureCube TextureCubeArray )

MemType

int

type MemType = int

const ( TextureMemTypeUnsignedByte MemType = iota )

TextureData

struct

type TextureData struct {
    Mem            []byte
    InternalFormat InputType
    Format         ColorFormat
    Type           MemType
    Width          int
    Height         int
    InputType      TextureFileFormat
    Dimensions     Dimensions
}

ReadImage

func ReadImage(mem []byte, pathOrFileFormat string) (TextureData, error)

TextureData.IsValid

func (t *TextureData) IsValid() bool

TextureFileFormat

string

type TextureFileFormat = string

Usage

uint32

type Usage uint32

const ( TextureSampled Usage = (1 << iota) TextureStorage TextureColorTarget TextureDepthStencilTarget TextureCopySource TextureCopyDestination )