* Checks if the source data for this texture has changed (if it's * easy to do so) and reuploads the texture if necessary. If it's not * possible or to expensive to do a calculation to determine wheter or * not the data has occurred, this method simply re-uploads the texture.
()
| 180 | * not the data has occurred, this method simply re-uploads the texture. |
| 181 | */ |
| 182 | update() { |
| 183 | const textureData = this._getTextureDataFromSource(); |
| 184 | if (!textureData) return false; |
| 185 | |
| 186 | let updated = false; |
| 187 | |
| 188 | if (this._shouldUpdate(textureData)) { |
| 189 | this.bindTexture(); |
| 190 | this._renderer.uploadTextureFromSource(this.textureHandle, textureData); |
| 191 | updated = true; |
| 192 | } |
| 193 | |
| 194 | return updated; |
| 195 | } |
| 196 | |
| 197 | _shouldUpdate(textureData) { |
| 198 | const data = this.src; |
no test coverage detected