mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
internal/graphicsdriver: rename constants
This commit is contained in:
parent
272d0c6a3f
commit
1d9f1474e9
@ -45,17 +45,17 @@ type BlendFactor int
|
|||||||
const (
|
const (
|
||||||
BlendFactorZero BlendFactor = iota
|
BlendFactorZero BlendFactor = iota
|
||||||
BlendFactorOne
|
BlendFactorOne
|
||||||
BlendFactorSrcAlpha
|
BlendFactorSourceAlpha
|
||||||
BlendFactorDstAlpha
|
BlendFactorDestinationAlpha
|
||||||
BlendFactorOneMinusSrcAlpha
|
BlendFactorOneMinusSourceAlpha
|
||||||
BlendFactorOneMinusDstAlpha
|
BlendFactorOneMinusDestinationAlpha
|
||||||
BlendFactorDstColor
|
BlendFactorDestinationColor
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c CompositeMode) BlendFactors() (src BlendFactor, dst BlendFactor) {
|
func (c CompositeMode) BlendFactors() (src BlendFactor, dst BlendFactor) {
|
||||||
switch c {
|
switch c {
|
||||||
case CompositeModeSourceOver:
|
case CompositeModeSourceOver:
|
||||||
return BlendFactorOne, BlendFactorOneMinusSrcAlpha
|
return BlendFactorOne, BlendFactorOneMinusSourceAlpha
|
||||||
case CompositeModeClear:
|
case CompositeModeClear:
|
||||||
return BlendFactorZero, BlendFactorZero
|
return BlendFactorZero, BlendFactorZero
|
||||||
case CompositeModeCopy:
|
case CompositeModeCopy:
|
||||||
@ -63,25 +63,25 @@ func (c CompositeMode) BlendFactors() (src BlendFactor, dst BlendFactor) {
|
|||||||
case CompositeModeDestination:
|
case CompositeModeDestination:
|
||||||
return BlendFactorZero, BlendFactorOne
|
return BlendFactorZero, BlendFactorOne
|
||||||
case CompositeModeDestinationOver:
|
case CompositeModeDestinationOver:
|
||||||
return BlendFactorOneMinusDstAlpha, BlendFactorOne
|
return BlendFactorOneMinusDestinationAlpha, BlendFactorOne
|
||||||
case CompositeModeSourceIn:
|
case CompositeModeSourceIn:
|
||||||
return BlendFactorDstAlpha, BlendFactorZero
|
return BlendFactorDestinationAlpha, BlendFactorZero
|
||||||
case CompositeModeDestinationIn:
|
case CompositeModeDestinationIn:
|
||||||
return BlendFactorZero, BlendFactorSrcAlpha
|
return BlendFactorZero, BlendFactorSourceAlpha
|
||||||
case CompositeModeSourceOut:
|
case CompositeModeSourceOut:
|
||||||
return BlendFactorOneMinusDstAlpha, BlendFactorZero
|
return BlendFactorOneMinusDestinationAlpha, BlendFactorZero
|
||||||
case CompositeModeDestinationOut:
|
case CompositeModeDestinationOut:
|
||||||
return BlendFactorZero, BlendFactorOneMinusSrcAlpha
|
return BlendFactorZero, BlendFactorOneMinusSourceAlpha
|
||||||
case CompositeModeSourceAtop:
|
case CompositeModeSourceAtop:
|
||||||
return BlendFactorDstAlpha, BlendFactorOneMinusSrcAlpha
|
return BlendFactorDestinationAlpha, BlendFactorOneMinusSourceAlpha
|
||||||
case CompositeModeDestinationAtop:
|
case CompositeModeDestinationAtop:
|
||||||
return BlendFactorOneMinusDstAlpha, BlendFactorSrcAlpha
|
return BlendFactorOneMinusDestinationAlpha, BlendFactorSourceAlpha
|
||||||
case CompositeModeXor:
|
case CompositeModeXor:
|
||||||
return BlendFactorOneMinusDstAlpha, BlendFactorOneMinusSrcAlpha
|
return BlendFactorOneMinusDestinationAlpha, BlendFactorOneMinusSourceAlpha
|
||||||
case CompositeModeLighter:
|
case CompositeModeLighter:
|
||||||
return BlendFactorOne, BlendFactorOne
|
return BlendFactorOne, BlendFactorOne
|
||||||
case CompositeModeMultiply:
|
case CompositeModeMultiply:
|
||||||
return BlendFactorDstColor, BlendFactorZero
|
return BlendFactorDestinationColor, BlendFactorZero
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("graphicsdriver: invalid composite mode: %d", c))
|
panic(fmt.Sprintf("graphicsdriver: invalid composite mode: %d", c))
|
||||||
}
|
}
|
||||||
|
@ -31,15 +31,15 @@ func blendFactorToBlend(c graphicsdriver.BlendFactor, alpha bool) _D3D12_BLEND {
|
|||||||
return _D3D12_BLEND_ZERO
|
return _D3D12_BLEND_ZERO
|
||||||
case graphicsdriver.BlendFactorOne:
|
case graphicsdriver.BlendFactorOne:
|
||||||
return _D3D12_BLEND_ONE
|
return _D3D12_BLEND_ONE
|
||||||
case graphicsdriver.BlendFactorSrcAlpha:
|
case graphicsdriver.BlendFactorSourceAlpha:
|
||||||
return _D3D12_BLEND_SRC_ALPHA
|
return _D3D12_BLEND_SRC_ALPHA
|
||||||
case graphicsdriver.BlendFactorDstAlpha:
|
case graphicsdriver.BlendFactorDestinationAlpha:
|
||||||
return _D3D12_BLEND_DEST_ALPHA
|
return _D3D12_BLEND_DEST_ALPHA
|
||||||
case graphicsdriver.BlendFactorOneMinusSrcAlpha:
|
case graphicsdriver.BlendFactorOneMinusSourceAlpha:
|
||||||
return _D3D12_BLEND_INV_SRC_ALPHA
|
return _D3D12_BLEND_INV_SRC_ALPHA
|
||||||
case graphicsdriver.BlendFactorOneMinusDstAlpha:
|
case graphicsdriver.BlendFactorOneMinusDestinationAlpha:
|
||||||
return _D3D12_BLEND_INV_DEST_ALPHA
|
return _D3D12_BLEND_INV_DEST_ALPHA
|
||||||
case graphicsdriver.BlendFactorDstColor:
|
case graphicsdriver.BlendFactorDestinationColor:
|
||||||
if alpha {
|
if alpha {
|
||||||
return _D3D12_BLEND_DEST_ALPHA
|
return _D3D12_BLEND_DEST_ALPHA
|
||||||
}
|
}
|
||||||
|
@ -306,15 +306,15 @@ func blendFactorToMetalBlendFactor(c graphicsdriver.BlendFactor) mtl.BlendFactor
|
|||||||
return mtl.BlendFactorZero
|
return mtl.BlendFactorZero
|
||||||
case graphicsdriver.BlendFactorOne:
|
case graphicsdriver.BlendFactorOne:
|
||||||
return mtl.BlendFactorOne
|
return mtl.BlendFactorOne
|
||||||
case graphicsdriver.BlendFactorSrcAlpha:
|
case graphicsdriver.BlendFactorSourceAlpha:
|
||||||
return mtl.BlendFactorSourceAlpha
|
return mtl.BlendFactorSourceAlpha
|
||||||
case graphicsdriver.BlendFactorDstAlpha:
|
case graphicsdriver.BlendFactorDestinationAlpha:
|
||||||
return mtl.BlendFactorDestinationAlpha
|
return mtl.BlendFactorDestinationAlpha
|
||||||
case graphicsdriver.BlendFactorOneMinusSrcAlpha:
|
case graphicsdriver.BlendFactorOneMinusSourceAlpha:
|
||||||
return mtl.BlendFactorOneMinusSourceAlpha
|
return mtl.BlendFactorOneMinusSourceAlpha
|
||||||
case graphicsdriver.BlendFactorOneMinusDstAlpha:
|
case graphicsdriver.BlendFactorOneMinusDestinationAlpha:
|
||||||
return mtl.BlendFactorOneMinusDestinationAlpha
|
return mtl.BlendFactorOneMinusDestinationAlpha
|
||||||
case graphicsdriver.BlendFactorDstColor:
|
case graphicsdriver.BlendFactorDestinationColor:
|
||||||
return mtl.BlendFactorDestinationColor
|
return mtl.BlendFactorDestinationColor
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("metal: invalid operation: %d", c))
|
panic(fmt.Sprintf("metal: invalid operation: %d", c))
|
||||||
|
@ -29,15 +29,15 @@ func convertBlendFactor(op graphicsdriver.BlendFactor) blendFactor {
|
|||||||
return zero
|
return zero
|
||||||
case graphicsdriver.BlendFactorOne:
|
case graphicsdriver.BlendFactorOne:
|
||||||
return one
|
return one
|
||||||
case graphicsdriver.BlendFactorSrcAlpha:
|
case graphicsdriver.BlendFactorSourceAlpha:
|
||||||
return srcAlpha
|
return srcAlpha
|
||||||
case graphicsdriver.BlendFactorDstAlpha:
|
case graphicsdriver.BlendFactorDestinationAlpha:
|
||||||
return dstAlpha
|
return dstAlpha
|
||||||
case graphicsdriver.BlendFactorOneMinusSrcAlpha:
|
case graphicsdriver.BlendFactorOneMinusSourceAlpha:
|
||||||
return oneMinusSrcAlpha
|
return oneMinusSrcAlpha
|
||||||
case graphicsdriver.BlendFactorOneMinusDstAlpha:
|
case graphicsdriver.BlendFactorOneMinusDestinationAlpha:
|
||||||
return oneMinusDstAlpha
|
return oneMinusDstAlpha
|
||||||
case graphicsdriver.BlendFactorDstColor:
|
case graphicsdriver.BlendFactorDestinationColor:
|
||||||
return dstColor
|
return dstColor
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("opengl: invalid blend factor %d at convertBlendFactor", op))
|
panic(fmt.Sprintf("opengl: invalid blend factor %d at convertBlendFactor", op))
|
||||||
|
Loading…
Reference in New Issue
Block a user