Beispiel #1
0
 public HLSLResult GetNodeValue(Node sender)
 {
     return(HLSLResult.Result(
                "luminosity",
                sender.HLSLValueBaseType,
                sender.HLSLValueSubType
                ));
 }
Beispiel #2
0
        public override HLSLResult GetNodeValue(Node sender)
        {
            var ResultA = nodeA.GetReverseNodes().Select(x => x as Node).FirstOrDefault()?.GetValue();
            var ResultB = nodeB.GetReverseNodes().Select(x => x as Node).FirstOrDefault()?.GetValue();

            if (ResultA == null || ResultB == null)
            {
                return(HLSLResult.Result(null, HLSLValueBaseType.NONE));
            }

            var AResultType = ResultA.HLSLValueBaseType;
            var BResultType = ResultB.HLSLValueBaseType;

            var max       = Math.Max((int)AResultType, (int)BResultType);
            var outResult = (HLSLValueBaseType)Enum.GetValues(typeof(HLSLValueBaseType)).GetValue(max);

            var result = string.Format("({0})", Result(ResultA, ResultB));

            var RequireNode = output.GetReverseNodes().Select(x => x as Node).FirstOrDefault();

            if (RequireNode.HLSLValueBaseType == HLSLValueBaseType.ADAPTIVE)
            {
                return(HLSLResult.Result(result, outResult));
            }
            else
            {
                if (outResult != RequireNode.HLSLValueBaseType)
                {
                    var converter = HLSLValueConverterContainer.Current();
                    if (converter.CanConvert(outResult, RequireNode.HLSLValueBaseType))
                    {
                        result = converter.Convert(
                            new HLSLResult {
                            Value = result, HLSLValueBaseType = outResult
                        },
                            new HLSLValue {
                            HLSLValueBaseType = RequireNode.HLSLValueBaseType
                        }
                            );
                        return(HLSLResult.Result(result, RequireNode.HLSLValueBaseType));
                    }
                    return(HLSLResult.Result(null, HLSLValueBaseType.NONE));
                }
            }

            return(HLSLResult.Result(result, RequireNode.HLSLValueBaseType));
        }
Beispiel #3
0
 public HLSLResult GetNodeValue(Node sender)
 {
     return(HLSLResult.Result("input.normal", sender.HLSLValueBaseType));
 }