本文整理汇总了C#中UnityEngine.Material.GetRangeNames方法的典型用法代码示例。如果您正苦于以下问题:C# Material.GetRangeNames方法的具体用法?C# Material.GetRangeNames怎么用?C# Material.GetRangeNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Material
的用法示例。
在下文中一共展示了Material.GetRangeNames方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DumpShaderMaterial
private BabylonMaterial DumpShaderMaterial(Material material)
{
if (materialsDictionary.ContainsKey(material.name))
{
return materialsDictionary[material.name];
}
var babylonShaderMaterial = new BabylonShaderMaterial
{
name = material.name,
id = Guid.NewGuid().ToString(),
};
ExporterWindow.ReportProgress(1, "Exporting glsl material: " + material.name);
List<string> tnames = material.GetTextureNames();
foreach (string tname in tnames)
{
BabylonTexture tdata = DumpTextureFromMaterial(material, tname);
if (tdata != null)
{
babylonShaderMaterial.textures.Add(tname, tdata);
}
}
List<string> fnames = material.GetFloatNames();
foreach (string fname in fnames)
{
float fdata = material.GetFloat(fname);
babylonShaderMaterial.floats.Add(fname, fdata);
}
List<string> rnames = material.GetRangeNames();
foreach (string rname in rnames)
{
float rdata = material.GetFloat(rname);
babylonShaderMaterial.floats.Add(rname, rdata);
}
List<string> cnames = material.GetColorNames();
foreach (string cname in cnames)
{
Color cdata = material.GetColor(cname);
babylonShaderMaterial.vectors4.Add(cname, cdata.ToFloat());
}
List<string> vnames = material.GetVectorNames();
foreach (string vname in vnames)
{
Vector4 vdata = material.GetVector(vname);
babylonShaderMaterial.vectors4.Add(vname, vdata.ToFloat());
}
Shader shader = material.shader;
string filename = AssetDatabase.GetAssetPath(shader);
string program = Tools.LoadTextAsset(filename);
string basename = shader.name.Replace("BabylonJS/", "").Replace("/", "_").Replace(" ", "");
string outpath = (!String.IsNullOrEmpty(exportationOptions.DefaultShaderFolder)) ? exportationOptions.DefaultShaderFolder : OutputPath;
var shaderpath = new Dictionary<string, string>();
List<string> attributeList = new List<string>();
List<string> uniformList = new List<string>();
List<string> samplerList = new List<string>();
List<string> defineList = new List<string>();
string babylonOptions = GetShaderProgramSection(basename, program, BabylonProgramSection.Babylon);
string[] babylonLines = babylonOptions.Split('\n');
foreach (string babylonLine in babylonLines)
{
if (babylonLine.IndexOf("attributes", StringComparison.OrdinalIgnoreCase) >= 0)
{
string[] attributes = babylonLine.Split(':');
if (attributes != null && attributes.Length > 1)
{
string abuffer = attributes[1].Replace("[", "").Replace("]", "");
if (!String.IsNullOrEmpty(abuffer))
{
abuffer = abuffer.Trim();
string[] adata = abuffer.Split(',');
if (adata != null && adata.Length > 0)
{
foreach (string aoption in adata)
{
string aoption_buffer = aoption.Trim().Replace("\"", "").Trim();
if (!String.IsNullOrEmpty(aoption_buffer))
{
attributeList.Add(aoption_buffer);
}
}
}
}
}
}
else if (babylonLine.IndexOf("uniforms", StringComparison.OrdinalIgnoreCase) >= 0)
{
string[] uniforms = babylonLine.Split(':');
if (uniforms != null && uniforms.Length > 1)
{
string ubuffer = uniforms[1].Replace("[", "").Replace("]", "");
if (!String.IsNullOrEmpty(ubuffer))
{
//.........这里部分代码省略.........