mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
openg: Refactoring
This commit is contained in:
parent
de541bdd7d
commit
df23b57b16
@ -47,9 +47,7 @@ func (p Program) id() programID {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type context struct {
|
type context struct {
|
||||||
locationCache *locationCache
|
|
||||||
funcs chan func()
|
funcs chan func()
|
||||||
lastCompositeMode CompositeMode
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewContext() (*Context, error) {
|
func NewContext() (*Context, error) {
|
||||||
@ -70,10 +68,10 @@ func NewContext() (*Context, error) {
|
|||||||
dstAlpha: gl.DST_ALPHA,
|
dstAlpha: gl.DST_ALPHA,
|
||||||
oneMinusSrcAlpha: gl.ONE_MINUS_SRC_ALPHA,
|
oneMinusSrcAlpha: gl.ONE_MINUS_SRC_ALPHA,
|
||||||
oneMinusDstAlpha: gl.ONE_MINUS_DST_ALPHA,
|
oneMinusDstAlpha: gl.ONE_MINUS_DST_ALPHA,
|
||||||
|
locationCache: newLocationCache(),
|
||||||
|
lastCompositeMode: CompositeModeUnknown,
|
||||||
}
|
}
|
||||||
c.locationCache = newLocationCache()
|
|
||||||
c.funcs = make(chan func())
|
c.funcs = make(chan func())
|
||||||
c.lastCompositeMode = CompositeModeUnknown
|
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,9 +65,7 @@ func (p Program) id() programID {
|
|||||||
type context struct {
|
type context struct {
|
||||||
gl *webgl.Context
|
gl *webgl.Context
|
||||||
lastFramebuffer Framebuffer
|
lastFramebuffer Framebuffer
|
||||||
locationCache *locationCache
|
|
||||||
lastProgramID programID
|
lastProgramID programID
|
||||||
lastCompositeMode CompositeMode
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewContext() (*Context, error) {
|
func NewContext() (*Context, error) {
|
||||||
@ -112,10 +110,10 @@ func NewContext() (*Context, error) {
|
|||||||
dstAlpha: operation(gl.DST_ALPHA),
|
dstAlpha: operation(gl.DST_ALPHA),
|
||||||
oneMinusSrcAlpha: operation(gl.ONE_MINUS_SRC_ALPHA),
|
oneMinusSrcAlpha: operation(gl.ONE_MINUS_SRC_ALPHA),
|
||||||
oneMinusDstAlpha: operation(gl.ONE_MINUS_DST_ALPHA),
|
oneMinusDstAlpha: operation(gl.ONE_MINUS_DST_ALPHA),
|
||||||
|
locationCache: newLocationCache(),
|
||||||
|
lastCompositeMode: CompositeModeUnknown,
|
||||||
}
|
}
|
||||||
c.gl = gl
|
c.gl = gl
|
||||||
c.locationCache = newLocationCache()
|
|
||||||
c.lastCompositeMode = CompositeModeUnknown
|
|
||||||
c.init()
|
c.init()
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,6 @@ func (p Program) id() programID {
|
|||||||
|
|
||||||
type context struct {
|
type context struct {
|
||||||
gl mgl.Context
|
gl mgl.Context
|
||||||
locationCache *locationCache
|
|
||||||
lastCompositeMode CompositeMode
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewContext() *Context {
|
func NewContext() *Context {
|
||||||
@ -65,9 +63,9 @@ func NewContext() *Context {
|
|||||||
StaticDraw: mgl.STATIC_DRAW,
|
StaticDraw: mgl.STATIC_DRAW,
|
||||||
Triangles: mgl.TRIANGLES,
|
Triangles: mgl.TRIANGLES,
|
||||||
Lines: mgl.LINES,
|
Lines: mgl.LINES,
|
||||||
|
locationCache: newLocationCache(),
|
||||||
|
lastCompositeMode: CompositeModeUnknown,
|
||||||
}
|
}
|
||||||
c.locationCache = newLocationCache()
|
|
||||||
c.lastCompositeMode = CompositeModeUnknown
|
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ type Context struct {
|
|||||||
dstAlpha operation
|
dstAlpha operation
|
||||||
oneMinusSrcAlpha operation
|
oneMinusSrcAlpha operation
|
||||||
oneMinusDstAlpha operation
|
oneMinusDstAlpha operation
|
||||||
|
locationCache *locationCache
|
||||||
|
lastCompositeMode CompositeMode
|
||||||
context
|
context
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user