### Build Job Setup for Windows
Source: https://github.com/vvvv/the-gray-book/blob/master/reference/extending/publishing.md
Configures a build job to run on a Windows environment. It includes steps for checking out the code, setting up MSBuild for C# projects, and installing Nuget for package management.
```yaml
jobs:
build:
runs-on: windows-latest
steps:
- name: Git Checkout
uses: actions/checkout@master
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
- name: Setup Nuget.exe
uses: nuget/setup-nuget@v2.0.0
```
--------------------------------
### Commandline Export with Custom Output Directory
Source: https://github.com/vvvv/the-gray-book/blob/master/reference/hde/exporting.md
This commandline example demonstrates how to specify a custom output directory for the exported application artifacts using the `--output-directory` argument.
```bash
vvvvc.exe MyApp.vl --output-directory C:\temp
```
--------------------------------
### Commandline Export with Asset Behavior Setting
Source: https://github.com/vvvv/the-gray-book/blob/master/reference/hde/exporting.md
This commandline example illustrates how to set the asset referencing behavior for the exported application. 'RelativeToDocument' is useful for development, while 'RelativeToOutput' is recommended for final exports.
```bash
vvvvc.exe MyApp.vl --asset-behavior RelativeToDocument
```
--------------------------------
### Commandline Export with Custom Application Icon
Source: https://github.com/vvvv/the-gray-book/blob/master/reference/hde/exporting.md
This example shows how to associate a custom icon file with the generated executable using the `--app-icon` argument, allowing you to specify the path to the .ico file.
```bash
vvvvc.exe MyApp.vl --app-icon C:\temp\my.ico
```
--------------------------------
### Commandline Export with Runtime Identifier
Source: https://github.com/vvvv/the-gray-book/blob/master/reference/hde/exporting.md
This commandline example shows how to specify the target operating system and architecture for the build using the `--rid` argument. Supported options include various Windows, macOS, and Linux configurations.
```bash
vvvvc.exe MyApp.vl --rid linux-arm64
```
--------------------------------
### Systemd Service Configuration Example (Pitfall)
Source: https://github.com/vvvv/the-gray-book/blob/master/reference/best-practice/raspberry-pi.md
This illustrates a potential pitfall when configuring a systemd service for autostarting a .NET application on a Raspberry Pi. It highlights the need for absolute paths for both the 'dotnet' executable and the application DLL within the 'ExecStart' directive.
```bash
/home/pi/.dotnet/dotnet /home/pi/MyApp/myapp.dll
```
--------------------------------
### Configure PTP Server on Raspberry Pi (Linux)
Source: https://github.com/vvvv/the-gray-book/blob/master/reference/best-practice/ptp.md
This snippet represents the conceptual setup for a PTP server on a Raspberry Pi, which may involve installing and configuring PTP daemon software. Specific commands depend on the chosen PTP software (e.g., ptp4l).
```bash
# Example conceptual command for starting ptp4l as a server
# sudo ptp4l -i eth0 -m -S
```
--------------------------------
### Creating a Custom VL Library (NuGet Package)
Source: https://context7.com/vvvv/the-gray-book/llms.txt
Details the process of creating a custom VL library and packaging it as a NuGet package for distribution. This involves setting up the project file (.csproj), writing C# code marked for VL import, and then building and packing the library.
```xml
net8.0-windows
true
false
true
VL.MyLibrary
1.0.0
Your Name
Custom VL library for special operations
VL, vvvv
./nuget
```
```csharp
// Mark assembly for VL import
using VL.Core;
[assembly: ImportAsIs]
namespace VL.MyLibrary
{
/// Main utility class
public static class Operations
{
/// Example operation
public static float Process(float input)
{
return input * 2.0f;
}
}
}
```
```bash
# Build and pack
dotnet build
dotnet pack
# Publish to nuget.org
dotnet nuget push ./nuget/VL.MyLibrary.1.0.0.nupkg --api-key YOUR_KEY --source https://api.nuget.org/v3/index.json
```
--------------------------------
### TextureFX Mixer Implementation Example (SDSL)
Source: https://github.com/vvvv/the-gray-book/blob/master/reference/libraries/3d/texturefx.md
Example of implementing a custom TextureFX shader that acts as a mixer. It inherits from `MixerBase` and uses the `Mix` function to blend two input texture colors (`tex0col`, `tex1col`) based on a `fader` parameter using linear interpolation (lerp).
```sdsl
shader Mix_TextureFX : MixerBase
{
float4 Mix(float4 tex0col, float4 tex1col, float fader)
{
return lerp(tex0col, tex1col, fader);
}
};
```
--------------------------------
### TextureFX Filter Implementation Example (SDSL)
Source: https://github.com/vvvv/the-gray-book/blob/master/reference/libraries/3d/texturefx.md
Example of implementing a custom TextureFX shader that acts as a filter. It inherits from `FilterBase` and modifies the input texture color by inverting its RGB components within the `Filter` function. The `tex0col` parameter represents the input texture's color.
```sdsl
shader MyFx_TextureFX : FilterBase
{
float4 Filter(float4 tex0col)
{
tex0col.rgb = 1 - tex0col.rgb;
return tex0col;
}
};
```
--------------------------------
### Setting up Stride 3D Scene
Source: https://context7.com/vvvv/the-gray-book/llms.txt
Establishes a high-level 3D scene graph rendering pipeline using VL.Stride. This setup includes a scene window, models (like spheres), transformations, materials, lights, and a camera. Dependencies include VL.Stride.
```vl
// Create a 3D scene with models, lights, and camera
Patch: Basic3DScene
Nodes:
- SceneWindow [Stride]
- Title: "My 3D Scene"
- Bounds: (1920, 1080)
- Group [Stride.Models.SceneGraph]
- Sphere [Stride.Models.Meshes]
- Radius: 1.0
- Transform [Stride]
- Translation: IOBox(Vector3) = (0, 0, 0)
- Material [Stride.Materials.PBR]
- BaseColor: IOBox(RGBA) = (0.8, 0.2, 0.2, 1)
- Metalness: 0.5
- Roughness: 0.5
- PointLight [Stride]
- Position: (5, 5, 5)
- Intensity: 10.0
- Camera [Stride]
- Position: (0, 2, 5)
- Target: (0, 0, 0)
Connections:
Sphere -> Transform -> Material -> Group
PointLight -> Group
Group -> SceneWindow.Scene
Camera -> SceneWindow.Camera
```
--------------------------------
### C# Multiple Outputs for VL Nodes
Source: https://github.com/vvvv/the-gray-book/blob/master/reference/extending/writing-nodes.md
Illustrates how to create nodes with multiple output pins in VL by using the `out` keyword for method parameters. Each `out` parameter in C# corresponds to a distinct output pin on the VL node.
```csharp
public static void MultipleOutputs(float firstInput, float secondInput, out float added, out float multiplied)
{
added = firstInput + secondInput;
multiplied = firstInput * secondInput;
}
```
--------------------------------
### Mapping Pi as Network Drive
Source: https://github.com/vvvv/the-gray-book/blob/master/reference/best-practice/raspberry-pi.md
This command demonstrates how to map a directory on a Raspberry Pi (typically a user's home directory) as a network drive (e.g., Z:) on a Windows machine. This facilitates easier file access and management between the two systems.
```bash
net use Z: \\hostname\username
```
--------------------------------
### Commandline Export with Specific Output Type
Source: https://github.com/vvvv/the-gray-book/blob/master/reference/hde/exporting.md
This example demonstrates how to specify the output type for the executable using the `--output-type` argument. You can choose between 'Exe' (Console application) or 'WinExe' (Windows application).
```bash
vvvvc.exe MyApp.vl --output-type Exe
```
--------------------------------
### Framework-Dependent Deployment Command
Source: https://github.com/vvvv/the-gray-book/blob/master/reference/best-practice/raspberry-pi.md
This command is used to run a framework-dependent .NET application on a Raspberry Pi after .NET has been installed on the device. It executes the application's DLL file.
```bash
dotnet myprogram.dll
```