You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Transitioning to a file-based system for shaders and projects would greatly enhance the app's functionality. This approach would enable the use of #include directives, allow per-project image assets, and facilitate editing additional file types in the future.
Concept
Project Structure
Instead of a list of shaders, the app will feature a file explorer within the drawer, accompanied by Open Project and Open Recent Project menu items. The Open Recent Project menu will include a submenu listing the last N (default: 10) opened projects.
Project Properties
Comprises multiple files within a directory.
Has a main shader entry point (default: ./main.frag).
Supports #include directives.
Contains an optional shader-project.json configuration file:
"main": overrides the entry point file.
"assetPaths": specifies paths to search for asset descriptors (default: ["${prefix}/.assets", "./assets/"]).
"includePath": specifies the include path list (default: ["${prefix}/.include"]).
Image Handling
Images can be stored within the project and referenced using comments within GLSL code:
/// @src {./res/something.jpg}uniformsampler2D myImage;
/// Example using ./res/pic.json from asset pathuniformsampler2D alsoWorks; ///< @src {pic}/// Example using the resource by uniform name/// This uses first noise.json found in "assetPaths"uniformsampler2D noise;
Asset Descriptor JSON
The JSON descriptor for assets, generated from the add texture fragment, follows this structure:
Motivation
Transitioning to a file-based system for shaders and projects would greatly enhance the app's functionality. This approach would enable the use of
#include
directives, allow per-project image assets, and facilitate editing additional file types in the future.Concept
Project Structure
Instead of a list of shaders, the app will feature a file explorer within the drawer, accompanied by
Open Project
andOpen Recent Project
menu items. TheOpen Recent Project
menu will include a submenu listing the lastN
(default: 10) opened projects.Project Properties
./main.frag
).#include
directives.shader-project.json
configuration file:"main"
: overrides the entry point file."assetPaths"
: specifies paths to search for asset descriptors (default:["${prefix}/.assets", "./assets/"]
)."includePath"
: specifies the include path list (default:["${prefix}/.include"]
).Image Handling
Images can be stored within the project and referenced using comments within GLSL code:
Asset Descriptor JSON
The JSON descriptor for assets, generated from the
add texture
fragment, follows this structure:JSON Schema
Migration Plan
To ensure a seamless transition with no data loss or need for source code refactoring, the following actions are necessary:
Add shaders from database file
option in settings and automatically execute this action when first opening the app afzer the update.Migration Procedure
main.frag
.${prefix}/.assets
) path and generate corresponding asset descriptor.json
files.Requirements
File Explorer UI
+
button for creating files or directories.⋮
button at the end of each item opens a menu:⋮
button at the top end of the view opens a menu:#include
Directive#include "..."
: Searches relative to the current file first.#include <...>
: Searches"includePath"
first.shader-project.json
Minimal Version
Open Project
shall work.*.glsl
,*.frag
) shall open the file<some-name>
,uniform sampler2D <some-name>
shall load the first<some-name>.json
found in the project's"assetPaths"
.#include
shall work.shader-project.json
shall work.The text was updated successfully, but these errors were encountered: