Documentation ¶
Index ¶
- Constants
- func BaseMaterialMarshal(wt io.Writer, mtl *BaseMaterial)
- func BuildGltf(doc *gltf.Document, mh *Mesh, exportOutline, gpu_instance bool) error
- func CompressImage(buf []byte) []byte
- func CreateDoc() *gltf.Document
- func DecompressImage(src []byte) ([]byte, error)
- func GetGltfBinary(doc *gltf.Document, paddingUnit int) ([]byte, error)
- func LambertMaterialMarshal(wt io.Writer, mtl *LambertMaterial)
- func LoadTexture(tex *Texture, flipY bool) (image.Image, error)
- func MaterialMarshal(wt io.Writer, mt MeshMaterial, v uint32)
- func MeshInstanceNodeMarshal(wt io.Writer, instNd *InstanceMesh, v uint32)
- func MeshInstanceNodesMarshal(wt io.Writer, instNd []*InstanceMesh, v uint32)
- func MeshMarshal(wt io.Writer, ms *Mesh)
- func MeshNodeMarshal(wt io.Writer, nd *MeshNode)
- func MeshNodesMarshal(wt io.Writer, nds []*MeshNode)
- func MeshOutlineMarshal(wt io.Writer, nd *MeshOutline)
- func MeshTriangleMarshal(wt io.Writer, nd *MeshTriangle)
- func MeshWriteTo(path string, ms *Mesh) error
- func MstToGltf(msts []*Mesh) (*gltf.Document, error)
- func MstToGltfWithOutline(msts []*Mesh) (*gltf.Document, error)
- func MtlsMarshal(wt io.Writer, mtls []MeshMaterial, v uint32)
- func PbrMaterialMarshal(wt io.Writer, mtl *PbrMaterial, v uint32)
- func PhongMaterialMarshal(wt io.Writer, mtl *PhongMaterial)
- func TextureMarshal(wt io.Writer, tex *Texture)
- func TextureMaterialMarshal(wt io.Writer, mtl *TextureMaterial)
- type BaseMaterial
- type BaseMesh
- type Face
- type InstanceMesh
- type LambertMaterial
- type Mesh
- type MeshMaterial
- type MeshNode
- type MeshOutline
- type MeshTriangle
- type PbrMaterial
- type PhongMaterial
- type Texture
- type TextureMaterial
Constants ¶
View Source
const ( MESH_TRIANGLE_MATERIAL_TYPE_COLOR = 0 MESH_TRIANGLE_MATERIAL_TYPE_TEXTURE = 1 MESH_TRIANGLE_MATERIAL_TYPE_PBR = 2 MESH_TRIANGLE_MATERIAL_TYPE_LAMBERT = 3 MESH_TRIANGLE_MATERIAL_TYPE_PHONG = 4 )
View Source
const ( PBR_MATERIAL_TYPE_LIT = 0 PBR_MATERIAL_TYPE_SUBSURFACE = 1 PBR_MATERIAL_TYPE_CLOTH = 2 )
View Source
const ( TEXTURE_PIXEL_TYPE_UBYTE = 0 TEXTURE_PIXEL_TYPE_BYTE = 1 TEXTURE_PIXEL_TYPE_USHORT = 2 TEXTURE_PIXEL_TYPE_SHORT = 3 TEXTURE_PIXEL_TYPE_UINT = 4 TEXTURE_PIXEL_TYPE_INT = 5 TEXTURE_PIXEL_TYPE_HALF = 6 TEXTURE_PIXEL_TYPE_FLOAT = 7 )
View Source
const ( TEXTURE_FORMAT_R = 0 TEXTURE_FORMAT_R_INTEGER = 1 TEXTURE_FORMAT_RG = 2 TEXTURE_FORMAT_RG_INTEGER = 3 TEXTURE_FORMAT_RGB = 4 TEXTURE_FORMAT_RGB_INTEGER = 5 TEXTURE_FORMAT_RGBA = 6 TEXTURE_FORMAT_RGBA_INTEGER = 7 TEXTURE_FORMAT_RGBM = 8 TEXTURE_FORMAT_DEPTH_COMPONENT = 9 TEXTURE_FORMAT_DEPTH_STENCIL = 10 TEXTURE_FORMAT_ALPHA = 11 )
View Source
const GLTF_VERSION = "2.0"
View Source
const MESH_SIGNATURE string = "fwtm"
View Source
const MSTEXT string = ".mst"
View Source
const (
TEXTURE_COMPRESSED_ZLIB = 1
)
View Source
const V1 uint32 = 1
View Source
const V2 uint32 = 2
View Source
const V3 uint32 = 3
View Source
const V4 uint32 = 4
Variables ¶
This section is empty.
Functions ¶
func BaseMaterialMarshal ¶
func BaseMaterialMarshal(wt io.Writer, mtl *BaseMaterial)
func CompressImage ¶
func DecompressImage ¶
func LambertMaterialMarshal ¶
func LambertMaterialMarshal(wt io.Writer, mtl *LambertMaterial)
func MaterialMarshal ¶
func MaterialMarshal(wt io.Writer, mt MeshMaterial, v uint32)
func MeshInstanceNodeMarshal ¶
func MeshInstanceNodeMarshal(wt io.Writer, instNd *InstanceMesh, v uint32)
func MeshInstanceNodesMarshal ¶
func MeshInstanceNodesMarshal(wt io.Writer, instNd []*InstanceMesh, v uint32)
func MeshMarshal ¶
func MeshNodeMarshal ¶
func MeshNodesMarshal ¶
func MeshOutlineMarshal ¶
func MeshOutlineMarshal(wt io.Writer, nd *MeshOutline)
func MeshTriangleMarshal ¶
func MeshTriangleMarshal(wt io.Writer, nd *MeshTriangle)
func MeshWriteTo ¶
func MtlsMarshal ¶
func MtlsMarshal(wt io.Writer, mtls []MeshMaterial, v uint32)
func PbrMaterialMarshal ¶
func PbrMaterialMarshal(wt io.Writer, mtl *PbrMaterial, v uint32)
func PhongMaterialMarshal ¶
func PhongMaterialMarshal(wt io.Writer, mtl *PhongMaterial)
func TextureMarshal ¶
func TextureMaterialMarshal ¶
func TextureMaterialMarshal(wt io.Writer, mtl *TextureMaterial)
Types ¶
type BaseMaterial ¶
type BaseMaterial struct { Color [3]byte `json:"color"` Transparency float32 `json:"transparency"` }
func BaseMaterialUnMarshal ¶
func BaseMaterialUnMarshal(rd io.Reader) *BaseMaterial
func (*BaseMaterial) GetColor ¶
func (m *BaseMaterial) GetColor() [3]byte
func (*BaseMaterial) GetEmissive ¶
func (m *BaseMaterial) GetEmissive() [3]byte
func (*BaseMaterial) GetTexture ¶
func (m *BaseMaterial) GetTexture() *Texture
func (*BaseMaterial) HasTexture ¶
func (m *BaseMaterial) HasTexture() bool
type BaseMesh ¶
type BaseMesh struct { Materials []MeshMaterial `json:"materials,omitempty"` Nodes []*MeshNode `json:"nodes,omitempty"` Code uint32 `json:"code,omitempty"` }
type InstanceMesh ¶
type InstanceMesh struct { Transfors []*dmat.T Features []uint64 BBox *[6]float64 Mesh *BaseMesh Hash uint64 }
func MeshInstanceNodeUnMarshal ¶
func MeshInstanceNodeUnMarshal(rd io.Reader, v uint32) *InstanceMesh
func MeshInstanceNodesUnMarshal ¶
func MeshInstanceNodesUnMarshal(rd io.Reader, v uint32) []*InstanceMesh
type LambertMaterial ¶
type LambertMaterial struct { TextureMaterial Ambient [3]byte `json:"ambient"` Diffuse [3]byte `json:"diffuse"` Emissive [3]byte `json:"emissive"` }
func LambertMaterialUnMarshal ¶
func LambertMaterialUnMarshal(rd io.Reader) *LambertMaterial
func (*LambertMaterial) GetEmissive ¶
func (m *LambertMaterial) GetEmissive() [3]byte
type Mesh ¶
type Mesh struct { BaseMesh Version uint32 `json:"version"` InstanceNode []*InstanceMesh }
func MeshReadFrom ¶
func MeshUnMarshal ¶
func (*Mesh) ComputeBBox ¶
func (*Mesh) MaterialCount ¶
type MeshMaterial ¶
type MeshMaterial interface { HasTexture() bool GetTexture() *Texture GetColor() [3]byte GetEmissive() [3]byte }
func MaterialUnMarshal ¶
func MaterialUnMarshal(rd io.Reader, v uint32) MeshMaterial
func MtlsUnMarshal ¶
func MtlsUnMarshal(rd io.Reader, v uint32) []MeshMaterial
type MeshNode ¶
type MeshNode struct { Vertices []vec3.T `json:"vertices"` Normals []vec3.T `json:"normals,omitempty"` Colors [][3]byte `json:"colors,omitempty"` TexCoords []vec2.T `json:"texCoords,omitempty"` Mat *dmat.T `json:"mat,omitempty"` FaceGroup []*MeshTriangle `json:"faceGroup,omitempty"` EdgeGroup []*MeshOutline `json:"edgeGroup,omitempty"` }
func MeshNodeUnMarshal ¶
func MeshNodesUnMarshal ¶
func (*MeshNode) GetBoundbox ¶
func (*MeshNode) ReComputeNormal ¶
func (n *MeshNode) ReComputeNormal()
func (*MeshNode) ResortVtVn ¶
type MeshOutline ¶
func MeshOutlineUnMarshal ¶
func MeshOutlineUnMarshal(rd io.Reader) *MeshOutline
type MeshTriangle ¶
func MeshTriangleUnMarshal ¶
func MeshTriangleUnMarshal(rd io.Reader) *MeshTriangle
type PbrMaterial ¶
type PbrMaterial struct { TextureMaterial Emissive [3]byte `json:"emissive"` Metallic float32 `json:"metallic"` Roughness float32 `json:"roughness"` Reflectance float32 `json:"reflectance"` AmbientOcclusion float32 `json:"ambientOcclusion"` ClearCoat float32 `json:"clearCoat"` ClearCoatRoughness float32 `json:"clearCoatRoughness"` ClearCoatNormal [3]byte `json:"clearCoatNormal"` Anisotropy float32 `json:"anisotropy"` AnisotropyDirection vec3.T `json:"anisotropyDirection"` Thickness float32 `json:"thickness"` // subsurface only SubSurfacePower float32 `json:"subSurfacePower"` // subsurface only SheenColor [3]byte `json:"sheenColor"` // cloth only SubSurfaceColor [3]byte `json:"subSurfaceColor"` // subsurface or cloth }
func PbrMaterialUnMarshal ¶
func PbrMaterialUnMarshal(rd io.Reader, v uint32) *PbrMaterial
func (*PbrMaterial) GetEmissive ¶
func (m *PbrMaterial) GetEmissive() [3]byte
type PhongMaterial ¶
type PhongMaterial struct { LambertMaterial Specular [3]byte `json:"specular"` Shininess float64 `json:"shininess"` Specularity float64 `json:"specularity"` }
func PhongMaterialUnMarshal ¶
func PhongMaterialUnMarshal(rd io.Reader) *PhongMaterial
type Texture ¶
type Texture struct { Id int `json:"id"` Name string `json:"name"` Size [2]uint64 `json:"size"` Format uint16 `json:"format"` Type uint16 `json:"type"` Compressed uint16 `json:"compressed"` Data []byte `json:"-"` Repeated bool `json:"repeated"` }
func TextureUnMarshal ¶
type TextureMaterial ¶
type TextureMaterial struct { BaseMaterial Texture *Texture `json:"texture,omitempty"` Normal *Texture `json:"normal,omitempty"` }
func TextureMaterialUnMarshal ¶
func TextureMaterialUnMarshal(rd io.Reader) *TextureMaterial
func (*TextureMaterial) GetNormalTexture ¶
func (m *TextureMaterial) GetNormalTexture() *Texture
func (*TextureMaterial) GetTexture ¶
func (m *TextureMaterial) GetTexture() *Texture
func (*TextureMaterial) HasNormalTexture ¶
func (m *TextureMaterial) HasNormalTexture() bool
func (*TextureMaterial) HasTexture ¶
func (m *TextureMaterial) HasTexture() bool
Click to show internal directories.
Click to hide internal directories.