mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/graphicsdriver: bug fix: render semi-transparent vectors correctly
Closes #1933
This commit is contained in:
parent
1f17a63084
commit
202f642395
@ -43,7 +43,7 @@ const (
|
|||||||
screenHeight = 480
|
screenHeight = 480
|
||||||
)
|
)
|
||||||
|
|
||||||
func drawEbitenText(screen *ebiten.Image) {
|
func drawEbitenText(screen *ebiten.Image, counter int) {
|
||||||
var path vector.Path
|
var path vector.Path
|
||||||
|
|
||||||
// E
|
// E
|
||||||
@ -119,6 +119,7 @@ func drawEbitenText(screen *ebiten.Image) {
|
|||||||
vs[i].ColorR = 0xdb / float32(0xff)
|
vs[i].ColorR = 0xdb / float32(0xff)
|
||||||
vs[i].ColorG = 0x56 / float32(0xff)
|
vs[i].ColorG = 0x56 / float32(0xff)
|
||||||
vs[i].ColorB = 0x20 / float32(0xff)
|
vs[i].ColorB = 0x20 / float32(0xff)
|
||||||
|
vs[i].ColorA = float32((counter/30)%2)/2 + 0.5
|
||||||
}
|
}
|
||||||
screen.DrawTriangles(vs, is, emptySubImage, op)
|
screen.DrawTriangles(vs, is, emptySubImage, op)
|
||||||
}
|
}
|
||||||
@ -245,7 +246,7 @@ func (g *Game) Update() error {
|
|||||||
|
|
||||||
func (g *Game) Draw(screen *ebiten.Image) {
|
func (g *Game) Draw(screen *ebiten.Image) {
|
||||||
screen.Fill(color.White)
|
screen.Fill(color.White)
|
||||||
drawEbitenText(screen)
|
drawEbitenText(screen, g.counter)
|
||||||
drawEbitenLogo(screen, 20, 90)
|
drawEbitenLogo(screen, 20, 90)
|
||||||
drawArc(screen, g.counter)
|
drawArc(screen, g.counter)
|
||||||
drawWave(screen, g.counter)
|
drawWave(screen, g.counter)
|
||||||
|
@ -737,13 +737,13 @@ func (g *Graphics) Initialize() error {
|
|||||||
BackFaceStencil: mtl.StencilDescriptor{
|
BackFaceStencil: mtl.StencilDescriptor{
|
||||||
StencilFailureOperation: mtl.StencilOperationKeep,
|
StencilFailureOperation: mtl.StencilOperationKeep,
|
||||||
DepthFailureOperation: mtl.StencilOperationKeep,
|
DepthFailureOperation: mtl.StencilOperationKeep,
|
||||||
DepthStencilPassOperation: mtl.StencilOperationKeep,
|
DepthStencilPassOperation: mtl.StencilOperationZero,
|
||||||
StencilCompareFunction: mtl.CompareFunctionNotEqual,
|
StencilCompareFunction: mtl.CompareFunctionNotEqual,
|
||||||
},
|
},
|
||||||
FrontFaceStencil: mtl.StencilDescriptor{
|
FrontFaceStencil: mtl.StencilDescriptor{
|
||||||
StencilFailureOperation: mtl.StencilOperationKeep,
|
StencilFailureOperation: mtl.StencilOperationKeep,
|
||||||
DepthFailureOperation: mtl.StencilOperationKeep,
|
DepthFailureOperation: mtl.StencilOperationKeep,
|
||||||
DepthStencilPassOperation: mtl.StencilOperationKeep,
|
DepthStencilPassOperation: mtl.StencilOperationZero,
|
||||||
StencilCompareFunction: mtl.CompareFunctionNotEqual,
|
StencilCompareFunction: mtl.CompareFunctionNotEqual,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -520,6 +520,6 @@ func (c *context) beginStencilWithEvenOddRule() {
|
|||||||
|
|
||||||
func (c *context) endStencilWithEvenOddRule() {
|
func (c *context) endStencilWithEvenOddRule() {
|
||||||
gl.StencilFunc(gl.NOTEQUAL, 0x00, 0xff)
|
gl.StencilFunc(gl.NOTEQUAL, 0x00, 0xff)
|
||||||
gl.StencilOp(gl.KEEP, gl.KEEP, gl.KEEP)
|
gl.StencilOp(gl.KEEP, gl.KEEP, gl.ZERO)
|
||||||
gl.ColorMask(true, true, true, true)
|
gl.ColorMask(true, true, true, true)
|
||||||
}
|
}
|
||||||
|
@ -660,6 +660,6 @@ func (c *context) beginStencilWithEvenOddRule() {
|
|||||||
func (c *context) endStencilWithEvenOddRule() {
|
func (c *context) endStencilWithEvenOddRule() {
|
||||||
gl := c.gl
|
gl := c.gl
|
||||||
gl.stencilFunc.Invoke(gles.NOTEQUAL, 0x00, 0xff)
|
gl.stencilFunc.Invoke(gles.NOTEQUAL, 0x00, 0xff)
|
||||||
gl.stencilOp.Invoke(gles.KEEP, gles.KEEP, gles.KEEP)
|
gl.stencilOp.Invoke(gles.KEEP, gles.KEEP, gles.ZERO)
|
||||||
gl.colorMask.Invoke(true, true, true, true)
|
gl.colorMask.Invoke(true, true, true, true)
|
||||||
}
|
}
|
||||||
|
@ -488,6 +488,6 @@ func (c *context) beginStencilWithEvenOddRule() {
|
|||||||
|
|
||||||
func (c *context) endStencilWithEvenOddRule() {
|
func (c *context) endStencilWithEvenOddRule() {
|
||||||
c.ctx.StencilFunc(gles.NOTEQUAL, 0x00, 0xff)
|
c.ctx.StencilFunc(gles.NOTEQUAL, 0x00, 0xff)
|
||||||
c.ctx.StencilOp(gles.KEEP, gles.KEEP, gles.KEEP)
|
c.ctx.StencilOp(gles.KEEP, gles.KEEP, gles.ZERO)
|
||||||
c.ctx.ColorMask(true, true, true, true)
|
c.ctx.ColorMask(true, true, true, true)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user