cgv
Loading...
Searching...
No Matches
cgv::render::shader_code_snippet Struct Reference

a snippet of shader code in raw text form. More...

#include <shader_code.h>

Public Attributes

std::string id
 the snippet id used for matching snippet markers in shader code
 
std::string content
 the snippet content; can be any valid piece of shader code
 

Detailed Description

a snippet of shader code in raw text form.

Used in shader_compile_options to replace special comments with user-defined code. Comments identifying snippet replacement locations must be of form

$cgv::<id>

where <id> is a user-defined name.

The comment is replaced with the content of a snippet whose id matches the given id.

To prevent ill-formed shader code due to potential missing definitions before snippet replacement, i.e. before pre-processing,
affected parts of code can be disabled by enclosing them in a define guard like so:

#ifdef CGV_USE_SNIPPETS
...code relying on snippet content
#endif

Definition at line 71 of file shader_code.h.

Member Data Documentation

◆ content

std::string cgv::render::shader_code_snippet::content

the snippet content; can be any valid piece of shader code

Definition at line 75 of file shader_code.h.

◆ id

std::string cgv::render::shader_code_snippet::id

the snippet id used for matching snippet markers in shader code

Definition at line 73 of file shader_code.h.


The documentation for this struct was generated from the following file: