Skip to content

Commit

Permalink
Merge geometry node implementations
Browse files Browse the repository at this point in the history
This changelist merges the implementations of geometry nodes across hardware shading languages, allowing a greater degree of code sharing.
  • Loading branch information
jstone-lucasfilm committed Jan 7, 2024
1 parent 66bc5b9 commit ad8a7d4
Show file tree
Hide file tree
Showing 22 changed files with 64 additions and 566 deletions.
16 changes: 8 additions & 8 deletions source/MaterialXGenGlsl/GlslShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
#include <MaterialXGenGlsl/GlslShaderGenerator.h>

#include <MaterialXGenGlsl/GlslSyntax.h>
#include <MaterialXGenGlsl/Nodes/PositionNodeGlsl.h>
#include <MaterialXGenGlsl/Nodes/NormalNodeGlsl.h>
#include <MaterialXGenGlsl/Nodes/TangentNodeGlsl.h>
#include <MaterialXGenGlsl/Nodes/BitangentNodeGlsl.h>
#include <MaterialXGenGlsl/Nodes/GeomColorNodeGlsl.h>
#include <MaterialXGenGlsl/Nodes/GeomPropValueNodeGlsl.h>
#include <MaterialXGenGlsl/Nodes/FrameNodeGlsl.h>
Expand All @@ -33,6 +29,10 @@
#include <MaterialXGenShader/Nodes/HwImageNode.h>
#include <MaterialXGenShader/Nodes/HwTexCoordNode.h>
#include <MaterialXGenShader/Nodes/HwTransformNode.h>
#include <MaterialXGenShader/Nodes/HwPositionNode.h>
#include <MaterialXGenShader/Nodes/HwNormalNode.h>
#include <MaterialXGenShader/Nodes/HwTangentNode.h>
#include <MaterialXGenShader/Nodes/HwBitangentNode.h>
#include <MaterialXGenShader/Nodes/ClosureSourceCodeNode.h>
#include <MaterialXGenShader/Nodes/ClosureCompoundNode.h>
#include <MaterialXGenShader/Nodes/ClosureLayerNode.h>
Expand Down Expand Up @@ -165,13 +165,13 @@ GlslShaderGenerator::GlslShaderGenerator() :
registerImplementation(elementNames, CombineNode::create);

// <!-- <position> -->
registerImplementation("IM_position_vector3_" + GlslShaderGenerator::TARGET, PositionNodeGlsl::create);
registerImplementation("IM_position_vector3_" + GlslShaderGenerator::TARGET, HwPositionNode::create);
// <!-- <normal> -->
registerImplementation("IM_normal_vector3_" + GlslShaderGenerator::TARGET, NormalNodeGlsl::create);
registerImplementation("IM_normal_vector3_" + GlslShaderGenerator::TARGET, HwNormalNode::create);
// <!-- <tangent> -->
registerImplementation("IM_tangent_vector3_" + GlslShaderGenerator::TARGET, TangentNodeGlsl::create);
registerImplementation("IM_tangent_vector3_" + GlslShaderGenerator::TARGET, HwTangentNode::create);
// <!-- <bitangent> -->
registerImplementation("IM_bitangent_vector3_" + GlslShaderGenerator::TARGET, BitangentNodeGlsl::create);
registerImplementation("IM_bitangent_vector3_" + GlslShaderGenerator::TARGET, HwBitangentNode::create);
// <!-- <texcoord> -->
registerImplementation("IM_texcoord_vector2_" + GlslShaderGenerator::TARGET, HwTexCoordNode::create);
registerImplementation("IM_texcoord_vector3_" + GlslShaderGenerator::TARGET, HwTexCoordNode::create);
Expand Down
135 changes: 0 additions & 135 deletions source/MaterialXGenGlsl/Nodes/BitangentNodeGlsl.cpp

This file was deleted.

87 changes: 0 additions & 87 deletions source/MaterialXGenGlsl/Nodes/PositionNodeGlsl.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion source/MaterialXGenGlsl/Nodes/SurfaceNodeGlsl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void SurfaceNodeGlsl::createVariables(const ShaderNode&, GenContext& context, Sh
{
// TODO:
// The surface shader needs position, normal, view position and light sources. We should solve this by adding some
// dependency mechanism so this implementation can be set to depend on the PositionNodeGlsl, NormalNodeGlsl
// dependency mechanism so this implementation can be set to depend on the HwPositionNode, HwNormalNode
// ViewDirectionNodeGlsl and LightNodeGlsl nodes instead? This is where the MaterialX attribute "internalgeomprops"
// is needed.
//
Expand Down
2 changes: 1 addition & 1 deletion source/MaterialXGenGlsl/Nodes/SurfaceShaderNodeGlsl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void SurfaceShaderNodeGlsl::createVariables(const ShaderNode&, GenContext& conte
{
// TODO:
// The surface shader needs position, view position and light sources. We should solve this by adding some
// dependency mechanism so this implementation can be set to depend on the PositionNodeGlsl,
// dependency mechanism so this implementation can be set to depend on the HwPositionNode,
// ViewDirectionNodeGlsl and LightNodeGlsl nodes instead? This is where the MaterialX attribute "internalgeomprops"
// is needed.
//
Expand Down
16 changes: 8 additions & 8 deletions source/MaterialXGenMsl/MslShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
#include <MaterialXGenMsl/MslShaderGenerator.h>

#include <MaterialXGenMsl/MslSyntax.h>
#include <MaterialXGenMsl/Nodes/PositionNodeMsl.h>
#include <MaterialXGenMsl/Nodes/NormalNodeMsl.h>
#include <MaterialXGenMsl/Nodes/TangentNodeMsl.h>
#include <MaterialXGenMsl/Nodes/BitangentNodeMsl.h>
#include <MaterialXGenMsl/Nodes/GeomColorNodeMsl.h>
#include <MaterialXGenMsl/Nodes/GeomPropValueNodeMsl.h>
#include <MaterialXGenMsl/Nodes/FrameNodeMsl.h>
Expand All @@ -33,6 +29,10 @@
#include <MaterialXGenShader/Nodes/HwImageNode.h>
#include <MaterialXGenShader/Nodes/HwTexCoordNode.h>
#include <MaterialXGenShader/Nodes/HwTransformNode.h>
#include <MaterialXGenShader/Nodes/HwPositionNode.h>
#include <MaterialXGenShader/Nodes/HwNormalNode.h>
#include <MaterialXGenShader/Nodes/HwTangentNode.h>
#include <MaterialXGenShader/Nodes/HwBitangentNode.h>
#include <MaterialXGenShader/Nodes/ClosureSourceCodeNode.h>
#include <MaterialXGenShader/Nodes/ClosureCompoundNode.h>
#include <MaterialXGenShader/Nodes/ClosureLayerNode.h>
Expand Down Expand Up @@ -169,13 +169,13 @@ MslShaderGenerator::MslShaderGenerator() :
registerImplementation(elementNames, CombineNode::create);

// <!-- <position> -->
registerImplementation("IM_position_vector3_" + MslShaderGenerator::TARGET, PositionNodeMsl::create);
registerImplementation("IM_position_vector3_" + MslShaderGenerator::TARGET, HwPositionNode::create);
// <!-- <normal> -->
registerImplementation("IM_normal_vector3_" + MslShaderGenerator::TARGET, NormalNodeMsl::create);
registerImplementation("IM_normal_vector3_" + MslShaderGenerator::TARGET, HwNormalNode::create);
// <!-- <tangent> -->
registerImplementation("IM_tangent_vector3_" + MslShaderGenerator::TARGET, TangentNodeMsl::create);
registerImplementation("IM_tangent_vector3_" + MslShaderGenerator::TARGET, HwTangentNode::create);
// <!-- <bitangent> -->
registerImplementation("IM_bitangent_vector3_" + MslShaderGenerator::TARGET, BitangentNodeMsl::create);
registerImplementation("IM_bitangent_vector3_" + MslShaderGenerator::TARGET, HwBitangentNode::create);
// <!-- <texcoord> -->
registerImplementation("IM_texcoord_vector2_" + MslShaderGenerator::TARGET, HwTexCoordNode::create);
registerImplementation("IM_texcoord_vector3_" + MslShaderGenerator::TARGET, HwTexCoordNode::create);
Expand Down
26 changes: 0 additions & 26 deletions source/MaterialXGenMsl/Nodes/BitangentNodeMsl.h

This file was deleted.

Loading

0 comments on commit ad8a7d4

Please sign in to comment.