@babylonjs/controls
Advanced tools
Comparing version 1.0.0-alpha.8 to 1.0.0-alpha.9
@@ -40,4 +40,4 @@ import { Engine } from "@babylonjs/core/Engines/engine"; | ||
/** | ||
* This will resize the texture to fit in the canvas size. | ||
* @param input defines the picture input we want to resize. It can be the url of a texture, another canvas or a video element. | ||
* This will filter the input and directly displays the result in the output. | ||
* @param input defines the picture input we want to filter. It can be the url of a texture, another canvas or a video element. | ||
* @param filter defines the effect to use to filter the image. | ||
@@ -48,4 +48,4 @@ * @returns a promise to know when the rendering is done. | ||
/** | ||
* This will return a Babylon texture resized to a chosen size. | ||
* @param textureData defines the picture input we want to resize. It can be the url of a texture, another canvas or a video element. | ||
* This will return a filtered Babylon texture. | ||
* @param textureData defines the picture input we want to filter. It can be the url of a texture, another canvas or a video element. | ||
* @param size defines the The chosen size of the texture on GPU. | ||
@@ -61,2 +61,10 @@ * @param filter defines the effect to use to filter the image. | ||
/** | ||
* This renders the effects using the current input babylon texture. This method | ||
* is better to use in realtime rendering of an effect as it does not generate any | ||
* promise or extra lamdas. | ||
* @param inputTexture defines the babylon texture to use as an input. | ||
* @param filter defines the effect to use to filter the image. | ||
*/ | ||
render(inputTexture: BaseTexture, filter: PostProcess | EffectWrapper): void; | ||
/** | ||
* Resizes the timeline to adapt to the new canvas size. | ||
@@ -73,3 +81,2 @@ * The canvas has to be resized before hand. | ||
private _initializeRenderer; | ||
private _render; | ||
} |
@@ -45,4 +45,4 @@ import { EffectWrapper, EffectRenderer } from "@babylonjs/core/Materials/effectRenderer"; | ||
/** | ||
* This will resize the texture to fit in the canvas size. | ||
* @param input defines the picture input we want to resize. It can be the url of a texture, another canvas or a video element. | ||
* This will filter the input and directly displays the result in the output. | ||
* @param input defines the picture input we want to filter. It can be the url of a texture, another canvas or a video element. | ||
* @param filter defines the effect to use to filter the image. | ||
@@ -61,3 +61,3 @@ * @returns a promise to know when the rendering is done. | ||
// Once the input is ready, Render the texture as a full target quad. | ||
this._render(inputTexture, filter); | ||
this.render(inputTexture, filter); | ||
// Free up memory resources from the input. | ||
@@ -73,4 +73,4 @@ inputTexture.dispose(); | ||
/** | ||
* This will return a Babylon texture resized to a chosen size. | ||
* @param textureData defines the picture input we want to resize. It can be the url of a texture, another canvas or a video element. | ||
* This will return a filtered Babylon texture. | ||
* @param textureData defines the picture input we want to filter. It can be the url of a texture, another canvas or a video element. | ||
* @param size defines the The chosen size of the texture on GPU. | ||
@@ -104,3 +104,3 @@ * @param filter defines the effect to use to filter the image. | ||
// Render the texture as a full target quad. | ||
this._render(inputTexture, filter); | ||
this.render(inputTexture, filter); | ||
// Unsets the output texture. | ||
@@ -116,2 +116,3 @@ this.engine.unBindFramebuffer(outputTexture); | ||
}; | ||
// Defers until the input texture is ready. | ||
const checkIsReady = (() => { | ||
@@ -130,2 +131,30 @@ if (inputTexture.isReady()) { | ||
/** | ||
* This renders the effects using the current input babylon texture. This method | ||
* is better to use in realtime rendering of an effect as it does not generate any | ||
* promise or extra lamdas. | ||
* @param inputTexture defines the babylon texture to use as an input. | ||
* @param filter defines the effect to use to filter the image. | ||
*/ | ||
render(inputTexture, filter) { | ||
if (!filter) { | ||
Logger.Error("Please, specify at least a post process or an effectWrapper in the options."); | ||
return; | ||
} | ||
if (!inputTexture.isReady()) { | ||
return; | ||
} | ||
let effect; | ||
if (filter instanceof PostProcess) { | ||
effect = filter.getEffect(); | ||
this._effectRenderer.bindBuffers(effect); | ||
filter.apply(); | ||
} | ||
else if (filter instanceof EffectWrapper) { | ||
effect = filter.effect; | ||
this._effectRenderer.applyEffectWrapper(filter); | ||
} | ||
effect.setTexture("textureSampler", inputTexture); | ||
this._effectRenderer.draw(); | ||
} | ||
/** | ||
* Resizes the timeline to adapt to the new canvas size. | ||
@@ -156,21 +185,3 @@ * The canvas has to be resized before hand. | ||
} | ||
_render(inputTexture, filter) { | ||
if (!filter) { | ||
Logger.Error("Please, specify at least a post process or an effectWrapper in the options."); | ||
return; | ||
} | ||
let effect; | ||
if (filter instanceof PostProcess) { | ||
effect = filter.getEffect(); | ||
this._effectRenderer.bindBuffers(effect); | ||
filter.apply(); | ||
} | ||
else if (filter instanceof EffectWrapper) { | ||
effect = filter.effect; | ||
this._effectRenderer.applyEffectWrapper(filter); | ||
} | ||
effect.setTexture("textureSampler", inputTexture); | ||
this._effectRenderer.draw(); | ||
} | ||
} | ||
//# sourceMappingURL=imageFilter.js.map |
{ | ||
"name": "@babylonjs/controls", | ||
"version": "1.0.0-alpha.8", | ||
"version": "1.0.0-alpha.9", | ||
"description": "Babylon.js controls are a set of regular web controls that used hardware accelerated rendering through Babylon.js to provide blazing fast dedicated controls.", | ||
@@ -5,0 +5,0 @@ "author": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131126
1214