mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
Resolve TODOs
This commit is contained in:
parent
02b1f7d798
commit
636ae84ad5
@ -28,8 +28,6 @@ const (
|
|||||||
screenHeight = 240
|
screenHeight = 240
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: Add Key.String() by stringer
|
|
||||||
|
|
||||||
var keyNames = map[ebiten.Key]string{
|
var keyNames = map[ebiten.Key]string{
|
||||||
ebiten.KeyBackspace: "Backspace",
|
ebiten.KeyBackspace: "Backspace",
|
||||||
ebiten.KeyComma: "','",
|
ebiten.KeyComma: "','",
|
||||||
|
@ -39,10 +39,10 @@ type TextureQuads interface {
|
|||||||
|
|
||||||
var initialized = false
|
var initialized = false
|
||||||
|
|
||||||
// TODO: Use unsafe.SizeOf?
|
|
||||||
const float32Size = 4
|
|
||||||
|
|
||||||
func DrawTexture(c *opengl.Context, texture opengl.Texture, projectionMatrix *[4][4]float64, quads TextureQuads, geo Matrix, color Matrix) error {
|
func DrawTexture(c *opengl.Context, texture opengl.Texture, projectionMatrix *[4][4]float64, quads TextureQuads, geo Matrix, color Matrix) error {
|
||||||
|
// unsafe.SizeOf can't be used because unsafe doesn't work with GopherJS.
|
||||||
|
const float32Size = 4
|
||||||
|
|
||||||
// TODO: Check len(quads) and gl.MAX_ELEMENTS_INDICES?
|
// TODO: Check len(quads) and gl.MAX_ELEMENTS_INDICES?
|
||||||
const stride = 4 * 4
|
const stride = 4 * 4
|
||||||
if !initialized {
|
if !initialized {
|
||||||
@ -56,7 +56,6 @@ func DrawTexture(c *opengl.Context, texture opengl.Texture, projectionMatrix *[4
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Check performance
|
|
||||||
program := useProgramColorMatrix(c, glMatrix(projectionMatrix), geo, color)
|
program := useProgramColorMatrix(c, glMatrix(projectionMatrix), geo, color)
|
||||||
|
|
||||||
// TODO: Do we have to call gl.ActiveTexture(gl.TEXTURE0)?
|
// TODO: Do we have to call gl.ActiveTexture(gl.TEXTURE0)?
|
||||||
|
@ -46,8 +46,7 @@ func initialize(c *opengl.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const stride = 4 * 4
|
const stride = 4 * 4
|
||||||
v := make([]float32, stride*size)
|
c.NewBuffer(c.ArrayBuffer, stride*size, c.DynamicDraw)
|
||||||
c.NewBuffer(c.ArrayBuffer, v, c.DynamicDraw)
|
|
||||||
|
|
||||||
indices := make([]uint16, 6*size)
|
indices := make([]uint16, 6*size)
|
||||||
for i := uint16(0); i < size; i++ {
|
for i := uint16(0); i < size; i++ {
|
||||||
@ -70,7 +69,6 @@ func useProgramColorMatrix(c *opengl.Context, projectionMatrix []float32, geo Ma
|
|||||||
c.UseProgram(programColorMatrix)
|
c.UseProgram(programColorMatrix)
|
||||||
lastProgram = programColorMatrix
|
lastProgram = programColorMatrix
|
||||||
}
|
}
|
||||||
// TODO: Check the performance.
|
|
||||||
program := programColorMatrix
|
program := programColorMatrix
|
||||||
|
|
||||||
c.UniformFloats(program, "projection_matrix", projectionMatrix)
|
c.UniformFloats(program, "projection_matrix", projectionMatrix)
|
||||||
|
@ -35,7 +35,6 @@ func shader(c *opengl.Context, id shaderId) string {
|
|||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Create version 100 for WebGL
|
|
||||||
var shaders = map[shaderId]string{
|
var shaders = map[shaderId]string{
|
||||||
shaderVertex: `
|
shaderVertex: `
|
||||||
uniform highp mat4 projection_matrix;
|
uniform highp mat4 projection_matrix;
|
||||||
|
@ -259,7 +259,6 @@ func (c *Context) NewBuffer(bufferType BufferType, v interface{}, bufferUsageTyp
|
|||||||
gl := c.gl
|
gl := c.gl
|
||||||
b := gl.CreateBuffer()
|
b := gl.CreateBuffer()
|
||||||
gl.BindBuffer(int(bufferType), b)
|
gl.BindBuffer(int(bufferType), b)
|
||||||
// TODO: Can we assign integer to gl.bufferData?
|
|
||||||
gl.BufferData(int(bufferType), v, int(bufferUsageType))
|
gl.BufferData(int(bufferType), v, int(bufferUsageType))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user