Metadata-Version: 2.4
Name: ogre-glslwright
Version: 0.1.1
Summary: Standalone shader-graph editor for Ogre/GLSL materials.
Author-email: Laturb <laturb@posteo.net>
License-Expression: MIT
Keywords: glsl,Ogre3D,dearImGui,Node editor
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.12.0
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ogre-python>=14.6.1
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: wheel; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# ogre-glslwright

Standalone shader-graph editor for Ogre/GLSL materials, extracted from
Opengate's `tools/assetsViewer` shader-graph tooling so it can run without
the Opengate game package.

![grafik](/uploads/76d295fb8d9d836494e2705c204aa729/grafik.png){width=900 height=550}

Standalone app needs (`ogre-meshviewer`)[https://github.com/OGRECave/ogre-meshviewer] in the root folder. It resuses it completly as base app without modify it.

The node editor is strongly inspired by blender shader editor.

Note. Its firstly supposed to be a toy and showcase, if there are interest or some needs it can be further developed to be some usefull tool maybe.


## Features

* Live node editor for glsl fragmentshader
* writes Ogre *.program *.material and *_FS.glsl and the node graph as *.toml
* uses Ogre3D RTSS shader as shader library
* uses noise from https://github.com/stegu/webgl-noise
* uses Ogre-Meshviewer as Main render environment
* only a few nodes available (right click for list)
* undo/redo, zoom/pan, grouping


## Usage

* to run the app you need a copy of ogre-meshviewer in the root path.

Call it e.g.:

```bash
./ogre_glslwright mesh/ico_sphere.mesh examples/greenHullDamage.toml
```

* `Middle-click` to pan the canvas
* `Scroll` to zoom in/out
* `Right-click` to open the node context menu
* `Left-click` draw lasso to select multiple nodes
* `Del` | `x` to delete selected nodes
* `Shift-D` to duplicate selection
* groups can be folded/unfolded (`double-click` the group header)
* `Ctrl-click` on node header connect output direct to the output surface input
* `Right-click` on connection to delete it
* Drop a node on a connection line to automatically create a connection


## Known limitations and issues

* Until I found a way to activate Imgui textinput in raw python, there is no save name selection and no edit of group names by single click on group header.
* Tool bar is very clunky for now
* No reopen the overlay if had be closed.
* Saveing overwrites the original *.toml
* no AA in standalone app
* weird display scaling for windows 10 and 4K monitor

## TODO if needed

* fix Issues
* more nodes
* texture backing
* vertex shader support (displacment?)
* extra viewport?
* pypi package
* ...


## Layout

- `pyproject.toml` - standard setuptools/src-layout project.
- `src/glslwright/` - pure-python core: graph data model, ogre- and imgui helper.
- `tests/` - a few unit tests for the core package.
- `examples` - some example files.
- `mesh` - reference icosphere.


## Setup

Since `Ogre3d-14.6.1` it works out of the box with `ogre-python` and `ogre-meshviewer` installed. (Tested on win10 and linux)

Clone repos.

```bash
git clone https://github.com/Turb/ogre-glslwright.git
cd ogre-glslwright
git clone https://github.com/OGRECave/ogre-meshviewer.git
```

and install it.

```bash
python3.12 -m venv .venv
source .venv/bin/activate
pip install -e .
```

And run example:

```bash
python ogre_glslwright mesh/ico_sphere.mesh examples/testBumpNode.toml
```

