GLIP-Lib
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Classes | Public Member Functions | Static Public Member Functions | List of all members
Glip::Modules::LayoutLoader Class Reference

Load and save pipelines layouts to file. More...

#include <LayoutLoader.hpp>

Classes

struct  PipelineScriptElements
 Contains data about a script, possibly made before the load operation. More...
 

Public Member Functions

 LayoutLoader (void)
 LayoutLoader constructor.
 
const std::vector< std::string > & paths (void) const
 Access the list of paths. More...
 
void clearPaths (void)
 Clear the list of paths.
 
void addToPaths (std::string p)
 Add a path. More...
 
void addToPaths (const std::vector< std::string > &paths)
 Add several paths. More...
 
bool removeFromPaths (const std::string &p)
 Remove an entity from the paths. More...
 
AbstractPipelineLayout getPipelineLayout (const std::string &source, std::string sourceName="", int startLine=1)
 Loads a pipeline layout from a file (see the script language description for more information). More...
 
PipelinegetPipeline (const std::string &source, std::string pipelineName="", std::string sourceName="", int startLine=1)
 Loads a pipeline from a file (see the script language description for more information). More...
 
void addRequiredElement (const std::string &name, const HdlAbstractTextureFormat &fmt, bool replace=true)
 Add a HdlAbstractTextureFormat to do the possibly required elements, along with its name. More...
 
bool hasRequiredFormat (const std::string &name) const
 Test if a required format was provided. More...
 
const HdlAbstractTextureFormatgetRequiredFormat (const std::string &name) const
 Get the required format. More...
 
int clearRequiredFormat (const std::string &name="")
 Remove required formats of given name. More...
 
int clearRequiredFormat (bool(*filter)(const std::string &))
 Remove required formats with user-defined criterion. More...
 
void addRequiredElement (const std::string &name, const ShaderSource &src, bool replace=true)
 Add a ShaderSource to do the possibly required elements, along with its name. More...
 
bool hasRequiredSource (const std::string &name) const
 Test if a required source was provided. More...
 
const ShaderSourcegetRequiredSource (const std::string &name) const
 Get the required source. More...
 
int clearRequiredSource (const std::string &name="")
 Remove required source of given name. More...
 
int clearRequiredSource (bool(*filter)(const std::string &))
 Remove required sources with user-defined criterion. More...
 
void addRequiredElement (const std::string &name, const GeometryModel &mdl, bool replace=true)
 Add a HdlAbstractTextureFormat to do the possibly required elements, along with its name. More...
 
bool hasRequiredGeometry (const std::string &name) const
 Test if a required geometry was provided. More...
 
const GeometryModelgetRequiredGeometry (const std::string &name) const
 Get the required geometry. More...
 
int clearRequiredGeometry (const std::string &name="")
 Remove required geometry of given name. More...
 
int clearRequiredGeometry (bool(*filter)(const std::string &))
 Remove required geometry with user-defined criterion. More...
 
void addRequiredElement (const std::string &name, AbstractPipelineLayout &layout, bool replace=true)
 Add a AbstractPipelineLayout to do the possibly required elements, along with its name. More...
 
bool hasRequiredPipeline (const std::string &name) const
 Test if a required pipeline was provided. More...
 
const AbstractPipelineLayoutgetRequiredPipelineLayout (const std::string &name) const
 Get the required pipeline. More...
 
int clearRequiredPipelineLayout (const std::string &name="")
 Remove required pipeline layout of given name. More...
 
int clearRequiredPipelineLayout (bool(*filter)(const std::string &))
 Remove required pipeline layout with user-defined criterion. More...
 
int clearRequiredElements (const std::string &name="")
 Remove the elements having the given name. More...
 
int clearRequiredElements (bool(*filter)(const std::string &))
 Remove elements according to a user-defined criterion. More...
 
PipelineScriptElements listElements (const std::string &source, std::string sourceName="", int startLine=1)
 List the resources contained in a script. More...
 
void addModule (LayoutLoaderModule *module, bool replace=false)
 Add a module which can be called from a script to generate dynamic data. More...
 
bool hasModule (const LayoutLoaderModule *module) const
 Test if a module is present. More...
 
bool hasModule (const std::string &name) const
 Test if a module is present. More...
 
std::vector< const
LayoutLoaderModule * > 
listModules (void) const
 List the modules used by this LayoutLoader object. More...
 
std::vector< LayoutLoaderModule * > listModules (void)
 List the modules used by this LayoutLoader object. More...
 
std::vector< std::string > listModuleNames (void) const
 List all modules loaded for this LayoutLoader object. More...
 
const LayoutLoaderModulemodule (const std::string &name) const
 Access a loaded module from its name. More...
 
LayoutLoaderModulemodule (const std::string &name)
 Access a loaded module from its name. More...
 
const LayoutLoaderModuleremoveModule (const LayoutLoaderModule *module)
 Remove a loaded module. More...
 
LayoutLoaderModuleremoveModule (const std::string &name)
 Remove a loaded module, or raise an Exception if any error occur. More...
 

Static Public Member Functions

static const char * getKeyword (LayoutLoaderKeyword k)
 Get the actual keyword string. More...
 

Detailed Description

Load and save pipelines layouts to file.

The LayoutLoader module enables you to use dynamic pipeline saved in a file or a standard string. It will create either a Glip::Core::PipelineLayout or a Glip::Core::Pipeline that you can use directly or combined with other pipeline structures.

Script Specifications

Structure

KEYWORD(argument0[, ...])

KEYWORD:name

KEYWORD
{
     body
}

KEYWORD:name
{
     body
}

KEYWORD(argument0[, ...])
{
     body
}

KEYWORD:name(argument0[, ...])

KEYWORD:name(argument0[, ...])
{
     body
}

These are the basic description structures the parser will attempt to match.

Comments

Comments are C++/C, both single line and multiple lines are valid.

Unique

UNIQUE(identifier)

Protect a source from being loaded multiple times. Based on the identifier used.

ArgumentDescription
identifier Unique identifier for a source.

Add path

ADD_PATH(path)

Add a specific path to the search pool.

ArgumentDescription
path Path to be added to the search pool. Separators are '/'.

Include

INCLUDE(filename)

Include another file. All the elements declared after parsing this file becomes available. The main pipeline(s) are changed into (a) pipeline layout(s). The elements declared before this include request are available to the included pipeline script through requirements mechanism (the included have to require these elements to use them). The required elements having the same name as an element will be overwritten for the parsing of this included file.

ArgumentDescription
filename The filename of the file to be loaded. This file must also be a script file.

Call

CALL:moduleName(argument0, argument1, [...])
{
     body
}

Enable the script to use predefined modules attached to this loader. These modules are implementing specific high-level functions. Each might request different arguments or some code in the body.

ArgumentDescription
name Name of the module to be called. This module must have been added to the current LayoutLoader.
argument0 First possible argument passed to the module.
argumentN ...
body Possible body, passed to the module.

For more information, refer to the modules documentation in Modules::LayoutLoaderModule and Modules::LayoutLoader::addModule.

Format

Format

TEXTURE_FORMAT:name(width, height, mode, depth)

TEXTURE_FORMAT:name(width, height, mode, depth[, minFiltering, maxFiltering, sWrapping, tWrapping, maxMipMapLevel])

Define a texture format (Core::HdlTextureFormat). The first line shows the minimum set of arguments required.

ArgumentDescription
name Name of the texture format created.
width Width in pixels of the format.
height Height in pixels of the format.
mode Mode of the format, among GL_RED, GL_LUMINANCE, GL_RGB, GL_RGBA, etc.
depth Depth of the format, among GL_BYTE, GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, GL_FLOAT, etc.
minFilter = GL_NEAREST Minification filtering.
magFilter = GL_NEAREST Magnification filtering.
sWrapping = GL_CLAMP S Wrapping.
tWrapping = GL_CLAMP T Wrapping.
maxMipMapLevel = 0 Maximum MipMap level.

Required Format

REQUIRED_FORMAT:name(requiredFormatName)

REQUIRED_FORMAT:name(requiredFormatName[, newWidth, newHeight, newMode, newDepth, newMinFilter, newMagFilter, newSWrapping, newTWrapping, newMaxMipMapLevel)

Define a texture format from a required resource. This enables the script to receive data from the program, as a dynamic specification.

ArgumentDescription
name Name of the texture format created.
requiredFormatName Name of the required format. Must be added to the LayoutLoader via LayoutLoader::addRequiredElement.
newWidth Replace the width (in pixels) of the original format. Use * to keep the original value.
newHeight Replace the height (in pixels) of the original format. Use * to keep the original value.
newMode Replace the mode of the original format. Use * to keep the original value.
newDepth Replace the depth of the original format. Use * to keep the original value.
newMinFilter Replace the minification filtering. Use * to keep the original value.
newMagFilter Replace the magnification filtering. Use * to keep the original value.
newSWrapping Replace the S Wrapping. Use * to keep the original value.
newTWrapping Replace the T Wrapping. Use * to keep the original value.
newMaxMipMapLevel = 0 Replace the Maximum MipMap level. Use * to keep the original value.

Geometry

Geometry

GEOMETRY:name(type[, argument0, ...])

Define a model, which can be used as the base drawing in a filter.

ArgumentDescription
name Name of the model.
type Type of the geometry. Can be GRID_2D, GRID_3D or CUSTOM_MODEL.
argument_0 Argument, depending on the choice of the geometry.

Grid2D

GEOMETRY:name(GRID_2D, width, height)

Create a 2D grid of dots.

ArgumentDescription
name Name of the model.
width Number of dots in the X direction.
height Number of dots in the Y direction.

Grid3D

GEOMETRY:name(GRID_3D, width, height, depth)

Create a 3D grid of dots.

ArgumentDescription
name Name of the model.
width Number of dots in the X direction.
height Number of dots in the Y direction.
depth Number of dots in the Z direction.

CustomModel

GEOMETRY:name(CUSTOM_MODEL, primitive, hasNormals, hasTexCoords)
{
     body
}

Create a custom geometry model.

ArgumentDescription
name Name of the model.
primitive Type of the primitive.
hasNormals If the VERTEX data will contain normals data. Either TRUE or FALSE.
hasTexCoords If the VERTEX data will contain the texture coordinates. Either TRUE or FALSE.
body Contains a description of the geometry, using VERTEX and ELEMENT.
Vertex

VERTEX(x, y[, nx, ny, u, v])

VERTEX(x, y, z[, nx, ny, nz, u, v])

Define a vertex. If the geometry was set to receive texture coordinates, the VERTEX data must have the U and V coordinates specified.

ArgumentDescription
x X Coordinate.
y Y Coordinate.
z Z Coordinate.
nx Normal X Component (must be skipped if hasNormals was FALSE).
ny Normal Y Component (must be skipped if hasNormals was FALSE).
nz Normal Z Component (must be skipped if hasNormals was FALSE).
u U Texture coordinate (must be skipped if hasTexCoords was FALSE).
v V Texture coordinate (must be skipped if hasTexCoords was FALSE).
Element

ELEMENT(a, [b, c, d])

Define an element. An element is the polygon structure or primitive defined for the current geometry model. Only using GL_POINT waive the requirement for defining elements. The number of elements indices needed depend on the number of vertices per element.

ArgumentDescription
a First vertex index.
b Second vertex index.
c Third vertex index.
d Fourth vertex index.

Required Source

REQUIRED_SOURCE:name(requiredSourceName)

Define a source from a required source. This enables the script to receive data from the program, as a dynamic specification.

ArgumentDescription
name Name of the source to be created.
requiredSpourceName Name of the required source to use.

Required Geometry

REQUIRED_GEOMETRY:name(requiredGeometryName)

Define a geometry model from a required geometry. This enables the script to receive data from the program, as a dynamic specification.

ArgumentDescription
name Name of the geometry to be created.
requiredGeometryName Name of the required geometry to use.

Source And Inclusion

Source

SOURCE:name
{
     code
}

SOURCE:name(filename)

Define a source code.

ArgumentDescription
name Name of the source.
code Source code.
filename Filename of the file to load the source code from. Will be checked against the search paths pool.

Insert

INSERT(sourceName)

Insert a source inside this source. This keyword must be inside another SOURCE. This call must be on a single line, by itself (but possibly including comments).

ArgumentDescription
sourceName Name of the source segment to be inserted at the current position.

Filter Layout

Filter Layout

FILTER_LAYOUT:name(outputFormatName[, fragmentShaderSourceName])

FILTER_LAYOUT:name(outputFormatName[, fragmentShaderSourceName])
{
     extraOptions
}

Define a filter layout.

ArgumentDescription
name Name of the filter layout created.
outputFormatName Name of the format for the output.
fragmentShaderSourceName Name of the fragment shader source.
vertexShaderSourceName Name of the vertex shader source. Use DEFAULT_VERTEX_SHADER to get the default vertex shader.
geometryName Name of the geometry model.
extraOptions Set of shaders, among GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, GL_COMPUTE_SHADER, GL_TESS_CONTROL_SHADER, GL_TESS_EVALUATION_SHADER, GL_GEOMETRY_SHADER. Specific Geometry model with GL_RENDER. Set of options for the filter layout : GL_CLEAR, GL_BLEND, GL_DEPTH_TEST

Shaders

GL_VERTEX_SHADER(name)
GL_FRAGMENT_SHADER(name)
GL_COMPUTE_SHADER(name)
GL_TESS_CONTROL_SHADER(name)
GL_TESS_EVALUATION_SHADER(name)
GL_GEOMETRY_SHADER(name)

Add other shader sources to the filter.

ArgumentDescription
name Name of the ShaderSource to be used.

Geometry Model

GL_RENDER(name)

Specify the GeometryModel to be used (default is a standard quad).

ArgumentDescription
name Name of the GeometryModel to be used.

Clearing

GL_CLEAR(enabled)

Enable the clear operation before computing the filter.

ArgumentDescription
enabled Either TRUE or FALSE.

Blending

GL_BLEND(sourceFactor, destinationFactor, blendingFunction)

Enable blending in the filter and setup the parameters.

ArgumentDescription
sourceFactor Blending factor for the source.
destinationFactor Blending factor for the destination.
blendingFunction Blending equation.

Depth Test

GL_DEPTH_TEST(depthTestFunction)

ArgumentDescription
depthTestFunction Function for the depth test.

Pipeline Layout

Pipeline Layout

PIPELINE_LAYOUT:name
{
     elements
}

Define a pipeline layout.

ArgumentDescription
name Name of the pipeline layout.
elements List of the elements in the layout.

Input Ports

INPUT_PORTS(portName0 [, ...])

Define the input ports of a pipeline layout.

ArgumentDescription
portName0 Name of the first input port.
portNameN ...

Output Ports

OUTPUT_PORTS(portName0 [, ...])

Define the output ports of a pipeline layout.

ArgumentDescription
portName0 Name of the first output port.
portNameN ...

Filter Instance

FILTER_INSTANCE:name

FILTER_INSTANCE:name(filterLayoutName)

Define a filter instance within a pipeline layout.

ArgumentDescription
name Name of this instance.
filterLayoutName The name of the layout to use. If the argument is not given, it will use the name of the instance instead.

Pipeline Instance

PIPELINE_INSTANCE:name

PIPELINE_INSTANCE:name(pipelineLayoutName)

Define a pipeline instance within a pipeline layout.

ArgumentDescription
name Name of this instance.
pipelineLayoutName The name of the layout to use. If the argument is not given, it will use the name of the instance instead.

Connection

CONNECTION(elementOutName, outputPortName, elementInName, inputPortName)

Define a connection from an output port to an input port. The data will flow from the output port outputPortName of the element elementOutName to the input port inputPortName of the element elementInName. If no connections are given in pipeline layout, the loader will attempt an automatic connection with the rules of PipelineLayout::autoConnect().

ArgumentDescription
elementOutName Element name (pipeline or filter) or the keyword THIS to get from an input port of the containing layout.
outputPortName Port name.
elementInName Element name (pipeline or filter) or the keyword THIS to get from an output port of the containing layout.
inputPortName Port name.

Required Pipeline

REQUIRED_PIPELINE:name(requiredPipelineName)

Define a pipeline layout from a required resource. This enables the script to receive data from the program, as a dynamic specification.

ArgumentDescription
name Name of the created layout.
requiredPipelineName Name of the required pipeline.

Main Pipeline

MAIN_PIPELINE:name
{
     elements
}

MAIN_PIPELINE:name(basePipelineLayoutName)
{
     ports
}

Define the main pipeline layout defined in the script. If the script is included from another, this will be automatically changed to a pipeline layout. The higher script must contain such pipeline. In case of the layout inheritance, you must define the input and output ports names.

ArgumentDescription
name Name of the pipeline layout.
elements Elements in the layout. See PIPELINE_LAYOUT.
basePipelineLayoutName Inherit layout from the layout which has this name.
ports Names of the input and output ports. See INPUT_PORTS and OUTPUT_PORTS

Script Example

Script

The following example is the a simple input to output copy with resize to 640x480 in RGB, 1 byte per component (whatever the input format is).

// The output format (for the output texture). Note that the filtering parameters are of no use in this pipeline. They will be use in the next processing/display step :
TEXTURE_FORMAT:format(640,480,GL_RGB,GL_UNSIGNED_BYTE,GL_LINEAR,GL_LINEAR)
// The shader source (for more information, check the GLSL language specifications at http://www.opengl.org/documentation/glsl/) :
SOURCE:SimpleCopySource
{
// Choose the right GLSL version :
#version 130
uniform sampler2D textureInput; // input texture.
out vec4 textureOutput; // output texture.
void main()
{
// Get the input data :
vec4 c = textureLod(textureInput, gl_TexCoord[0].st, 0.0);
// Write the output data :
textureOutput = c;
}
}
// Declare the filter layout :
FILTER_LAYOUT:SimpleCopyFilter(format, SimpleCopySource)
// The filter layout will have one input port and one output port, which names are respectively textureInput and textureOutput.
// This information is gathered from the shader source SimpleCopySource, by analyzing the variables declared as uniform sampler2D for inputs and out vec4 for outputs.
PIPELINE_MAIN:SimpleCopyPipeline
{
// Declare some input and output ports for this pipeline :
INPUT_PORTS(textureInput)
OUTPUT_PORTS(textureOutput)
// Declare one filter component :
FILTER_INSTANCE:SimpleCopyFilter
// Since the input and output port names we chose for the pipeline are the same as for the filter
// then we don't need to do the connections (it will be made automatically).
// However one can imagine replacing the previous code by :
//
//INPUT_PORTS(input)
//OUTPUT_PORTS(output)
//
// In that case, we would have to declare the connections as :
//
//CONNECTION(THIS,input,SimpleCopyFilter,textureInput)
//CONNECTION(SimpleCopyFilter,textureOutput,THIS,output)
}

Loading Code

The following code shows how to load a script with the API :

try
{
// Load a PipelineLayout :
LayoutLoader loader;
PipelineLayout myLayout = loader.getPipelineLayout("./path/pipeline.ppl");
// use it :
Pipeline* myPipeline1 = new Pipeline(myLayout,"Pipeline1");
Pipeline* myPipeline2 = new Pipeline(myLayout,"Pipeline2");
// For a single pipeline, the second string is the name of that particular instance :
Pipeline* myPipelineU = loader.getPipeline("./path/otherPipeline.ppl", "myPipelineName");
// use them, see Glip::CorePipeline::Pipeline documentation...
// Clean all :
delete myPipeline1;
delete myPipeline2;
delete myPipelineU;
}
catch(Exception& e)
{
// If either the parsing of the script or the compilation of the shader(s) failed, you will receive a Glip::Exception.
// You can probe Glip::Exception::getType() to check the type of the error (which might be Glip::Exception::ClientScriptException or Glip::Exception::ClientShaderException, possibly another).
std::cout << "An exception was caught : " << std::endl;
std::cout << e.what() << std::endl;
}

Member Function Documentation

void LayoutLoader::addModule ( LayoutLoaderModule module,
bool  replace = false 
)

Add a module which can be called from a script to generate dynamic data.

Parameters
moduleThe module to add. See LayoutLoaderModule documentation for more information. The memory will be safely releaed by the destructor of LayoutLoader, the user shall not release it.
replaceSet to true if any module having similar name must be replaced. Raise an exception otherwise.

If the replace flag is set, any existing module with this name will be deleted.

void LayoutLoader::addRequiredElement ( const std::string &  name,
const HdlAbstractTextureFormat fmt,
bool  replace = true 
)

Add a HdlAbstractTextureFormat to do the possibly required elements, along with its name.

Will raise an exception if an elemient with the same name already exists and the replacement flag is set to false. All the following pipelines loaded and containing a call REQUIRED_FORMAT:someName(name); will use this format.

Parameters
nameThe name of the element.
fmtThe element to be associated.
replaceEnable replacement.
void LayoutLoader::addRequiredElement ( const std::string &  name,
const ShaderSource src,
bool  replace = true 
)

Add a ShaderSource to do the possibly required elements, along with its name.

Will raise an exception if an element with the same name already exists and the replacement flag is set to false. All the following pipelines loaded and containing a call REQUIRED_SOURCE:someName(name); will use this format.

Parameters
nameThe name of the element.
srcThe element to be associated.
replaceEnable replacement.
void LayoutLoader::addRequiredElement ( const std::string &  name,
const GeometryModel mdl,
bool  replace = true 
)

Add a HdlAbstractTextureFormat to do the possibly required elements, along with its name.

Will raise an exception if an element with the same name already exists and the replacement flag is set to false. All the following pipelines loaded and containing a call REQUIRED_GEOMETRY:someName(name); will use this geometry model.

Parameters
nameThe name of the element.
mdlThe element to be associated.
replaceEnable replacement.
void LayoutLoader::addRequiredElement ( const std::string &  name,
AbstractPipelineLayout layout,
bool  replace = true 
)

Add a AbstractPipelineLayout to do the possibly required elements, along with its name.

Will raise an exception if an element with the same name already exists and the replacement flag is set to false. All the following pipelines loaded and containing a call REQUIRED_PIPELINE:someName(name); will use this pipeline layout.

Parameters
nameThe name of the element.
layoutThe element to be associated.
replaceEnable replacement.
void LayoutLoader::addToPaths ( std::string  p)

Add a path.

Parameters
pThe path (might be invalid, avoid input of non-canonical paths which might results in ambiguous links errors).
void LayoutLoader::addToPaths ( const std::vector< std::string > &  paths)

Add several paths.

Parameters
pathsThe list of paths to add (might be invalid, avoid input of non-canonical paths which might results in ambiguous links errors).
int LayoutLoader::clearRequiredElements ( const std::string &  name = "")

Remove the elements having the given name.

Parameters
nameThe name of the targeted element. If empty, will remove all elements.
Returns
The number of elements removed.
int LayoutLoader::clearRequiredElements ( bool(*)(const std::string &)  filter)

Remove elements according to a user-defined criterion.

Parameters
filterFiltering functions (returns true to remove an element).
Returns
The number of elements removed.
int LayoutLoader::clearRequiredFormat ( const std::string &  name = "")

Remove required formats of given name.

Parameters
nameName of the required format.
Returns
The number of elements removed.
int LayoutLoader::clearRequiredFormat ( bool(*)(const std::string &)  filter)

Remove required formats with user-defined criterion.

Parameters
filterThe filtering function (returning true to remove an element).
Returns
The number of elements removed.
int LayoutLoader::clearRequiredGeometry ( const std::string &  name = "")

Remove required geometry of given name.

Parameters
nameName of the required format.
Returns
The number of elements removed.
int LayoutLoader::clearRequiredGeometry ( bool(*)(const std::string &)  filter)

Remove required geometry with user-defined criterion.

Parameters
filterThe filtering function (returning true to remove an element).
Returns
The number of elements removed.
int LayoutLoader::clearRequiredPipelineLayout ( const std::string &  name = "")

Remove required pipeline layout of given name.

Parameters
nameName of the required format.
Returns
The number of elements removed.
int LayoutLoader::clearRequiredPipelineLayout ( bool(*)(const std::string &)  filter)

Remove required pipeline layout with user-defined criterion.

Parameters
filterThe filtering function (returning true to remove an element).
Returns
The number of elements removed.
int LayoutLoader::clearRequiredSource ( const std::string &  name = "")

Remove required source of given name.

Parameters
nameName of the required source.
Returns
The number of elements removed.
int LayoutLoader::clearRequiredSource ( bool(*)(const std::string &)  filter)

Remove required sources with user-defined criterion.

Parameters
filterThe filtering function (returning true to remove an element).
Returns
The number of elements removed.
const char * LayoutLoader::getKeyword ( LayoutLoaderKeyword  k)
static

Get the actual keyword string.

Parameters
kThe index of the keyword.
Returns
A const pointer to a C-style character string.
Pipeline * LayoutLoader::getPipeline ( const std::string &  source,
std::string  pipelineName = "",
std::string  sourceName = "",
int  startLine = 1 
)

Loads a pipeline from a file (see the script language description for more information).

Parameters
sourceThe source to load. It is considered as a filename if it doesn't contain '\n'.
pipelineNameThe name of the unique instance created (or take the type name if left empty).
sourceNameSpecify a particular source name (for instance, a filename, an url, etc.).
startLineThe number of the first line in the source (only informational).
Returns
A pointer to the unique instance built on the newly loaded layout or raise an exception if any errors occur. You have the charge to delete the newly created object.
AbstractPipelineLayout LayoutLoader::getPipelineLayout ( const std::string &  source,
std::string  sourceName = "",
int  startLine = 1 
)

Loads a pipeline layout from a file (see the script language description for more information).

Parameters
sourceThe source to load. It is considered as a filename if it doesn't contain '\n'.
sourceNameSpecify a particular source name (for instance, a filename, an url, etc.).
startLineThe number of the first line in the source (only informational).
Returns
The newly loaded layout or raise an exception if any errors occur.
const HdlAbstractTextureFormat & LayoutLoader::getRequiredFormat ( const std::string &  name) const

Get the required format.

Parameters
nameName of the required format.
Returns
A constant reference to the corresponding format or raise and exception if it does not exist.
const GeometryModel & LayoutLoader::getRequiredGeometry ( const std::string &  name) const

Get the required geometry.

Parameters
nameName of the required geometry.
Returns
A constant reference to the corresponding geometry or raise and exception if it does not exist.
const AbstractPipelineLayout & LayoutLoader::getRequiredPipelineLayout ( const std::string &  name) const

Get the required pipeline.

Parameters
nameName of the required pipeline.
Returns
A constant reference to the corresponding pipeline or raise and exception if not it is not found.
const ShaderSource & LayoutLoader::getRequiredSource ( const std::string &  name) const

Get the required source.

Parameters
nameName of the required source.
Returns
A constant reference to the corresponding source or raise and exception if it does not exist.
bool LayoutLoader::hasModule ( const LayoutLoaderModule module) const

Test if a module is present.

Parameters
moduleThe module to test.
Returns
True if the module is present.
bool LayoutLoader::hasModule ( const std::string &  name) const

Test if a module is present.

Parameters
nameThe name of the module to test.
Returns
True if the module is present.
bool LayoutLoader::hasRequiredFormat ( const std::string &  name) const

Test if a required format was provided.

Parameters
nameName of the required format.
Returns
True if the format is known.
bool LayoutLoader::hasRequiredGeometry ( const std::string &  name) const

Test if a required geometry was provided.

Parameters
nameName of the required geometry.
Returns
True if the geometry is known.
bool LayoutLoader::hasRequiredPipeline ( const std::string &  name) const

Test if a required pipeline was provided.

Parameters
nameName of the required pipeline.
Returns
True if the pipeline is known.
bool LayoutLoader::hasRequiredSource ( const std::string &  name) const

Test if a required source was provided.

Parameters
nameName of the required source.
Returns
True if the source is known.
LayoutLoader::PipelineScriptElements LayoutLoader::listElements ( const std::string &  source,
std::string  sourceName = "",
int  startLine = 1 
)

List the resources contained in a script.

Parameters
sourceThe source to load. It is considered as a filename if it doesn't contain '\n'.
sourceNameSpecify a particular source name (for instance, a filename, an url, etc.).
startLineThe number of the first line in the source (only informational).
Returns
A LayoutLoader::PipelineScriptElements object containing all informations.
std::vector< std::string > LayoutLoader::listModuleNames ( void  ) const

List all modules loaded for this LayoutLoader object.

Returns
A list of the names of the loaded modules (possibly empty if no module was loaded).
std::vector< const LayoutLoaderModule * > LayoutLoader::listModules ( void  ) const

List the modules used by this LayoutLoader object.

Returns
A list of constant pointers to the LayoutLoaderModule objects used.
std::vector< LayoutLoaderModule * > LayoutLoader::listModules ( void  )

List the modules used by this LayoutLoader object.

Returns
A list of pointers to the LayoutLoaderModule objects used.
const LayoutLoaderModule & LayoutLoader::module ( const std::string &  name) const

Access a loaded module from its name.

Parameters
nameThe name of the module to access.
Returns
A constant reference to the targeted module or raise an exception otherwise.
LayoutLoaderModule & LayoutLoader::module ( const std::string &  name)

Access a loaded module from its name.

Parameters
nameThe name of the module to access.
Returns
A constant reference to the targeted module or raise an exception otherwise.
const std::vector< std::string > & LayoutLoader::paths ( void  ) const

Access the list of paths.

Returns
A read-only access to the list of paths.
bool LayoutLoader::removeFromPaths ( const std::string &  p)

Remove an entity from the paths.

Parameters
pThe path to remove.
Returns
True if a path was remove; false otherwise.
const LayoutLoaderModule * LayoutLoader::removeModule ( const LayoutLoaderModule module)

Remove a loaded module.

Parameters
modulePointer to the module to remove.
Returns
The pointer of the removed module or NULL if not found. The user must take care of deallocating it.
LayoutLoaderModule * LayoutLoader::removeModule ( const std::string &  name)

Remove a loaded module, or raise an Exception if any error occur.

Parameters
nameThe name of the module to remove.
Returns
The pointer of the removed module. The user must take care of deallocating it.

The documentation for this class was generated from the following files: