VVISF & VVGL
|
Describes an "ISF file"- requires an actual file on disk which is parsed. Capable of generating GLSL source code for the various shader types. More...
#include <ISFDoc.hpp>
Public Member Functions | |
bool | generateShaderSource (string *outFragSrc, string *outVertSrc, VVGL::GLVersion &inGLVers, const bool &inVarsAsUBO=false) |
Returns a true if successful. Generates GLSL source code, populating the provided vars with strings that are usable for frag/vert shaders. More... | |
Constructors | |
ISFDoc (const string &inPath, ISFScene *inParentScene=nullptr, const bool &inThrowExcept=true) noexcept(false) | |
Constructs an ISFDoc instance from a passed file on disk. Consider using CreateISFDocRef() instead. More... | |
ISFDoc (const string &inFSContents, const string &inVSContents, const string &importsDir, ISFScene *inParentScene=nullptr, const bool &inThrowExcept=true) | |
Constructs an ISFDoc instance from shader strings. Consider using CreateISFDocRef() instead. | |
ISF file properties | |
string | path () const |
Returns the path of the ISF file for the receiver. This is probably the path to the frag shader. | |
string | name () const |
Returns the name of the receiver's ISF file (the file name, minus the extension). | |
string | description () const |
Returns the receiver's "description" string, as defined in its JSON blob ("DESCRIPTION"). | |
string | credit () const |
Returns the receiver's "credit" string, as defined in its JSON blob ("CREDIT"). | |
string | vsn () const |
Returns the receiver's "vsn" string, as defined in its JSON blob ("VSN") | |
ISFFileType | type () const |
Returns the receiver's file type. | |
vector< string > & | categories () |
Returns a vector containing strings listing the receiver's categories. | |
ISF attribute/INPUT getters | |
vector< ISFAttrRef > & | inputs () |
Returns a vector of ISFAttrRef instances describing all of the receiver's inputs. | |
vector< ISFAttrRef > & | imageInputs () |
Returns a vector of ISFAttrRef instances describing only the receiver's image inputs. | |
vector< ISFAttrRef > & | audioInputs () |
Returns a vector of ISFAttrRef instances describing only the receiver's audio inputs. | |
vector< ISFAttrRef > & | imageImports () |
Returns a vector of ISFAttrRef instances describing only the receiver's audioFFT inputs. | |
vector< ISFAttrRef > | inputsOfType (const ISFValType &inInputType) |
Returns a vector of ISFAttrRef instances describing only the receiver's inputs that match the passed type. | |
ISFAttrRef | input (const string &inAttrName) |
Returns the ISFAttrRef for the input with the passed name. | |
ISF render pass getters | |
vector< ISFPassTargetRef > | persistentPassTargets () const |
Returns a vector of ISFPassTargetRef instances describing every pass that has a persistent buffer. | |
vector< ISFPassTargetRef > | tempPassTargets () const |
Returns a vector of ISFPassTargetRef instances describing every pass that doesn't have a persistent buffer. | |
vector< string > & | renderPasses () |
Returns a vector of std::string instances describing the names of the render passes, in order. If the names were not specified properly in the JSON blob, this array will be incomplete or inaccurate and rendering won't work! | |
const VVGL::GLBufferRef | getBufferForKey (const string &n) |
Returns the GLBufferRef for the passed key. Checks all attributes/inputs as well as persistent and temp buffers. | |
const VVGL::GLBufferRef | getPersistentBufferForKey (const string &n) |
Returns the persistent buffer for the render pass with the passed key. | |
const VVGL::GLBufferRef | getTempBufferForKey (const string &n) |
Returns the temp buffer for the render pass with the passed key. | |
const ISFPassTargetRef | passTargetForKey (const string &n) |
Returns the ISFPassTarget that matches the passed key. Returns null if no pass could be found. | |
const ISFPassTargetRef | persistentPassTargetForKey (const string &n) |
Returns the ISFPassTarget that matches the passed key. Returns null if no pass could be found or if the pass found wasn't flagged as requiring a persistent buffer. | |
const ISFPassTargetRef | tempPassTargetForKey (const string &n) |
Returns the ISFPassTarget that matches the passed key. Returns null if no pass could be found or if the pass found was flagged as requiring a persistent buffer. | |
ISF file source code getters | |
string * | jsonSourceString () const |
Returns the JSON string from the source including the comments and any linebreaks before/after it | |
string * | jsonString () const |
Returns the JSON string copied from the source- doesn't include any comments before/after it. | |
string * | vertShaderSource () const |
Returns the raw vert shader source before being find-and-replaced. | |
string * | fragShaderSource () const |
Returns the raw frag shader source before being find-and-replaced. | |
void | jsonSourceString (string &outStr) |
Populates the passed var with the JSON string from the source including the comments and any linebreaks before/after it | |
Related Functions | |
(Note that these are not member functions.) | |
using | ISFDocRef = shared_ptr< ISFDoc > |
ISFDocRef is a shared pointer around an ISFDoc instance. More... | |
ISFDocRef | CreateISFDocRef (const string &inPath, ISFScene *inParentScene=nullptr, const bool &inThrowExcept=true) noexcept(false) |
Constructs an ISFDoc instance from a passed file on disk. More... | |
ISFDocRef | CreateISFDocRefWith (const string &inFSContents, const string &inImportsDir=string("/"), const string &inVSContents=string(ISFVertPassthru_GL2), ISFScene *inParentScene=nullptr, const bool &inThrowExcept=true) |
Constructs an ISFDoc instance from shader strings. More... | |
Describes an "ISF file"- requires an actual file on disk which is parsed. Capable of generating GLSL source code for the various shader types.
Constructing an instance of this class will load the files from disk into local string vars, parse them, and populate the instance with all the attributes(ISFAttr)/passes(ISFPassTarget) necessary to fully describe the ISF file.
Notes on use:
|
noexcept |
Constructs an ISFDoc instance from a passed file on disk. Consider using CreateISFDocRef() instead.
inPath | The path to the ISF file you want to load as an ISFDoc. |
inParentScene | The scene that will be used to render this ISFDoc, or null if no scene is to be used. |
inThrowExcept | Whether or not the ISFDoc should throw any exceptions if it encounters errors parsing anything. Throws an ISFErr if there is a problem of some sort loading the ISF file from disk or parsing the JSON in the ISF file. |
bool VVISF::ISFDoc::generateShaderSource | ( | string * | outFragSrc, |
string * | outVertSrc, | ||
VVGL::GLVersion & | inGLVers, | ||
const bool & | inVarsAsUBO = false |
||
) |
Returns a true if successful. Generates GLSL source code, populating the provided vars with strings that are usable for frag/vert shaders.
outFragSrc | A non-null pre-allocated std::string variable which will be populated with the fragment shader source code generated for this ISF file. |
outVertSrc | A non-null pre-allocated std::string variable which will be populated with the vertex shader source code generated for this ISF file. |
inGLVers | The version of OpenGL that the generated source code must be compatible with. |
inVarsAsUBO | Defaults to false. If true, variable declarations for non-image INPUTS will be assembled in a uniform block. This option was added because a downstream utility requires it. |
|
related |
Constructs an ISFDoc instance from a passed file on disk.
inPath | The path to the ISF file you want to load as an ISFDoc. |
inParentScene | The scene that will be used to render this ISFDoc, or null if no scene is to be used. |
inThrowExcept | Whether or not the ISFDoc should throw any exceptions if it encounters errors parsing anything. Throws an ISFErr if there is a problem of some sort loading the ISF file from disk or parsing the JSON in the ISF file. |
|
related |
Constructs an ISFDoc instance from shader strings.
inFSContents | A string containing the fragment shader portion of the ISF file. The JSON blob that defines the ISF file must be contained in here. |
inVSContents | A string containing the vertex shader portion of the ISF file. If you don't have a vertex shader to pass, VVISF defines a static string "ISFVertPassthru_GL2", which should work as a "passthru" vertex shader for most purposes. |
inParentScene | The scene that will be used to render this ISFDoc, or null if no scene is to be used. |
inThrowExcept | Whether or not the ISFDoc should throw any exceptions if it encounters errors parsing anything. Throws an ISFErr if there is a problem of some sort parsing the JSON blob from the frag shader string. |