mirror of
https://github.com/Kugelschieber/go-game.git
synced 2026-01-18 06:40:28 +00:00
Moved types to top of files, started 2D texture mapped font rendering.
This commit is contained in:
42
loader.go
42
loader.go
@@ -21,6 +21,27 @@ 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)
|
||||
@@ -61,20 +82,6 @@ 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
|
||||
}
|
||||
|
||||
// Drops contained GL buffers.
|
||||
func (p *Ply) Drop() {
|
||||
if p.IndexBuffer != nil {
|
||||
@@ -124,13 +131,6 @@ func (p *Ply) SetExt(ext string) {
|
||||
p.ext = ext
|
||||
}
|
||||
|
||||
// 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 *PlyLoader) Load(file string) (Res, error) {
|
||||
handle, err := os.Open(file)
|
||||
defer handle.Close()
|
||||
|
||||
Reference in New Issue
Block a user