本文整理汇总了C#中UnityEngine.ProceduralMaterial类的典型用法代码示例。如果您正苦于以下问题:C# ProceduralMaterial类的具体用法?C# ProceduralMaterial怎么用?C# ProceduralMaterial使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProceduralMaterial类属于UnityEngine命名空间,在下文中一共展示了ProceduralMaterial类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Start
/// <summary>
/// Gets all necessary references.
/// </summary>
void Start()
{
networkLayer = this.GetComponent<PanelNetworkLayer>();
substance = panelBase.GetComponent<Renderer>().material as ProceduralMaterial;
//otherPanels = GameController.instance.GetGamePanels();
}
开发者ID:dearzhangle,项目名称:UNION-OpenSource-MOBA,代码行数:11,代码来源:Panel.cs
示例2: GetAnimationUpdateRate
/// <summary>
/// <para>Get the ProceduralMaterial animation update rate in millisecond.</para>
/// </summary>
/// <param name="material"></param>
public int GetAnimationUpdateRate(ProceduralMaterial material)
{
if (material == null)
{
throw new ArgumentException("Invalid ProceduralMaterial");
}
return this.GetMaterialInformation(material).animationUpdateRate;
}
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:12,代码来源:SubstanceImporter.cs
示例3: constructor
public static int constructor(IntPtr l)
{
try {
UnityEngine.ProceduralMaterial o;
o=new UnityEngine.ProceduralMaterial();
pushValue(l,o);
return 1;
}
catch(Exception e) {
LuaDLL.luaL_error(l, e.ToString());
return 0;
}
}
开发者ID:LunaFramework,项目名称:Luna,代码行数:13,代码来源:Lua_UnityEngine_ProceduralMaterial.cs
示例4: ExportPreset
/// <summary>
/// <para>Export a XML preset string with the value of all parameters of a given ProceduralMaterial to the specified folder.</para>
/// </summary>
/// <param name="material">The ProceduralMaterial whose preset string will be saved.</param>
/// <param name="exportPath">Path to a folder where the preset file will be saved. The folder will be created if it doesn't already exist.</param>
public void ExportPreset(ProceduralMaterial material, string exportPath)
{
if (material == null)
{
throw new ArgumentException("Invalid ProceduralMaterial");
}
if (exportPath == "")
{
throw new ArgumentException("Invalid export path specified");
}
if (!Directory.CreateDirectory(exportPath).Exists)
{
throw new ArgumentException("Export folder " + exportPath + " doesn't exist and cannot be created.");
}
File.WriteAllText(Path.Combine(exportPath, material.name + ".sbsprs"), material.preset);
}
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:21,代码来源:SubstanceImporter.cs
示例5: ExportBitmaps
/// <summary>
/// <para>Export the bitmaps generated by a ProceduralMaterial as TGA files.</para>
/// </summary>
/// <param name="material">The ProceduralMaterial whose output textures will be saved.</param>
/// <param name="exportPath">Path to a folder where the output bitmaps will be saved. The folder will be created if it doesn't already exist.</param>
/// <param name="alphaRemap">Indicates whether alpha channel remapping should be performed.</param>
public void ExportBitmaps(ProceduralMaterial material, string exportPath, bool alphaRemap)
{
if (material == null)
{
throw new ArgumentException("Invalid ProceduralMaterial");
}
if (exportPath == "")
{
throw new ArgumentException("Invalid export path specified");
}
if (!Directory.CreateDirectory(exportPath).Exists)
{
throw new ArgumentException("Export folder " + exportPath + " doesn't exist and cannot be created.");
}
this.ExportBitmapsInternal(material, exportPath, alphaRemap);
}
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:22,代码来源:SubstanceImporter.cs
示例6: OnGUI
void OnGUI()
{
GUILayout.BeginArea(new Rect(10, 10, Screen.width / 6, Screen.height - 20));
scrollViewVector = GUILayout.BeginScrollView(scrollViewVector);
//scrollViewVector = GUI.BeginScrollView(new Rect(10, 10, Screen.width / 6, Screen.height - 20), scrollViewVector, new Rect(10, 10, Screen.width / 6, Screen.height*5));
string[] bn = new string[buttonNames.Count()];
for (int i = 0; i < buttonNames.Count(); i++)
{ bn[i] = buttonNames[i]; }
button_selected = GUILayout.SelectionGrid(button_selected, bn, 1);
GUILayout.EndScrollView();
GUILayout.EndArea();
//mt = Materials[button_selected];
GUILayout.BeginArea(new Rect(Screen.width - (Screen.width / 6), 10, Screen.width / 6, Screen.height - 20));
Object.GetComponent<Renderer>().sharedMaterial = Materials[button_selected];
mt_proc = Object.GetComponent<Renderer>().sharedMaterial as ProceduralMaterial;
//material_arguments.Clear();
material_arguments = new List<ProceduralPropertyDescription>();
material_arguments = mt_proc.GetProceduralPropertyDescriptions().Select(m => { return m; }).ToList();
//prop_values = new float[material_arguments.Count()];
//this.prop_values = new List<float>();
//int ind = 0;
GUILayout.BeginScrollView(Vector2.zero);
foreach (ProceduralPropertyDescription desc in material_arguments)
{
Debug.Log(desc.GetType());
if (desc.type == ProceduralPropertyType.Float)
{
//prop_values[ind] = GUILayout.HorizontalSlider(prop_values[ind], desc.minimum, desc.maximum);
GUILayout.TextField(desc.name);
mt_proc.SetProceduralFloat(desc.name, GUILayout.HorizontalSlider(mt_proc.GetProceduralFloat(desc.name), desc.minimum, desc.maximum));
//ind++;
}
//else Debug.Log("There is no float");
}
GUILayout.EndScrollView();
//foreach (var m in mt_proc.GetProceduralPropertyDescriptions()) { material_arguments.Add(m); Debug.Log(m.name); }
//arg.Clear();
//arg = new List<float>();
//argument = GUILayout.HorizontalSlider(argument, 0, 1);
//arg.Add(argument);
//mt_proc.SetProceduralFloat("Age", argument);
mt_proc.RebuildTextures();
// Object.GetComponent<Renderer>().sharedMaterial = mt_proc;
GUILayout.EndArea();
}
开发者ID:pmpu,项目名称:3DRecreator,代码行数:47,代码来源:GUI_Script.cs
示例7: DisplayRestrictedInspector
internal void DisplayRestrictedInspector()
{
this.m_MightHaveModified = false;
if (this.m_Styles == null)
{
this.m_Styles = new Styles();
}
ProceduralMaterial target = base.target as ProceduralMaterial;
if (m_Material != target)
{
m_Material = target;
m_ShaderPMaterial = target.shader;
}
this.ProceduralProperties();
GUILayout.Space(15f);
this.GeneratedTextures();
}
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:17,代码来源:ProceduralMaterialInspector.cs
示例8: OnGUI
// Implement your own editor GUI here.
void OnGUI()
{
Objects = Selection.gameObjects as GameObject[];
EditorGUI.LabelField(new Rect(10,10,position.width - 20, 16),"Selected Objs :", (Objects.Length).ToString());
Mat = EditorGUI.ObjectField(new Rect(10,40,position.width - 20, 16),"Substance Mat.",Mat,typeof(ProceduralMaterial)) as ProceduralMaterial;
if (GUI.Button(new Rect(10, 70, 50, 30), "Apply!"))
{
foreach(GameObject Object in Objects)
{
if (Object.GetComponent<Renderer>() != null)
{
Object.renderer.sharedMaterial = Mat as ProceduralMaterial;
}
}
}
}
开发者ID:gordonklarson,项目名称:Perfect-hockey,代码行数:19,代码来源:BatchApplySubstance.cs
示例9: SetTextureAlphaSource
public extern void SetTextureAlphaSource(ProceduralMaterial material, string textureName, ProceduralOutputType alphaSource);
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:1,代码来源:SubstanceImporter.cs
示例10: SetGenerateMipMaps
public void SetGenerateMipMaps(ProceduralMaterial material, bool mode)
{
ProceduralMaterialInformation materialInformation = this.GetMaterialInformation(material);
materialInformation.generateMipMaps = mode;
this.SetMaterialInformation(material, materialInformation);
}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:6,代码来源:SubstanceImporter.cs
示例11: SetAnimationUpdateRate
public void SetAnimationUpdateRate(ProceduralMaterial material, int animation_update_rate)
{
ProceduralMaterialInformation materialInformation = this.GetMaterialInformation(material);
materialInformation.animationUpdateRate = animation_update_rate;
this.SetMaterialInformation(material, materialInformation);
}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:6,代码来源:SubstanceImporter.cs
示例12: SetGenerateAllOutputs
public void SetGenerateAllOutputs(ProceduralMaterial material, bool generated)
{
ProceduralMaterialInformation materialInformation = this.GetMaterialInformation(material);
materialInformation.generateAllOutputs = generated;
this.SetMaterialInformation(material, materialInformation);
}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:6,代码来源:SubstanceImporter.cs
示例13: SetMaterialScale
public void SetMaterialScale(ProceduralMaterial material, Vector2 scale)
{
ProceduralMaterialInformation materialInformation = this.GetMaterialInformation(material);
materialInformation.scale = scale;
this.SetMaterialInformation(material, materialInformation);
}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:6,代码来源:SubstanceImporter.cs
示例14: SetMaterialOffset
public void SetMaterialOffset(ProceduralMaterial material, Vector2 offset)
{
ProceduralMaterialInformation materialInformation = this.GetMaterialInformation(material);
materialInformation.offset = offset;
this.SetMaterialInformation(material, materialInformation);
}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:6,代码来源:SubstanceImporter.cs
示例15: RenderDiffuse
//
// This function creates a RenderToTexture for the diffuse map and stores it as a png in the Resources folders.
//
public void RenderDiffuse(ProceduralMaterial Diffuse, int slot)
{
GameObject rtObject = (GameObject)Instantiate(Resources.Load("RTTSubTerrain"));
Camera cam = rtObject.transform.Find("RTTSubCamera").GetComponent<Camera>();
// Create Render To Texture
Vector2 TexSize = new Vector2((float)Math.Pow(2,Diffuse.GetProceduralVector("$outputsize").x), (float)Math.Pow(2,Diffuse.GetProceduralVector("$outputsize").y));
RenderTexture rt = new RenderTexture((int)TexSize.x, (int)TexSize.y, 32);
cam.targetTexture = rt;
rtObject.transform.Find("RTTSubPlane").GetComponent<Renderer>().sharedMaterial.mainTexture = Diffuse.GetTexture ("_MainTex");
cam.Render();
RenderTexture.active = rt;
Texture2D dif = new Texture2D((int)TexSize.x, (int)TexSize.y, TextureFormat.ARGB32, false);
dif.ReadPixels(new Rect(0, 0, (int)TexSize.x, (int)TexSize.y), 0, 0);
// Clean up
cam.targetTexture = null;
RenderTexture.active = null; // added to avoid errors
DestroyImmediate(rt,true);
DestroyImmediate(rtObject,true);
// Write Diffuse map as PNG
byte[] bytes = dif.EncodeToPNG();
string filename = Application.dataPath + "/SubTerrain/Resources/" + gameObject.name+"_splat" + slot.ToString() + ".png";
System.IO.File.WriteAllBytes(filename, bytes);
AssetDatabase.ImportAsset( "Assets/SubTerrain/Resources/" + gameObject.name+"_splat" + slot.ToString() + ".png" );
DestroyImmediate(dif,true);
}
开发者ID:alextalvan,项目名称:Ships2,代码行数:32,代码来源:SubTerrain.cs
示例16: OnShaderModified
public extern void OnShaderModified(ProceduralMaterial material);
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:1,代码来源:SubstanceImporter.cs
示例17: GetMaterialOffset
public Vector2 GetMaterialOffset(ProceduralMaterial material)
{
return this.GetMaterialInformation(material).offset;
}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:4,代码来源:SubstanceImporter.cs
示例18: SetMaterialInformation
private extern void SetMaterialInformation(ProceduralMaterial material, ProceduralMaterialInformation information);
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:1,代码来源:SubstanceImporter.cs
示例19: GetMaterialScale
public Vector2 GetMaterialScale(ProceduralMaterial material)
{
return this.GetMaterialInformation(material).scale;
}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:4,代码来源:SubstanceImporter.cs
示例20: ExportBitmaps
internal extern void ExportBitmaps(ProceduralMaterial material);
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:1,代码来源:SubstanceImporter.cs
注:本文中的UnityEngine.ProceduralMaterial类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论