Documentation
¶
Index ¶
- Constants
- Variables
- func Parser() *parser
- func ThrowAllCache(gltf *GLTF)
- type Accessor
- func (s *Accessor) GetExtension() *Extensions
- func (s *Accessor) MustSliceMapping(out_ptrslice interface{}, typeSafety, componentSafety bool) interface{}
- func (s *Accessor) RawMap() ([]byte, error)
- func (s *Accessor) SetExtension(extensions *Extensions)
- func (s *Accessor) SliceMapping(out_ptrslice interface{}, typeSafety, componentSafety bool) (interface{}, error)
- type AccessorSparse
- type AccessorSparseIndices
- type AccessorSparseValues
- type AccessorType
- type AlphaMode
- type Animation
- type AnimationChannel
- type AnimationChannelTarget
- type AnimationSampler
- type Asset
- type AttributeKey
- type Buffer
- type BufferImage
- func (s *BufferImage) Cache() *image.RGBA
- func (s *BufferImage) Extensions() *Extensions
- func (s *BufferImage) Extras() *Extras
- func (s *BufferImage) GetExtension() *Extensions
- func (s *BufferImage) IsCached() bool
- func (s *BufferImage) Load(useCache bool) (img *image.RGBA, err error)
- func (s *BufferImage) Name() string
- func (s *BufferImage) SetExtension(extensions *Extensions)
- func (s *BufferImage) SetUserData(data interface{})
- func (s *BufferImage) ThrowCache()
- func (s *BufferImage) UserData() interface{}
- type BufferType
- type BufferView
- type Camera
- type CameraSetting
- type CameraType
- type ComponentType
- type ExtensionSpecifier
- type ExtensionStructure
- type ExtensionType
- type Extensions
- type Extras
- type GLDefine
- type GLTF
- type Image
- type IndexTexCoord
- type Interpolation
- type KHRDracoMeshCompression
- type KHRMaterialsPBRSpecularGlossiness
- type Linker
- type MagFilter
- type Material
- type MaterialNormalTextureInfo
- type MaterialOcclusionTextureInfo
- type MaterialPBRMetallicRoughness
- type Mesh
- type MeshPrimitive
- type MimeType
- type MinFilter
- type Mode
- type Node
- type OrthographicCamera
- func (s *OrthographicCamera) CameraType() CameraType
- func (s *OrthographicCamera) GetExtension() *Extensions
- func (s *OrthographicCamera) SetExtension(extensions *Extensions)
- func (s *OrthographicCamera) SetUserData(data interface{})
- func (s *OrthographicCamera) UserData() interface{}
- func (s *OrthographicCamera) View(monitorSize image.Point) mgl32.Mat4
- type Parents
- type Path
- type PerspectiveCamera
- func (s *PerspectiveCamera) CameraType() CameraType
- func (s *PerspectiveCamera) GetExtension() *Extensions
- func (s *PerspectiveCamera) SetExtension(extensions *Extensions)
- func (s *PerspectiveCamera) SetUserData(data interface{})
- func (s *PerspectiveCamera) UserData() interface{}
- func (s *PerspectiveCamera) View(monitorSize image.Point) mgl32.Mat4
- type PostTask
- type PreTask
- type Sampler
- type Scene
- type Skin
- type SpecAccessor
- func (s *SpecAccessor) Link(Root *GLTF, parent interface{}, dst interface{}) error
- func (s *SpecAccessor) Scheme() string
- func (s *SpecAccessor) SpecExtension() *SpecExtensions
- func (s *SpecAccessor) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecAccessor) To(ctx *parserContext) interface{}
- type SpecAnimation
- func (s *SpecAnimation) GetChild(i int) Specifier
- func (s *SpecAnimation) ImpleGetChild(i int, dst interface{}) interface{}
- func (s *SpecAnimation) LenChild() int
- func (s *SpecAnimation) Scheme() string
- func (s *SpecAnimation) SetChild(i int, dst, object interface{})
- func (s *SpecAnimation) SpecExtension() *SpecExtensions
- func (s *SpecAnimation) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecAnimation) To(ctx *parserContext) interface{}
- type SpecAnimationChannel
- func (s *SpecAnimationChannel) GetChild(i int) Specifier
- func (s *SpecAnimationChannel) ImpleGetChild(i int, dst interface{}) interface{}
- func (s *SpecAnimationChannel) LenChild() int
- func (s *SpecAnimationChannel) Link(Root *GLTF, parent interface{}, dst interface{}) error
- func (s *SpecAnimationChannel) Scheme() string
- func (s *SpecAnimationChannel) SetChild(i int, dst, object interface{})
- func (s *SpecAnimationChannel) SpecExtension() *SpecExtensions
- func (s *SpecAnimationChannel) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecAnimationChannel) To(ctx *parserContext) interface{}
- type SpecAnimationChannelTarget
- func (s *SpecAnimationChannelTarget) Link(Root *GLTF, parent interface{}, dst interface{}) error
- func (s *SpecAnimationChannelTarget) Scheme() string
- func (s *SpecAnimationChannelTarget) SpecExtension() *SpecExtensions
- func (s *SpecAnimationChannelTarget) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecAnimationChannelTarget) To(ctx *parserContext) interface{}
- type SpecAnimationSampler
- func (s *SpecAnimationSampler) Link(Root *GLTF, parent interface{}, dst interface{}) error
- func (s *SpecAnimationSampler) Scheme() string
- func (s *SpecAnimationSampler) SpecExtension() *SpecExtensions
- func (s *SpecAnimationSampler) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecAnimationSampler) To(ctx *parserContext) interface{}
- type SpecAsset
- type SpecBuffer
- type SpecBufferView
- func (s *SpecBufferView) Link(Root *GLTF, parent interface{}, dst interface{}) error
- func (s *SpecBufferView) Scheme() string
- func (s *SpecBufferView) SpecExtension() *SpecExtensions
- func (s *SpecBufferView) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecBufferView) To(ctx *parserContext) interface{}
- type SpecCamera
- func (s *SpecCamera) GetChild(i int) Specifier
- func (s *SpecCamera) ImpleGetChild(i int, dst interface{}) interface{}
- func (s *SpecCamera) LenChild() int
- func (s *SpecCamera) Scheme() string
- func (s *SpecCamera) SetChild(i int, dst, object interface{})
- func (s *SpecCamera) SpecExtension() *SpecExtensions
- func (s *SpecCamera) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecCamera) To(ctx *parserContext) interface{}
- type SpecCameraOrthographic
- type SpecCameraPerspective
- type SpecExtensions
- type SpecGLTF
- func (s *SpecGLTF) GetChild(i int) Specifier
- func (s *SpecGLTF) ImpleGetChild(i int, dst interface{}) interface{}
- func (s *SpecGLTF) LenChild() int
- func (s *SpecGLTF) Link(Root *GLTF, parent interface{}, dst interface{}) error
- func (s *SpecGLTF) Scheme() string
- func (s *SpecGLTF) SetChild(i int, dst, object interface{})
- func (s *SpecGLTF) SpecExtension() *SpecExtensions
- func (s *SpecGLTF) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecGLTF) To(ctx *parserContext) interface{}
- type SpecGLTFID
- type SpecImage
- func (s *SpecImage) Link(Root *GLTF, parent interface{}, dst interface{}) error
- func (s *SpecImage) Scheme() string
- func (s *SpecImage) SpecExtension() *SpecExtensions
- func (s *SpecImage) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecImage) To(ctx *parserContext) interface{}
- type SpecKHRDracoMeshCompression
- func (s *SpecKHRDracoMeshCompression) Link(Root *GLTF, parent interface{}, dst interface{}) error
- func (s *SpecKHRDracoMeshCompression) Scheme() string
- func (s *SpecKHRDracoMeshCompression) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecKHRDracoMeshCompression) To(ctx *parserContext) interface{}
- type SpecKHRMaterialsPBRSpecularGlossiness
- func (s *SpecKHRMaterialsPBRSpecularGlossiness) Children() (res []Specifier)
- func (s *SpecKHRMaterialsPBRSpecularGlossiness) GetChild(i int) Specifier
- func (s *SpecKHRMaterialsPBRSpecularGlossiness) ImpleGetChild(i int, dst interface{}) interface{}
- func (s *SpecKHRMaterialsPBRSpecularGlossiness) LenChild() int
- func (s *SpecKHRMaterialsPBRSpecularGlossiness) Scheme() string
- func (s *SpecKHRMaterialsPBRSpecularGlossiness) SetChild(i int, dst, object interface{})
- func (s *SpecKHRMaterialsPBRSpecularGlossiness) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecKHRMaterialsPBRSpecularGlossiness) To(ctx *parserContext) interface{}
- type SpecMaterial
- func (s *SpecMaterial) Children() (res []Specifier)
- func (s *SpecMaterial) GetChild(i int) Specifier
- func (s *SpecMaterial) ImpleGetChild(i int, dst interface{}) interface{}
- func (s *SpecMaterial) LenChild() int
- func (s *SpecMaterial) Scheme() string
- func (s *SpecMaterial) SetChild(i int, dst, object interface{})
- func (s *SpecMaterial) SpecExtension() *SpecExtensions
- func (s *SpecMaterial) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecMaterial) To(ctx *parserContext) interface{}
- type SpecMaterialNormalTextureInfo
- func (s *SpecMaterialNormalTextureInfo) Link(Root *GLTF, parent interface{}, dst interface{}) error
- func (s *SpecMaterialNormalTextureInfo) Scheme() string
- func (s *SpecMaterialNormalTextureInfo) SpecExtension() *SpecExtensions
- func (s *SpecMaterialNormalTextureInfo) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecMaterialNormalTextureInfo) To(ctx *parserContext) interface{}
- type SpecMaterialOcclusionTextureInfo
- func (s *SpecMaterialOcclusionTextureInfo) Link(Root *GLTF, parent interface{}, dst interface{}) error
- func (s *SpecMaterialOcclusionTextureInfo) Scheme() string
- func (s *SpecMaterialOcclusionTextureInfo) SpecExtension() *SpecExtensions
- func (s *SpecMaterialOcclusionTextureInfo) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecMaterialOcclusionTextureInfo) To(ctx *parserContext) interface{}
- type SpecMaterialPBRMetallicRoughness
- func (s *SpecMaterialPBRMetallicRoughness) Children() []Specifier
- func (s *SpecMaterialPBRMetallicRoughness) GetChild(i int) Specifier
- func (s *SpecMaterialPBRMetallicRoughness) ImpleGetChild(i int, dst interface{}) interface{}
- func (s *SpecMaterialPBRMetallicRoughness) LenChild() int
- func (s *SpecMaterialPBRMetallicRoughness) Scheme() string
- func (s *SpecMaterialPBRMetallicRoughness) SetChild(i int, dst, object interface{})
- func (s *SpecMaterialPBRMetallicRoughness) SpecExtension() *SpecExtensions
- func (s *SpecMaterialPBRMetallicRoughness) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecMaterialPBRMetallicRoughness) To(ctx *parserContext) interface{}
- type SpecMesh
- func (s *SpecMesh) GetChild(i int) Specifier
- func (s *SpecMesh) ImpleGetChild(i int, dst interface{}) interface{}
- func (s *SpecMesh) LenChild() int
- func (s *SpecMesh) Scheme() string
- func (s *SpecMesh) SetChild(i int, dst, object interface{})
- func (s *SpecMesh) SpecExtension() *SpecExtensions
- func (s *SpecMesh) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecMesh) To(ctx *parserContext) interface{}
- type SpecMeshPrimitive
- func (s *SpecMeshPrimitive) Link(Root *GLTF, parent interface{}, dst interface{}) error
- func (s *SpecMeshPrimitive) Scheme() string
- func (s *SpecMeshPrimitive) SpecExtension() *SpecExtensions
- func (s *SpecMeshPrimitive) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecMeshPrimitive) To(ctx *parserContext) interface{}
- type SpecNode
- func (s *SpecNode) Link(Root *GLTF, parent interface{}, dst interface{}) error
- func (s *SpecNode) Scheme() string
- func (s *SpecNode) SpecExtension() *SpecExtensions
- func (s *SpecNode) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecNode) To(ctx *parserContext) interface{}
- type SpecSampler
- type SpecScene
- func (s *SpecScene) Link(Root *GLTF, parent interface{}, dst interface{}) error
- func (s *SpecScene) Scheme() string
- func (s *SpecScene) SpecExtension() *SpecExtensions
- func (s *SpecScene) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecScene) To(ctx *parserContext) interface{}
- type SpecSkin
- func (s *SpecSkin) Link(Root *GLTF, parent interface{}, dst interface{}) error
- func (s *SpecSkin) Scheme() string
- func (s *SpecSkin) SpecExtension() *SpecExtensions
- func (s *SpecSkin) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecSkin) To(ctx *parserContext) interface{}
- type SpecTexture
- func (s *SpecTexture) Link(Root *GLTF, parent interface{}, dst interface{}) error
- func (s *SpecTexture) Scheme() string
- func (s *SpecTexture) SpecExtension() *SpecExtensions
- func (s *SpecTexture) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecTexture) To(ctx *parserContext) interface{}
- type SpecTextureInfo
- func (s *SpecTextureInfo) Link(Root *GLTF, parent interface{}, dst interface{}) error
- func (s *SpecTextureInfo) Scheme() string
- func (s *SpecTextureInfo) SpecExtension() *SpecExtensions
- func (s *SpecTextureInfo) Syntax(strictness Strictness, root Specifier, parent Specifier) error
- func (s *SpecTextureInfo) To(ctx *parserContext) interface{}
- type Specifier
- type Strictness
- type Task
- type Texture
- type TextureInfo
- type URI
- type URIImage
- func (s *URIImage) Cache() *image.RGBA
- func (s *URIImage) Extensions() *Extensions
- func (s *URIImage) Extras() *Extras
- func (s *URIImage) GetExtension() *Extensions
- func (s *URIImage) IsCached() bool
- func (s *URIImage) Load(useCache bool) (img *image.RGBA, err error)
- func (s *URIImage) Name() string
- func (s *URIImage) SetExtension(extensions *Extensions)
- func (s *URIImage) SetUserData(data interface{})
- func (s *URIImage) ThrowCache()
- func (s *URIImage) UserData() interface{}
- type Wrap
Constants ¶
const ( SCHEME_GLTF = "glTF" SCHEME_BUFFER = "buffer" SCHEME_BUFFERVIEW = "bufferView" SCHEME_ACCESSOR = "accessor" SCHEME_ASSET = "asset" SCHEME_CAMERA = "camera" SCHEME_CAMERA_PERSPECTIVE = "camera/perspective" SCHEME_CAMERA_ORTHOGRAPHIC = "camera/orthographic" SCHEME_IMAGE = "image" SCHEME_SAMPLER = "sampler" SCHEME_TEXTURE = "texture" SCHEME_TEXTURE_INFO = "texture/info" SCHEME_MATERIAL = "material" SCHEME_MATERIAL_PBR_METALLIC_ROUGHNESS = "material/pbrMetallicRoughness" SCHEME_MATERIAL_OCCLUSION_TEXTUREINFO = "material/occlusionTextureInfo" SCHEME_MATERIAL_NORMAL_TEXTUREINFO = "material/normalTextureInfo" SCHEME_MESH = "mesh" SCHEME_MESH_PRIMITIVE = "mesh/primitive" SCHEME_NODE = "node" SCHEME_SCENE = "scene" SCHEME_ANIMATION = "animation" SCHEME_ANIMATION_SAMPLER = "animation/sampler" SCHEME_ANIMATION_CHANNEL = "animation/channel" SCHEME_ANIMATION_CHANNEL_TARGET = "animation/channel/target" SCHEME_EXTENSION = "extension" SCHEME_SKIN = "skin" )
Variables ¶
var ( ErrorJSON = errors.New("Json parsing fail") ErrorEnum = errors.New("Enum parsing fail") ErrorGLTFSpec = errors.New("Specifier fail") ErrorGLTFLink = errors.New("glTFid link not found") ErrorTask = errors.New("Task fail") ErrorParser = errors.New("Parser error") ErrorExtension = errors.New("ExtensionKey error") ErrorParserOption = errors.New("Parser option error") )
var Tasks = struct { HelloWorld Task ByeWorld Task // Buffer upload to memory(RAM) BufferCaching Task // Image upload to memory(RAM) ImageCaching Task // BufferCaching + ImageCaching // If there is Caching, you don't need to call BufferCaching or ImageCaching Caching Task AccessorMinMax Task ModelAlign func(x, y, z align.Align) Task ModelScale func(axis axis.Axis, meter meter.Meter) Task // Set bufferView.Target NEED_TO_DEFINE_BUFFER to real gl.h enum AutoBufferTarget Task // make accessor no stride TightPacking Task }{ HelloWorld: FnPreTask("Hello, World", func(parser *parserContext, gltf *SpecGLTF, logger *glog.Glogger) { logger.Println("Hello, World") }), ByeWorld: FnPostTask("Bye, World", func(parser *parserContext, gltf *GLTF, logger *glog.Glogger) error { logger.Println("Bye, World") return nil }), BufferCaching: FnPostTask("Buffer Caching", _BufferCaching), ImageCaching: FnPostTask("Image Caching", _ImageCaching), Caching: FnPostTask("Caching", func(parser *parserContext, gltf *GLTF, logger *glog.Glogger) error { if err := _BufferCaching(parser, gltf, logger); err != nil { return err } if err := _ImageCaching(parser, gltf, logger); err != nil { return err } return nil }), AccessorMinMax: FnPostTask("Accessor Min Max", func(parser *parserContext, gltf *GLTF, logger *glog.Glogger) error { for i, accessor := range gltf.Accessors { if len(accessor.Min) > 0 && len(accessor.Max) > 0 { continue } if accessor.BufferView == nil { continue } var ( min = make([]float32, accessor.Type.Count()) max = make([]float32, accessor.Type.Count()) ) switch accessor.ComponentType { case BYTE: var ( tempmin = make([]int8, accessor.Type.Count()) tempmax = make([]int8, accessor.Type.Count()) ) slice := accessor.MustSliceMapping(new([]int8), false, true).([]int8) for i := 0; i < len(slice); i += accessor.Type.Count() { for j := 0; j < accessor.Type.Count(); j++ { if slice[i+j] < tempmin[j] { tempmin[j] = slice[i+j] } if slice[i+j] > tempmax[j] { tempmax[j] = slice[i+j] } } } for i, v := range tempmin { min[i] = float32(v) } for i, v := range tempmax { max[i] = float32(v) } case UNSIGNED_BYTE: var ( tempmin = make([]uint8, accessor.Type.Count()) tempmax = make([]uint8, accessor.Type.Count()) ) slice := accessor.MustSliceMapping(new([]uint8), false, true).([]uint8) for i := 0; i < len(slice); i += accessor.Type.Count() { for j := 0; j < accessor.Type.Count(); j++ { if slice[i+j] < tempmin[j] { tempmin[j] = slice[i+j] } if slice[i+j] > tempmax[j] { tempmax[j] = slice[i+j] } } } for i, v := range tempmin { min[i] = float32(v) } for i, v := range tempmax { max[i] = float32(v) } case SHORT: var ( tempmin = make([]int16, accessor.Type.Count()) tempmax = make([]int16, accessor.Type.Count()) ) slice := accessor.MustSliceMapping(new([]int16), false, true).([]int16) for i := 0; i < len(slice); i += accessor.Type.Count() { for j := 0; j < accessor.Type.Count(); j++ { if slice[i+j] < tempmin[j] { tempmin[j] = slice[i+j] } if slice[i+j] > tempmax[j] { tempmax[j] = slice[i+j] } } } for i, v := range tempmin { min[i] = float32(v) } for i, v := range tempmax { max[i] = float32(v) } case UNSIGNED_SHORT: var ( tempmin = make([]uint16, accessor.Type.Count()) tempmax = make([]uint16, accessor.Type.Count()) ) slice := accessor.MustSliceMapping(new([]uint16), false, true).([]uint16) for i := 0; i < len(slice); i += accessor.Type.Count() { for j := 0; j < accessor.Type.Count(); j++ { if slice[i+j] < tempmin[j] { tempmin[j] = slice[i+j] } if slice[i+j] > tempmax[j] { tempmax[j] = slice[i+j] } } } for i, v := range tempmin { min[i] = float32(v) } for i, v := range tempmax { max[i] = float32(v) } case UNSIGNED_INT: var ( tempmin = make([]uint32, accessor.Type.Count()) tempmax = make([]uint32, accessor.Type.Count()) ) slice := accessor.MustSliceMapping(new([]uint32), false, true).([]uint32) for i := 0; i < len(slice); i += accessor.Type.Count() { for j := 0; j < accessor.Type.Count(); j++ { if slice[i+j] < tempmin[j] { tempmin[j] = slice[i+j] } if slice[i+j] > tempmax[j] { tempmax[j] = slice[i+j] } } } for i, v := range tempmin { min[i] = float32(v) } for i, v := range tempmax { max[i] = float32(v) } case FLOAT: slice := accessor.MustSliceMapping(new([]float32), false, true).([]float32) for i := 0; i < len(slice); i += accessor.Type.Count() { for j := 0; j < accessor.Type.Count(); j++ { if slice[i+j] < min[j] { min[j] = slice[i+j] } if slice[i+j] > max[j] { max[j] = slice[i+j] } } } default: logger.Panic("Unreachable") } if len(accessor.Name) > 0 { logger.Printf("glTF.Accessors['%s'] ", accessor.Name) } else { logger.Printf("glTF.Accessors[%d] ", i) } inner := logger.Indent() accessor.Min = min accessor.Max = max inner.Printf("Min : %v", min) inner.Printf("Max : %v", max) } return nil }), TightPacking: FnPostTask("TightPacking", func(parser *parserContext, gltf *GLTF, logger *glog.Glogger) error { for i := 0; i < len(gltf.Accessors); i++ { a := gltf.Accessors[i] _, err := a.BufferView.Buffer.Modify() if err != nil { return err } for j := i + 1; j < len(gltf.Accessors); j++ { b := gltf.Accessors[j] if a.BufferView == b.BufferView { return errors.Errorf("Overlap") } if a.BufferView.Buffer == b.BufferView.Buffer { af := a.BufferView.ByteOffset at := a.BufferView.ByteOffset + a.BufferView.ByteLength bf := b.BufferView.ByteOffset bt := b.BufferView.ByteOffset + b.BufferView.ByteLength if af >= bf { if bt-af <= 0 { return errors.Errorf("Overlap") } } else { if at-bf <= 0 { return errors.Errorf("Overlap") } } } } } for i, v := range gltf.Accessors { if v.BufferView.ByteStride != 0 { if len(v.Name) > 0 { logger.Println("gltf.Accessor['%s']", v.Name) } else { logger.Println("gltf.Accessor[%d]", i) } inner := logger.Indent() var lineDataCount int var lineLength = v.Count switch v.Type { case SCALAR: lineDataCount = 1 case VEC2: lineDataCount = 2 case VEC3: lineDataCount = 3 case VEC4: lineDataCount = 4 case MAT2: lineDataCount = 2 lineLength *= 2 case MAT3: lineDataCount = 3 lineLength *= 3 case MAT4: lineDataCount = 4 lineLength *= 4 } var ( tightBlockSize = lineDataCount * v.ComponentType.Size() leftBlockSize = tightBlockSize % v.BufferView.ByteStride blockSize = tightBlockSize + leftBlockSize ) inner.Printf("Block[%d/%d/%d]", tightBlockSize, leftBlockSize, blockSize) if leftBlockSize == 0 { inner.Println("No need to packing") v.BufferView.ByteStride = 0 } else { var wrtOffset = v.BufferView.ByteOffset + v.ByteOffset var rdOffset = v.BufferView.ByteOffset + v.ByteOffset for i := 0; i < lineLength; i++ { copy(v.BufferView.Buffer.cache[wrtOffset:], v.BufferView.Buffer.cache[rdOffset:rdOffset+tightBlockSize]) wrtOffset += tightBlockSize rdOffset += blockSize } v.BufferView.ByteStride = 0 v.BufferView.ByteLength = wrtOffset - v.ByteOffset inner.Println("Packing complete") } } } return nil }), ModelAlign: func(x align.Align, y align.Align, z align.Align) Task { return &modelAlign{x: x, y: y, z: z} }, ModelScale: func(axis axis.Axis, meter meter.Meter) Task { return &modelScale{ len: meter, axis: axis, } }, AutoBufferTarget: FnPreTask("Auto Buffer Target", func(parser *parserContext, gltf *SpecGLTF, logger *glog.Glogger) { for _, mesh := range gltf.Meshes { for _, prim := range mesh.Primitives { if prim.Indices != nil && inRange(*prim.Indices, len(gltf.Accessors)) { bvi := gltf.Accessors[*prim.Indices].BufferView if bvi != nil && inRange(*bvi, len(gltf.BufferViews)) { bv := &gltf.BufferViews[*bvi] if bv.Target != nil && *bv.Target == ELEMENT_ARRAY_BUFFER { if bv.Name != nil { logger.Printf("gltf.BufferView['%s'] Already setup : EBO", *bv.Name) } else { logger.Printf("gltf.BufferView[%d] Already setup : EBO", *bvi) } } else { if bv.Target == nil { bv.Target = new(BufferType) *bv.Target = ELEMENT_ARRAY_BUFFER if bv.Name != nil { logger.Printf("gltf.BufferView['%s'] Target : EBO", *bv.Name) } else { logger.Printf("gltf.BufferView[%d] Target : EBO", *bvi) } } else { logger.Printf("gltf.BufferView[%d] Expected EBO, but VBO detected", *bvi) } } } } } } for i := range gltf.BufferViews { if gltf.BufferViews[i].Target == nil { gltf.BufferViews[i].Target = new(BufferType) *gltf.BufferViews[i].Target = ARRAY_BUFFER if gltf.BufferViews[i].Name != nil { logger.Printf("gltf.BufferView['%s'] Target : VBO", *gltf.BufferViews[i].Name) } else { logger.Printf("gltf.BufferView[%d] Target : VBO", i) } } } }), }
Functions ¶
func ThrowAllCache ¶
func ThrowAllCache(gltf *GLTF)
Types ¶
type Accessor ¶
type Accessor struct {
BufferView *BufferView
ByteOffset int
Count int
Normalized bool
Type AccessorType
ComponentType ComponentType
Max []float32
Min []float32
// TODO : Sparse *AccessorSparse `json:"sparse,omitempty"`
Name string
Extensions *Extensions
Extras *Extras
// None spec
UserData interface{}
}
func (*Accessor) GetExtension ¶
func (s *Accessor) GetExtension() *Extensions
func (*Accessor) MustSliceMapping ¶
func (*Accessor) RawMap ¶
[ Unsafe ] : careful to use [ Reflect ] : using reflect, it can be cause performance issue
out_ptrslice : Pointer Slice Type for reading accessor typeSafety : typeSafety option, if enable, checking type safety by using reflect
ex) data, err := <Accessor>.SliceMapping(new([][3]float), true)
slice := data.([][3]float)
func (*Accessor) SetExtension ¶
func (s *Accessor) SetExtension(extensions *Extensions)
func (*Accessor) SliceMapping ¶
type AccessorSparse ¶
type AccessorSparse struct {
Count int `json:"count"` // required, minimum(0)
Indices AccessorSparseIndices `json:"indice"` // required
Values AccessorSparseValues `json:"values"` // required
}
func (*AccessorSparse) UnmarshalJSON ¶
func (s *AccessorSparse) UnmarshalJSON(data []byte) error
type AccessorSparseIndices ¶
type AccessorSparseIndices struct {
BufferView SpecGLTFID `json:"bufferView"` // required
ByteOffset int `json:"byteOffset,omitempty"` // default(0), minimum(0)
ComponentType ComponentType `json:"componentType"` // required
Extensions *Extensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*AccessorSparseIndices) UnmarshalJSON ¶
func (s *AccessorSparseIndices) UnmarshalJSON(data []byte) error
type AccessorSparseValues ¶
type AccessorSparseValues struct {
BufferView SpecGLTFID `json:"bufferView"` // required
ByteOffset *int `json:"byteOffset,omitempty"` // default(0), minimum(0)
Extensions *Extensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*AccessorSparseValues) UnmarshalJSON ¶
func (s *AccessorSparseValues) UnmarshalJSON(data []byte) error
type AccessorType ¶
type AccessorType uint8
const ( SCALAR AccessorType = iota VEC2 AccessorType = iota VEC3 AccessorType = iota VEC4 AccessorType = iota MAT2 AccessorType = iota MAT3 AccessorType = iota MAT4 AccessorType = iota )
func (AccessorType) Count ¶
func (s AccessorType) Count() int
func (*AccessorType) MarshalJSON ¶
func (s *AccessorType) MarshalJSON() ([]byte, error)
func (AccessorType) String ¶
func (s AccessorType) String() string
func (*AccessorType) UnmarshalJSON ¶
func (s *AccessorType) UnmarshalJSON(data []byte) error
type AlphaMode ¶
type AlphaMode uint8
func (*AlphaMode) MarshalJSON ¶
func (*AlphaMode) UnmarshalJSON ¶
type Animation ¶
type Animation struct {
Channels []*AnimationChannel `json:"channels"` // required, minItem(1)
Samplers []*AnimationSampler `json:"samplers"` // required, minItem(1)
Name string `json:"name,omitempty"`
Extensions *Extensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
// None spec
UserData interface{}
}
func (*Animation) GetExtension ¶
func (s *Animation) GetExtension() *Extensions
func (*Animation) SetExtension ¶
func (s *Animation) SetExtension(extensions *Extensions)
type AnimationChannel ¶
type AnimationChannel struct {
Sampler *AnimationSampler `json:"sampler"` // required
Target *AnimationChannelTarget `json:"target"` // required
Extensions *Extensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
// None spec
UserData interface{}
}
func (*AnimationChannel) GetExtension ¶
func (s *AnimationChannel) GetExtension() *Extensions
func (*AnimationChannel) SetExtension ¶
func (s *AnimationChannel) SetExtension(extensions *Extensions)
type AnimationChannelTarget ¶
type AnimationChannelTarget struct {
Node *Node
Path Path
Extensions *Extensions
Extras *Extras
}
func (*AnimationChannelTarget) GetExtension ¶
func (s *AnimationChannelTarget) GetExtension() *Extensions
func (*AnimationChannelTarget) SetExtension ¶
func (s *AnimationChannelTarget) SetExtension(extensions *Extensions)
type AnimationSampler ¶
type AnimationSampler struct {
Input *Accessor
Interpolation Interpolation
Output *Accessor
Extensions *Extensions
Extras *Extras
// None spec
UserData interface{}
}
func (*AnimationSampler) GetExtension ¶
func (s *AnimationSampler) GetExtension() *Extensions
func (*AnimationSampler) SetExtension ¶
func (s *AnimationSampler) SetExtension(extensions *Extensions)
type Asset ¶
type Asset struct {
Copyright string
Generator string
Version version.Version
MinVersion *version.Version
Extensions *Extensions
Extras *Extras
}
func (Asset) GetExtension ¶
func (s Asset) GetExtension() *Extensions
func (Asset) SetExtension ¶
func (s Asset) SetExtension(extensions *Extensions)
type AttributeKey ¶
type AttributeKey string
const ( POSITION AttributeKey = "POSITION" NORMAL AttributeKey = "NORMAL" TANGENT AttributeKey = "TANGENT" TEXCOORD_0 AttributeKey = "TEXCOORD_0" TEXCOORD_1 AttributeKey = "TEXCOORD_1" COLOR_0 AttributeKey = "COLOR_0" JOINTS_0 AttributeKey = "JOINTS_0" WEIGHTS_0 AttributeKey = "WEIGHTS_0" )
func (AttributeKey) IsCustom ¶
func (s AttributeKey) IsCustom() bool
type Buffer ¶
type Buffer struct {
//
URI *URI
// If it was nil, it automatically assume size
ByteLength *int
Name string
Extensions *Extensions
Extras *Extras
// None spec
UserData interface{}
// contains filtered or unexported fields
}
https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#buffers-and-buffer-views Implementation Note : Limit of ByteLength
func (*Buffer) GetExtension ¶
func (s *Buffer) GetExtension() *Extensions
func (*Buffer) SetExtension ¶
func (s *Buffer) SetExtension(extensions *Extensions)
func (*Buffer) ThrowCache ¶
func (s *Buffer) ThrowCache()
type BufferImage ¶
type BufferImage struct {
//
Mime MimeType
BufferView *BufferView
// contains filtered or unexported fields
}
func (*BufferImage) Cache ¶
func (s *BufferImage) Cache() *image.RGBA
func (*BufferImage) Extensions ¶
func (s *BufferImage) Extensions() *Extensions
func (*BufferImage) Extras ¶
func (s *BufferImage) Extras() *Extras
func (*BufferImage) GetExtension ¶
func (s *BufferImage) GetExtension() *Extensions
func (*BufferImage) IsCached ¶
func (s *BufferImage) IsCached() bool
func (*BufferImage) Name ¶
func (s *BufferImage) Name() string
func (*BufferImage) SetExtension ¶
func (s *BufferImage) SetExtension(extensions *Extensions)
func (*BufferImage) SetUserData ¶
func (s *BufferImage) SetUserData(data interface{})
func (*BufferImage) ThrowCache ¶
func (s *BufferImage) ThrowCache()
func (*BufferImage) UserData ¶
func (s *BufferImage) UserData() interface{}
type BufferType ¶
type BufferType int32
const ( // gl.h ARRAY_BUFFER BufferType = 34962 ELEMENT_ARRAY_BUFFER BufferType = 34963 // None gl.h NEED_TO_DEFINE_BUFFER BufferType = 0 )
func (BufferType) GL ¶
func (s BufferType) GL() int32
func (BufferType) String ¶
func (s BufferType) String() string
type BufferView ¶
type BufferView struct {
Buffer *Buffer // Linking
ByteOffset int // default 0
ByteLength int // must have
ByteStride int // default 0
Target BufferType
Name string
Extensions *Extensions
Extras *Extras
// None spec
UserData interface{}
}
https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#buffers-and-buffer-views Implementation Note : BufferView.Target determine BufferType
func (*BufferView) GetExtension ¶
func (s *BufferView) GetExtension() *Extensions
func (*BufferView) Load ¶
func (s *BufferView) Load() ([]byte, error)
func (*BufferView) LoadReader ¶
func (s *BufferView) LoadReader() (io.Reader, error)
func (*BufferView) SetExtension ¶
func (s *BufferView) SetExtension(extensions *Extensions)
type Camera ¶
type Camera struct {
Setting CameraSetting
Extensions *Extensions
Extras *Extras
}
https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/schema/camera.schema.json
func (*Camera) GetExtension ¶
func (s *Camera) GetExtension() *Extensions
func (*Camera) SetExtension ¶
func (s *Camera) SetExtension(extensions *Extensions)
type CameraSetting ¶
type CameraSetting interface {
CameraType() CameraType
View(monitorSize image.Point) mgl32.Mat4
UserData() interface{}
SetUserData(data interface{})
GetExtension() *Extensions
}
type CameraType ¶
type CameraType uint8
const ( Orthographic CameraType = iota Perspective CameraType = iota )
func (*CameraType) MarshalJSON ¶
func (s *CameraType) MarshalJSON() ([]byte, error)
func (CameraType) String ¶
func (s CameraType) String() string
func (*CameraType) UnmarshalJSON ¶
func (s *CameraType) UnmarshalJSON(data []byte) error
type ComponentType ¶
type ComponentType int32
const ( BYTE ComponentType = 5120 UNSIGNED_BYTE ComponentType = 5121 SHORT ComponentType = 5122 UNSIGNED_SHORT ComponentType = 5123 UNSIGNED_INT ComponentType = 5125 FLOAT ComponentType = 5126 )
gl.h
func (ComponentType) GL ¶
func (s ComponentType) GL() int32
func (ComponentType) Size ¶
func (s ComponentType) Size() int
func (ComponentType) String ¶
func (s ComponentType) String() string
type ExtensionSpecifier ¶
type ExtensionSpecifier interface {
SpecExtension() *SpecExtensions
}
type ExtensionStructure ¶
type ExtensionStructure interface {
SetExtension(extensions *Extensions)
GetExtension() *Extensions
}
type ExtensionType ¶
type Extensions ¶
type Extensions map[string]ExtensionType
func (*Extensions) Get ¶
func (s *Extensions) Get(extType ExtensionType) ExtensionType
func (*Extensions) GetByName ¶
func (s *Extensions) GetByName(name string) ExtensionType
type GLTF ¶
type GLTF struct {
ExtensionsUsed []string
ExtensionsRequired []string
Accessors []*Accessor
Asset Asset
Buffers []*Buffer
BufferViews []*BufferView
Cameras []*Camera
Images []Image
Materials []*Material
Meshes []*Mesh
Nodes []*Node
Samplers []*Sampler
Scene *Scene
Scenes []*Scene
Textures []*Texture
Animations []*Animation
Skins []*Skin
Extensions *Extensions
Extras *Extras
// None spec
UserData interface{}
}
https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/schema/glTF.schema.json
func (*GLTF) GetExtension ¶
func (s *GLTF) GetExtension() *Extensions
func (*GLTF) SetExtension ¶
func (s *GLTF) SetExtension(extensions *Extensions)
type IndexTexCoord ¶
type IndexTexCoord int32
const ( TexCoord0 IndexTexCoord = 0 TexCoord1 IndexTexCoord = 1 )
func (IndexTexCoord) String ¶
func (s IndexTexCoord) String() string
type Interpolation ¶
type Interpolation uint8
const ( LINEAR Interpolation = iota STEP Interpolation = iota CUBICSPLINE Interpolation = iota )
func (*Interpolation) MarshalJSON ¶
func (s *Interpolation) MarshalJSON() ([]byte, error)
func (Interpolation) String ¶
func (s Interpolation) String() string
func (*Interpolation) UnmarshalJSON ¶
func (s *Interpolation) UnmarshalJSON(data []byte) error
type KHRDracoMeshCompression ¶
type KHRDracoMeshCompression struct {
BufferView *BufferView
Attributes map[AttributeKey]SpecGLTFID
}
if there is no None compressed mesh, extension Required have KHR_draco_mesh_compression
func (*KHRDracoMeshCompression) Constructor ¶
func (s *KHRDracoMeshCompression) Constructor(src []byte) (Specifier, error)
func (*KHRDracoMeshCompression) ExtensionName ¶
func (s *KHRDracoMeshCompression) ExtensionName() string
type KHRMaterialsPBRSpecularGlossiness ¶
type KHRMaterialsPBRSpecularGlossiness struct {
DiffuseFactor mgl32.Vec4 `json:"diffuseFactor"` // default:[1.0,1.0,1.0,1.0]
DiffuseTexture *TextureInfo `json:"diffuseTexture"`
SpecularFactor mgl32.Vec3 `json:"specularFactor"` // default:[1.0,1.0,1.0]
GlossinessFactor float32 `json:"glossinessFactor"` // default:1.0
SpecularGlossinessTexture *TextureInfo `json:"specularGlossinessTexture"`
}
func (*KHRMaterialsPBRSpecularGlossiness) Constructor ¶
func (s *KHRMaterialsPBRSpecularGlossiness) Constructor(src []byte) (Specifier, error)
func (*KHRMaterialsPBRSpecularGlossiness) ExtensionName ¶
func (s *KHRMaterialsPBRSpecularGlossiness) ExtensionName() string
type Material ¶
type Material struct {
Name string `json:"name,omitempty"`
Extensions *Extensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
PBRMetallicRoughness *MaterialPBRMetallicRoughness `json:"pbrMetallicRoughness"`
NormalTexture *MaterialNormalTextureInfo `json:"normalTexture"`
OcclusionTexture *MaterialOcclusionTextureInfo `json:"occlusionTexture"`
EmissiveFactor mgl32.Vec3 `json:"emissiveFactor"` // default([0.0, 0.0, 0.0]
EmissiveTexture *TextureInfo `json:"emissiveTexture"` //
AlphaMode AlphaMode `json:"alphaMode"` // default(OPAQUE)
AlphaCutoff float32 `json:"alphaCutoff"` // default(0.5), minimum(0.0), dependency(AlphaMode) ! ignore(dependency) : cause default
DoubleSided bool `json:"doubleSided"` // default(false)
// None spec
UserData interface{}
}
func DefaultMaterial ¶
func DefaultMaterial() *Material
func (*Material) GetExtension ¶
func (s *Material) GetExtension() *Extensions
func (*Material) SetExtension ¶
func (s *Material) SetExtension(extensions *Extensions)
type MaterialNormalTextureInfo ¶
type MaterialNormalTextureInfo struct {
Index *Texture
TexCoord IndexTexCoord
Scale float32
Extensions *Extensions
Extras *Extras
}
func (*MaterialNormalTextureInfo) GetExtension ¶
func (s *MaterialNormalTextureInfo) GetExtension() *Extensions
func (*MaterialNormalTextureInfo) SetExtension ¶
func (s *MaterialNormalTextureInfo) SetExtension(extensions *Extensions)
type MaterialOcclusionTextureInfo ¶
type MaterialOcclusionTextureInfo struct {
Index *Texture
TexCoord IndexTexCoord
Strength float32
Extensions *Extensions
Extras *Extras
}
func (*MaterialOcclusionTextureInfo) GetExtension ¶
func (s *MaterialOcclusionTextureInfo) GetExtension() *Extensions
func (*MaterialOcclusionTextureInfo) SetExtension ¶
func (s *MaterialOcclusionTextureInfo) SetExtension(extensions *Extensions)
type MaterialPBRMetallicRoughness ¶
type MaterialPBRMetallicRoughness struct {
BaseColorFactor mgl32.Vec4 `json:"baseColorFactor"` // default([1.0, 1.0, 1.0, 1.0]), fixedItem(4), validate(f32Color4)
MetallicFactor float32 `json:"metallicFactor"` // default(1.0), range(0.0, 1.0)
RoughnessFactor float32 `json:"roughnessFactor"` // default(1.0), range(0.0, 1.0)
BaseColorTexture *TextureInfo `json:"baseColorTexture"`
MetallicRoughnessTexture *TextureInfo `json:"metallicRoughnessTexture"`
Extensions *Extensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*MaterialPBRMetallicRoughness) GetExtension ¶
func (s *MaterialPBRMetallicRoughness) GetExtension() *Extensions
func (*MaterialPBRMetallicRoughness) SetExtension ¶
func (s *MaterialPBRMetallicRoughness) SetExtension(extensions *Extensions)
type Mesh ¶
type Mesh struct {
Primitives []*MeshPrimitive
Weights []float32
Name string
Extensions *Extensions
Extras *Extras
// None spec
UserData interface{}
}
func (*Mesh) GetExtension ¶
func (s *Mesh) GetExtension() *Extensions
func (*Mesh) SetExtension ¶
func (s *Mesh) SetExtension(extensions *Extensions)
type MeshPrimitive ¶
type MeshPrimitive struct {
Attributes map[AttributeKey]*Accessor
Indices *Accessor
Material *Material
Mode Mode
Targets []map[AttributeKey]*Accessor
Extensions *Extensions
Extras *Extras
// None spec
UserData interface{}
}
func (*MeshPrimitive) GetExtension ¶
func (s *MeshPrimitive) GetExtension() *Extensions
func (*MeshPrimitive) SetExtension ¶
func (s *MeshPrimitive) SetExtension(extensions *Extensions)
type MinFilter ¶
type MinFilter int32
type Node ¶
type Node struct {
Camera *Camera
Parent *Node
Children []*Node
Skin *Skin
Matrix mgl32.Mat4
Rotation mgl32.Quat
Scale mgl32.Vec3
Translation mgl32.Vec3
Weights []float32
Mesh *Mesh
Name string
Extensions *Extensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
// None spec
UserData interface{}
}
if define Matrix, can't have TRS
func (*Node) GetExtension ¶
func (s *Node) GetExtension() *Extensions
func (*Node) SetExtension ¶
func (s *Node) SetExtension(extensions *Extensions)
type OrthographicCamera ¶
type OrthographicCamera struct {
Xmag float32
Ymag float32
Znear float32
Zfar float32
Extensions *Extensions
Extras *Extras
// contains filtered or unexported fields
}
func (*OrthographicCamera) CameraType ¶
func (s *OrthographicCamera) CameraType() CameraType
func (*OrthographicCamera) GetExtension ¶
func (s *OrthographicCamera) GetExtension() *Extensions
func (*OrthographicCamera) SetExtension ¶
func (s *OrthographicCamera) SetExtension(extensions *Extensions)
func (*OrthographicCamera) SetUserData ¶
func (s *OrthographicCamera) SetUserData(data interface{})
func (*OrthographicCamera) UserData ¶
func (s *OrthographicCamera) UserData() interface{}
type PerspectiveCamera ¶
type PerspectiveCamera struct {
AspectRatio *float32 // if nil, follow monitor ratio
Yfov float32
Znear float32
Zfar float32
Extensions *Extensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
// contains filtered or unexported fields
}
func (*PerspectiveCamera) CameraType ¶
func (s *PerspectiveCamera) CameraType() CameraType
func (*PerspectiveCamera) GetExtension ¶
func (s *PerspectiveCamera) GetExtension() *Extensions
func (*PerspectiveCamera) SetExtension ¶
func (s *PerspectiveCamera) SetExtension(extensions *Extensions)
func (*PerspectiveCamera) SetUserData ¶
func (s *PerspectiveCamera) SetUserData(data interface{})
func (*PerspectiveCamera) UserData ¶
func (s *PerspectiveCamera) UserData() interface{}
type Sampler ¶
type Sampler struct {
MagFilter MagFilter
MinFilter MinFilter
WrapS Wrap
WrapT Wrap
Name string
Extensions *Extensions
Extras *Extras
// None spec
UserData interface{}
}
func DefaultSampler ¶
func DefaultSampler() *Sampler
func (*Sampler) GetExtension ¶
func (s *Sampler) GetExtension() *Extensions
func (*Sampler) SetExtension ¶
func (s *Sampler) SetExtension(extensions *Extensions)
type Scene ¶
type Scene struct {
Nodes []*Node
Name string
Extensions *Extensions
Extras *Extras
// None spec
UserData interface{}
}
https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/schema/scene.schema.json
func (*Scene) GetExtension ¶
func (s *Scene) GetExtension() *Extensions
func (*Scene) SetExtension ¶
func (s *Scene) SetExtension(extensions *Extensions)
type Skin ¶
type Skin struct {
InverseBindMatrices *Accessor
Skeleton *Node
Joints []*Node
Name string
Extensions *Extensions
Extras *Extras
// None spec
UserData interface{}
}
func (*Skin) GetExtension ¶
func (s *Skin) GetExtension() *Extensions
func (*Skin) SetExtension ¶
func (s *Skin) SetExtension(extensions *Extensions)
type SpecAccessor ¶
type SpecAccessor struct {
BufferView *SpecGLTFID `json:"bufferView,omitempty"` //
ByteOffset *int `json:"byteOffset,omitempty"` // default(0), minimum(0), dependency(bufferView)
ComponentType *ComponentType `json:"componentType"` // required
Normalized *bool `json:"normalized,omitempty"` // default(false)
Count *int `json:"count"` // required, minimum(1)
Type *AccessorType `json:"type"` // required
Max []float32 `json:"max,omitempty"` // rangeitem(1, 16)
Min []float32 `json:"min,omitempty"` // rangeitem(1, 16)
Sparse *AccessorSparse `json:"sparse,omitempty"`
Name *string `json:"name,omitempty"`
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecAccessor) Link ¶
func (s *SpecAccessor) Link(Root *GLTF, parent interface{}, dst interface{}) error
func (*SpecAccessor) Scheme ¶
func (s *SpecAccessor) Scheme() string
func (*SpecAccessor) SpecExtension ¶
func (s *SpecAccessor) SpecExtension() *SpecExtensions
func (*SpecAccessor) Syntax ¶
func (s *SpecAccessor) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecAccessor) To ¶
func (s *SpecAccessor) To(ctx *parserContext) interface{}
type SpecAnimation ¶
type SpecAnimation struct {
Channels []SpecAnimationChannel `json:"channels"` // required, minItem(1)
Samplers []SpecAnimationSampler `json:"samplers"` // required, minItem(1)
Name *string `json:"name,omitempty"`
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecAnimation) GetChild ¶
func (s *SpecAnimation) GetChild(i int) Specifier
func (*SpecAnimation) ImpleGetChild ¶
func (s *SpecAnimation) ImpleGetChild(i int, dst interface{}) interface{}
func (*SpecAnimation) LenChild ¶
func (s *SpecAnimation) LenChild() int
func (*SpecAnimation) Scheme ¶
func (s *SpecAnimation) Scheme() string
func (*SpecAnimation) SetChild ¶
func (s *SpecAnimation) SetChild(i int, dst, object interface{})
func (*SpecAnimation) SpecExtension ¶
func (s *SpecAnimation) SpecExtension() *SpecExtensions
func (*SpecAnimation) Syntax ¶
func (s *SpecAnimation) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecAnimation) To ¶
func (s *SpecAnimation) To(ctx *parserContext) interface{}
type SpecAnimationChannel ¶
type SpecAnimationChannel struct {
Sampler *SpecGLTFID `json:"sampler"` // required
Target *SpecAnimationChannelTarget `json:"target"` // required
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecAnimationChannel) GetChild ¶
func (s *SpecAnimationChannel) GetChild(i int) Specifier
func (*SpecAnimationChannel) ImpleGetChild ¶
func (s *SpecAnimationChannel) ImpleGetChild(i int, dst interface{}) interface{}
func (*SpecAnimationChannel) LenChild ¶
func (s *SpecAnimationChannel) LenChild() int
func (*SpecAnimationChannel) Link ¶
func (s *SpecAnimationChannel) Link(Root *GLTF, parent interface{}, dst interface{}) error
func (*SpecAnimationChannel) Scheme ¶
func (s *SpecAnimationChannel) Scheme() string
func (*SpecAnimationChannel) SetChild ¶
func (s *SpecAnimationChannel) SetChild(i int, dst, object interface{})
func (*SpecAnimationChannel) SpecExtension ¶
func (s *SpecAnimationChannel) SpecExtension() *SpecExtensions
func (*SpecAnimationChannel) Syntax ¶
func (s *SpecAnimationChannel) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecAnimationChannel) To ¶
func (s *SpecAnimationChannel) To(ctx *parserContext) interface{}
type SpecAnimationChannelTarget ¶
type SpecAnimationChannelTarget struct {
Node *SpecGLTFID `json:"node"`
Path *Path `json:"path"` // required
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecAnimationChannelTarget) Link ¶
func (s *SpecAnimationChannelTarget) Link(Root *GLTF, parent interface{}, dst interface{}) error
func (*SpecAnimationChannelTarget) Scheme ¶
func (s *SpecAnimationChannelTarget) Scheme() string
func (*SpecAnimationChannelTarget) SpecExtension ¶
func (s *SpecAnimationChannelTarget) SpecExtension() *SpecExtensions
func (*SpecAnimationChannelTarget) Syntax ¶
func (s *SpecAnimationChannelTarget) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecAnimationChannelTarget) To ¶
func (s *SpecAnimationChannelTarget) To(ctx *parserContext) interface{}
type SpecAnimationSampler ¶
type SpecAnimationSampler struct {
Input *SpecGLTFID `json:"input"` // required
Interpolation *Interpolation `json:"interpolation"` // default(LINEAR)
Output *SpecGLTFID `json:"output"` // required, AnimationSampler.Output -> Accessor.ComponentType must(FLOAT or normalized integer)
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecAnimationSampler) Link ¶
func (s *SpecAnimationSampler) Link(Root *GLTF, parent interface{}, dst interface{}) error
func (*SpecAnimationSampler) Scheme ¶
func (s *SpecAnimationSampler) Scheme() string
func (*SpecAnimationSampler) SpecExtension ¶
func (s *SpecAnimationSampler) SpecExtension() *SpecExtensions
func (*SpecAnimationSampler) Syntax ¶
func (s *SpecAnimationSampler) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecAnimationSampler) To ¶
func (s *SpecAnimationSampler) To(ctx *parserContext) interface{}
type SpecAsset ¶
type SpecAsset struct {
Copyright *string `json:"copyright,omitempty"`
Generator *string `json:"generator,omitempty"`
Version *version.Version `json:"version"` // required
MinVersion *version.Version `json:"minVersion,omitempty"`
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecAsset) SpecExtension ¶
func (s *SpecAsset) SpecExtension() *SpecExtensions
type SpecBuffer ¶
type SpecBuffer struct {
URI *URI `json:"URI, omitempty"`
ByteLength *int `json:"ByteLength"` // required, min(1)
Name *string `json:"name,omitempty"`
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecBuffer) Scheme ¶
func (s *SpecBuffer) Scheme() string
func (*SpecBuffer) SpecExtension ¶
func (s *SpecBuffer) SpecExtension() *SpecExtensions
func (*SpecBuffer) Syntax ¶
func (s *SpecBuffer) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecBuffer) To ¶
func (s *SpecBuffer) To(ctx *parserContext) interface{}
type SpecBufferView ¶
type SpecBufferView struct {
Buffer *SpecGLTFID `json:"buffer"` // required
ByteOffset *int `json:"byteOffset"` // default(0), min(0)
ByteLength *int `json:"ByteLength"` // required, min(1)
ByteStride *int `json:"byteStride"` // range(4, 252, step=4) ! default(0) : not spec, but can be
Target *BufferType `json:"target"` //
Name *string `json:"name,omitempty"`
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecBufferView) Link ¶
func (s *SpecBufferView) Link(Root *GLTF, parent interface{}, dst interface{}) error
func (*SpecBufferView) Scheme ¶
func (s *SpecBufferView) Scheme() string
func (*SpecBufferView) SpecExtension ¶
func (s *SpecBufferView) SpecExtension() *SpecExtensions
func (*SpecBufferView) Syntax ¶
func (s *SpecBufferView) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecBufferView) To ¶
func (s *SpecBufferView) To(ctx *parserContext) interface{}
type SpecCamera ¶
type SpecCamera struct {
Type *CameraType `json:"type"` // required
Orthographic *SpecCameraOrthographic `json:"orthographic"` // link(type)
Perspective *SpecCameraPerspective `json:"perspective"` // link(type)
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecCamera) GetChild ¶
func (s *SpecCamera) GetChild(i int) Specifier
func (*SpecCamera) ImpleGetChild ¶
func (s *SpecCamera) ImpleGetChild(i int, dst interface{}) interface{}
func (*SpecCamera) LenChild ¶
func (s *SpecCamera) LenChild() int
func (*SpecCamera) Scheme ¶
func (s *SpecCamera) Scheme() string
func (*SpecCamera) SetChild ¶
func (s *SpecCamera) SetChild(i int, dst, object interface{})
func (*SpecCamera) SpecExtension ¶
func (s *SpecCamera) SpecExtension() *SpecExtensions
func (*SpecCamera) Syntax ¶
func (s *SpecCamera) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecCamera) To ¶
func (s *SpecCamera) To(ctx *parserContext) interface{}
type SpecCameraOrthographic ¶
type SpecCameraOrthographic struct {
Xmag *float32 `json:"xmag"` // required, not(0.0)
Ymag *float32 `json:"ymag"` // required, not(0.0)
Znear *float32 `json:"znear"` // required, minimum(0.0)
Zfar *float32 `json:"zfar"` // required, larger(0.0), larger(znear)
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecCameraOrthographic) Scheme ¶
func (s *SpecCameraOrthographic) Scheme() string
func (*SpecCameraOrthographic) SpecExtension ¶
func (s *SpecCameraOrthographic) SpecExtension() *SpecExtensions
func (*SpecCameraOrthographic) Syntax ¶
func (s *SpecCameraOrthographic) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecCameraOrthographic) To ¶
func (s *SpecCameraOrthographic) To(ctx *parserContext) interface{}
type SpecCameraPerspective ¶
type SpecCameraPerspective struct {
AspectRatio *float32 `json:"aspectRatio"` // larger(0.0)
Yfov *float32 `json:"yfov"` // required
Znear *float32 `json:"znear"` // required, larger(0.0)
Zfar *float32 `json:"zfar"` // larger(0.0) larger(znear) : not spec but need
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecCameraPerspective) Scheme ¶
func (s *SpecCameraPerspective) Scheme() string
func (*SpecCameraPerspective) SpecExtension ¶
func (s *SpecCameraPerspective) SpecExtension() *SpecExtensions
func (*SpecCameraPerspective) Syntax ¶
func (s *SpecCameraPerspective) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecCameraPerspective) To ¶
func (s *SpecCameraPerspective) To(ctx *parserContext) interface{}
type SpecExtensions ¶
type SpecExtensions map[string]*jsonRawString
type SpecGLTF ¶
type SpecGLTF struct {
ExtensionsUsed []string `json:"extensionsUsed,omitempty"` // minitem(1), unique
ExtensionsRequired []string `json:"extensionsRequired,omitempty"` // minitem(1), unique
Accessors []SpecAccessor `json:"accessors,omitempty"` // minitem(1)
Asset *SpecAsset `json:"asset,omitempty"` // required
Buffers []SpecBuffer `json:"buffers,omitempty"` // minitem(1)
BufferViews []SpecBufferView `json:"bufferViews,omitempty"` // minitem(1)
Cameras []SpecCamera `json:"cameras,omitempty"` // minitem(1)
Images []SpecImage `json:"images,omitempty"` // minitem(1)
Materials []SpecMaterial `json:"materials,omitempty"` // minitem(1)
Meshes []SpecMesh `json:"meshes,omitempty"` // minitem(1)
Nodes []SpecNode `json:"nodes,omitempty"` // minitem(1)
Samplers []SpecSampler `json:"samplers,omitempty"` // minitem(1)
Scene *SpecGLTFID `json:"scene,omitempty"` // dependency(scenes)
Scenes []SpecScene `json:"scenes,omitempty"` // minitem(1)
Textures []SpecTexture `json:"textures,omitempty"` // minitem(1)
Animations []SpecAnimation `json:"animations,omitempty"` // minitem(1)
Skins []SpecSkin `json:"skins,omitempty"` // minitem(1)
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
// contains filtered or unexported fields
}
func (*SpecGLTF) ImpleGetChild ¶
func (*SpecGLTF) SpecExtension ¶
func (s *SpecGLTF) SpecExtension() *SpecExtensions
type SpecGLTFID ¶
type SpecGLTFID int
https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/schema/glTFid.schema.json
func (SpecGLTFID) String ¶
func (s SpecGLTFID) String() string
func (*SpecGLTFID) UnmarshalJSON ¶
func (s *SpecGLTFID) UnmarshalJSON(src []byte) error
type SpecImage ¶
type SpecImage struct {
URI *URI `json:"URI"` // exclusive_require(URI, bufferView)
MimeType *MimeType `json:"mimeType"` //
BufferView *SpecGLTFID `json:"bufferView"` // exclusive_require(URI, bufferView), dependency(MimeType)
Name *string `json:"name,omitempty"`
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecImage) SpecExtension ¶
func (s *SpecImage) SpecExtension() *SpecExtensions
type SpecKHRDracoMeshCompression ¶
type SpecKHRDracoMeshCompression struct {
BufferView *SpecGLTFID `json:"bufferView"` // required
Attributes *map[AttributeKey]SpecGLTFID `json:"attributes"` // required
}
func (*SpecKHRDracoMeshCompression) Link ¶
func (s *SpecKHRDracoMeshCompression) Link(Root *GLTF, parent interface{}, dst interface{}) error
func (*SpecKHRDracoMeshCompression) Scheme ¶
func (s *SpecKHRDracoMeshCompression) Scheme() string
func (*SpecKHRDracoMeshCompression) Syntax ¶
func (s *SpecKHRDracoMeshCompression) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecKHRDracoMeshCompression) To ¶
func (s *SpecKHRDracoMeshCompression) To(ctx *parserContext) interface{}
type SpecKHRMaterialsPBRSpecularGlossiness ¶
type SpecKHRMaterialsPBRSpecularGlossiness struct {
DiffuseFactor *mgl32.Vec4 `json:"diffuseFactor"` // default:[1.0,1.0,1.0,1.0]
DiffuseTexture *SpecTextureInfo `json:"diffuseTexture"`
SpecularFactor *mgl32.Vec3 `json:"specularFactor"` // default:[1.0,1.0,1.0]
GlossinessFactor *float32 `json:"glossinessFactor"` // default:1.0
SpecularGlossinessTexture *SpecTextureInfo `json:"specularGlossinessTexture"`
}
func (*SpecKHRMaterialsPBRSpecularGlossiness) Children ¶
func (s *SpecKHRMaterialsPBRSpecularGlossiness) Children() (res []Specifier)
func (*SpecKHRMaterialsPBRSpecularGlossiness) GetChild ¶
func (s *SpecKHRMaterialsPBRSpecularGlossiness) GetChild(i int) Specifier
func (*SpecKHRMaterialsPBRSpecularGlossiness) ImpleGetChild ¶
func (s *SpecKHRMaterialsPBRSpecularGlossiness) ImpleGetChild(i int, dst interface{}) interface{}
func (*SpecKHRMaterialsPBRSpecularGlossiness) LenChild ¶
func (s *SpecKHRMaterialsPBRSpecularGlossiness) LenChild() int
func (*SpecKHRMaterialsPBRSpecularGlossiness) Scheme ¶
func (s *SpecKHRMaterialsPBRSpecularGlossiness) Scheme() string
func (*SpecKHRMaterialsPBRSpecularGlossiness) SetChild ¶
func (s *SpecKHRMaterialsPBRSpecularGlossiness) SetChild(i int, dst, object interface{})
func (*SpecKHRMaterialsPBRSpecularGlossiness) Syntax ¶
func (s *SpecKHRMaterialsPBRSpecularGlossiness) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecKHRMaterialsPBRSpecularGlossiness) To ¶
func (s *SpecKHRMaterialsPBRSpecularGlossiness) To(ctx *parserContext) interface{}
type SpecMaterial ¶
type SpecMaterial struct {
Name *string `json:"name,omitempty"`
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
PBRMetallicRoughness *SpecMaterialPBRMetallicRoughness `json:"pbrMetallicRoughness"`
NormalTexture *SpecMaterialNormalTextureInfo `json:"normalTexture"`
OcclusionTexture *SpecMaterialOcclusionTextureInfo `json:"occlusionTexture"`
EmissiveFactor *mgl32.Vec3 `json:"emissiveFactor"` // default([0.0, 0.0, 0.0], validate(f32Color)
EmissiveTexture *SpecTextureInfo `json:"emissiveTexture"` //
AlphaMode *AlphaMode `json:"alphaMode"` // default(OPAQUE)
AlphaCutoff *float32 `json:"alphaCutoff"` // default(0.5), minimum(0.0), dependency(AlphaMode) ! ignore(dependency) : cause default
DoubleSided *bool `json:"doubleSided"` // default(false)
}
func (*SpecMaterial) Children ¶
func (s *SpecMaterial) Children() (res []Specifier)
func (*SpecMaterial) GetChild ¶
func (s *SpecMaterial) GetChild(i int) Specifier
func (*SpecMaterial) ImpleGetChild ¶
func (s *SpecMaterial) ImpleGetChild(i int, dst interface{}) interface{}
func (*SpecMaterial) LenChild ¶
func (s *SpecMaterial) LenChild() int
func (*SpecMaterial) Scheme ¶
func (s *SpecMaterial) Scheme() string
func (*SpecMaterial) SetChild ¶
func (s *SpecMaterial) SetChild(i int, dst, object interface{})
func (*SpecMaterial) SpecExtension ¶
func (s *SpecMaterial) SpecExtension() *SpecExtensions
func (*SpecMaterial) Syntax ¶
func (s *SpecMaterial) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecMaterial) To ¶
func (s *SpecMaterial) To(ctx *parserContext) interface{}
type SpecMaterialNormalTextureInfo ¶
type SpecMaterialNormalTextureInfo struct {
Index *SpecGLTFID `json:"index"` // required, minimum(0)
TexCoord *IndexTexCoord `json:"texCoord"` // default(0), minimum(0)
Scale *float32 `json:"scale"` // default(1.0), minimum(0)
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecMaterialNormalTextureInfo) Link ¶
func (s *SpecMaterialNormalTextureInfo) Link(Root *GLTF, parent interface{}, dst interface{}) error
func (*SpecMaterialNormalTextureInfo) Scheme ¶
func (s *SpecMaterialNormalTextureInfo) Scheme() string
func (*SpecMaterialNormalTextureInfo) SpecExtension ¶
func (s *SpecMaterialNormalTextureInfo) SpecExtension() *SpecExtensions
func (*SpecMaterialNormalTextureInfo) Syntax ¶
func (s *SpecMaterialNormalTextureInfo) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecMaterialNormalTextureInfo) To ¶
func (s *SpecMaterialNormalTextureInfo) To(ctx *parserContext) interface{}
type SpecMaterialOcclusionTextureInfo ¶
type SpecMaterialOcclusionTextureInfo struct {
Index *SpecGLTFID `json:"index"` // required, minimum(0)
TexCoord *IndexTexCoord `json:"texCoord"` // default(0), minimum(0)
Strength *float32 `json:"scale"` // default(1.0), range(0.0, 1.0)
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecMaterialOcclusionTextureInfo) Link ¶
func (s *SpecMaterialOcclusionTextureInfo) Link(Root *GLTF, parent interface{}, dst interface{}) error
func (*SpecMaterialOcclusionTextureInfo) Scheme ¶
func (s *SpecMaterialOcclusionTextureInfo) Scheme() string
func (*SpecMaterialOcclusionTextureInfo) SpecExtension ¶
func (s *SpecMaterialOcclusionTextureInfo) SpecExtension() *SpecExtensions
func (*SpecMaterialOcclusionTextureInfo) Syntax ¶
func (s *SpecMaterialOcclusionTextureInfo) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecMaterialOcclusionTextureInfo) To ¶
func (s *SpecMaterialOcclusionTextureInfo) To(ctx *parserContext) interface{}
type SpecMaterialPBRMetallicRoughness ¶
type SpecMaterialPBRMetallicRoughness struct {
BaseColorFactor *mgl32.Vec4 `json:"baseColorFactor"` // default([1.0, 1.0, 1.0, 1.0]), fixedItem(4), eachItemRange(0.0, 0.1)
MetallicFactor *float32 `json:"metallicFactor"` // default(1.0), range(0.0, 1.0)
RoughnessFactor *float32 `json:"roughnessFactor"` // default(1.0), range(0.0, 1.0)
BaseColorTexture *SpecTextureInfo `json:"baseColorTexture"`
MetallicRoughnessTexture *SpecTextureInfo `json:"metallicRoughnessTexture"`
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecMaterialPBRMetallicRoughness) Children ¶
func (s *SpecMaterialPBRMetallicRoughness) Children() []Specifier
func (*SpecMaterialPBRMetallicRoughness) GetChild ¶
func (s *SpecMaterialPBRMetallicRoughness) GetChild(i int) Specifier
func (*SpecMaterialPBRMetallicRoughness) ImpleGetChild ¶
func (s *SpecMaterialPBRMetallicRoughness) ImpleGetChild(i int, dst interface{}) interface{}
func (*SpecMaterialPBRMetallicRoughness) LenChild ¶
func (s *SpecMaterialPBRMetallicRoughness) LenChild() int
func (*SpecMaterialPBRMetallicRoughness) Scheme ¶
func (s *SpecMaterialPBRMetallicRoughness) Scheme() string
func (*SpecMaterialPBRMetallicRoughness) SetChild ¶
func (s *SpecMaterialPBRMetallicRoughness) SetChild(i int, dst, object interface{})
func (*SpecMaterialPBRMetallicRoughness) SpecExtension ¶
func (s *SpecMaterialPBRMetallicRoughness) SpecExtension() *SpecExtensions
func (*SpecMaterialPBRMetallicRoughness) Syntax ¶
func (s *SpecMaterialPBRMetallicRoughness) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecMaterialPBRMetallicRoughness) To ¶
func (s *SpecMaterialPBRMetallicRoughness) To(ctx *parserContext) interface{}
type SpecMesh ¶
type SpecMesh struct {
Primitives []SpecMeshPrimitive `json:"primitives"` // required, minItem(1)
Weights []float32 `json:"weights"` // minItem(1)
Name *string `json:"name,omitempty"`
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecMesh) ImpleGetChild ¶
func (*SpecMesh) SpecExtension ¶
func (s *SpecMesh) SpecExtension() *SpecExtensions
type SpecMeshPrimitive ¶
type SpecMeshPrimitive struct {
Attributes map[AttributeKey]SpecGLTFID `json:"attributes"` // required, minItem(1)
Indices *SpecGLTFID `json:"indices"` //
Material *SpecGLTFID `json:"material"` //
Mode *Mode `json:"mode"` // default(TRIANGLES)
Targets []map[AttributeKey]SpecGLTFID `json:"targets"` // [*]allow(POSITION, NORMAL, TANGENT)
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecMeshPrimitive) Link ¶
func (s *SpecMeshPrimitive) Link(Root *GLTF, parent interface{}, dst interface{}) error
func (*SpecMeshPrimitive) Scheme ¶
func (s *SpecMeshPrimitive) Scheme() string
func (*SpecMeshPrimitive) SpecExtension ¶
func (s *SpecMeshPrimitive) SpecExtension() *SpecExtensions
func (*SpecMeshPrimitive) Syntax ¶
func (s *SpecMeshPrimitive) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecMeshPrimitive) To ¶
func (s *SpecMeshPrimitive) To(ctx *parserContext) interface{}
type SpecNode ¶
type SpecNode struct {
Camera *SpecGLTFID `json:"camera"`
Children []SpecGLTFID `json:"children"` // unique, minItem(1)
Skin *SpecGLTFID `json:"skin"` // dependancy(Mesh)
Matrix *mgl32.Mat4 `json:"matrix"` // default(mgl32.Ident4()), exclusive(Translation, Rotation, Scale)
Rotation *mgl32.Vec4 `json:"rotation"` // default(mgl32.Vec4{0,0,0,1})
Scale *mgl32.Vec3 `json:"scale"` // default(mgl32.Vec{1,1,1})
Translation *mgl32.Vec3 `json:"translation"` // default(mgl32.Vec{0,0,0})
Weights []float32 `json:"weights"` // minItem(1), dependancy(Mesh)
Mesh *SpecGLTFID `json:"mesh"` //
Name *string `json:"name,omitempty"`
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecNode) SpecExtension ¶
func (s *SpecNode) SpecExtension() *SpecExtensions
type SpecSampler ¶
type SpecSampler struct {
MagFilter *MagFilter `json:"magFilter"` // notspec default(MAG_LINEAR) : [https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glTexParameter.xhtm]
MinFilter *MinFilter `json:"minFilter"` // notspec default(MIN_NEAREST_MIPMAP_LINEAR) : [https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glTexParameter.xhtm]
WrapS *Wrap `json:"wrapS"` // notspec default(REPEAT) : [https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glTexParameter.xhtm]
WrapT *Wrap `json:"wrapT"` // notspec default(REPEAT) : [https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glTexParameter.xhtm]
Name *string `json:"name,omitempty"`
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecSampler) Scheme ¶
func (s *SpecSampler) Scheme() string
func (*SpecSampler) SpecExtension ¶
func (s *SpecSampler) SpecExtension() *SpecExtensions
func (*SpecSampler) Syntax ¶
func (s *SpecSampler) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecSampler) To ¶
func (s *SpecSampler) To(ctx *parserContext) interface{}
type SpecScene ¶
type SpecScene struct {
Nodes []SpecGLTFID `json:"nodes"` // unique, minItem(1)
Name *string `json:"name,omitempty"`
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecScene) SpecExtension ¶
func (s *SpecScene) SpecExtension() *SpecExtensions
type SpecSkin ¶
type SpecSkin struct {
InverseBindMatrices *SpecGLTFID `json:"inverseBindMatrices"` // When undefined, it is Ident4x4 matrix
Skeleton *SpecGLTFID `json:"skeleton"` // When undefined, joints transforms resolve to scene root.
Joints []SpecGLTFID `json:"joints"` // require(min = 1), unique
Name *string `json:"name,omitempty"`
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecSkin) SpecExtension ¶
func (s *SpecSkin) SpecExtension() *SpecExtensions
type SpecTexture ¶
type SpecTexture struct {
Sampler *SpecGLTFID `json:"sampler"`
Source *SpecGLTFID `json:"source"`
Name *string `json:"name,omitempty"`
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecTexture) Link ¶
func (s *SpecTexture) Link(Root *GLTF, parent interface{}, dst interface{}) error
func (*SpecTexture) Scheme ¶
func (s *SpecTexture) Scheme() string
func (*SpecTexture) SpecExtension ¶
func (s *SpecTexture) SpecExtension() *SpecExtensions
func (*SpecTexture) Syntax ¶
func (s *SpecTexture) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecTexture) To ¶
func (s *SpecTexture) To(ctx *parserContext) interface{}
type SpecTextureInfo ¶
type SpecTextureInfo struct {
Index *SpecGLTFID `json:"index"` // required
TexCoord *IndexTexCoord `json:"texCoord"` // default(0), minimum(0)
Extensions *SpecExtensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
}
func (*SpecTextureInfo) Link ¶
func (s *SpecTextureInfo) Link(Root *GLTF, parent interface{}, dst interface{}) error
func (*SpecTextureInfo) Scheme ¶
func (s *SpecTextureInfo) Scheme() string
func (*SpecTextureInfo) SpecExtension ¶
func (s *SpecTextureInfo) SpecExtension() *SpecExtensions
func (*SpecTextureInfo) Syntax ¶
func (s *SpecTextureInfo) Syntax(strictness Strictness, root Specifier, parent Specifier) error
func (*SpecTextureInfo) To ¶
func (s *SpecTextureInfo) To(ctx *parserContext) interface{}
type Specifier ¶
type Specifier interface {
Scheme() string
Syntax(strictness Strictness, root Specifier, parent Specifier) error
To(ctx *parserContext) interface{}
}
type Strictness ¶
type Strictness uint8
const ( // Do not check anything // LEVEL0 Strictness = 0 // Check essential only // // + required field // + dependency LEVEL1 Strictness = 1 // Check potential problematic // // + unique slice item // + slice item count // ! CameraSetting/Perspective : + Argument large, etc // ! CameraSetting/Orthographic : + Argument large, etc // ! Material/pbrMetallicRoughness : + Argument range, etc LEVEL2 Strictness = 2 // Follow Specifier // // // + max, min limitation LEVEL3 Strictness = 3 )
Anything other than LEVEL{0 to 3} is treated as LEVLE0
type Texture ¶
type Texture struct {
Sampler *Sampler `json:"sampler"`
Source Image `json:"source"`
Name string `json:"name,omitempty"`
Extensions *Extensions `json:"extensions,omitempty"`
Extras *Extras `json:"extras,omitempty"`
// None spec
UserData interface{}
}
func (*Texture) GetExtension ¶
func (s *Texture) GetExtension() *Extensions
func (*Texture) SetExtension ¶
func (s *Texture) SetExtension(extensions *Extensions)
type TextureInfo ¶
type TextureInfo struct {
Index *Texture
TexCoord IndexTexCoord
Extensions *Extensions
Extras *Extras
}
func (*TextureInfo) GetExtension ¶
func (s *TextureInfo) GetExtension() *Extensions
func (*TextureInfo) SetExtension ¶
func (s *TextureInfo) SetExtension(extensions *Extensions)
type URI ¶
func (*URI) UnmarshalJSON ¶
type URIImage ¶
type URIImage struct {
//
URI *URI
// contains filtered or unexported fields
}
func (*URIImage) Extensions ¶
func (s *URIImage) Extensions() *Extensions
func (*URIImage) GetExtension ¶
func (s *URIImage) GetExtension() *Extensions
func (*URIImage) SetExtension ¶
func (s *URIImage) SetExtension(extensions *Extensions)
func (*URIImage) SetUserData ¶
func (s *URIImage) SetUserData(data interface{})
func (*URIImage) ThrowCache ¶
func (s *URIImage) ThrowCache()
Source Files
¶
- aExtension.go
- aParser.go
- aStrictness.go
- aTask.go
- eKHRDracoMeshCompression.go
- eKHRMaterialsPBRSpecularGlossiness.go
- eScheme.go
- enums.go
- errors.go
- interfaces.go
- spec_Accessor.go
- spec_AccessorSparse.go
- spec_AccessorSparseIndices.go
- spec_AccessorSparseValues.go
- spec_Animation.go
- spec_AnimationChannel.go
- spec_AnimationChannelTarget.go
- spec_AnimationSampler.go
- spec_Asset.go
- spec_Buffer.go
- spec_BufferView.go
- spec_Camera.go
- spec_CameraOrthographic.go
- spec_CameraPerspective.go
- spec_Extension_Extra.go
- spec_Image.go
- spec_Material.go
- spec_MaterialNormalTextureInfo.go
- spec_MaterialOcclusionTextureInfo.go
- spec_MaterialPBRMetallicRoughness.go
- spec_Mesh.go
- spec_MeshPrimitive.go
- spec_Node.go
- spec_Sampler.go
- spec_Scene.go
- spec_Skin.go
- spec_Texture.go
- spec_TextureInfo.go
- spec_glTF.go
- spec_glTFid.go
- uCache.go
- uF32.go
- uURI.go
- uUnique.go