mirror of
https://github.com/Kugelschieber/go-game.git
synced 2026-01-18 06:40:28 +00:00
Code restructuring.
This commit is contained in:
42
loader.go
42
loader.go
@@ -21,27 +21,6 @@ type PngLoader struct {
|
||||
KeepData bool
|
||||
}
|
||||
|
||||
// Standford ply file resource.
|
||||
type Ply struct {
|
||||
name string
|
||||
path string
|
||||
ext string
|
||||
|
||||
firstLine, data, hasVertex, hasTexCoord, hasNormal bool
|
||||
elements, faces int
|
||||
indices []uint32
|
||||
vertices, texCoords, normals []float32
|
||||
|
||||
IndexBuffer, VertexBuffer, TexCoordBuffer, NormalBuffer *VBO
|
||||
}
|
||||
|
||||
// Loads ply files and creates VBOs within the Ply resource.
|
||||
// The indices must be present as triangles.
|
||||
// Expected type is float32. If it fails to parse, it will panic.
|
||||
type PlyLoader struct {
|
||||
VboUsage uint32
|
||||
}
|
||||
|
||||
func (p *PngLoader) Load(file string) (Res, error) {
|
||||
// load texture
|
||||
imgFile, err := os.Open(file)
|
||||
@@ -82,6 +61,27 @@ func (p *PngLoader) Ext() string {
|
||||
return "png"
|
||||
}
|
||||
|
||||
// Standford ply file resource.
|
||||
type Ply struct {
|
||||
name string
|
||||
path string
|
||||
ext string
|
||||
|
||||
firstLine, data, hasVertex, hasTexCoord, hasNormal bool
|
||||
elements, faces int
|
||||
indices []uint32
|
||||
vertices, texCoords, normals []float32
|
||||
|
||||
IndexBuffer, VertexBuffer, TexCoordBuffer, NormalBuffer *VBO
|
||||
}
|
||||
|
||||
// Loads ply files and creates VBOs within the Ply resource.
|
||||
// The indices must be present as triangles.
|
||||
// Expected type is float32. If it fails to parse, it will panic.
|
||||
type PlyLoader struct {
|
||||
VboUsage uint32
|
||||
}
|
||||
|
||||
// Drops contained GL buffers.
|
||||
func (p *Ply) Drop() {
|
||||
if p.IndexBuffer != nil {
|
||||
|
||||
Reference in New Issue
Block a user