GetTexture2D returns a pointer to an instance of the Texture2D with the specified id in the Collada document and an error. If no previous instance of the texture was found it is created.
(id string)
| 75 | // with the specified id in the Collada document and an error. |
| 76 | // If no previous instance of the texture was found it is created. |
| 77 | func (d *Decoder) GetTexture2D(id string) (*texture.Texture2D, error) { |
| 78 | |
| 79 | // If texture already created, returns it |
| 80 | tex := d.tex2D[id] |
| 81 | if tex != nil { |
| 82 | return tex, nil |
| 83 | } |
| 84 | |
| 85 | // Creates texture and saves it associated with its id |
| 86 | tex, err := d.NewTexture2D(id) |
| 87 | if err != nil { |
| 88 | return nil, err |
| 89 | } |
| 90 | d.tex2D[id] = tex |
| 91 | return tex, nil |
| 92 | } |
| 93 | |
| 94 | // NewTexture2D creates and returns a pointer to a new Texture2D |
| 95 | // from the specified sampler2D id/url in the dom |
no test coverage detected