示例#1
0
        internal static string GetDefaultFunctionString(string structName, List <HlslInput> inputList)
        {
            string getDefaultFunctionString = string.Format("{0} {1}", structName, GetDefaultInputFunctionCallString(structName)) + "\n{\n";

            getDefaultFunctionString += string.Format("\t{0} ret;\n\n", structName);

            for (int i = 0; i < inputList.Count; ++i)
            {
                HlslInput input = inputList[i];
                string    defaultValueString = input.GetDefaultValueString();
                getDefaultFunctionString += string.Format("\tret.{0} = {1};\n", input.name, defaultValueString);
            }

            getDefaultFunctionString += "\n\treturn ret;\n}\n\n";

            return(getDefaultFunctionString);
        }
示例#2
0
        internal static string BuildStructString(string structName, List <HlslInput> inputList)
        {
            string structDefStr = "struct " + structName + "\n{\n";

            for (int i = 0; i < inputList.Count; ++i)
            {
                HlslInput input = inputList[i];

                string valueString = input.GetHlslValueTypeString();

                structDefStr += string.Format("\t{0} {1};\n", valueString, input.name);
            }

            structDefStr += "};\n\n";

            return(structDefStr);
        }