GithubHelp home page GithubHelp logo

rsschermer / glsl_include_transformer.dart Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 7 KB

Transformer preprocessor for include directives in GLSL shader files.

License: BSD 3-Clause "New" or "Revised" License

Dart 100.00%

glsl_include_transformer.dart's Introduction

glsl_include_transformer.dart

Transformer preprocessor for include directives in .glsl shader files.

Build Status

C-style include preprocessor directives are a basic way to reuse code snippets across multitple files. However, although OpenGL/WebGL implementations support most C-style preprocessor directives, include is a notable exception. This package adds support for include preprocessor directives through a Pub transformer that performs an additional preprocessing step at build time.

Usage

Add the glsl_include_transformer to the transformer list in your pubspec.yaml:

transformers:
  - glsl_include_transformer

This transformer will substitute include directives in .glsl files with the contents of the file they reference:

// Gets replaced with the contents of partials/my_shader_partial.glsl
#include "partials/my_shader_partial.glsl"

// Or alternatively, if you prefer angle brackets
#include <partials/my_shader_partial.glsl>

The include directive must reference a URI enclosed in double quotes or angle brackets. Unlike in C or C++ preprocessors there is no semantic difference between double quotes or angle brackets. The URI must be a relative URI (absolute URIs are not allowed):

// my_package/lib/shaders/my_shader.glsl

// Includes my_package|lib/shaders/partials/some_shader_partial.glsl
#include "partials/some_shader_partial.glsl"

A URI may reach into another package via the packages directory:

// my_package/lib/shaders/my_shader.glsl

// Includes some_package|lib/shaders/some_shader_partial.glsl
#include "../../packages/some_package/shaders/some_shader_partial.glsl"

You may only reference files in another package's lib directory. Note that URIs that reference another package should not contain a lib segment.

glsl_include_transformer.dart's People

Contributors

rsschermer avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.