mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
parent
2a5a0a8895
commit
ce9274a29d
18
image.go
18
image.go
@ -391,12 +391,14 @@ type DrawTrianglesOptions struct {
|
||||
}
|
||||
|
||||
// MaxIndicesCount is the maximum number of indices for DrawTriangles and DrawTrianglesShader.
|
||||
const MaxIndicesCount = graphics.IndicesCount
|
||||
//
|
||||
// Deprecated: as of v2.6. This constant is no longer used.
|
||||
const MaxIndicesCount = (1 << 16) / 3 * 3
|
||||
|
||||
// MaxIndicesNum is the maximum number of indices for DrawTriangles and DrawTrianglesShader.
|
||||
//
|
||||
// Deprecated: as of v2.4. Use MaxIndicesCount instead.
|
||||
const MaxIndicesNum = graphics.IndicesCount
|
||||
// Deprecated: as of v2.4. This constant is no longer used.
|
||||
const MaxIndicesNum = MaxIndicesCount
|
||||
|
||||
// DrawTriangles draws triangles with the specified vertices and their indices.
|
||||
//
|
||||
@ -410,8 +412,6 @@ const MaxIndicesNum = graphics.IndicesCount
|
||||
//
|
||||
// If len(indices) is not multiple of 3, DrawTriangles panics.
|
||||
//
|
||||
// If len(indices) is more than MaxIndicesCount, DrawTriangles panics.
|
||||
//
|
||||
// The rule in which DrawTriangles works effectively is same as DrawImage's.
|
||||
//
|
||||
// When the given image is disposed, DrawTriangles panics.
|
||||
@ -430,9 +430,6 @@ func (i *Image) DrawTriangles(vertices []Vertex, indices []uint16, img *Image, o
|
||||
if len(indices)%3 != 0 {
|
||||
panic("ebiten: len(indices) % 3 must be 0")
|
||||
}
|
||||
if len(indices) > MaxIndicesCount {
|
||||
panic("ebiten: len(indices) must be <= MaxIndicesCount")
|
||||
}
|
||||
// TODO: Check the maximum value of indices and len(vertices)?
|
||||
|
||||
if options == nil {
|
||||
@ -556,8 +553,6 @@ var _ [len(DrawTrianglesShaderOptions{}.Images) - graphics.ShaderImageCount]stru
|
||||
//
|
||||
// If len(indices) is not multiple of 3, DrawTrianglesShader panics.
|
||||
//
|
||||
// If len(indices) is more than MaxIndicesCount, DrawTrianglesShader panics.
|
||||
//
|
||||
// When a specified image is non-nil and is disposed, DrawTrianglesShader panics.
|
||||
//
|
||||
// When the image i is disposed, DrawTrianglesShader does nothing.
|
||||
@ -571,9 +566,6 @@ func (i *Image) DrawTrianglesShader(vertices []Vertex, indices []uint16, shader
|
||||
if len(indices)%3 != 0 {
|
||||
panic("ebiten: len(indices) % 3 must be 0")
|
||||
}
|
||||
if len(indices) > MaxIndicesCount {
|
||||
panic("ebiten: len(indices) must be <= MaxIndicesCount")
|
||||
}
|
||||
// TODO: Check the maximum value of indices and len(vertices)?
|
||||
|
||||
if options == nil {
|
||||
|
@ -2742,7 +2742,7 @@ func TestIndicesOverflow(t *testing.T) {
|
||||
|
||||
op := &ebiten.DrawTrianglesOptions{}
|
||||
vs := make([]ebiten.Vertex, 3)
|
||||
is := make([]uint16, graphics.IndicesCount/3*3)
|
||||
is := make([]uint16, graphics.MaxVertexCount/3*3)
|
||||
dst.DrawTriangles(vs, is, src, op)
|
||||
|
||||
// Cause an overflow for indices.
|
||||
@ -2813,7 +2813,7 @@ func TestVerticesOverflow(t *testing.T) {
|
||||
src.Fill(color.White)
|
||||
|
||||
op := &ebiten.DrawTrianglesOptions{}
|
||||
vs := make([]ebiten.Vertex, graphics.IndicesCount-1)
|
||||
vs := make([]ebiten.Vertex, graphics.MaxVertexCount-1)
|
||||
is := make([]uint16, 3)
|
||||
dst.DrawTriangles(vs, is, src, op)
|
||||
|
||||
@ -2885,7 +2885,7 @@ func TestTooManyVertices(t *testing.T) {
|
||||
src.Fill(color.White)
|
||||
|
||||
op := &ebiten.DrawTrianglesOptions{}
|
||||
vs := make([]ebiten.Vertex, graphics.IndicesCount+1)
|
||||
vs := make([]ebiten.Vertex, graphics.MaxVertexCount+1)
|
||||
is := make([]uint16, 3)
|
||||
dst.DrawTriangles(vs, is, src, op)
|
||||
|
||||
|
@ -51,10 +51,6 @@ const (
|
||||
16 // the projection matrix
|
||||
)
|
||||
|
||||
const (
|
||||
IndicesCount = (1 << 16) / 3 * 3 // Adjust num for triangles. TODO: Remove this (#2460).
|
||||
)
|
||||
|
||||
const (
|
||||
VertexFloatCount = 8
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user