Skip to content

Commit

Permalink
add gltf decoding example
Browse files Browse the repository at this point in the history
  • Loading branch information
qmuntal committed Mar 3, 2021
1 parent 071dd6f commit cb2315a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The Go-Draco package supports the latest releases of Draco (v1.4.1) on Linux, ma
- Mesh decoding
- Mesh inspection
- Pre-compiled static libraries for windows and linux
- gltf extension for `github.com/qmuntal/gltf`

## Usage

Expand Down Expand Up @@ -41,6 +42,27 @@ func main() {
}
```

### glTF decoding

```go
package main

import (
"fmt"
"github.com/qmuntal/gltf"
"github.com/qmuntal/draco-go/gltf/draco"
)

func main() {
doc, _err_ := gltf.Open("testdata/box/Box.gltf")
pd, _ := draco.UnmarshalMesh(doc, doc.BufferViews[0])
p := doc.Meshes[0].Primitives[0]
fmt.Println(pd.ReadIndices(nil))
fmt.Println(pd.ReadAttr(p, "POSITION", nil))
fmt.Println(pd.ReadAttr(p, "NORMAL", nil))
}
```

## Development

The CGO bindings uses a C API that is maintained in [qmuntal/draco-c](https://github.com/qmuntal/draco-c), as the Draco team do not have enough bandwidth to support it. See [google/draco#467](https://github.com/google/draco/pull/663#issuecomment-772802508) for more context.
Expand Down

0 comments on commit cb2315a

Please sign in to comment.