mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-24 18:02:02 +01:00
opengl: Unexport DataType/Float/Short
This commit is contained in:
parent
82e9f227d1
commit
580cd5cc71
@ -126,7 +126,7 @@ func (q *commandQueue) EnqueueDrawImageCommand(dst, src *Image, vertices []float
|
||||
|
||||
q.appendVertices(vertices)
|
||||
q.appendIndices(indices, uint16(q.nextIndex))
|
||||
q.nextIndex += len(vertices) * opengl.Float.SizeInBytes() / opengl.ArrayBufferLayoutTotalBytes()
|
||||
q.nextIndex += len(vertices) / opengl.ArrayBufferLayoutFloatNum()
|
||||
q.tmpNumIndices += len(indices)
|
||||
|
||||
q.doEnqueueDrawImageCommand(dst, src, len(vertices), len(indices), color, mode, filter, split)
|
||||
|
@ -25,8 +25,8 @@ var (
|
||||
elementArrayBuffer bufferType
|
||||
dynamicDraw bufferUsage
|
||||
staticDraw bufferUsage
|
||||
Short DataType
|
||||
Float DataType
|
||||
short dataType
|
||||
float dataType
|
||||
|
||||
zero operation
|
||||
one operation
|
||||
|
@ -61,8 +61,8 @@ func init() {
|
||||
arrayBuffer = gl.ARRAY_BUFFER
|
||||
elementArrayBuffer = gl.ELEMENT_ARRAY_BUFFER
|
||||
dynamicDraw = gl.DYNAMIC_DRAW
|
||||
Short = gl.SHORT
|
||||
Float = gl.FLOAT
|
||||
short = gl.SHORT
|
||||
float = gl.FLOAT
|
||||
|
||||
zero = gl.ZERO
|
||||
one = gl.ONE
|
||||
@ -408,7 +408,7 @@ func (c *Context) getAttribLocationImpl(p program, location string) attribLocati
|
||||
return attrib
|
||||
}
|
||||
|
||||
func (c *Context) vertexAttribPointer(p program, location string, size int, dataType DataType, stride int, offset int) {
|
||||
func (c *Context) vertexAttribPointer(p program, location string, size int, dataType dataType, stride int, offset int) {
|
||||
_ = mainthread.Run(func() error {
|
||||
l := c.locationCache.GetAttribLocation(c, p, location)
|
||||
gl.VertexAttribPointer(uint32(l), int32(size), uint32(dataType), false, int32(stride), gl.PtrOffset(offset))
|
||||
|
@ -78,8 +78,8 @@ func init() {
|
||||
arrayBuffer = bufferType(c.Get("ARRAY_BUFFER").Int())
|
||||
elementArrayBuffer = bufferType(c.Get("ELEMENT_ARRAY_BUFFER").Int())
|
||||
dynamicDraw = bufferUsage(c.Get("DYNAMIC_DRAW").Int())
|
||||
Short = DataType(c.Get("SHORT").Int())
|
||||
Float = DataType(c.Get("FLOAT").Int())
|
||||
short = dataType(c.Get("SHORT").Int())
|
||||
float = dataType(c.Get("FLOAT").Int())
|
||||
|
||||
zero = operation(c.Get("ZERO").Int())
|
||||
one = operation(c.Get("ONE").Int())
|
||||
@ -410,7 +410,7 @@ func (c *Context) getAttribLocationImpl(p program, location string) attribLocati
|
||||
return attribLocation(gl.Call("getAttribLocation", p.value, location).Int())
|
||||
}
|
||||
|
||||
func (c *Context) vertexAttribPointer(p program, location string, size int, dataType DataType, stride int, offset int) {
|
||||
func (c *Context) vertexAttribPointer(p program, location string, size int, dataType dataType, stride int, offset int) {
|
||||
c.ensureGL()
|
||||
gl := c.gl
|
||||
l := c.locationCache.GetAttribLocation(c, p, location)
|
||||
|
@ -57,8 +57,8 @@ func init() {
|
||||
arrayBuffer = mgl.ARRAY_BUFFER
|
||||
elementArrayBuffer = mgl.ELEMENT_ARRAY_BUFFER
|
||||
dynamicDraw = mgl.DYNAMIC_DRAW
|
||||
Short = mgl.SHORT
|
||||
Float = mgl.FLOAT
|
||||
short = mgl.SHORT
|
||||
float = mgl.FLOAT
|
||||
|
||||
zero = mgl.ZERO
|
||||
one = mgl.ONE
|
||||
@ -332,7 +332,7 @@ func (c *Context) getAttribLocationImpl(p program, location string) attribLocati
|
||||
return a
|
||||
}
|
||||
|
||||
func (c *Context) vertexAttribPointer(p program, location string, size int, dataType DataType, stride int, offset int) {
|
||||
func (c *Context) vertexAttribPointer(p program, location string, size int, dataType dataType, stride int, offset int) {
|
||||
gl := c.gl
|
||||
l := c.locationCache.GetAttribLocation(c, p, location)
|
||||
gl.VertexAttribPointer(mgl.Attrib(l), size, mgl.Enum(dataType), false, stride, offset)
|
||||
|
@ -46,7 +46,7 @@ func (a *arrayBufferLayout) totalBytes() int {
|
||||
}
|
||||
t := 0
|
||||
for _, p := range a.parts {
|
||||
t += Float.SizeInBytes() * p.num
|
||||
t += float.SizeInBytes() * p.num
|
||||
}
|
||||
a.total = t
|
||||
return a.total
|
||||
@ -65,8 +65,8 @@ func (a *arrayBufferLayout) enable(program program) {
|
||||
total := a.totalBytes()
|
||||
offset := 0
|
||||
for _, p := range a.parts {
|
||||
GetContext().vertexAttribPointer(program, p.name, p.num, Float, total, offset)
|
||||
offset += Float.SizeInBytes() * p.num
|
||||
GetContext().vertexAttribPointer(program, p.name, p.num, float, total, offset)
|
||||
offset += float.SizeInBytes() * p.num
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,8 +101,8 @@ func initializeArrayBuferLayout() {
|
||||
}
|
||||
}
|
||||
|
||||
func ArrayBufferLayoutTotalBytes() int {
|
||||
return theArrayBufferLayout.totalBytes()
|
||||
func ArrayBufferLayoutFloatNum() int {
|
||||
return theArrayBufferLayout.totalBytes() / float.SizeInBytes()
|
||||
}
|
||||
|
||||
// openGLState is a state for
|
||||
|
@ -21,13 +21,13 @@ type (
|
||||
operation int
|
||||
)
|
||||
|
||||
type DataType int
|
||||
type dataType int
|
||||
|
||||
func (d DataType) SizeInBytes() int {
|
||||
func (d dataType) SizeInBytes() int {
|
||||
switch d {
|
||||
case Short:
|
||||
case short:
|
||||
return 2
|
||||
case Float:
|
||||
case float:
|
||||
return 4
|
||||
default:
|
||||
panic("not reached")
|
||||
|
Loading…
Reference in New Issue
Block a user