MaterialX 1.38.2
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
11
13
17
19
20namespace MaterialX
21{
22
23class ShaderGenerator;
24
26using ColorManagementSystemPtr = shared_ptr<class ColorManagementSystem>;
27
30struct MX_GENSHADER_API ColorSpaceTransform
31{
32 ColorSpaceTransform(const string& ss, const string& ts, const TypeDesc* t);
33
34 string sourceSpace;
35 string targetSpace;
36 const TypeDesc* type;
37
39 bool operator==(const ColorSpaceTransform &other) const
40 {
41 return sourceSpace == other.sourceSpace &&
42 targetSpace == other.targetSpace &&
43 type == other.type;
44 }
45};
46
49class MX_GENSHADER_API ColorManagementSystem
50{
51 public:
52 virtual ~ColorManagementSystem() { }
53
55 virtual const string& getName() const = 0;
56
59 virtual void loadLibrary(DocumentPtr document);
60
62 bool supportsTransform(const ColorSpaceTransform& transform) const;
63
65 ShaderNodePtr createNode(const ShaderGraph* parent, const ColorSpaceTransform& transform, const string& name,
66 GenContext& context) const;
67
68 protected:
71
73 virtual ImplementationPtr getImplementation(const ColorSpaceTransform& transform) const = 0;
74
75 protected:
76 DocumentPtr _document;
77};
78
79} // namespace MaterialX
80
81#endif
shared_ptr< class ColorManagementSystem > ColorManagementSystemPtr
A shared pointer to a ColorManagementSystem.
Definition: ColorManagementSystem.h:26
shared_ptr< Implementation > ImplementationPtr
A shared pointer to an Implementation.
Definition: Definition.h:38
The top-level Document class.
shared_ptr< Document > DocumentPtr
A shared pointer to a Document.
Definition: Document.h:23
Macros for declaring imported and exported symbols.
Classes for nodes created during shader generation.
shared_ptr< class ShaderNode > ShaderNodePtr
Shared pointer to a ShaderNode.
Definition: ShaderNode.h:36
Base class for shader node implementations.
Type descriptor for a MaterialX data type.
Abstract base class for color management systems.
Definition: ColorManagementSystem.h:50
virtual ImplementationPtr getImplementation(const ColorSpaceTransform &transform) const =0
Returns an implementation for a given transform.
virtual const string & getName() const =0
Return the ColorManagementSystem name.
A context class for shader generation.
Definition: GenContext.h:27
Class representing a graph (DAG) for shader generation.
Definition: ShaderGraph.h:45
A type descriptor for MaterialX data types.
Definition: TypeDesc.h:29
Structure that represents color space transform information.
Definition: ColorManagementSystem.h:31
bool operator==(const ColorSpaceTransform &other) const
Comparison operator.
Definition: ColorManagementSystem.h:39