Socket
Book a DemoInstallSign in
Socket

single-shader-loader

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

single-shader-loader

Glsl shader loader from webpack

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

single-shader-loader

Glsl shader loader from webpack. You can combine vertex and fragment in a single file.

Install

npm install single-shader-loader --save-dev

Config webpack:

module: [
  rules: [
    {
      test: /\.(shader|glsl)$/,
      loader: 'single-shader-loader',
    },
  ]
]

Example

You can code ./shader/example.shader as:

varying vec3 vAlpha; // It's going to be filled in both vertex and fragment.

vertex:
attribute float aAlpha;
void main() {
  vAlpha = aAlpha;
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}

fragment:
void main() {
  gl_FragColor = vec4(color, vAlpha);
}

You can now require your glsl file:

import { vertex, fragment } from './shader/example.shader';
const material = new THREE.ShaderMaterial({
  vertexShader:   vertex,
  fragmentShader: fragment,
});

Keywords

glsl

FAQs

Package last updated on 23 Nov 2018

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.