graphics: Hide Texture/Framebuffer

This commit is contained in:
Hajime Hoshi 2016-06-12 01:41:50 +09:00
parent eca175e0f4
commit 68c19d7cae
3 changed files with 23 additions and 23 deletions

View File

@ -72,7 +72,7 @@ func FlushCommands(context *opengl.Context) error {
}
type fillCommand struct {
dst *Framebuffer
dst *framebuffer
color color.Color
}
@ -90,8 +90,8 @@ func (c *fillCommand) Exec(context *opengl.Context) error {
}
type drawImageCommand struct {
dst *Framebuffer
src *Texture
dst *framebuffer
src *texture
vertices []int16
geo Matrix
color Matrix
@ -127,8 +127,8 @@ func (c *drawImageCommand) Exec(context *opengl.Context) error {
}
type replacePixelsCommand struct {
dst *Framebuffer
texture *Texture
dst *framebuffer
texture *texture
pixels []uint8
}
@ -147,8 +147,8 @@ func (c *replacePixelsCommand) Exec(context *opengl.Context) error {
}
type disposeCommand struct {
framebuffer *Framebuffer
texture *Texture
framebuffer *framebuffer
texture *texture
}
func (c *disposeCommand) Exec(context *opengl.Context) error {
@ -162,8 +162,8 @@ func (c *disposeCommand) Exec(context *opengl.Context) error {
}
type newImageFromImageCommand struct {
texture *Texture
framebuffer *Framebuffer
texture *texture
framebuffer *framebuffer
img *image.RGBA
filter opengl.Filter
}
@ -192,8 +192,8 @@ func (c *newImageFromImageCommand) Exec(context *opengl.Context) error {
}
type newImageCommand struct {
texture *Texture
framebuffer *Framebuffer
texture *texture
framebuffer *framebuffer
width int
height int
filter opengl.Filter

View File

@ -34,7 +34,7 @@ func orthoProjectionMatrix(left, right, bottom, top int) *[4][4]float64 {
}
}
type Framebuffer struct {
type framebuffer struct {
native opengl.Framebuffer
width int
height int
@ -43,7 +43,7 @@ type Framebuffer struct {
}
func NewZeroFramebufferImage(width, height int) (*Image, error) {
f := &Framebuffer{
f := &framebuffer{
width: width,
height: height,
flipY: true,
@ -53,7 +53,7 @@ func NewZeroFramebufferImage(width, height int) (*Image, error) {
}, nil
}
func (f *Framebuffer) initFromTexture(context *opengl.Context, texture *Texture) error {
func (f *framebuffer) initFromTexture(context *opengl.Context, texture *texture) error {
native, err := context.NewFramebuffer(opengl.Texture(texture.native))
if err != nil {
return err
@ -75,13 +75,13 @@ func (i *Image) Dispose() error {
const viewportSize = 4096
func (f *Framebuffer) setAsViewport(c *opengl.Context) error {
func (f *framebuffer) setAsViewport(c *opengl.Context) error {
width := viewportSize
height := viewportSize
return c.SetViewport(f.native, width, height)
}
func (f *Framebuffer) projectionMatrix() *[4][4]float64 {
func (f *framebuffer) projectionMatrix() *[4][4]float64 {
if f.proMatrix != nil {
return f.proMatrix
}

View File

@ -44,11 +44,11 @@ func adjustImageForTexture(img *image.RGBA) *image.RGBA {
}
type Image struct {
texture *Texture
framebuffer *Framebuffer
texture *texture
framebuffer *framebuffer
}
type Texture struct {
type texture struct {
native opengl.Texture
width int
height int
@ -56,8 +56,8 @@ type Texture struct {
func NewImage(width, height int, filter opengl.Filter) (*Image, error) {
i := &Image{
texture: &Texture{},
framebuffer: &Framebuffer{},
texture: &texture{},
framebuffer: &framebuffer{},
}
c := &newImageCommand{
texture: i.texture,
@ -72,8 +72,8 @@ func NewImage(width, height int, filter opengl.Filter) (*Image, error) {
func NewImageFromImage(img *image.RGBA, filter opengl.Filter) (*Image, error) {
i := &Image{
texture: &Texture{},
framebuffer: &Framebuffer{},
texture: &texture{},
framebuffer: &framebuffer{},
}
c := &newImageFromImageCommand{
texture: i.texture,