Transformer preprocessor for
include directives in
.glsl shader files.
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.
glsl_include_transformer to the transformer list in your
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>
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
Add this to your package's pubspec.yaml file:
dependencies: glsl_include_transformer: ^0.1.3
You can install packages from the command line:
$ pub get
Alternatively, your editor might support
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|0.1.3||Oct 22, 2016|
|0.1.2||Aug 30, 2016|
|0.1.1||Aug 27, 2016|
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.
Support Dart 2 in
The SDK constraint in
pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.
|Dart SDK||>=1.0.0 <2.0.0|