pub struct TextureLoader;Expand description
three.js’ TextureLoader.
Implementations§
Source§impl TextureLoader
impl TextureLoader
Sourcepub fn load<P: AsRef<Path>>(&self, url: P) -> Result<Texture, Error>
pub fn load<P: AsRef<Path>>(&self, url: P) -> Result<Texture, Error>
new TextureLoader().load( url ). The loader leaves every Texture
default in place — flipY true, generateMipmaps true,
LinearFilter / LinearMipmapLinearFilter, ClampToEdgeWrapping,
anisotropy 1, NoColorSpace (the example never sets colorSpace, so
uv_grid_opengl.jpg is sampled as raw bytes and no sRGB decode
happens in the shader).
Sourcepub fn from_bytes(
&self,
bytes: &[u8],
mime_type: Option<&str>,
) -> Result<Texture, Error>
pub fn from_bytes( &self, bytes: &[u8], mime_type: Option<&str>, ) -> Result<Texture, Error>
The bytes of an image the loader never sees as a file: a glTF image
stored in the BIN chunk or a data URI. ImageBitmapLoader /
createImageBitmap in the browser; here the decode is picked by the
glTF mimeType when there is one and by the file’s magic otherwise,
because images[ i ].mimeType is only required for a bufferView
source.
The Texture comes back with the same defaults load() gives one;
GLTFLoader is what sets flipY, the wrapping and the colour space.