materials

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Namespace is the canonical name of this extension.
	Namespace = "http://schemas.microsoft.com/3dmanufacturing/material/2015/02"
	// RelTypeTexture3D is the canonical 3D texture relationship type.
	RelTypeTexture3D = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture"
)

Variables

View Source
var (
	ErrMultiBlend         = errors.New("there MUST NOT be more blendmethods than layers – 1")
	ErrMaterialMulti      = errors.New("a material, if included, MUST be positioned as the first layer")
	ErrMultiRefMulti      = errors.New("the pids list MUST NOT contain any references to a multiproperties")
	ErrMultiColors        = errors.New("the pids list MUST NOT contain more than one reference to a colorgroup")
	ErrTextureReference   = errors.New("MUST reference to a texture resource")
	ErrCompositeBase      = errors.New("MUST reference to a basematerials group")
	ErrMissingTexturePart = errors.New("texture part MUST be added as an attachment")
)
View Source
var DefaultExtension = go3mf.Extension{
	Namespace:  Namespace,
	LocalName:  "m",
	IsRequired: false,
}

Functions

This section is empty.

Types

type BlendMethod

type BlendMethod uint8

BlendMethod defines the equation to use when blending a layer with the previous layer.

const (
	BlendMix BlendMethod = iota
	BlendMultiply
)

Supported blend methods.

func (BlendMethod) String

func (b BlendMethod) String() string

type ColorGroup

type ColorGroup struct {
	ID     uint32
	Colors []color.RGBA
}

ColorGroup acts as a container for color properties.

func (*ColorGroup) Identify

func (c *ColorGroup) Identify() uint32

Identify returns the unique ID of the resource.

func (*ColorGroup) Len

func (r *ColorGroup) Len() int

Len returns the materials count.

func (*ColorGroup) Marshal3MF

func (r *ColorGroup) Marshal3MF(x spec.Encoder) error

Marshal3MF encodes the resource.

type Composite

type Composite struct {
	Values []float32
}

A Composite specifies the proportion of the overall mixture for each material.

type CompositeMaterials

type CompositeMaterials struct {
	ID         uint32
	MaterialID uint32
	Indices    []uint32
	Composites []Composite
}

CompositeMaterials defines materials derived by mixing 2 or more base materials in defined ratios.

func (*CompositeMaterials) Identify

func (c *CompositeMaterials) Identify() uint32

Identify returns the unique ID of the resource.

func (*CompositeMaterials) Len

func (r *CompositeMaterials) Len() int

Len returns the materials count.

func (*CompositeMaterials) Marshal3MF

func (r *CompositeMaterials) Marshal3MF(x spec.Encoder) error

Marshal3MF encodes the resource.

type Multi

type Multi struct {
	PIndices []uint32
}

The Multi element combines the constituent materials and properties.

type MultiProperties

type MultiProperties struct {
	ID           uint32
	PIDs         []uint32
	BlendMethods []BlendMethod
	Multis       []Multi
}

A MultiProperties element acts as a container for Multi elements which are indexable groups of property indices.

func (*MultiProperties) Identify

func (c *MultiProperties) Identify() uint32

Identify returns the unique ID of the resource.

func (*MultiProperties) Len

func (r *MultiProperties) Len() int

Len returns the materials count.

func (*MultiProperties) Marshal3MF

func (r *MultiProperties) Marshal3MF(x spec.Encoder) error

Marshal3MF encodes the resource.

type Spec

type Spec struct{}

func (Spec) CreateElementDecoder

func (Spec) CreateElementDecoder(parent interface{}, name string) (child spec.ElementDecoder)

func (Spec) DecodeAttribute

func (Spec) DecodeAttribute(interface{}, spec.Attr) error

func (Spec) Validate

func (Spec) Validate(model interface{}, path string, asset interface{}) error

type Texture2D

type Texture2D struct {
	ID          uint32
	Path        string
	ContentType Texture2DType
	TileStyleU  TileStyle
	TileStyleV  TileStyle
	Filter      TextureFilter
}

Texture2D defines the Model Texture 2D.

func (*Texture2D) Identify

func (t *Texture2D) Identify() uint32

Identify returns the unique ID of the resource.

func (*Texture2D) Marshal3MF

func (r *Texture2D) Marshal3MF(x spec.Encoder) error

Marshal3MF encodes the resource.

type Texture2DGroup

type Texture2DGroup struct {
	ID        uint32
	TextureID uint32
	Coords    []TextureCoord
}

Texture2DGroup acts as a container for texture coordinate properties.

func (*Texture2DGroup) Identify

func (r *Texture2DGroup) Identify() uint32

Identify returns the unique ID of the resource.

func (*Texture2DGroup) Len

func (r *Texture2DGroup) Len() int

Len returns the materials count.

func (*Texture2DGroup) Marshal3MF

func (r *Texture2DGroup) Marshal3MF(x spec.Encoder) error

Marshal3MF encodes the resource.

type Texture2DType

type Texture2DType uint8

Texture2DType defines the allowed texture 2D types.

const (
	TextureTypePNG Texture2DType = iota + 1
	TextureTypeJPEG
)

Supported texture types.

func (Texture2DType) String

func (t Texture2DType) String() string

type TextureCoord

type TextureCoord [2]float32

TextureCoord map a vertex of a triangle to a position in image space (U, V coordinates)

func (TextureCoord) U

func (t TextureCoord) U() float32

U returns the first coordinate.

func (TextureCoord) V

func (t TextureCoord) V() float32

V returns the second coordinate.

type TextureFilter

type TextureFilter uint8

TextureFilter defines the allowed texture filters.

const (
	TextureFilterAuto TextureFilter = iota
	TextureFilterLinear
	TextureFilterNearest
)

Supported texture filters.

func (TextureFilter) String

func (t TextureFilter) String() string

type TileStyle

type TileStyle uint8

TileStyle defines the allowed tile styles.

const (
	TileWrap TileStyle = iota
	TileMirror
	TileClamp
	TileNone
)

Supported tile style.

func (TileStyle) String

func (t TileStyle) String() string

Jump to

Keyboard shortcuts

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