opengl: Remove arrayBufferLayoutPart.dataType

This commit is contained in:
Hajime Hoshi 2018-11-06 01:13:55 +09:00
parent 00f28dd896
commit 82e9f227d1

View File

@ -27,7 +27,6 @@ import (
type arrayBufferLayoutPart struct { type arrayBufferLayoutPart struct {
// TODO: This struct should belong to a program and know it. // TODO: This struct should belong to a program and know it.
name string name string
dataType DataType
num int num int
} }
@ -47,7 +46,7 @@ func (a *arrayBufferLayout) totalBytes() int {
} }
t := 0 t := 0
for _, p := range a.parts { for _, p := range a.parts {
t += p.dataType.SizeInBytes() * p.num t += Float.SizeInBytes() * p.num
} }
a.total = t a.total = t
return a.total return a.total
@ -66,8 +65,8 @@ func (a *arrayBufferLayout) enable(program program) {
total := a.totalBytes() total := a.totalBytes()
offset := 0 offset := 0
for _, p := range a.parts { for _, p := range a.parts {
GetContext().vertexAttribPointer(program, p.name, p.num, p.dataType, total, offset) GetContext().vertexAttribPointer(program, p.name, p.num, Float, total, offset)
offset += p.dataType.SizeInBytes() * p.num offset += Float.SizeInBytes() * p.num
} }
} }
@ -88,17 +87,14 @@ func initializeArrayBuferLayout() {
parts: []arrayBufferLayoutPart{ parts: []arrayBufferLayoutPart{
{ {
name: "vertex", name: "vertex",
dataType: Float,
num: 2, num: 2,
}, },
{ {
name: "tex_coord", name: "tex_coord",
dataType: Float,
num: 4, num: 4,
}, },
{ {
name: "color_scale", name: "color_scale",
dataType: Float,
num: 4, num: 4,
}, },
}, },