Esempio n. 1
0
 public HLSLResult GetNodeValue(Node sender)
 {
     return(HLSLResult.Result(
                "luminosity",
                sender.HLSLValueBaseType,
                sender.HLSLValueSubType
                ));
 }
Esempio n. 2
0
        public string Convert(HLSLResult input, HLSLValue target)
        {
            var pair = new HLSLValuePair
            {
                From = input.HLSLValueBaseType,
                To   = target.HLSLValueBaseType
            };

            if (CanConvert(pair))
            {
                var converter = converters[pair];
                return(converter.Convert(input.HLSLValueSubType, target.HLSLValueSubType, input.Value));
            }

            return("");
        }
Esempio n. 3
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));
        }
Esempio n. 4
0
 protected override string Result(HLSLResult a, HLSLResult b)
 {
     return(string.Format("{0} * {1}", a.Value, b.Value));
 }
Esempio n. 5
0
 public HLSLResult GetNodeValue(Node sender)
 {
     return(HLSLResult.Result("input.normal", sender.HLSLValueBaseType));
 }
Esempio n. 6
0
 protected abstract string Result(HLSLResult a, HLSLResult b);