Socket
Socket
Sign inDemoInstall

twgl.js

Package Overview
Dependencies
Maintainers
1
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twgl.js - npm Package Compare versions

Comparing version 4.19.5 to 4.20.0

3

dist/4.x/twgl-full.d.ts

@@ -261,2 +261,5 @@

export function createProgramFromSources(gl: WebGLRenderingContext, shaderSources: string[], opt_attribs?: ProgramOptions | string[] | ErrorCallback, opt_errorCallback?: ErrorCallback): WebGLProgram;
export function createUniformSettersAndUniformTree(gl: WebGLRenderingContext, program: WebGLProgram): {
[key: string]: (...params: any[]) => any;
};
export function createUniformSetters(gl: WebGLRenderingContext, program: WebGLProgram): {

@@ -263,0 +266,0 @@ [key: string]: (...params: any[]) => any;

@@ -261,2 +261,5 @@

export function createProgramFromSources(gl: WebGLRenderingContext, shaderSources: string[], opt_attribs?: ProgramOptions | string[] | ErrorCallback, opt_errorCallback?: ErrorCallback): WebGLProgram;
export function createUniformSettersAndUniformTree(gl: WebGLRenderingContext, program: WebGLProgram): {
[key: string]: (...params: any[]) => any;
};
export function createUniformSetters(gl: WebGLRenderingContext, program: WebGLProgram): {

@@ -263,0 +266,0 @@ [key: string]: (...params: any[]) => any;

2

package.json
{
"name": "twgl.js",
"version": "4.19.5",
"version": "4.20.0",
"description": "A Tiny WebGL helper library",

@@ -5,0 +5,0 @@ "main": "dist/4.x/twgl-full.js",

@@ -379,2 +379,47 @@ TWGL: A Tiny WebGL helper Library<div id="pronounce" style="font-size: xx-small;">[rhymes with wiggle]</div>

### Setting uniform and uniformblock structures and arrays
Given an array of GLSL structures like this
```glsl
struct Light {
float intensity;
float shininess;
vec4 color;
}
uniform Light lights[2];
```
TWGL
```javascript
const progInfo = twgl.createProgramInfo(gl, [vs, fs]);
...
twgl.setUniforms(progInfo, {
lights: [
{ intensity: 5.0, shininess: 100, color: [1, 0, 0, 1] },
{ intensity: 2.0, shininess: 50, color: [0, 0, 1, 1] },
],
})
```
WebGL
```javascript
// assuming we already compiled and linked the program
const light0IntensityLoc = gl.getUniformLocation('lights[0].intensity');
const light0ShininessLoc = gl.getUniformLocation('lights[0].shininess');
const light0ColorLoc = gl.getUniformLocation('lights[0].color');
const light1IntensityLoc = gl.getUniformLocation('lights[1].intensity');
const light1ShininessLoc = gl.getUniformLocation('lights[1].shininess');
const light1ColorLoc = gl.getUniformLocation('lights[1].color');
...
gl.uniform1f(light0IntensityLoc, 5.0);
gl.uniform1f(light0ShininessLoc, 100);
gl.uniform4fv(light0ColorLoc, [1, 0, 0, 1]);
gl.uniform1f(light1IntensityLoc, 2.0);
gl.uniform1f(light1ShininessLoc, 50);
gl.uniform4fv(light1ColorLoc, [0, 0, 1, 1]);
```
### Compare

@@ -381,0 +426,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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