https://github.com/imnerocode/parser-obj
A lightweight Go parser that converts OBJ files into a vo.Model structure using the vo-structures module, making it easy to integrate 3D models into your projects
https://github.com/imnerocode/parser-obj
go golang obj parser vo-structures
Last synced: 7 months ago
JSON representation
A lightweight Go parser that converts OBJ files into a vo.Model structure using the vo-structures module, making it easy to integrate 3D models into your projects
- Host: GitHub
- URL: https://github.com/imnerocode/parser-obj
- Owner: imnerocode
- License: mit
- Created: 2024-12-20T16:09:42.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-03T20:43:27.000Z (about 1 year ago)
- Last Synced: 2025-02-14T19:51:53.806Z (about 1 year ago)
- Topics: go, golang, obj, parser, vo-structures
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OBJ Parser
This package provides a function to parse OBJ files and convert them into a model structure using the `vo-structures` package.
## Installation
To install this package, use `go get`:
```sh
go get github.com/imnerocode/parser-obj
```
## Usage
Below is an example of how to use this package to parse an OBJ file:
```go
package main
import (
"fmt"
"log"
"github.com/imnerocode/parser-obj"
)
func main() {
model, err := parser_obj.ParseOBJ("path/to/your/file.obj")
if err != nil {
log.Fatalf("Error parsing OBJ file: %v", err)
}
fmt.Printf("Parsed model: %+v\n", model)
}
```
## Functions
### ParseOBJ
```go
func ParseOBJ(filePath string) (*vo.Model, error)
```
Parses an OBJ file and converts it into a `vo.Model` structure.
- **filePath**: The path to the OBJ file.
- Returns a pointer to `vo.Model` and an error if any issue occurs.
## Structures
This package uses the following structures from the `vo-structures` package:
- `vo.Model`
- `vo.Vertex`
- `vo.Face`
You need to import these structures from the `vo-structures` package, which is a separate package available at: [https://github.com/imnerocode/vo-structures](https://github.com/imnerocode/vo-structures)
## License
This project is licensed under the terms of the MIT license.