HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ColorManagementSystem.h
Go to the documentation of this file.
1 //
2 // TM & (c) 2017 Lucasfilm Entertainment Company Ltd. and Lucasfilm Ltd.
3 // All rights reserved. See LICENSE.txt for license.
4 //
5 
6 #ifndef MATERIALX_COLOR_MANAGEMENT_SYSTEM_H
7 #define MATERIALX_COLOR_MANAGEMENT_SYSTEM_H
8 
9 /// @file
10 /// Color management system classes
11 
13 
17 
18 #include <MaterialXCore/Document.h>
19 
21 
22 class ShaderGenerator;
23 
24 /// A shared pointer to a ColorManagementSystem
25 using ColorManagementSystemPtr = shared_ptr<class ColorManagementSystem>;
26 
27 /// @struct ColorSpaceTransform
28 /// Structure that represents color space transform information
30 {
31  ColorSpaceTransform(const string& ss, const string& ts, const TypeDesc* t);
32 
33  string sourceSpace;
34  string targetSpace;
35  const TypeDesc* type;
36 
37  /// Comparison operator
38  bool operator==(const ColorSpaceTransform &other) const
39  {
40  return sourceSpace == other.sourceSpace &&
41  targetSpace == other.targetSpace &&
42  type == other.type;
43  }
44 };
45 
46 /// @class ColorManagementSystem
47 /// Abstract base class for color management systems
49 {
50  public:
51  virtual ~ColorManagementSystem() { }
52 
53  /// Return the ColorManagementSystem name
54  virtual const string& getName() const = 0;
55 
56  /// Load a library of implementations from the provided document,
57  /// replacing any previously loaded content.
58  virtual void loadLibrary(DocumentPtr document);
59 
60  /// Returns whether this color management system supports a provided transform
61  bool supportsTransform(const ColorSpaceTransform& transform) const;
62 
63  /// Create a node to use to perform the given color space transformation.
64  ShaderNodePtr createNode(const ShaderGraph* parent, const ColorSpaceTransform& transform, const string& name,
65  GenContext& context) const;
66 
67  protected:
68  /// Protected constructor
70 
71  /// Returns an implementation for a given transform
72  virtual ImplementationPtr getImplementation(const ColorSpaceTransform& transform) const = 0;
73 
74  protected:
76 };
77 
79 
80 #endif
#define MATERIALX_NAMESPACE_BEGIN
Definition: Generated.h:23
MX_FORMAT_API void loadLibrary(const FilePath &file, DocumentPtr doc, const FileSearchPath &searchPath=FileSearchPath(), const XmlReadOptions *readOptions=nullptr)
Load a given MaterialX library into a document.
#define MX_GENSHADER_API
Definition: Export.h:18
GLuint const GLchar * name
Definition: glcorearb.h:786
GLdouble GLdouble t
Definition: glew.h:1403
bool operator==(const ColorSpaceTransform &other) const
Comparison operator.
GLuint GLenum GLenum transform
Definition: glew.h:15055
shared_ptr< class ColorManagementSystem > ColorManagementSystemPtr
A shared pointer to a ColorManagementSystem.
shared_ptr< class ShaderNode > ShaderNodePtr
Shared pointer to a ShaderNode.
Definition: ShaderNode.h:35
shared_ptr< Implementation > ImplementationPtr
A shared pointer to an Implementation.
Definition: Definition.h:37
shared_ptr< Document > DocumentPtr
A shared pointer to a Document.
Definition: Document.h:22
class OCIOEXPORT ColorSpaceTransform
#define MATERIALX_NAMESPACE_END
Definition: Generated.h:24
type
Definition: core.h:1059