Graphite  Version 3
An experimental 3D geometry processing program
OGF::SceneGraphLibrary Class Reference

Provides functions to dynamically declare new Grob classes, commands, shaders and tools. More...

#include <OGF/scene_graph/types/scene_graph_library.h>

Inheritance diagram for OGF::SceneGraphLibrary:
GEO::Environment GEO::Counted

Public Member Functions

 SceneGraphLibrary ()
 SceneGraphLibrary constructor.
 
 ~SceneGraphLibrary () override
 SceneGraphLibrary destructor.
 
SceneGraphscene_graph ()
 Gets the SceneGraph. More...
 
const SceneGraphscene_graph () const
 Gets the SceneGraph. More...
 
SceneGraphToolsManagerscene_graph_tools_manager ()
 Gets the SceneGraphToolsManager. More...
 
void register_grob_type (const std::string &grob_class_name, bool abstract=false)
 Registers a new Grob type. More...
 
void register_grob_read_file_extension (const std::string &grob_class_name, const std::string &extension)
 Registers a new file extension associated with a Grob type for reading. More...
 
void register_grob_write_file_extension (const std::string &grob_class_name, const std::string &extension)
 Registers a new file extension associated with a Grob type for writing. More...
 
void register_grob_shader (const std::string &grob_class_name, const std::string &shader_class_name, const std::string &shader_user_name="")
 Registers a new Shader class associated with a Grob class. More...
 
void register_grob_tool (const std::string &grob_class_name, const std::string &tool_class_name)
 Registers a new Tool class associated with a Grob class. More...
 
void register_grob_interface (const std::string &grob_class_name, const std::string &interface_class_name)
 Registers a new Interface class associated with a Grob class. More...
 
void register_grob_commands (const std::string &grob_class_name, const std::string &commands_class_name)
 Registers a new Commands class associated with a Grob class. More...
 
void register_full_screen_effect (const std::string &full_screen_effect_class_name, const std::string &user_name="")
 Registers a new full screen effect. More...
 
std::string file_extension_to_grob (const std::string &extension) const
 Finds the object class names associated with a file extension for reading. More...
 
bool get_local_value (const std::string &name, std::string &value) const override
 Retrieves a variable value locally. More...
 
bool set_local_value (const std::string &name, const std::string &value) override
 Sets a variable value locally. More...
 
std::string default_grob_read_extension (const std::string &grob_class_name) const
 Gets the default file extension associated with a Grob class for reading. More...
 
std::string default_grob_write_extension (const std::string &grob_class_name) const
 Gets the default file extension associated with a Grob class for writing. More...
 
const std::string & shader_user_to_classname (const std::string &grob_class_name, const std::string &shader_user_name) const
 Converts a shader user name to the associated internal class name. More...
 
const std::string & shader_classname_to_user (const std::string &grob_class_name, const std::string &shader_class_name) const
 Converts a shader class name to the associated user shader name. More...
 
std::string full_screen_effect_user_to_classname (const std::string &full_screen_effect_user_name) const
 Converts a full screen effect user name to the associated internal full screen effect class name. More...
 
const std::string & full_screen_effect_classname_to_user (const std::string &full_screen_effect_classname) const
 Converts a full screen effect class name to the associated user name. More...
 
- Public Member Functions inherited from GEO::Environment
virtual bool add_environment (Environment *env)
 Adds a child environment. More...
 
bool has_value (const std::string &name) const
 Tests if a variable exists. More...
 
virtual bool get_value (const std::string &name, std::string &value) const
 Retrieves the value of a variable. More...
 
std::string get_value (const std::string &name) const
 Retrieves the value of a variable. More...
 
virtual bool set_value (const std::string &name, const std::string &value)
 Sets a variable value. More...
 
virtual Environmentfind_environment (const std::string &name)
 Finds the environment that declares a variable as a local name. More...
 
virtual bool add_observer (const std::string &name, VariableObserver *observer)
 Attaches an observer to a variable. More...
 
virtual bool remove_observer (const std::string &name, VariableObserver *observer)
 Detaches an observer from a variable. More...
 
virtual bool notify_observers (const std::string &name, bool recursive=false)
 Notifies observers. More...
 
- Public Member Functions inherited from GEO::Counted
void ref () const
 Increments the reference count. More...
 
void unref () const
 Decrements the reference count. More...
 
bool is_shared () const
 Check if the object is shared. More...
 
int nb_refs () const
 Gets the number of references that point to this object. More...
 

Static Public Member Functions

static SceneGraphLibraryinstance ()
 Gets the instance. More...
 
static void initialize ()
 Initializes the SceneGraphLibrary instance. More...
 
static void terminate ()
 Terminates the SceneGraphLibrary instance. More...
 
- Static Public Member Functions inherited from GEO::Environment
static Environmentinstance ()
 Gets the root environment. More...
 
static void terminate ()
 Cleans up the environment. More...
 
- Static Public Member Functions inherited from GEO::Counted
static void ref (const Counted *counted)
 Increments the reference count. More...
 
static void unref (const Counted *counted)
 Decrements the reference count. More...
 

Protected Member Functions

void scene_graph_values_changed_notify_environment ()
 Notifies all listeners of scene graph environment variables.
 
void set_scene_graph (SceneGraph *scene_graph)
 Sets the SceneGraph. More...
 
void set_scene_graph_shader_manager (SceneGraphShaderManager *scene_graph_shader_manager)
 Sets the SceneGraphShaderManager. More...
 
void set_scene_graph_tools_manager (SceneGraphToolsManager *scene_graph_tools_manager)
 Sets the SceneGraphToolsManager. More...
 
- Protected Member Functions inherited from GEO::Environment
 ~Environment () override
 Environment destructor. More...
 
bool notify_observers (const std::string &name, const std::string &value, bool recursive)
 Notifies observers. More...
 
bool notify_local_observers (const std::string &name, const std::string &value)
 Notifies local observers. More...
 
- Protected Member Functions inherited from GEO::Counted
 Counted ()
 Creates a reference counted object. More...
 
virtual ~Counted ()
 Destroys a reference counted object. More...
 

Friends

class SceneGraph
 
class SceneGraphCommandsManager
 
class SceneGraphShaderManager
 
class SceneGraphToolsManager
 

Detailed Description

Provides functions to dynamically declare new Grob classes, commands, shaders and tools.

Note
SceneGraphLibrary member functions register_xxx use typenames passed as strings. It is preferred to use typesafe template wrappers ogf_register_xxx<>().

Definition at line 68 of file scene_graph_library.h.

Member Function Documentation

◆ default_grob_read_extension()

std::string OGF::SceneGraphLibrary::default_grob_read_extension ( const std::string &  grob_class_name) const

Gets the default file extension associated with a Grob class for reading.

Parameters
[in]grob_class_namethe Grob class name as a string, with the "OGF::" prefix
Returns
the default file extension associated with the Grob class name for reading

◆ default_grob_write_extension()

std::string OGF::SceneGraphLibrary::default_grob_write_extension ( const std::string &  grob_class_name) const

Gets the default file extension associated with a Grob class for writing.

Parameters
[in]grob_class_namethe Grob class name as a string, with the "OGF::" prefix
Returns
the default file extension associated with the Grob class name for writing

◆ file_extension_to_grob()

std::string OGF::SceneGraphLibrary::file_extension_to_grob ( const std::string &  extension) const

Finds the object class names associated with a file extension for reading.

Parameters
[in]extensionthe extension, without the "."
Returns
the ';'-separated list of object class names that can read the extension

◆ full_screen_effect_classname_to_user()

const std::string& OGF::SceneGraphLibrary::full_screen_effect_classname_to_user ( const std::string &  full_screen_effect_classname) const

Converts a full screen effect class name to the associated user name.

Parameters
[in]full_screen_effect_classnamethe class name of the full screen effect as a string, with the "OGF::" prefix
Returns
the user name of the full screen effect

◆ full_screen_effect_user_to_classname()

std::string OGF::SceneGraphLibrary::full_screen_effect_user_to_classname ( const std::string &  full_screen_effect_user_name) const

Converts a full screen effect user name to the associated internal full screen effect class name.

Parameters
[in]full_screen_effect_user_namethe user name of the full screen effect
Returns
the internal class name of the full screen effect as a string, with the "OGF::" prefix

◆ get_local_value()

bool OGF::SceneGraphLibrary::get_local_value ( const std::string &  name,
std::string &  value 
) const
overridevirtual

Retrieves a variable value locally.

This function is used internally. It searches variable name locally and stores its value in the output string value.

Parameters
[in]namethe name of the variable
[out]valueis set the variable value if it was found locally.
Return values
trueif the variable was found
falseif not
Note
This function must be reimplemented in derived custom environments.

Provides the following environment variables:

  • grob_types
  • grob_read_extensions
  • grob_write_extensions
  • SceneGraph_commands
  • xxx_read_extensions
  • xxx_write_extensions
  • xxx_shaders
  • xxx_tools
  • xxx_commands
  • full_screen_effects

Implements GEO::Environment.

◆ initialize()

static void OGF::SceneGraphLibrary::initialize ( )
static

Initializes the SceneGraphLibrary instance.

This function is called at Graphite startup. Client code should not call it.

◆ instance()

static SceneGraphLibrary* OGF::SceneGraphLibrary::instance ( )
static

Gets the instance.

Returns
a pointer to the SceneGraphLibrary instance

◆ register_full_screen_effect()

void OGF::SceneGraphLibrary::register_full_screen_effect ( const std::string &  full_screen_effect_class_name,
const std::string &  user_name = "" 
)

Registers a new full screen effect.

Parameters
[in]full_screen_effect_class_namethe class name of the full screen effect, with the "OGF::" prefix
Note
it is preferred to use the type-safe ogf_register_full_screen_effect instead.
Parameters
[in]user_namean optional user name for the full screen effect that will be used in the GUI

◆ register_grob_commands()

void OGF::SceneGraphLibrary::register_grob_commands ( const std::string &  grob_class_name,
const std::string &  commands_class_name 
)

Registers a new Commands class associated with a Grob class.

Parameters
[in]grob_class_namethe object class name as a string, with the "OGF::" prefix
[in]commands_class_namethe tool class name as a string, with the "OGF::" prefix
Note
it is preferred to use the type-safe ogf_register_grob_commands instead.

◆ register_grob_interface()

void OGF::SceneGraphLibrary::register_grob_interface ( const std::string &  grob_class_name,
const std::string &  interface_class_name 
)

Registers a new Interface class associated with a Grob class.

Parameters
[in]grob_class_namethe object class name as a string, with the "OGF::" prefix
[in]interface_class_namethe tool class name as a string, with the "OGF::" prefix
Note
it is preferred to use the type-safe ogf_register_grob_interface instead.

◆ register_grob_read_file_extension()

void OGF::SceneGraphLibrary::register_grob_read_file_extension ( const std::string &  grob_class_name,
const std::string &  extension 
)

Registers a new file extension associated with a Grob type for reading.

Parameters
[in]grob_class_namethe object class name as a string, with the "OGF::" prefix
[in]extensionthe extension, without the "."
Note
it is preferred to use the type-safe ogf_register_grob_read_file_extension instead.

◆ register_grob_shader()

void OGF::SceneGraphLibrary::register_grob_shader ( const std::string &  grob_class_name,
const std::string &  shader_class_name,
const std::string &  shader_user_name = "" 
)

Registers a new Shader class associated with a Grob class.

Parameters
[in]grob_class_namethe object class name as a string, with the "OGF::" prefix
[in]shader_class_namethe shader class name as a string, with the "OGF::" prefix
[in]shader_user_namean optional user name for the shader, that will be used in the GUI
Note
it is preferred to use the type-safe ogf_register_grob_shader instead.

◆ register_grob_tool()

void OGF::SceneGraphLibrary::register_grob_tool ( const std::string &  grob_class_name,
const std::string &  tool_class_name 
)

Registers a new Tool class associated with a Grob class.

Parameters
[in]grob_class_namethe object class name as a string, with the "OGF::" prefix
[in]tool_class_namethe tool class name as a string, with the "OGF::" prefix
Note
it is preferred to use the type-safe ogf_register_grob_tool instead.

◆ register_grob_type()

void OGF::SceneGraphLibrary::register_grob_type ( const std::string &  grob_class_name,
bool  abstract = false 
)

Registers a new Grob type.

Parameters
[in]grob_class_namethe object class name as a string, with the "OGF::" prefix
[in]abstracttrue if the object class name is abstract
Note
it is prefered to use the type-safe ogf_register_grob_type instead.

◆ register_grob_write_file_extension()

void OGF::SceneGraphLibrary::register_grob_write_file_extension ( const std::string &  grob_class_name,
const std::string &  extension 
)

Registers a new file extension associated with a Grob type for writing.

Parameters
[in]grob_class_namethe object class name as a string, with the "OGF::" prefix
[in]extensionthe extension, without the "."
Note
it is preferred to use the type-safe ogf_register_grob_write_file_extension instead.

◆ scene_graph() [1/2]

SceneGraph* OGF::SceneGraphLibrary::scene_graph ( )
inline

Gets the SceneGraph.

Returns
a pointer to the SceneGraph

Definition at line 106 of file scene_graph_library.h.

◆ scene_graph() [2/2]

const SceneGraph* OGF::SceneGraphLibrary::scene_graph ( ) const
inline

Gets the SceneGraph.

Returns
a const pointer to the SceneGraph

Definition at line 114 of file scene_graph_library.h.

◆ scene_graph_tools_manager()

SceneGraphToolsManager* OGF::SceneGraphLibrary::scene_graph_tools_manager ( )
inline

Gets the SceneGraphToolsManager.

Returns
a pointer to the SceneGraphToolsManager

Definition at line 122 of file scene_graph_library.h.

◆ set_local_value()

bool OGF::SceneGraphLibrary::set_local_value ( const std::string &  name,
const std::string &  value 
)
overridevirtual

Sets a variable value locally.

This function is used internally. It sets the variable named name to the given value locally.

Parameters
[in]namethe name of the variable
[in]valuethe value of the variable
Return values
trueif the variable was successfully added locally
falseotherwise
Note
This function must be reimplemented in derived custom environments.

Implements GEO::Environment.

◆ set_scene_graph()

void OGF::SceneGraphLibrary::set_scene_graph ( SceneGraph scene_graph)
inlineprotected

Sets the SceneGraph.

Parameters
[in]scene_grapha pointer to the SceneGraph
Precondition
scene_graph() == nullptr

Definition at line 365 of file scene_graph_library.h.

◆ set_scene_graph_shader_manager()

void OGF::SceneGraphLibrary::set_scene_graph_shader_manager ( SceneGraphShaderManager scene_graph_shader_manager)
inlineprotected

Sets the SceneGraphShaderManager.

Parameters
[in]scene_graph_shader_managera pointer to the SceneGraphShaderManager
Precondition
scene_graph_shader_manager() == nullptr

Definition at line 376 of file scene_graph_library.h.

◆ set_scene_graph_tools_manager()

void OGF::SceneGraphLibrary::set_scene_graph_tools_manager ( SceneGraphToolsManager scene_graph_tools_manager)
inlineprotected

Sets the SceneGraphToolsManager.

Parameters
[in]scene_graph_tools_managera pointer to the SceneGraphToolsManager
Precondition
scene_graph_tools_manager() == nullptr

Definition at line 389 of file scene_graph_library.h.

◆ shader_classname_to_user()

const std::string& OGF::SceneGraphLibrary::shader_classname_to_user ( const std::string &  grob_class_name,
const std::string &  shader_class_name 
) const

Converts a shader class name to the associated user shader name.

Parameters
[in]grob_class_namethe Grob class name the shader is associated with, as a string with the "OGF::" prefix
[in]shader_class_namethe Shader class name as a string, with the "OGF::" prefix
Returns
the user shader name

◆ shader_user_to_classname()

const std::string& OGF::SceneGraphLibrary::shader_user_to_classname ( const std::string &  grob_class_name,
const std::string &  shader_user_name 
) const

Converts a shader user name to the associated internal class name.

Parameters
[in]grob_class_namethe Grob class name the shader is associated with, as a string with the "OGF::" prefix
[in]shader_user_namethe shader user name
Returns
the internal shader class name as a string, with the "OGF::" prefix

◆ terminate()

static void OGF::SceneGraphLibrary::terminate ( )
static

Terminates the SceneGraphLibrary instance.

This function is called at Graphite shutdown. Client code should not call it.


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