MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / VsToPs

Method VsToPs

Source/Engine/Tools/MaterialGenerator/MaterialGenerator.cpp:855–881  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

853}
854
855ShaderGenerator::Value MaterialGenerator::VsToPs(Node* node, Box* input)
856{
857 // If used in VS then pass the value from the input box
858 if (_treeType == MaterialTreeType::VertexShader)
859 {
860 return tryGetValue(input, Value::Zero).AsFloat4();
861 }
862
863 // Check if can use more interpolants
864 if (_vsToPsInterpolants.Count() == 16)
865 {
866 OnError(node, input, TEXT("Too many VS to PS interpolants used."));
867 return Value::Zero;
868 }
869
870 // Check if can use interpolants
871 const auto layer = GetRootLayer();
872 if (!layer || layer->Domain == MaterialDomain::Decal || layer->Domain == MaterialDomain::PostProcess)
873 {
874 OnError(node, input, TEXT("VS to PS interpolants are not supported in Decal or Post Process materials."));
875 return Value::Zero;
876 }
877
878 // Indicate the interpolator slot usage
879 _vsToPsInterpolants.Add(input);
880 return Value(VariantType::Float4, String::Format(TEXT("input.CustomVSToPS[{0}]"), _vsToPsInterpolants.Count() - 1));
881}
882
883#endif

Callers

nothing calls this directly

Calls 6

OnErrorFunction · 0.85
ValueEnum · 0.85
AsFloat4Method · 0.80
FormatFunction · 0.50
CountMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected