Documentation
¶
Overview ¶
Package draco decodes Draco-compressed triangle meshes (bitstream version 2.2, the version KHR_draco_mesh_compression normatively references) in pure Go.
It is a port, modified for Go, of the decoding half of Google's Draco library 1.5.7 (https://github.com/google/draco, Copyright 2016 The Draco Authors, licensed under the Apache License, Version 2.0; see the NOTICE file in this directory): sequential and edgebreaker (standard and valence) connectivity, the generic, integer, quantization and normal attribute decoders, and the difference, parallelogram, multi-parallelogram, constrained multi-parallelogram, portable texture coordinate and geometric normal prediction schemes with their wrap and octahedron transforms. Every read is bounds checked so malformed input returns an error instead of panicking.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultLimits = Limits{MaxFaces: 1 << 22, MaxPoints: 1 << 22, MaxBytes: 256 << 20}
DefaultLimits are used when a Limits field is zero.
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute struct {
// contains filtered or unexported fields
}
Attribute is one decoded per-point attribute of a Mesh.
func (Attribute) Normalized ¶
Normalized reports whether integer values are meant to be normalized.
func (Attribute) NumComponents ¶
NumComponents returns the number of components per value.
type Limits ¶
type Limits struct {
// MaxFaces is the largest triangle count accepted.
MaxFaces int
// MaxPoints is the largest point (vertex) count accepted.
MaxPoints int
// MaxBytes caps the working memory, in bytes, that scales with the number of attributes and attribute connectivities a stream declares: per-attribute corner tables, point mappings, and decoded and portable values. A stream that would need more fails before allocating it. Mesh.Bytes reports what a successful decode charged.
MaxBytes uint64
}
Limits caps the sizes a stream may declare, so a small malicious input cannot force large allocations.
type Mesh ¶
type Mesh struct {
// Faces holds three point indices per triangle.
Faces []uint32
// NumPoints is the number of points the faces index.
NumPoints int
// Bytes is the working memory charged against Limits.MaxBytes while decoding.
Bytes uint64
// contains filtered or unexported fields
}
Mesh is a decoded Draco triangle mesh. Faces index points; every attribute has one value per point.