MCPcopy
hub / github.com/g3n/engine / GetTexture2D

Method GetTexture2D

loader/collada/material.go:77–92  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
77func (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

Callers 1

newPhongMaterialMethod · 0.95

Calls 1

NewTexture2DMethod · 0.95

Tested by

no test coverage detected