typesl
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

TypeSL

TypeSL (Typescript Shader Language) enables Typescript -> GLSL Transpile.

Table of Contents
  1. TypeSL
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License

Example

vert(attribute: RectangleAttribute, uniform: RectangleUniform): RectangleVarying {
    const positionVec4 = new Vec4(attribute.aPosition, 1.0);
    this.gl_Position = uniform.uProjectionMatrix * uniform.uModelViewMatrix * positionVec4;

    return {
        vTexCoord: attribute.aTexCoord
    };
}

transpiles to

#version 300 es
precision highp float;

attribute vec3 aPosition;
attribute vec2 aTexCoord;

varying vec2 vTexCoord;

uniform mat4 uProjectionMatrix;
uniform mat4 uModelViewMatrix;

void main() {
    vec4 positionVec4 = vec4(aPosition, 1.0);
    gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;
    vTexCoord = aTexCoord;
}

Getting Started

Prerequisites

  1. NodeJS

NodeJS is a javascript runtime. This will enables run tslc.

  1. npm

npm (Node Package Manager) is package manager for nodejs, you need this for install TypeSL transpiler.

Installation

npm install (-g) typesl

or

yarn (global) add typesl

Usage

tslc {target file}

Roadmap

  • CLI support (sorry)
  • Fragment shader (sorry)
  • Geometry shader
  • Operator methods
  • Core profile

Contributing

Pull request and issues always open!

License

MIT License

Readme

Keywords

none

Package Sidebar

Install

npm i typesl

Weekly Downloads

1

Version

0.4.0

License

MIT

Unpacked Size

112 kB

Total Files

25

Last publish

Collaborators

  • sier-vr