Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@babylonjs/controls

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babylonjs/controls - npm Package Compare versions

Comparing version 1.0.0-alpha.4 to 1.0.0-alpha.5

17

dist/src/coreControls/elementToTexture.js

@@ -34,7 +34,18 @@ import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture";

const onload = () => {
htmlElementTexture.update(false);
htmlElementTexture.element = null;
const checkIsReady = (() => {
if (textureData.readyState < textureData.HAVE_ENOUGH_DATA) {
return;
}
engine.stopRenderLoop(checkIsReady);
htmlElementTexture.update(false);
// Try to not release too soon, it looks like
// it might cause glitches in older browsers.
setTimeout(() => {
htmlElementTexture.element = null;
}, 500);
}).bind(this);
engine.runRenderLoop(checkIsReady);
};
if (textureData instanceof HTMLVideoElement) {
if (textureData.readyState < textureData.HAVE_CURRENT_DATA) {
if (textureData.readyState < textureData.HAVE_ENOUGH_DATA) {
// Seek to 0 does not raise by default.

@@ -41,0 +52,0 @@ // Use loadedData instead

@@ -12,2 +12,4 @@ import { Engine } from "@babylonjs/core/Engines/engine";

export declare class Resizer extends BaseControl {
private readonly _generateMipMaps;
private readonly _textureFiltering;
private _effectRenderer;

@@ -14,0 +16,0 @@ private _effectWrapper;

32

dist/src/resizer/resizer.js

@@ -24,2 +24,4 @@ import { EffectWrapper, EffectRenderer } from "@babylonjs/core/Materials/effectRenderer";

super(parent);
this._generateMipMaps = this.engine.webGLVersion > 1;
this._textureFiltering = this._generateMipMaps ? Constants.TEXTURE_TRILINEAR_SAMPLINGMODE : Constants.TEXTURE_BILINEAR_SAMPLINGMODE;
// Initializes the resizer control.

@@ -44,7 +46,9 @@ this._initializeRenderer();

// Converts the texture data to an actual babylon.js texture.
const inputTexture = elementToTexture(this.engine, textureData, "input", true, Constants.TEXTURE_TRILINEAR_SAMPLINGMODE);
const inputTexture = elementToTexture(this.engine, textureData, "input", this._generateMipMaps, this._textureFiltering);
// Wraps the result in a promise to simplify usage.
return new Promise((success, _) => {
const checkIsReady = () => {
const checkIsReady = (() => {
if (inputTexture.isReady()) {
// Stops the check
this.engine.stopRenderLoop(checkIsReady);
// Once the input is ready, Render the texture as a full target quad.

@@ -57,10 +61,4 @@ this._render(inputTexture);

}
else {
// Regularly check the texture status to notify the promise success.
setTimeout(() => {
checkIsReady();
}, 100);
}
};
checkIsReady();
}).bind(this);
this.engine.runRenderLoop(checkIsReady);
});

@@ -77,3 +75,3 @@ }

// Converts the texture data to an actual babylon.js texture.
const inputTexture = elementToTexture(this.engine, textureData, "input", true, Constants.TEXTURE_TRILINEAR_SAMPLINGMODE);
const inputTexture = elementToTexture(this.engine, textureData, "input", this._generateMipMaps, this._textureFiltering);
// Creates an offscreen texture to render to.

@@ -110,13 +108,9 @@ const outputTexture = this.engine.createRenderTargetTexture(size, {

};
const checkIsReady = () => {
const checkIsReady = (() => {
if (inputTexture.isReady()) {
this.engine.stopRenderLoop(checkIsReady);
render();
}
else {
setTimeout(() => {
checkIsReady();
}, 100);
}
};
checkIsReady();
}).bind(this);
this.engine.runRenderLoop(checkIsReady);
// Wraps the lower level texture in a more friendly one.

@@ -123,0 +117,0 @@ const texture = new BaseTexture(null);

{
"name": "@babylonjs/controls",
"version": "1.0.0-alpha.4",
"version": "1.0.0-alpha.5",
"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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc