npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

shaded

v1.1.0

Published

glsl fragment shader viewer and browser

Downloads

15

Readme

shaded is a development tool for writing and previewing glsl fragment shaders, in the spirit of:

Features

  1. Bring your own text editor.

  2. Run your shader while you code, with hot reloading on save.

  3. Share and reuse code with glslify:

    #pragma glslify: noise = require('glsl-noise/simplex/2d')
    #pragma glslify: smoothUnion = require('./smoothUnion')
  4. Built in uniforms (compatible with The Book of Shaders):

    uniform vec2 u_resolution;
    uniform vec2 u_mouse;
    uniform float u_time;
  5. Texture loading by comment:

    uniform sampler2D bump; // ../textures/brick_wall.jpg

All of these features are available in atom-glsl-preview, but I switched from Atom to VSCode a while back, so I wanted to be able to write shaders in any text editor. vscode-glsl-canvas is pretty great, but doesn't support glslify or simple texture loading. Instead of tying myself to a particular editor, I decided to write a more generic tool that simply worked with my file system and a browser.

NOTE: If you're coming from atom-glsl-preview, the behavior of u_mouse has changed: instead of providing normalized mouse coordinates (0 to 1), u_mouse will match the coordinates of gl_FragCoord (divide by u_resolution to get back to normalized coordinates). This makes the behavior match that of The Book of Shaders editor.

As in recent versions of atom-glsl-preview, no precision specifiers or uniform declarations will be added to your shader automatically—what you code is what you get.

Install

npm

npm install --global shaded

Or, with yarn:

yarn global add shaded

Usage

Start the server in the current directory:

$ shaded
shaded listening at http://localhost:3000

Open http://localhost:3000 in your browser to see a listing of the files in the current directory. Navigating to a file ending with the extension .glsl will open a page showing the shader in a WebGL canvas.

Examples

  • /examples in this repository
  • https://fordhurley.com/shaders
  • https://github.com/fordhurley/shaders

Development

  • Start the build "watchers":

     yarn run server-watch
     yarn run frontend-watch
  • Start the server (needs to be manually restarted after a change):

     node dist/server/index.js
  • Open a browser to the examples: http://localhost:3000/examples

Publishing

shaded is automatically published to npm by Github Actions when a new release is created in the Github repository.

Before each release:

  1. Manually test all of the examples.
  2. Update CHANGELOG.md.
  3. Bump the version number in package.json, following semver.

Then, create a Release in the Github UI.

TODO

  • More testing (especially cross platform/browser).
  • Show/copy original source and "compiled" (glslified) source.
  • Show line errors when viewing source.
  • Custom file extensions.
  • Browse "gallery" with previews.
  • Play/pause controls.
  • Export frames/video.
  • Custom uniform sliders.
  • Custom programmable uniforms (e.g. mouse clicks, keyboard, date).
  • Video textures.
  • Multiple buffers.