forked from autodesk-forks/MaterialX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGenOsl.h
64 lines (51 loc) · 1.96 KB
/
GenOsl.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
//
// TM & (c) 2017 Lucasfilm Entertainment Company Ltd. and Lucasfilm Ltd.
// All rights reserved. See LICENSE.txt for license.
//
#ifndef GENOSL_H
#define GENOSL_H
#include <MaterialXTest/Catch/catch.hpp>
#include <MaterialXGenOsl/OslShaderGenerator.h>
#include <MaterialXTest/GenShaderUtil.h>
namespace mx = MaterialX;
class OslShaderGeneratorTester : public GenShaderUtil::ShaderGeneratorTester
{
public:
using ParentClass = GenShaderUtil::ShaderGeneratorTester;
OslShaderGeneratorTester(mx::ShaderGeneratorPtr shaderGenerator, const std::vector<mx::FilePath>& testRootPaths,
const mx::FilePath& libSearchPath, const mx::FileSearchPath& srcSearchPath,
const mx::FilePath& logFilePath) :
GenShaderUtil::ShaderGeneratorTester(shaderGenerator, testRootPaths, libSearchPath, srcSearchPath, logFilePath)
{}
void setTestStages() override
{
_testStages.push_back(mx::Stage::PIXEL);
}
// Ignore trying to create shader code for lightshaders
void addSkipNodeDefs() override
{
_skipNodeDefs.insert("ND_point_light");
_skipNodeDefs.insert("ND_spot_light");
_skipNodeDefs.insert("ND_directional_light");
ParentClass::addSkipNodeDefs();
}
// Ignore light shaders in the document for OSL
void findLights(mx::DocumentPtr /*doc*/, std::vector<mx::NodePtr>& lights) override
{
lights.clear();
}
// No direct lighting to register for OSL
void registerLights(mx::DocumentPtr /*doc*/, const std::vector<mx::NodePtr>& /*lights*/, mx::GenContext& /*context*/) override
{
}
protected:
void getImplementationWhiteList(mx::StringSet& whiteList) override
{
whiteList =
{
"ambientocclusion", "arrayappend", "backfacing", "screen", "curveadjust", "displacementshader",
"volumeshader", "IM_constant_", "IM_dot_", "IM_geompropvalue", "IM_angle"
};
}
};
#endif // GENOSL_H