three#LinearFilter TypeScript Examples
The following examples show how to use
three#LinearFilter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DynamicFont.ts From FairyGUI-threejs with MIT License | 6 votes |
private createTexture(size: number): void {
this._canvas.width = this._canvas.height = size;
if (!this.mainTexture) {
this._texture = new Texture(this._canvas);
this._texture.generateMipmaps = false;
this._texture.magFilter = LinearFilter;
this._texture.minFilter = LinearFilter;
this.mainTexture = new NTexture(this._texture);
}
else {
this._texture.needsUpdate = true;
this.mainTexture.reload(this._texture);
}
this.clearTexture();
}
Example #2
Source File: UIPackage.ts From FairyGUI-threejs with MIT License | 6 votes |
function loadTexture(pi: PackageItem, onProgress?: (event: ProgressEvent) => void): Promise<void> {
return new Promise((resolve, reject) => {
new TextureLoader().load(pi.file,
texture => {
texture.generateMipmaps = false;
texture.magFilter = LinearFilter;
texture.minFilter = LinearFilter;
pi.texture = new NTexture(texture);
resolve();
},
onProgress,
ev => {
reject(ev.message);
});
});
}
Example #3
Source File: MapHeightNode.ts From geo-three with MIT License | 6 votes |
/**
* Load tile texture from the server.
*
* Aditionally in this height node it loads elevation data from the height provider and generate the appropiate maps.
*/
public async loadTexture(): Promise<void>
{
const texture = new Texture();
texture.image = await this.mapView.provider.fetchTile(this.level, this.x, this.y);
texture.generateMipmaps = false;
texture.format = RGBAFormat;
texture.magFilter = LinearFilter;
texture.minFilter = LinearFilter;
texture.needsUpdate = true;
// @ts-ignore
this.material.map = texture;
// @ts-ignore
this.material.needsUpdate = true;
this.textureLoaded = true;
this.nodeReady();
}
Example #4
Source File: MapHeightNodeShader.ts From geo-three with MIT License | 6 votes |
public async loadTexture(): Promise<void>
{
const image = await this.mapView.provider.fetchTile(this.level, this.x, this.y);
const texture = new Texture(image as any);
texture.generateMipmaps = false;
texture.format = RGBAFormat;
texture.magFilter = LinearFilter;
texture.minFilter = LinearFilter;
texture.needsUpdate = true;
// @ts-ignore
this.material.map = texture;
// @ts-ignore
this.material.needsUpdate = true;
this.textureLoaded = true;
this.nodeReady();
await this.loadHeightGeometry();
}
Example #5
Source File: MapNode.ts From geo-three with MIT License | 6 votes |
/**
* Load tile texture from the server.
*
* This base method assumes the existence of a material attribute with a map texture.
*/
public async loadTexture(): Promise<void>
{
try
{
const image: HTMLImageElement = await this.mapView.provider.fetchTile(this.level, this.x, this.y);
const texture = new Texture(image);
texture.generateMipmaps = false;
texture.format = RGBAFormat;
texture.magFilter = LinearFilter;
texture.minFilter = LinearFilter;
texture.needsUpdate = true;
// @ts-ignore
this.material.map = texture;
this.nodeReady();
}
catch (e)
{
const canvas = CanvasUtils.createOffscreenCanvas(1, 1);
const context = canvas.getContext('2d');
context.fillStyle = '#FF0000';
context.fillRect(0, 0, 1, 1);
const texture = new Texture(canvas as any);
texture.generateMipmaps = false;
texture.needsUpdate = true;
// @ts-ignore
this.material.map = texture;
this.nodeReady();
}
}