materialbin

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute uint8
const (
	AttributePosition Attribute = iota
	AttributeNormal
	AttributeTangent
	AttributeBitangent
	AttributeColor0
	AttributeColor1
	AttributeColor2
	AttributeColor3
	AttributeIndices
	AttributeWeights
	AttributeTexCoord0
	AttributeTexCoord1
	AttributeTexCoord2
	AttributeTexCoord3
	AttributeTexCoord4
	AttributeTexCoord5
	AttributeTexCoord6
	AttributeTexCoord7
	AttributeTexCoord8
	AttributeFrontFacing
)

func (Attribute) Tuple

func (a Attribute) Tuple() (index, subIndex uint8)

type BGFXShader

type BGFXShader struct {
	Magic      uint32
	Hash       uint32
	Uniforms   []Uniform
	Code       []byte
	Attributes []uint16
	Size       *uint16
}

func ParseBGFXShader

func ParseBGFXShader(data []byte, materialFileVersion uint64) (*BGFXShader, error)

func (*BGFXShader) MarshalBinary

func (b *BGFXShader) MarshalBinary(materialFileVersion uint64) ([]byte, error)

type BlendMode

type BlendMode uint16
const (
	BlendModeNone BlendMode = iota
	BlendModeReplace
	BlendModeAlphaBlend
	BlendModeColorBlendAlphaAdd
	BlendModePreMultiplied
	BlendModeInvertColor
	BlendModeAdditive
	BlendModeAdditiveAlpha
	BlendModeMultiply
	BlendModeMultiplyBoth
	BlendModeInverseSrcAlpha
	BlendModeSrcAlpha
)

type CompiledMaterialDefinition

type CompiledMaterialDefinition struct {
	Version           uint64
	EncryptionVariant EncryptionVariant
	Name              string
	ParentName        *string

	SamplerDefinitions []NamedSamplerDefinition
	PropertyFields     []NamedPropertyField
	UniformOverrides   *[]StringPair
	Passes             []NamedPass
}

func Parse

func Parse(data []byte, materialFileVersion uint64) (*CompiledMaterialDefinition, error)

func ParseAuto

func ParseAuto(data []byte) (*CompiledMaterialDefinition, uint64, error)

func (*CompiledMaterialDefinition) MarshalBinary

func (c *CompiledMaterialDefinition) MarshalBinary(materialFileVersion uint64) ([]byte, error)

func (*CompiledMaterialDefinition) WriteTo

func (c *CompiledMaterialDefinition) WriteTo(w io.Writer, materialFileVersion uint64) (int64, error)

type CustomTypeInfo

type CustomTypeInfo struct {
	CustomType       string
	CustomTypeStride uint32
}

type EncryptionVariant

type EncryptionVariant uint32
const (
	EncryptionVariantNone             EncryptionVariant = 0x4E4F4E45
	EncryptionVariantSimplePassphrase EncryptionVariant = 0x534D504C
	EncryptionVariantKeyPair          EncryptionVariant = 0x4B595052
)

func (EncryptionVariant) IsEncrypted

func (e EncryptionVariant) IsEncrypted() bool

type InterpolationConstraint

type InterpolationConstraint uint8
const (
	InterpolationConstraintFlat InterpolationConstraint = iota
	InterpolationConstraintSmooth
	InterpolationConstraintNoPerspective
	InterpolationConstraintCentroid
)

type NamedPass

type NamedPass struct {
	Name string
	Pass Pass
}

type NamedPropertyField

type NamedPropertyField struct {
	Name          string
	PropertyField PropertyField
}

type NamedSamplerDefinition

type NamedSamplerDefinition struct {
	Name              string
	SamplerDefinition SamplerDefinition
}

type NamedShaderInput

type NamedShaderInput struct {
	Name  string
	Input ShaderInput
}

type Pass

type Pass struct {
	PlatformSupport        string
	Fallback               string
	Variants               []Variant
	DefaultFlagValues      []StringPair
	DefaultBlendMode       *BlendMode
	OutputBindingSignature *uint32
}

type PlatformShaderCode

type PlatformShaderCode struct {
	Stage PlatformShaderStage
	Code  ShaderCode
}

type PlatformShaderStage

type PlatformShaderStage struct {
	StageName    string
	PlatformName string
	Stage        ShaderStage
	Platform     ShaderCodePlatform
}

type PrecisionConstraint

type PrecisionConstraint uint8
const (
	PrecisionConstraintLow PrecisionConstraint = iota
	PrecisionConstraintMedium
	PrecisionConstraintHigh
)

type PropertyField

type PropertyField struct {
	FieldType  PropertyType
	Num        uint32
	VectorData []byte
	MatrixData []byte
}

type PropertyType

type PropertyType uint16
const (
	PropertyTypeVec4     PropertyType = 2
	PropertyTypeMat3     PropertyType = 3
	PropertyTypeMat4     PropertyType = 4
	PropertyTypeExternal PropertyType = 5
)

type SamplerAccess

type SamplerAccess uint8
const (
	SamplerAccessNone SamplerAccess = iota
	SamplerAccessRead
	SamplerAccessWrite
	SamplerAccessReadWrite
)

type SamplerDefinition

type SamplerDefinition struct {
	RegisterSlot         uint16
	BindingSlot          uint8
	Size                 uint32
	Access               SamplerAccess
	Precision            PrecisionConstraint
	AllowUnorderedAccess uint8
	SamplerType          SamplerType
	TextureFormat        string
	SamplerState         *SamplerState
	DefaultTexture       *string
	TextureURI           *string
	CustomTypeInfo       *CustomTypeInfo
}

type SamplerState

type SamplerState uint8
const (
	SamplerStateClampPoint SamplerState = iota
	SamplerStateClampLinear
	SamplerStateWrapPoint
	SamplerStateWrapLinear
)

type SamplerType

type SamplerType uint8
const (
	SamplerType2D SamplerType = iota
	SamplerType2DArray
	SamplerType2DExternal
	SamplerType3D
	SamplerTypeCube
	SamplerTypeSamplerCubeArray
	SamplerTypeStructuredBuffer
	SamplerTypeRawBuffer
	SamplerTypeAccelerationStructure
	SamplerType2DShadow
	SamplerType2DArrayShadow
)

type ShaderCode

type ShaderCode struct {
	ShaderInputs   []NamedShaderInput
	SourceHash     uint64
	BgfxShaderData []byte
}

type ShaderCodePlatform

type ShaderCodePlatform uint8
const (
	ShaderCodePlatformDirect3DSm40 ShaderCodePlatform = iota
	ShaderCodePlatformDirect3DSm50
	ShaderCodePlatformDirect3DSm60
	ShaderCodePlatformDirect3DSm65
	ShaderCodePlatformDirect3DXB1
	ShaderCodePlatformDirect3DXBX
	ShaderCodePlatformGlsl120
	ShaderCodePlatformGlsl430
	ShaderCodePlatformEssl100
	ShaderCodePlatformEssl300
	ShaderCodePlatformEssl310
	ShaderCodePlatformMetal
	ShaderCodePlatformVulkan
	ShaderCodePlatformNvn
	ShaderCodePlatformPssl
)

func (ShaderCodePlatform) String

func (p ShaderCodePlatform) String() string

type ShaderInput

type ShaderInput struct {
	InputType               ShaderInputType
	Attribute               Attribute
	IsPerInstance           bool
	PrecisionConstraint     *PrecisionConstraint
	InterpolationConstraint *InterpolationConstraint
}

type ShaderInputType

type ShaderInputType uint8
const (
	ShaderInputTypeFloat ShaderInputType = iota
	ShaderInputTypeVec2
	ShaderInputTypeVec3
	ShaderInputTypeVec4
	ShaderInputTypeInt
	ShaderInputTypeInt2
	ShaderInputTypeInt3
	ShaderInputTypeInt4
	ShaderInputTypeUInt
	ShaderInputTypeUInt2
	ShaderInputTypeUInt3
	ShaderInputTypeUInt4
	ShaderInputTypeMat4
)

type ShaderStage

type ShaderStage uint8
const (
	ShaderStageVertex ShaderStage = iota
	ShaderStageFragment
	ShaderStageCompute
	ShaderStageUnknown
)

type StringPair

type StringPair struct {
	Key   string
	Value string
}

type Uniform

type Uniform struct {
	Name     string
	Type     uint8
	Num      uint8
	RegIndex uint16
	RegCount uint16
}

type Variant

type Variant struct {
	IsSupported bool
	Flags       []StringPair
	ShaderCodes []PlatformShaderCode
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL