Capítulo 773 de 859

Chapter 773: Source

Core Idea

Represents the data source of a texture.

The main purpose of this class is to decouple the data definition from the texture definition so the same data can be used with multiple texture instances.

Key Concepts

  • data : any: The data definition of a texture.
  • dataReady : boolean: This property is only relevant when Source#needsUpdate is set to true and provides more control on how texture…
  • id : number (readonly): The ID of the source.
  • isSource : boolean (readonly): This flag can be used for type testing.
  • needsUpdate : boolean: When the property is set to true, the engine allocates the memory for the texture (if necessary) and triggers the actual texture upload t…
  • uuid : string (readonly): The UUID of the source.
  • version : number (readonly): This starts at 0 and counts how many times Source#needsUpdate is set to true.

Reference Tables

Constructor

Signature
new Source( data : any )

Properties

PropertyDescription
.data : anyThe data definition of a texture.
.dataReady : booleanThis property is only relevant when Source#needsUpdate is set to true and provides more control on how texture data should be processed. When dataReady is set to `false…
.id : number (readonly)The ID of the source.
.isSource : boolean (readonly)This flag can be used for type testing.
.needsUpdate : booleanWhen the property is set to true, the engine allocates the memory for the texture (if necessary) and triggers the actual texture upload to the GPU next time the source is used.
.uuid : string (readonly)The UUID of the source.
.version : number (readonly)This starts at 0 and counts how many times Source#needsUpdate is set to true.

Methods

MethodDescription
`.getSize( target : Vector2Vector3 ) : Vector2
`.toJSON( meta : Objectstring ) : Object`

Key Takeaways

  1. Most relevant properties: data, dataReady, id, isSource.
  2. Key methods: getSize, toJSON.

Connects To