MaterialX 1.39.1
Loading...
Searching...
No Matches
ColorManagementSystem.h
Go to the documentation of this file.
1//
2// Copyright Contributors to the MaterialX Project
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#ifndef MATERIALX_COLOR_MANAGEMENT_SYSTEM_H
7#define MATERIALX_COLOR_MANAGEMENT_SYSTEM_H
8
11
13
17
19
20MATERIALX_NAMESPACE_BEGIN
21
22class ShaderGenerator;
23
25using ColorManagementSystemPtr = shared_ptr<class ColorManagementSystem>;
26
29struct MX_GENSHADER_API ColorSpaceTransform
30{
31 ColorSpaceTransform(const string& ss, const string& ts, TypeDesc t);
32
33 string sourceSpace;
34 string targetSpace;
35 TypeDesc type;
36
38 bool operator==(const ColorSpaceTransform& other) const
39 {
40 return sourceSpace == other.sourceSpace &&
41 targetSpace == other.targetSpace &&
42 type == other.type;
43 }
44};
45
48class MX_GENSHADER_API ColorManagementSystem
49{
50 public:
51 virtual ~ColorManagementSystem() { }
52
54 virtual const string& getName() const = 0;
55
58 virtual void loadLibrary(DocumentPtr document);
59
61 bool supportsTransform(const ColorSpaceTransform& transform) const;
62
64 ShaderNodePtr createNode(const ShaderGraph* parent, const ColorSpaceTransform& transform, const string& name,
65 GenContext& context) const;
66
67 protected:
70
72 virtual NodeDefPtr getNodeDef(const ColorSpaceTransform& transform) const = 0;
73
74 protected:
75 DocumentPtr _document;
76};
77
78MATERIALX_NAMESPACE_END
79
80#endif
shared_ptr< class ColorManagementSystem > ColorManagementSystemPtr
A shared pointer to a ColorManagementSystem.
Definition: ColorManagementSystem.h:25
shared_ptr< NodeDef > NodeDefPtr
A shared pointer to a NodeDef.
Definition: Definition.h:32
The top-level Document class.
shared_ptr< Document > DocumentPtr
A shared pointer to a Document.
Definition: Document.h:22
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:35
Base class for shader node implementations.
Type descriptor for a MaterialX data type.
Abstract base class for color management systems.
Definition: ColorManagementSystem.h:49
ShaderNodePtr createNode(const ShaderGraph *parent, const ColorSpaceTransform &transform, const string &name, GenContext &context) const
Create a node to use to perform the given color space transformation.
virtual const string & getName() const =0
Return the ColorManagementSystem name.
virtual void loadLibrary(DocumentPtr document)
Load a library of implementations from the provided document, replacing any previously loaded content...
bool supportsTransform(const ColorSpaceTransform &transform) const
Returns whether this color management system supports a provided transform.
ColorManagementSystem()
Protected constructor.
virtual NodeDefPtr getNodeDef(const ColorSpaceTransform &transform) const =0
Returns a nodedef for a given transform.
A context class for shader generation.
Definition: GenContext.h:31
Base class for shader generators All third-party shader generators should derive from this class.
Definition: ShaderGenerator.h:31
Class representing a graph (DAG) for shader generation.
Definition: ShaderGraph.h:44
A type descriptor for MaterialX data types.
Definition: TypeDesc.h:35
Structure that represents color space transform information.
Definition: ColorManagementSystem.h:30
bool operator==(const ColorSpaceTransform &other) const
Comparison operator.
Definition: ColorManagementSystem.h:38