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

Method ProcessGroupBitwise

Source/Engine/Visject/ShaderGraph.cpp:899–948  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

897}
898
899void ShaderGenerator::ProcessGroupBitwise(Box* box, Node* node, Value& value)
900{
901 switch (node->TypeID)
902 {
903 // NOT
904 case 1:
905 {
906 // Get A value
907 const Value a = tryGetValue(node->GetBox(0), Value(ValueType::Int, TEXT("0"))).AsInt();
908
909 // Perform operation
910 value = writeLocal(ValueType::Int, String::Format(TEXT("!{0}"), a.Value), node);
911 break;
912 }
913 // AND, OR, XOR
914 case 2:
915 case 3:
916 case 4:
917 {
918 // Get A and B values
919 const Value a = tryGetValue(node->GetBox(0), node->Values[0]).AsInt();
920 const Value b = tryGetValue(node->GetBox(1), node->Values[1]).AsInt();
921
922 // Perform operation
923 const Char* op;
924 switch (node->TypeID)
925 {
926 // AND
927 case 2:
928 op = TEXT("{0} & {1}");
929 break;
930 // OR
931 case 3:
932 op = TEXT("{0} | {1}");
933 break;
934 // XOR
935 case 4:
936 op = TEXT("{0} ^ {1}");
937 break;
938 default:
939 CRASH;
940 return;
941 }
942 value = writeLocal(ValueType::Int, String::Format(op, a.Value, b.Value), node);
943 break;
944 }
945 default:
946 break;
947 }
948}
949
950void ShaderGenerator::ProcessGroupComparisons(Box* box, Node* node, Value& value)
951{

Callers

nothing calls this directly

Calls 4

ValueEnum · 0.85
AsIntMethod · 0.80
FormatFunction · 0.50
GetBoxMethod · 0.45

Tested by

no test coverage detected