| 1 | // Copyright 2014 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | //go:build darwin || linux || windows |
| 6 | |
| 7 | // Package glsprite implements a sprite Engine using OpenGL ES 2. |
| 8 | // |
| 9 | // Each sprite.Texture is loaded as a GL texture object and drawn |
| 10 | // to the screen via an affine transform done in a simple shader. |
| 11 | package glspritescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/ |
| 12 | |
| 13 | import ( |
| 14 | "imagescip-go gomod github.com/golang/go/src go1.24.0 image/" |
| 15 | "image/drawscip-go gomod github.com/golang/go/src go1.24.0 `image/draw`/" |
| 16 | |
| 17 | "golang.org/x/mobile/event/sizescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/size`/" |
| 18 | "golang.org/x/mobile/exp/f32scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/f32`/" |
| 19 | "golang.org/x/mobile/exp/gl/glutilscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/gl/glutil`/" |
| 20 | "golang.org/x/mobile/exp/spritescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/" |
| 21 | "golang.org/x/mobile/exp/sprite/clockscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/clock`/" |
| 22 | "golang.org/x/mobile/geomscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/" |
| 23 | ) |
| 24 | |
| 25 | type nodescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/node# struct { |
| 26 | // TODO: move this into package sprite as Node.EngineFields.RelTransform?? |
| 27 | relTransformscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/node#relTransform. f32scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/f32`/.Affinescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/f32`/Affine# |
| 28 | } |
| 29 | |
| 30 | type texturescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture# struct { |
| 31 | escip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#e. *enginescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine# |
| 32 | glImagescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#glImage. *glutilscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/gl/glutil`/.Imagescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/gl/glutil`/Image# |
| 33 | bscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#b. imagescip-go gomod github.com/golang/go/src go1.24.0 image/.Rectanglescip-go gomod github.com/golang/go/src go1.24.0 image/Rectangle# |
| 34 | } |
| 35 | |
| 36 | func (t *texturescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#) Boundsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#Bounds().() (w, h int) { return t.bscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#b..Dxscip-go gomod github.com/golang/go/src go1.24.0 image/Rectangle#Dx().(), t.bscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#b..Dyscip-go gomod github.com/golang/go/src go1.24.0 image/Rectangle#Dy().() } |
| 37 | |
| 38 | func (t *texturescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#) Downloadscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#Download().(r imagescip-go gomod github.com/golang/go/src go1.24.0 image/.Rectanglescip-go gomod github.com/golang/go/src go1.24.0 image/Rectangle#, dst drawscip-go gomod github.com/golang/go/src go1.24.0 `image/draw`/.Imagescip-go gomod github.com/golang/go/src go1.24.0 `image/draw`/Image#) { |
| 39 | panic("TODO") |
| 40 | } |
| 41 | |
| 42 | func (t *texturescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#) Uploadscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#Upload().(r imagescip-go gomod github.com/golang/go/src go1.24.0 image/.Rectanglescip-go gomod github.com/golang/go/src go1.24.0 image/Rectangle#, src imagescip-go gomod github.com/golang/go/src go1.24.0 image/.Imagescip-go gomod github.com/golang/go/src go1.24.0 image/Image#) { |
| 43 | drawscip-go gomod github.com/golang/go/src go1.24.0 `image/draw`/.Drawscip-go gomod github.com/golang/go/src go1.24.0 `image/draw`/Draw().(t.glImagescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#glImage..RGBAscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/gl/glutil`/Image#RGBA., r, src, src.Boundsscip-go gomod github.com/golang/go/src go1.24.0 image/Image#Bounds().().Minscip-go gomod github.com/golang/go/src go1.24.0 image/Rectangle#Min., drawscip-go gomod github.com/golang/go/src go1.24.0 `image/draw`/.Srcscip-go gomod github.com/golang/go/src go1.24.0 `image/draw`/Src.) |
| 44 | t.glImagescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#glImage..Uploadscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/gl/glutil`/Image#Upload().() |
| 45 | } |
| 46 | |
| 47 | func (t *texturescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#) Releasescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#Release().() { |
| 48 | t.glImagescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#glImage..Releasescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/gl/glutil`/Image#Release().() |
| 49 | delete(t.escip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#e..texturesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#textures., t) |
| 50 | } |
| 51 | |
| 52 | // Engine creates an OpenGL-based sprite.Engine. |
| 53 | func Enginescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/Engine().(images *glutilscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/gl/glutil`/.Imagesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/gl/glutil`/Images#) spritescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/.Enginescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Engine# { |
| 54 | return &enginescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#{ |
| 55 | nodesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#nodes.: []*nodescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/node#{nil}, |
| 56 | imagesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#images.: images, |
| 57 | texturesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#textures.: make(map[*texturescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#]struct{}), |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | type enginescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine# struct { |
| 62 | imagesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#images. *glutilscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/gl/glutil`/.Imagesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/gl/glutil`/Images# |
| 63 | texturesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#textures. map[*texturescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#]struct{} |
| 64 | nodesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#nodes. []*nodescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/node# |
| 65 | |
| 66 | absTransformsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#absTransforms. []f32scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/f32`/.Affinescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/f32`/Affine# |
| 67 | } |
| 68 | |
| 69 | func (e *enginescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#) Registerscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#Register().(n *spritescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/.Nodescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#) { |
| 70 | if n.EngineFieldsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#EngineFields..Indexscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#$anon_d2259bd86e77f8aa#Index. != 0 { |
| 71 | panic("glsprite: sprite.Node already registered") |
| 72 | } |
| 73 | o := &nodescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/node#{} |
| 74 | o.relTransformscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/node#relTransform..Identityscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/f32`/Affine#Identity().() |
| 75 | |
| 76 | e.nodesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#nodes. = append(e.nodesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#nodes., o) |
| 77 | n.EngineFieldsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#EngineFields..Indexscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#$anon_d2259bd86e77f8aa#Index. = int32(len(e.nodesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#nodes.) - 1) |
| 78 | } |
| 79 | |
| 80 | func (e *enginescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#) Unregisterscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#Unregister().(n *spritescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/.Nodescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#) { |
| 81 | panic("todo") |
| 82 | } |
| 83 | |
| 84 | func (e *enginescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#) LoadTexturescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#LoadTexture().(src imagescip-go gomod github.com/golang/go/src go1.24.0 image/.Imagescip-go gomod github.com/golang/go/src go1.24.0 image/Image#) (spritescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/.Texturescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Texture#, error) { |
| 85 | b := src.Boundsscip-go gomod github.com/golang/go/src go1.24.0 image/Image#Bounds().() |
| 86 | t := &texturescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#{ |
| 87 | escip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#e.: e, |
| 88 | glImagescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#glImage.: e.imagesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#images..NewImagescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/gl/glutil`/Images#NewImage().(b.Dxscip-go gomod github.com/golang/go/src go1.24.0 image/Rectangle#Dx().(), b.Dyscip-go gomod github.com/golang/go/src go1.24.0 image/Rectangle#Dy().()), |
| 89 | bscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#b.: b, |
| 90 | } |
| 91 | e.texturesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#textures.[t] = struct{}{} |
| 92 | t.Uploadscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#Upload().(b, src) |
| 93 | // TODO: set "glImage.Pix = nil"?? We don't need the CPU-side image any more. |
| 94 | return t, nil |
| 95 | } |
| 96 | |
| 97 | func (e *enginescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#) SetSubTexscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#SetSubTex().(n *spritescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/.Nodescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#, x spritescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/.SubTexscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/SubTex#) { |
| 98 | n.EngineFieldsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#EngineFields..Dirtyscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#$anon_d2259bd86e77f8aa#Dirty. = true // TODO: do we need to propagate dirtiness up/down the tree? |
| 99 | n.EngineFieldsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#EngineFields..SubTexscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#$anon_d2259bd86e77f8aa#SubTex. = x |
| 100 | } |
| 101 | |
| 102 | func (e *enginescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#) SetTransformscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#SetTransform().(n *spritescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/.Nodescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#, m f32scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/f32`/.Affinescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/f32`/Affine#) { |
| 103 | n.EngineFieldsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#EngineFields..Dirtyscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#$anon_d2259bd86e77f8aa#Dirty. = true // TODO: do we need to propagate dirtiness up/down the tree? |
| 104 | e.nodesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#nodes.[n.EngineFieldsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#EngineFields..Indexscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#$anon_d2259bd86e77f8aa#Index.].relTransformscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/node#relTransform. = m |
| 105 | } |
| 106 | |
| 107 | func (e *enginescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#) Renderscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#Render().(scene *spritescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/.Nodescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#, t clockscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/clock`/.Timescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/clock`/Time#, sz sizescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/size`/.Eventscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/size`/Event#) { |
| 108 | e.absTransformsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#absTransforms. = append(e.absTransformsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#absTransforms.[:0], f32scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/f32`/.Affinescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/f32`/Affine#{ |
| 109 | {1, 0, 0}, |
| 110 | {0, 1, 0}, |
| 111 | }) |
| 112 | e.renderscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#render().(scene, t, sz) |
| 113 | } |
| 114 | |
| 115 | func (e *enginescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#) renderscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#render().(n *spritescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/.Nodescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#, t clockscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/clock`/.Timescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/clock`/Time#, sz sizescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/size`/.Eventscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/size`/Event#) { |
| 116 | if n.EngineFieldsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#EngineFields..Indexscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#$anon_d2259bd86e77f8aa#Index. == 0 { |
| 117 | panic("glsprite: sprite.Node not registered") |
| 118 | } |
| 119 | if n.Arrangerscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#Arranger. != nil { |
| 120 | n.Arrangerscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#Arranger..Arrangescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Arranger#Arrange.(e, n, t) |
| 121 | } |
| 122 | |
| 123 | // Push absTransforms. |
| 124 | // TODO: cache absolute transforms and use EngineFields.Dirty? |
| 125 | rel := &e.nodesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#nodes.[n.EngineFieldsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#EngineFields..Indexscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#$anon_d2259bd86e77f8aa#Index.].relTransformscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/node#relTransform. |
| 126 | m := f32scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/f32`/.Affinescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/f32`/Affine#{} |
| 127 | m.Mulscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/f32`/Affine#Mul().(&e.absTransformsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#absTransforms.[len(e.absTransformsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#absTransforms.)-1], rel) |
| 128 | e.absTransformsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#absTransforms. = append(e.absTransformsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#absTransforms., m) |
| 129 | |
| 130 | if x := n.EngineFieldsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#EngineFields..SubTexscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#$anon_d2259bd86e77f8aa#SubTex.; x.Tscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/SubTex#T. != nil { |
| 131 | x.Tscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/SubTex#T..(*texturescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#).glImagescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#glImage..Drawscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/gl/glutil`/Image#Draw().( |
| 132 | sz, |
| 133 | geomscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/.Pointscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/Point#{ |
| 134 | geomscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/.Ptscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/Pt#(m[0][2]), |
| 135 | geomscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/.Ptscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/Pt#(m[1][2]), |
| 136 | }, |
| 137 | geomscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/.Pointscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/Point#{ |
| 138 | geomscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/.Ptscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/Pt#(m[0][2] + m[0][0]), |
| 139 | geomscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/.Ptscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/Pt#(m[1][2] + m[1][0]), |
| 140 | }, |
| 141 | geomscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/.Pointscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/Point#{ |
| 142 | geomscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/.Ptscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/Pt#(m[0][2] + m[0][1]), |
| 143 | geomscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/.Ptscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/geom`/Pt#(m[1][2] + m[1][1]), |
| 144 | }, |
| 145 | x.Rscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/SubTex#R., |
| 146 | ) |
| 147 | } |
| 148 | |
| 149 | for c := n.FirstChildscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#FirstChild.; c != nil; c = c.NextSiblingscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite`/Node#NextSibling. { |
| 150 | e.renderscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#render().(c, t, sz) |
| 151 | } |
| 152 | |
| 153 | // Pop absTransforms. |
| 154 | e.absTransformsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#absTransforms. = e.absTransformsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#absTransforms.[:len(e.absTransformsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#absTransforms.)-1] |
| 155 | } |
| 156 | |
| 157 | func (e *enginescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#) Releasescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#Release().() { |
| 158 | for img := range e.texturesscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/engine#textures. { |
| 159 | img.Releasescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/exp/sprite/glsprite`/texture#Release().() |
| 160 | } |
| 161 | } |