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.84 to 0.0.85

2

package.json
{
"name": "ogl",
"version": "0.0.84",
"version": "0.0.85",
"description": "WebGL Library",

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

@@ -114,5 +114,2 @@ import { Geometry } from '../core/Geometry.js';

// Create uniforms for scene lights (TODO: light linking?)
const lights = this.parseLights(gl, desc);
// Place nodes in skeletons

@@ -128,2 +125,5 @@ this.populateSkins(skins, nodes);

// Create uniforms for scene lights (TODO: light linking?)
const lights = this.parseLights(gl, desc, nodes, scenes);
// Remove null nodes (instanced transforms)

@@ -662,2 +662,3 @@ for (let i = nodes.length; i >= 0; i--) if (!nodes[i]) nodes.splice(i, 1);

node.extras = extras;
node.extensions = extensions;

@@ -750,43 +751,2 @@ // Need to attach to node as may have same material but different lightmap

static parseLights(gl, desc) {
const lights = {
directional: [],
point: [],
spot: [],
};
// uses KHR_lights_punctual extension
const lightsDescArray = desc.extensions?.KHR_lights_punctual?.lights || [];
// Need nodes for transforms
desc.nodes.forEach((node) => {
if (!node.extensions?.KHR_lights_punctual) return;
const lightIndex = node.extensions.KHR_lights_punctual.light;
const lightDesc = lightsDescArray[lightIndex];
const light = {
name: lightDesc.name || '',
color: { value: new Vec3().set(lightDesc.color || 1) },
};
// Apply intensity directly to color
if (lightDesc.intensity !== undefined) light.color.value.multiply(lightDesc.intensity);
switch (lightDesc.type) {
case 'directional':
light.direction = { value: new Vec3(0, 0, 1).applyQuaternion(node.rotation) };
break;
case 'point':
light.position = { value: new Vec3().set(node.translation) };
light.distance = { value: lightDesc.range };
light.decay = { value: 2 };
break;
case 'spot':
// TODO: support spot uniforms
Object.assign(light, lightDesc);
break;
}
lights[lightDesc.type].push(light);
});
return lights;
}
static populateSkins(skins, nodes) {

@@ -878,2 +838,48 @@ if (!skins) return;

}
static parseLights(gl, desc, nodes, scenes) {
const lights = {
directional: [],
point: [],
spot: [],
};
// Update matrices on root nodes
scenes.forEach((scene) => scene.forEach((node) => node.updateMatrixWorld()));
// uses KHR_lights_punctual extension
const lightsDescArray = desc.extensions?.KHR_lights_punctual?.lights || [];
// Need nodes for transforms
nodes.forEach((node) => {
if (!node.extensions?.KHR_lights_punctual) return;
const lightIndex = node.extensions.KHR_lights_punctual.light;
const lightDesc = lightsDescArray[lightIndex];
const light = {
name: lightDesc.name || '',
color: { value: new Vec3().set(lightDesc.color || 1) },
};
// Apply intensity directly to color
if (lightDesc.intensity !== undefined) light.color.value.multiply(lightDesc.intensity);
switch (lightDesc.type) {
case 'directional':
light.direction = { value: new Vec3(0, 0, 1).transformDirection(node.worldMatrix) };
break;
case 'point':
light.position = { value: new Vec3().applyMatrix4(node.worldMatrix) };
light.distance = { value: lightDesc.range };
light.decay = { value: 2 };
break;
case 'spot':
// TODO: support spot uniforms
Object.assign(light, lightDesc);
break;
}
lights[lightDesc.type].push(light);
});
return lights;
}
}
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