mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
opengl: Remove arrayBufferLayoutPart.dataType
This commit is contained in:
parent
00f28dd896
commit
82e9f227d1
@ -26,9 +26,8 @@ import (
|
|||||||
// arrayBufferLayoutPart is a part of an array buffer layout.
|
// arrayBufferLayoutPart is a part of an array buffer layout.
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// arrayBufferLayout is an array buffer layout.
|
// arrayBufferLayout is an array buffer layout.
|
||||||
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,19 +86,16 @@ func initializeArrayBuferLayout() {
|
|||||||
// Note that GL_MAX_VERTEX_ATTRIBS is at least 16.
|
// Note that GL_MAX_VERTEX_ATTRIBS is at least 16.
|
||||||
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,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user