mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/mipmap: refactoring
This commit is contained in:
parent
5e820be911
commit
e6807794f2
@ -74,19 +74,21 @@ func (m *Mipmap) DrawTriangles(srcs [graphics.ShaderSrcImageCount]*Mipmap, verti
|
||||
if !canSkipMipmap && srcs[0] != nil && canUseMipmap(srcs[0].imageType) {
|
||||
level = math.MaxInt32
|
||||
for i := 0; i < len(indices); i += 3 {
|
||||
const n = graphics.VertexFloatCount
|
||||
dx0 := vertices[n*indices[i]+0]
|
||||
dy0 := vertices[n*indices[i]+1]
|
||||
sx0 := vertices[n*indices[i]+2]
|
||||
sy0 := vertices[n*indices[i]+3]
|
||||
dx1 := vertices[n*indices[i+1]+0]
|
||||
dy1 := vertices[n*indices[i+1]+1]
|
||||
sx1 := vertices[n*indices[i+1]+2]
|
||||
sy1 := vertices[n*indices[i+1]+3]
|
||||
dx2 := vertices[n*indices[i+2]+0]
|
||||
dy2 := vertices[n*indices[i+2]+1]
|
||||
sx2 := vertices[n*indices[i+2]+2]
|
||||
sy2 := vertices[n*indices[i+2]+3]
|
||||
idx0 := indices[i]
|
||||
idx1 := indices[i+1]
|
||||
idx2 := indices[i+2]
|
||||
dx0 := vertices[graphics.VertexFloatCount*idx0]
|
||||
dy0 := vertices[graphics.VertexFloatCount*idx0+1]
|
||||
sx0 := vertices[graphics.VertexFloatCount*idx0+2]
|
||||
sy0 := vertices[graphics.VertexFloatCount*idx0+3]
|
||||
dx1 := vertices[graphics.VertexFloatCount*idx1]
|
||||
dy1 := vertices[graphics.VertexFloatCount*idx1+1]
|
||||
sx1 := vertices[graphics.VertexFloatCount*idx1+2]
|
||||
sy1 := vertices[graphics.VertexFloatCount*idx1+3]
|
||||
dx2 := vertices[graphics.VertexFloatCount*idx2]
|
||||
dy2 := vertices[graphics.VertexFloatCount*idx2+1]
|
||||
sx2 := vertices[graphics.VertexFloatCount*idx2+2]
|
||||
sy2 := vertices[graphics.VertexFloatCount*idx2+3]
|
||||
if l := mipmapLevelFromDistance(dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1); level > l {
|
||||
level = l
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user