forked from AcademySoftwareFoundation/MaterialX
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into adsk/bugfix/module_path_fix_python_3_8
- Loading branch information
Showing
23 changed files
with
302 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// Copyright Contributors to the MaterialX Project | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include <MaterialXGenMdl/Nodes/ImageNodeMdl.h> | ||
#include <MaterialXGenShader/ShaderGenerator.h> | ||
#include <MaterialXGenShader/Shader.h> | ||
#include <MaterialXGenShader/GenContext.h> | ||
|
||
MATERIALX_NAMESPACE_BEGIN | ||
|
||
const string ImageNodeMdl::FLIP_V = "flip_v"; | ||
|
||
ShaderNodeImplPtr ImageNodeMdl::create() | ||
{ | ||
return std::make_shared<ImageNodeMdl>(); | ||
} | ||
|
||
void ImageNodeMdl::addInputs(ShaderNode& node, GenContext& context) const | ||
{ | ||
BASE::addInputs(node, context); | ||
node.addInput(ImageNodeMdl::FLIP_V, Type::BOOLEAN)->setUniform(); | ||
} | ||
|
||
bool ImageNodeMdl::isEditable(const ShaderInput& input) const | ||
{ | ||
if (input.getName() == ImageNodeMdl::FLIP_V) | ||
{ | ||
return false; | ||
} | ||
return BASE::isEditable(input); | ||
} | ||
|
||
void ImageNodeMdl::emitFunctionCall(const ShaderNode& _node, GenContext& context, ShaderStage& stage) const | ||
{ | ||
DEFINE_SHADER_STAGE(stage, Stage::PIXEL) | ||
{ | ||
ShaderNode& node = const_cast<ShaderNode&>(_node); | ||
ShaderInput* flipUInput = node.getInput(ImageNodeMdl::FLIP_V); | ||
ValuePtr value = TypedValue<bool>::createValue(context.getOptions().fileTextureVerticalFlip); | ||
if (flipUInput) | ||
{ | ||
flipUInput->setValue(value); | ||
} | ||
BASE::emitFunctionCall(_node, context, stage); | ||
} | ||
} | ||
|
||
MATERIALX_NAMESPACE_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// Copyright Contributors to the MaterialX Project | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#ifndef MATERIALX_IMAGENODEMDL_H | ||
#define MATERIALX_IMAGENODEMDL_H | ||
|
||
#include <MaterialXGenMdl/Export.h> | ||
|
||
#include "SourceCodeNodeMdl.h" | ||
|
||
MATERIALX_NAMESPACE_BEGIN | ||
|
||
/// Image node implementation for MDL | ||
class MX_GENMDL_API ImageNodeMdl : public SourceCodeNodeMdl | ||
{ | ||
using BASE = SourceCodeNodeMdl; | ||
|
||
public: | ||
static const string FLIP_V; ///< the empty string "" | ||
|
||
static ShaderNodeImplPtr create(); | ||
|
||
void addInputs(ShaderNode& node, GenContext& context) const override; | ||
|
||
bool isEditable(const ShaderInput& input) const override; | ||
|
||
void emitFunctionCall(const ShaderNode& node, GenContext& context, ShaderStage& stage) const override; | ||
}; | ||
|
||
MATERIALX_NAMESPACE_END | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.