forked from blender/blender
Move the MaterialX export code into the existing shader node files #18
@ -115,25 +115,4 @@ struct NodeParserData {
|
||||
NodeItem result;
|
||||
};
|
||||
|
||||
#define NODE_SHADER_MATERIALX_BEGIN \
|
||||
class MaterialXNodeParser : public materialx::NodeParser { \
|
||||
public: \
|
||||
using materialx::NodeParser::NodeParser; \
|
||||
materialx::NodeItem compute() override; \
|
||||
}; \
|
||||
\
|
||||
materialx::NodeItem MaterialXNodeParser::compute() \
|
||||
{ \
|
||||
using NodeItem = materialx::NodeItem;
|
||||
|
||||
#define NODE_SHADER_MATERIALX_END \
|
||||
} \
|
||||
\
|
||||
void node_shader_materialx(void *data, struct bNode *node, struct bNodeSocket *out) \
|
||||
{ \
|
||||
materialx::NodeParserData *d = reinterpret_cast<materialx::NodeParserData *>(data); \
|
||||
d->result = MaterialXNodeParser(d->graph, d->depsgraph, d->material, node, out, d->to_type) \
|
||||
.compute_full(); \
|
||||
}
|
||||
|
||||
} // namespace blender::nodes::materialx
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include "node_shader_register.hh"
|
||||
|
||||
#include "materialx/nodes/node_parser.h"
|
||||
|
||||
struct bContext;
|
||||
typedef struct bContext bContext;
|
||||
struct bNodeExecContext;
|
||||
@ -65,3 +67,26 @@ void ntreeShaderEndExecTree_internal(bNodeTreeExec *exec);
|
||||
|
||||
void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, bNode *output_node);
|
||||
void get_XYZ_to_RGB_for_gpu(XYZ_to_RGB *data);
|
||||
|
||||
/* ********* MaterialX defines *********** */
|
||||
|
||||
#define NODE_SHADER_MATERIALX_BEGIN \
|
||||
class MaterialXNodeParser : public materialx::NodeParser { \
|
||||
public: \
|
||||
using materialx::NodeParser::NodeParser; \
|
||||
materialx::NodeItem compute() override; \
|
||||
}; \
|
||||
\
|
||||
materialx::NodeItem MaterialXNodeParser::compute() \
|
||||
{ \
|
||||
using NodeItem = materialx::NodeItem;
|
||||
|
||||
#define NODE_SHADER_MATERIALX_END \
|
||||
} \
|
||||
\
|
||||
void node_shader_materialx(void *data, struct bNode *node, struct bNodeSocket *out) \
|
||||
{ \
|
||||
materialx::NodeParserData *d = reinterpret_cast<materialx::NodeParserData *>(data); \
|
||||
d->result = MaterialXNodeParser(d->graph, d->depsgraph, d->material, node, out, d->to_type) \
|
||||
.compute_full(); \
|
||||
}
|
||||
|
@ -22,6 +22,13 @@ static int node_shader_gpu_add_shader(GPUMaterial *mat,
|
||||
return GPU_stack_link(mat, node, "node_add_shader", in, out);
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
{
|
||||
/* TODO: Implement */
|
||||
return empty();
|
||||
}
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_add_shader_cc
|
||||
|
||||
/* node type definition */
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "../materialx/nodes/node_parser.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.hh"
|
||||
|
@ -2,7 +2,6 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "../materialx/nodes/node_parser.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "BKE_scene.h"
|
||||
|
Loading…
Reference in New Issue
Block a user