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

@luma.gl/shadertools

Package Overview
Dependencies
Maintainers
0
Versions
245
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@luma.gl/shadertools

Shader module system for luma.gl

  • 9.0.17
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
77K
decreased by-69.49%
Maintainers
0
Weekly downloads
 
Created

What is @luma.gl/shadertools?

@luma.gl/shadertools is a collection of tools for working with WebGL shaders. It provides utilities for shader transpilation, shader module management, and shader debugging, making it easier to develop and manage complex WebGL applications.

What are @luma.gl/shadertools's main functionalities?

Shader Transpilation

This feature allows you to transpile GLSL code to be compatible with different versions of WebGL. The code sample demonstrates how to transpile a simple GLSL fragment shader to WebGL2.

const { transpileShader } = require('@luma.gl/shadertools');
const glslCode = `
  void main() {
    gl_FragColor = vec4(1.0);
  }
`;
const transpiledCode = transpileShader(glslCode, { target: 'webgl2' });
console.log(transpiledCode);

Shader Module Management

This feature helps in managing and assembling shader modules. The code sample shows how to assemble vertex and fragment shaders along with additional shader modules.

const { assembleShaders } = require('@luma.gl/shadertools');
const vs = `
  attribute vec4 position;
  void main() {
    gl_Position = position;
  }
`;
const fs = `
  void main() {
    gl_FragColor = vec4(1.0);
  }
`;
const modules = [
  { name: 'module1', vs, fs }
];
const assembledShaders = assembleShaders({ vs, fs, modules });
console.log(assembledShaders);

Shader Debugging

This feature provides tools for parsing and debugging GLSL code. The code sample demonstrates how to parse a simple GLSL fragment shader to get an abstract syntax tree (AST) representation.

const { parseGLSL } = require('@luma.gl/shadertools');
const glslCode = `
  void main() {
    gl_FragColor = vec4(1.0);
  }
`;
const parsedShader = parseGLSL(glslCode);
console.log(parsedShader);

Other packages similar to @luma.gl/shadertools

Keywords

FAQs

Package last updated on 29 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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