New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ogl

Package Overview
Dependencies
Maintainers
1
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ogl - npm Package Compare versions

Comparing version 0.0.113 to 0.0.114

2

package.json
{
"name": "ogl",
"version": "0.0.113",
"version": "0.0.114",
"description": "WebGL Library",

@@ -5,0 +5,0 @@ "exports": "./src/index.mjs",

@@ -5,4 +5,4 @@ let supportedFormat;

export class BasisManager {
constructor(workerSrc) {
if (!supportedFormat) supportedFormat = this.getSupportedFormat();
constructor(workerSrc, canvas) {
if (!supportedFormat) supportedFormat = this.getSupportedFormat(canvas);
this.onMessage = this.onMessage.bind(this);

@@ -13,4 +13,4 @@ this.queue = new Map();

getSupportedFormat() {
const gl = document.createElement('canvas').getContext('webgl');
getSupportedFormat(canvas = document.createElement('canvas')) {
const gl = canvas.getContext('webgl');
/* if (!!gl.getExtension('WEBGL_compressed_texture_etc')) {

@@ -17,0 +17,0 @@ return 'etc2';

@@ -9,2 +9,13 @@ import { Texture } from '../core/Texture.js';

const isCreateImageBitmap = (() => {
const isChrome = navigator.userAgent.toLowerCase().includes('chrome');
if (!isChrome) return false;
try {
createImageBitmap;
} catch (e) {
return false;
}
return true;
})();
export class TextureLoader {

@@ -143,7 +154,4 @@ static load(

// Check for WebP support
if (detectWebP()) supportedExtensions.push('webp');
// Formats supported by all
supportedExtensions.push('png', 'jpg');
supportedExtensions.push('png', 'jpg', 'webp');

@@ -185,6 +193,2 @@ return supportedExtensions;

function detectWebP() {
return document.createElement('canvas').toDataURL('image/webp').indexOf('data:image/webp') == 0;
}
function powerOfTwo(value) {

@@ -197,8 +201,6 @@ // (width & (width - 1)) !== 0

return new Promise((resolve) => {
// Only chrome's implementation of createImageBitmap is fully supported
const isChrome = navigator.userAgent.toLowerCase().includes('chrome');
if (!!window.createImageBitmap && isChrome) {
if (isCreateImageBitmap) {
fetch(src, { mode: 'cors' })
.then(r => r.blob())
.then(b => createImageBitmap(b, { imageOrientation: flipY ? 'flipY' : 'none', premultiplyAlpha: 'none' }))
.then((r) => r.blob())
.then((b) => createImageBitmap(b, { imageOrientation: flipY ? 'flipY' : 'none', premultiplyAlpha: 'none' }))
.then(resolve);

@@ -205,0 +207,0 @@ } else {

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