Refactoring

This commit is contained in:
Hajime Hoshi 2013-10-19 18:33:55 +09:00
parent b594624105
commit 78755c9b09

View File

@ -176,18 +176,14 @@ func (context *Context) flush() {
func (context *Context) projectionMatrix() [16]float32 { func (context *Context) projectionMatrix() [16]float32 {
texture := context.currentOffscreen texture := context.currentOffscreen
var e11, e22, e41, e42 float32 e11 := float32(2) / float32(texture.textureWidth)
if texture != context.mainFramebufferTexture { e22 := float32(2) / float32(texture.textureHeight)
e11 = float32(2) / float32(texture.textureWidth) e41 := float32(-1)
e22 = float32(2) / float32(texture.textureHeight) e42 := float32(-1)
e41 = -1
e42 = -1 if texture == context.mainFramebufferTexture {
} else { e22 *= -1
height := float32(texture.height) e42 += float32(texture.height)/float32(texture.textureHeight)*2
e11 = float32(2) / float32(texture.textureWidth)
e22 = -1 * float32(2) / float32(texture.textureHeight)
e41 = -1
e42 = -1 + height/float32(texture.textureHeight)*2
} }
return [...]float32{ return [...]float32{