| 17 | typedef map<string, string> opt_t; |
| 18 | |
| 19 | static |
| 20 | void print_usage() { |
| 21 | cout << R"delimiter(GLSL2CPP |
| 22 | Converts OpenGL shader files to C++ headers. It is similar to bin2c and xxd but adds |
| 23 | support for namespaces. |
| 24 | |
| 25 | | --name | name of the variable (default: var) | |
| 26 | | --file | input file | |
| 27 | | --output | output file (If no output is specified then it prints to stdout) | |
| 28 | | --type | Type of variable (default: char) | |
| 29 | | --namespace | A space seperated list of namespaces | |
| 30 | | --formatted | Tabs for formatting | |
| 31 | | --version | Prints my name | |
| 32 | | --help | Prints usage info | |
| 33 | |
| 34 | Example |
| 35 | ------- |
| 36 | Command: |
| 37 | ./glsl2cpp --file blah.txt --namespace shaders --formatted --name image_vs |
| 38 | |
| 39 | Will produce the following: |
| 40 | #pragma once |
| 41 | #include <cstddef> |
| 42 | namespace shaders { |
| 43 | static const char image_vs[] = R"shader( |
| 44 | #version 330 |
| 45 | |
| 46 | layout(location = 0) in vec3 pos; |
| 47 | layout(location = 1) in vec2 tex; |
| 48 | |
| 49 | uniform mat4 matrix; |
| 50 | |
| 51 | out vec2 texcoord; |
| 52 | |
| 53 | void main() { |
| 54 | texcoord = tex; |
| 55 | gl_Position = matrix * vec4(pos,1.0); |
| 56 | } |
| 57 | )shader"; |
| 58 | } |
| 59 | )delimiter"; |
| 60 | exit(0); |
| 61 | } |
| 62 | |
| 63 | static bool formatted; |
| 64 | |