forked from autodesk-forks/MaterialX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathColorManagementSystem.h
81 lines (60 loc) · 2.27 KB
/
ColorManagementSystem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//
// TM & (c) 2017 Lucasfilm Entertainment Company Ltd. and Lucasfilm Ltd.
// All rights reserved. See LICENSE.txt for license.
//
#ifndef MATERIALX_COLOR_MANAGEMENT_SYSTEM_H
#define MATERIALX_COLOR_MANAGEMENT_SYSTEM_H
/// @file
/// Color management system classes
#include <MaterialXGenShader/Library.h>
#include <MaterialXGenShader/ShaderNode.h>
#include <MaterialXGenShader/ShaderNodeImpl.h>
#include <MaterialXGenShader/TypeDesc.h>
#include <MaterialXCore/Document.h>
namespace MaterialX
{
class ShaderGenerator;
/// A shared pointer to a ColorManagementSystem
using ColorManagementSystemPtr = shared_ptr<class ColorManagementSystem>;
/// @struct ColorSpaceTransform
/// Structure that represents color space transform information
struct ColorSpaceTransform
{
ColorSpaceTransform(const string& ss, const string& ts, const TypeDesc* t);
string sourceSpace;
string targetSpace;
const TypeDesc* type;
/// Comparison operator
bool operator==(const ColorSpaceTransform &other) const
{
return sourceSpace == other.sourceSpace &&
targetSpace == other.targetSpace &&
type == other.type;
}
};
/// @class ColorManagementSystem
/// Abstract base class for color management systems
class ColorManagementSystem
{
public:
virtual ~ColorManagementSystem() { }
/// Return the ColorManagementSystem name
virtual const string& getName() const = 0;
/// Load a library of implementations from the provided document,
/// replacing any previously loaded content.
virtual void loadLibrary(DocumentPtr document);
/// Returns whether this color management system supports a provided transform
bool supportsTransform(const ColorSpaceTransform& transform) const;
/// Create a node to use to perform the given color space transformation.
ShaderNodePtr createNode(const ShaderGraph* parent, const ColorSpaceTransform& transform, const string& name,
GenContext& context) const;
protected:
/// Protected constructor
ColorManagementSystem();
/// Returns an implementation name for a given transform
virtual string getImplementationName(const ColorSpaceTransform& transform) const = 0;
protected:
DocumentPtr _document;
};
} // namespace MaterialX
#endif