forked from AcademySoftwareFoundation/MaterialX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPyGlslShaderGenerator.cpp
35 lines (29 loc) · 1.35 KB
/
PyGlslShaderGenerator.cpp
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
//
// TM & (c) 2017 Lucasfilm Entertainment Company Ltd. and Lucasfilm Ltd.
// All rights reserved. See LICENSE.txt for license.
//
#include <PyMaterialX/PyMaterialX.h>
#include <MaterialXGenGlsl/GlslShaderGenerator.h>
#include <MaterialXGenGlsl/GlslResourceBindingContext.h>
#include <MaterialXGenShader/Shader.h>
#include <MaterialXGenShader/ShaderGenerator.h>
#include <string>
namespace py = pybind11;
namespace mx = MaterialX;
void bindPyGlslShaderGenerator(py::module& mod)
{
py::class_<mx::GlslShaderGenerator, mx::HwShaderGenerator, mx::GlslShaderGeneratorPtr>(mod, "GlslShaderGenerator")
.def_static("create", &mx::GlslShaderGenerator::create)
.def(py::init<>())
.def("generate", &mx::GlslShaderGenerator::generate)
.def("getTarget", &mx::GlslShaderGenerator::getTarget)
.def("getVersion", &mx::GlslShaderGenerator::getVersion);
}
void bindPyGlslResourceBindingContext(py::module &mod)
{
py::class_<mx::GlslResourceBindingContext, mx::HwResourceBindingContext, mx::GlslResourceBindingContextPtr>(mod, "GlslResourceBindingContext")
.def_static("create", &mx::GlslResourceBindingContext::create)
.def(py::init<size_t, size_t>())
.def("emitDirectives", &mx::GlslResourceBindingContext::emitDirectives)
.def("emitResourceBindings", &mx::GlslResourceBindingContext::emitResourceBindings);
}