Skip to content

Commit

Permalink
Fix issue #1425.
Browse files Browse the repository at this point in the history
This merges the `TransformXXXNodeGlsl` and `TransformXXXNodeMsl` classes
into a `HwTransformNode` which has 3 subclasses,
`HwTransformVectorNode`, `HwTransformPointNode`, and
`HwTransformNormalNode`, all of which can be configured by overriding
the virtual methods of `HwTransformNode`.
  • Loading branch information
madmann91 committed Oct 12, 2023
1 parent c7f01d8 commit ccefb38
Show file tree
Hide file tree
Showing 18 changed files with 212 additions and 496 deletions.
15 changes: 4 additions & 11 deletions source/MaterialXGenGlsl/GlslShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
#include <MaterialXGenGlsl/Nodes/HeightToNormalNodeGlsl.h>
#include <MaterialXGenGlsl/Nodes/LightSamplerNodeGlsl.h>
#include <MaterialXGenGlsl/Nodes/NumLightsNodeGlsl.h>
#include <MaterialXGenGlsl/Nodes/TransformVectorNodeGlsl.h>
#include <MaterialXGenGlsl/Nodes/TransformPointNodeGlsl.h>
#include <MaterialXGenGlsl/Nodes/TransformNormalNodeGlsl.h>
#include <MaterialXGenGlsl/Nodes/BlurNodeGlsl.h>

#include <MaterialXGenShader/Nodes/MaterialNode.h>
Expand All @@ -34,6 +31,7 @@
#include <MaterialXGenShader/Nodes/CombineNode.h>
#include <MaterialXGenShader/Nodes/SwitchNode.h>
#include <MaterialXGenShader/Nodes/HwImageNode.h>
#include <MaterialXGenShader/Nodes/HwTransformNode.h>
#include <MaterialXGenShader/Nodes/ClosureSourceCodeNode.h>
#include <MaterialXGenShader/Nodes/ClosureCompoundNode.h>
#include <MaterialXGenShader/Nodes/ClosureLayerNode.h>
Expand Down Expand Up @@ -228,13 +226,13 @@ GlslShaderGenerator::GlslShaderGenerator() :
registerImplementation(elementNames, BlurNodeGlsl::create);

// <!-- <ND_transformpoint> ->
registerImplementation("IM_transformpoint_vector3_" + GlslShaderGenerator::TARGET, TransformPointNodeGlsl::create);
registerImplementation("IM_transformpoint_vector3_" + GlslShaderGenerator::TARGET, HwTransformPointNode::create);

// <!-- <ND_transformvector> ->
registerImplementation("IM_transformvector_vector3_" + GlslShaderGenerator::TARGET, TransformVectorNodeGlsl::create);
registerImplementation("IM_transformvector_vector3_" + GlslShaderGenerator::TARGET, HwTransformVectorNode::create);

// <!-- <ND_transformnormal> ->
registerImplementation("IM_transformnormal_vector3_" + GlslShaderGenerator::TARGET, TransformNormalNodeGlsl::create);
registerImplementation("IM_transformnormal_vector3_" + GlslShaderGenerator::TARGET, HwTransformNormalNode::create);

// <!-- <image> -->
elementNames = {
Expand Down Expand Up @@ -902,11 +900,6 @@ ShaderNodeImplPtr GlslShaderGenerator::getImplementation(const NodeDef& nodedef,
}

const string GlslImplementation::SPACE = "space";
const string GlslImplementation::TO_SPACE = "tospace";
const string GlslImplementation::FROM_SPACE = "fromspace";
const string GlslImplementation::WORLD = "world";
const string GlslImplementation::OBJECT = "object";
const string GlslImplementation::MODEL = "model";
const string GlslImplementation::INDEX = "index";
const string GlslImplementation::GEOMPROP = "geomprop";

Expand Down
5 changes: 0 additions & 5 deletions source/MaterialXGenGlsl/GlslShaderGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,6 @@ class MX_GENGLSL_API GlslImplementation : public ShaderNodeImpl

/// Internal string constants
static const string SPACE;
static const string TO_SPACE;
static const string FROM_SPACE;
static const string WORLD;
static const string OBJECT;
static const string MODEL;
static const string INDEX;
static const string GEOMPROP;
};
Expand Down
43 changes: 0 additions & 43 deletions source/MaterialXGenGlsl/Nodes/TransformNormalNodeGlsl.cpp

This file was deleted.

27 changes: 0 additions & 27 deletions source/MaterialXGenGlsl/Nodes/TransformNormalNodeGlsl.h

This file was deleted.

23 changes: 0 additions & 23 deletions source/MaterialXGenGlsl/Nodes/TransformPointNodeGlsl.cpp

This file was deleted.

25 changes: 0 additions & 25 deletions source/MaterialXGenGlsl/Nodes/TransformPointNodeGlsl.h

This file was deleted.

84 changes: 0 additions & 84 deletions source/MaterialXGenGlsl/Nodes/TransformVectorNodeGlsl.cpp

This file was deleted.

30 changes: 0 additions & 30 deletions source/MaterialXGenGlsl/Nodes/TransformVectorNodeGlsl.h

This file was deleted.

15 changes: 4 additions & 11 deletions source/MaterialXGenMsl/MslShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
#include <MaterialXGenMsl/Nodes/HeightToNormalNodeMsl.h>
#include <MaterialXGenMsl/Nodes/LightSamplerNodeMsl.h>
#include <MaterialXGenMsl/Nodes/NumLightsNodeMsl.h>
#include <MaterialXGenMsl/Nodes/TransformVectorNodeMsl.h>
#include <MaterialXGenMsl/Nodes/TransformPointNodeMsl.h>
#include <MaterialXGenMsl/Nodes/TransformNormalNodeMsl.h>
#include <MaterialXGenMsl/Nodes/BlurNodeMsl.h>

#include <MaterialXGenShader/Nodes/MaterialNode.h>
Expand All @@ -34,6 +31,7 @@
#include <MaterialXGenShader/Nodes/CombineNode.h>
#include <MaterialXGenShader/Nodes/SwitchNode.h>
#include <MaterialXGenShader/Nodes/HwImageNode.h>
#include <MaterialXGenShader/Nodes/HwTransformNode.h>
#include <MaterialXGenShader/Nodes/ClosureSourceCodeNode.h>
#include <MaterialXGenShader/Nodes/ClosureCompoundNode.h>
#include <MaterialXGenShader/Nodes/ClosureLayerNode.h>
Expand Down Expand Up @@ -232,13 +230,13 @@ MslShaderGenerator::MslShaderGenerator() :
registerImplementation(elementNames, BlurNodeMsl::create);

// <!-- <ND_transformpoint> ->
registerImplementation("IM_transformpoint_vector3_" + MslShaderGenerator::TARGET, TransformPointNodeMsl::create);
registerImplementation("IM_transformpoint_vector3_" + MslShaderGenerator::TARGET, HwTransformPointNode::create);

// <!-- <ND_transformvector> ->
registerImplementation("IM_transformvector_vector3_" + MslShaderGenerator::TARGET, TransformVectorNodeMsl::create);
registerImplementation("IM_transformvector_vector3_" + MslShaderGenerator::TARGET, HwTransformVectorNode::create);

// <!-- <ND_transformnormal> ->
registerImplementation("IM_transformnormal_vector3_" + MslShaderGenerator::TARGET, TransformNormalNodeMsl::create);
registerImplementation("IM_transformnormal_vector3_" + MslShaderGenerator::TARGET, HwTransformNormalNode::create);

// <!-- <image> -->
elementNames = {
Expand Down Expand Up @@ -1404,11 +1402,6 @@ ShaderNodeImplPtr MslShaderGenerator::getImplementation(const NodeDef& nodedef,
}

const string MslImplementation::SPACE = "space";
const string MslImplementation::TO_SPACE = "tospace";
const string MslImplementation::FROM_SPACE = "fromspace";
const string MslImplementation::WORLD = "world";
const string MslImplementation::OBJECT = "object";
const string MslImplementation::MODEL = "model";
const string MslImplementation::INDEX = "index";
const string MslImplementation::GEOMPROP = "geomprop";

Expand Down
5 changes: 0 additions & 5 deletions source/MaterialXGenMsl/MslShaderGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,6 @@ class MX_GENMSL_API MslImplementation : public ShaderNodeImpl

/// Internal string constants
static const string SPACE;
static const string TO_SPACE;
static const string FROM_SPACE;
static const string WORLD;
static const string OBJECT;
static const string MODEL;
static const string INDEX;
static const string GEOMPROP;
};
Expand Down
43 changes: 0 additions & 43 deletions source/MaterialXGenMsl/Nodes/TransformNormalNodeMsl.cpp

This file was deleted.

Loading

0 comments on commit ccefb38

Please sign in to comment.