forked from AcademySoftwareFoundation/MaterialX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGenOptions.h
156 lines (126 loc) · 4.89 KB
/
GenOptions.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
//
// TM & (c) 2017 Lucasfilm Entertainment Company Ltd. and Lucasfilm Ltd.
// All rights reserved. See LICENSE.txt for license.
//
#ifndef MATERIALX_GENOPTIONS_H
#define MATERIALX_GENOPTIONS_H
/// @file
/// Shader generation options class
#include <MaterialXGenShader/Library.h>
namespace MaterialX
{
/// Type of shader interface to be generated
enum ShaderInterfaceType
{
/// Create a complete interface with uniforms for all
/// editable inputs on all nodes used by the shader.
/// This interface makes the shader fully editable by
/// value without requiring any rebuilds.
/// This is the default interface type.
SHADER_INTERFACE_COMPLETE,
/// Create a reduced interface with uniforms only for
/// the inputs that has been declared in the shaders
/// nodedef interface. If values on other inputs are
/// changed the shader needs to be rebuilt.
SHADER_INTERFACE_REDUCED
};
/// Method to use for specular environment lighting
enum HwSpecularEnvironmentMethod
{
/// Do not use specular environment maps
SPECULAR_ENVIRONMENT_NONE,
/// Use Filtered Importance Sampling for
/// specular environment/indirect lighting.
SPECULAR_ENVIRONMENT_FIS,
/// Use pre-filtered environment maps for
/// specular environment/indirect lighting.
SPECULAR_ENVIRONMENT_PREFILTER
};
/// Method to use for directional albedo evaluation
enum HwDirectionalAlbedoMethod
{
/// Use a curve fit approximation for directional albedo.
DIRECTIONAL_ALBEDO_CURVE_FIT,
/// Use a table look-up for directional albedo.
DIRECTIONAL_ALBEDO_TABLE,
/// Use importance sampling for directional albedo.
DIRECTIONAL_ALBEDO_IS
};
/// @class GenOptions
/// Class holding options to configure shader generation.
class GenOptions
{
public:
GenOptions() :
shaderInterfaceType(SHADER_INTERFACE_COMPLETE),
fileTextureVerticalFlip(false),
addUpstreamDependencies(true),
hwTransparency(false),
hwSpecularEnvironmentMethod(SPECULAR_ENVIRONMENT_FIS),
hwDirectionalAlbedoMethod(DIRECTIONAL_ALBEDO_CURVE_FIT),
hwWriteDepthMoments(false),
hwShadowMap(false),
hwAmbientOcclusion(false),
hwMaxActiveLightSources(3),
hwNormalizeUdimTexCoords(false),
hwWriteAlbedoTable(false)
{
}
virtual ~GenOptions() { }
// TODO: Add options for:
// - shader gen optimization level
// - graph flattening or not
/// Sets the type of shader interface to be generated
int shaderInterfaceType;
/// If true the y-component of texture coordinates used for sampling
/// file textures will be flipped before sampling. This can be used if
/// file textures need to be flipped vertically to match the target's
/// texture space convention. By default this option is false.
bool fileTextureVerticalFlip;
/// An optional override for the target color space.
/// Shader fragments will be generated to transform
/// input values and textures into this color space.
string targetColorSpaceOverride;
/// Define the target distance unit.
/// Shader fragments will be generated to transform
/// input distance values to the given unit.
string targetDistanceUnit;
/// Sets whether to include upstream dependencies
/// for the element to generate a shader for.
bool addUpstreamDependencies;
/// Sets if transparency is needed or not for HW shaders.
/// If a surface shader has potential of being transparent
/// this must be set to true, otherwise no transparency
/// code fragments will be generated for the shader and
/// the surface will be fully opaque.
bool hwTransparency;
/// Sets the method to use for specular environment lighting
/// for HW shader targets.
HwSpecularEnvironmentMethod hwSpecularEnvironmentMethod;
/// Sets the method to use for directional albedo evaluation
/// for HW shader targets.
HwDirectionalAlbedoMethod hwDirectionalAlbedoMethod;
/// Enables the writing of depth moments for HW shader targets.
/// Defaults to false.
bool hwWriteDepthMoments;
/// Enables shadow mapping for HW shader targets.
/// Defaults to false.
bool hwShadowMap;
/// Enables ambient occlusion rendering for HW shader targets.
/// Defaults to false.
bool hwAmbientOcclusion;
/// Sets the maximum number of light sources that can
/// be active at once.
unsigned int hwMaxActiveLightSources;
/// Sets whether to transform texture coordinates to normalize
/// uv space when UDIMs images are bound to an image. Can be
/// enabled for when texture atlas generation is performed to
/// compress a set of UDIMs into a single normalized image for
/// hardware rendering.
bool hwNormalizeUdimTexCoords;
/// Enables the writing of a directional albedo table.
/// Defaults to false.
bool hwWriteAlbedoTable;
};
} // namespace MaterialX
#endif