Moved types to top of files, started 2D texture mapped font rendering.

This commit is contained in:
Marvin Blum
2016-07-16 02:31:53 +02:00
parent 67571025e9
commit ed39081300
11 changed files with 281 additions and 180 deletions

View File

@@ -14,6 +14,26 @@ type Mesh struct {
Vao *VAO
}
// Model is an actor having a 3D position, a texture and a 3D mesh.
type Model struct {
*Actor
*Pos3D
*Tex
*Mesh
}
// The model renderer is a system rendering models.
// It has a 3D position component, to move all models at once.
type ModelRenderer struct {
Pos3D
Shader *Shader
Camera *Camera
ortho bool
models []Model
}
// Creates a new mesh with given GL buffers.
// The VAO must be prepared by ModelRenderer.
func NewMesh(index, vertex, texcoord *VBO) *Mesh {
@@ -36,14 +56,6 @@ func (m *Mesh) Drop() {
m.Vao.Drop()
}
// Model is an actor having a 3D position, a texture and a 3D mesh.
type Model struct {
*Actor
*Pos3D
*Tex
*Mesh
}
// Creates a new model with given mesh and texture.
func NewModel(mesh *Mesh, tex *Tex) *Model {
model := &Model{}
@@ -60,18 +72,6 @@ func NewModel(mesh *Mesh, tex *Tex) *Model {
return model
}
// The model renderer is a system rendering models.
// It has a 3D position component, to move all models at once.
type ModelRenderer struct {
Pos3D
Shader *Shader
Camera *Camera
ortho bool
models []Model
}
// Creates a new model renderer using given shader and camera.
// If shader and/or camera are nil, the default one will be used.
// Orth can be set to true, to use orthogonal projection.