Skip to content

Commit

Permalink
Cleanup examples
Browse files Browse the repository at this point in the history
  • Loading branch information
seanisom committed Mar 31, 2024
1 parent f6bca8a commit cdf4610
Show file tree
Hide file tree
Showing 14 changed files with 323 additions and 252 deletions.
205 changes: 0 additions & 205 deletions NvD3D11SavedState.h

This file was deleted.

78 changes: 57 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,21 @@
# wander
# wander - the Wasm Renderer

![logo light](/docs/wander-light.svg#gh-light-mode-only)
![logo dark](/docs/wander-dark.svg#gh-dark-mode-only)

wander - the Wasm Renderer

`wander` is a GPU-based rendering framework designed to be fully embeddable in any application.

Use `wander` to run `renderlets` in your existing software - self contained, portable modules of graphics data and code compiled to WebAssembly.
Use `wander` to run `renderlets` in any software - self contained, portable modules of graphics data and code compiled to WebAssembly.

## What can this do?

Renderlet is like Unity for Apps. Developers can build modern, interactive visualizations that run on any platform.
With renderlet, developers can build modern, interactive visualizations that run on any platform.

Many modern apps need a high-performance rendering engine that works in a browser or in a native app, where a JavaScript library won't scale, but a game engine is too heavy.
Many visual apps need a high-performance rendering engine that works in a browser or in a native app, where a JavaScript library won't scale, but a game engine is not the right application model.

### Example use-cases
`wander` is designed to be a rendering engine for any high-performance application. It primarily is designed as the runtime to run `renderlet` bundles, but also can be used more generically as a WebAssembly-based rendering engine that uses the GPU.

Use `wander` to build things like:
* Modern CAD Apps: Use code to allow objects to describe how to render themselves
* Procedural Modeling and DataViz: Execute runtime code to view your data in new ways
* Product Visualization: Interact with dynamic objects in 3D on any device
* Composable User Interfaces: Render any UI module on top of an existing canvas or in any scene
* Interactive Animations: Like Adobe Flash, but with an actual programming language and GPUs
* Low/No-Code Graphics: Make a graphics pipelines out of existing building blocks

### Why use a renderlet?
### What are renderlets?

The `wander` SDK brings all of the benefits of `renderlets` into your own application:
* High performance 2D and 3D graphics
Expand All @@ -37,6 +27,16 @@ The `wander` SDK brings all of the benefits of `renderlets` into your own applic
* No game engine / platform dependencies
* No GPU expertise required

### Example use-cases

Use `wander` to build things like:
* Modern CAD Apps: Use code to allow objects to describe how to render themselves
* Procedural Modeling and DataViz: Execute runtime code to view your data in new ways
* Product Visualization: Interact with dynamic objects in 3D on any device
* Composable User Interfaces: Render any UI module on top of an existing canvas or in any scene
* Interactive Animations: Like Adobe Flash, but with an actual programming language and GPUs
* Low/No-Code Graphics: Make a graphics pipelines out of existing building blocks

## Platform Support

| API | Windows | Linux/Android | macOS/iOS | Web (wasm) |
Expand Down Expand Up @@ -76,7 +76,6 @@ auto tree = runtime->GetRenderTree(tree_id);
Drawing the data is as simple as iterating the render tree:
```C++
// Set and global context necessary to render the data
deviceContext->PSSetShaderResources(0, 1, &textureViewWhite);
for (auto i = 0; i < tree->Length(); ++i)
Expand All @@ -96,13 +95,50 @@ Also, wander can tear down every object automatically on unload or close:
runtime->Release();
```

### Examples
### Usage

Examples are provided in the [examples folder](examples/) for D3D11 and OpenGL 3.3 (Mac/Windows/Linux).

CMake support is not yet implmented, but you can follow platform-specific examples below to integrate into your own app.

#### rive-renderer integration

`wander` has experimental support for 2D vector operations using [`rive-renderer`](https://github.com/rive-app/rive-renderer)

Currently this is only supported in the Windows / Direct3D11 backend. We are working on a `WebGPU` build, and MacOS will require us to implement a `Metal` backend.

It is non-trivial to build `rive-renderer` on Windows. We have provided a GitHub release with precompiled binaries / .lib files in [the D3D11 example](examples/DX11). If you want to build yourself, here's some tips:
1. Ensure you have a `MinGW` toolchain installed
2. Clone this repo with `--recurvsive` - `rive-renderer` will be subbomduled in `libs`, and will have `rive-cpp` submoduled in `libs/rive-renderer/submodules/rive-cpp`
3. Follow the basic instructions using `MinGW` for commands in the `README` for `rive-renderer`
4. You may manually have to run CMake for glfw: `cmake ../glfw -DBUILD_SHARED_LIBS=OFF -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DGLFW_BUILD_WAYLAND=OFF -A x64`
5. For premake, `set PREMAKE_PATH=<path>wander\libs\rive-renderer\submodules\rive-cpp\build`
6. Then, `premake5 vs2022 --toolset=msc --with_rive_text --config=release --out=out/release` (or debug)
7. Open the output `rive.sln`, and switch every project to `MD` / `MDd` to match most apps
8. For `path_fiddle`, upgrade to C++20 and on linker and C++ settings disable warnings as errors (`/WX-`)
9. Now build all in Visual Studio or via MSBuild - the DX11 example will automatically pull from the submodule paths

Basic examples are provided in the [examples folder](examples/) for D3D11 and OpenGL.
To use this, `RLT_RIVE` globally in your project (the DX11 example does this automatically in the Release build), and `wander` will automatically link to the output `.lib`s.

The OpenGL build is not yet tested on Mac but should work with basic dependencies.
You can read more about the `rive-renderer` [integration here](https://github.com/renderlet/wander/wiki/Using-renderlet-with-rive%E2%80%90renderer).

![animated](https://github.com/renderlet/wander/blob/main/docs/wiki/vector-static.gif)

#### Building the Examples

##### On Windows
Ensure you have the latest Visual Studio 2022 and Windows 11 SDK, and use the `Examples.sln`.

The DX11 example includes experimental `rive-renderer` support for 2D vectors.

##### On OSX

Ensure you have a working `clang` installation, then simply use the [`Makefile`](examples/OpenGL/Makefile):
```sh
make run
```

#### Building the examples
This should produce a new `opengl` binary under `/src/examples/OpenGL` and run it with the default scene.

##### On Linux

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 10 additions & 6 deletions examples/OpenGL/OpenGL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,23 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<IncludePath>$(ProjectDir)glfw\include;$(ProjectDir)glew\include;$(ProjectDir)gl3w;$(SolutionDir)..\;$(SolutionDir)..\wasmtime\include;$(IncludePath)</IncludePath>
<IncludePath>$(ProjectDir)glfw\include;$(ProjectDir)glew\include;$(SolutionDir);$(SolutionDir)..\;$(SolutionDir)..\wasmtime\include;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<IncludePath>$(ProjectDir)glfw\include;$(ProjectDir)glew\include;$(ProjectDir)gl3w;$(SolutionDir)..\;$(SolutionDir)..\wasmtime\include;$(IncludePath)</IncludePath>
<IncludePath>$(ProjectDir)glfw\include;$(ProjectDir)glew\include;$(SolutionDir);$(SolutionDir)..\;$(SolutionDir)..\wasmtime\include;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(ProjectDir)glfw\include;$(ProjectDir)glew\include;$(ProjectDir)gl3w;$(SolutionDir)..\;$(SolutionDir)..\wasmtime\include;$(IncludePath)</IncludePath>
<IncludePath>$(ProjectDir)glfw\include;$(ProjectDir)glew\include;$(SolutionDir);$(SolutionDir)..\;$(SolutionDir)..\wasmtime\include;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(ProjectDir)glfw\include;$(ProjectDir)glew\include;$(ProjectDir)gl3w;$(SolutionDir)..\;$(SolutionDir)..\wasmtime\include;$(IncludePath)</IncludePath>
<IncludePath>$(ProjectDir)glfw\include;$(ProjectDir)glew\include;$(SolutionDir);$(SolutionDir)..\;$(SolutionDir)..\wasmtime\include;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>$(ProjectDir)glfw\include;$(ProjectDir)glew\include;$(ProjectDir)gl3w;$(SolutionDir)..\;$(SolutionDir)..\wasmtime\include;$(IncludePath)</IncludePath>
<IncludePath>$(ProjectDir)glfw\include;$(ProjectDir)glew\include;$(SolutionDir);$(SolutionDir)..\;$(SolutionDir)..\wasmtime\include;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)..\wasmtime\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(ProjectDir)glfw\include;$(ProjectDir)glew\include;$(ProjectDir)gl3w;$(SolutionDir)..\;$(SolutionDir)..\wasmtime\include;$(IncludePath)</IncludePath>
<IncludePath>$(ProjectDir)glfw\include;$(ProjectDir)glew\include;$(SolutionDir);$(SolutionDir)..\;$(SolutionDir)..\wasmtime\include;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)..\wasmtime\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
Expand Down Expand Up @@ -221,6 +221,10 @@
<FileType>Document</FileType>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="roof2.bmp" />
<CopyFileToFolders Include="window.bmp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down
Loading

0 comments on commit cdf4610

Please sign in to comment.