Rename Framebuffer.framebuffer -> Framebuffer.native

This commit is contained in:
Hajime Hoshi 2014-12-31 18:00:53 +09:00
parent cdcc46543b
commit 4e3beb65f0

View File

@ -35,7 +35,7 @@ func orthoProjectionMatrix(left, right, bottom, top int) [4][4]float64 {
} }
type Framebuffer struct { type Framebuffer struct {
framebuffer opengl.Framebuffer native opengl.Framebuffer
width int width int
height int height int
flipY bool flipY bool
@ -51,13 +51,13 @@ func NewZeroFramebuffer(c *opengl.Context, width, height int) (*Framebuffer, err
} }
func NewFramebufferFromTexture(c *opengl.Context, texture *Texture) (*Framebuffer, error) { func NewFramebufferFromTexture(c *opengl.Context, texture *Texture) (*Framebuffer, error) {
framebuffer, err := c.NewFramebuffer(opengl.Texture(texture.native)) f, err := c.NewFramebuffer(opengl.Texture(texture.native))
if err != nil { if err != nil {
return nil, err return nil, err
} }
w, h := texture.Size() w, h := texture.Size()
return &Framebuffer{ return &Framebuffer{
framebuffer: framebuffer, native: f,
width: w, width: w,
height: h, height: h,
}, nil }, nil
@ -68,13 +68,13 @@ func (f *Framebuffer) Size() (width, height int) {
} }
func (f *Framebuffer) Dispose() { func (f *Framebuffer) Dispose() {
f.framebuffer.Delete() f.native.Delete()
} }
func (f *Framebuffer) setAsViewport() error { func (f *Framebuffer) setAsViewport() error {
width := internal.NextPowerOf2Int(f.width) width := internal.NextPowerOf2Int(f.width)
height := internal.NextPowerOf2Int(f.height) height := internal.NextPowerOf2Int(f.height)
return f.framebuffer.SetAsViewport(width, height) return f.native.SetAsViewport(width, height)
} }
func (f *Framebuffer) projectionMatrix() [4][4]float64 { func (f *Framebuffer) projectionMatrix() [4][4]float64 {
@ -102,7 +102,7 @@ func (f *Framebuffer) Fill(r, g, b, a float64) error {
if err := f.setAsViewport(); err != nil { if err := f.setAsViewport(); err != nil {
return err return err
} }
return f.framebuffer.Fill(r, g, b, a) return f.native.Fill(r, g, b, a)
} }
func (f *Framebuffer) DrawTexture(c *opengl.Context, t *Texture, quads TextureQuads, geo, clr Matrix) error { func (f *Framebuffer) DrawTexture(c *opengl.Context, t *Texture, quads TextureQuads, geo, clr Matrix) error {