本文整理汇总了C#中Planet.Generate方法的典型用法代码示例。如果您正苦于以下问题:C# Planet.Generate方法的具体用法?C# Planet.Generate怎么用?C# Planet.Generate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Planet
的用法示例。
在下文中一共展示了Planet.Generate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OutputGUI
private void OutputGUI()
{
useLivePreview = EditorGUILayout.Foldout(useLivePreview, "Live preview");
if(useLivePreview) {
livePreview = (Planet)EditorGUILayout.ObjectField("Live preview:", livePreview, typeof(Planet), true);
if(livePreview != null) {
if(GUILayout.Button("Update Mesh")) {
TerrainModule tm = new TerrainModule();
tm.textureNodes = new List<TextureNode>();
tm.module = outputNode.GetModule();
livePreview.Terrain = tm;
livePreview.Generate(null, false);
}
}
EditorGUILayout.HelpBox("Drag a planet from scene to preview mesh while editing the module", MessageType.Info);
node.rect.height += controlHeight * 2.5f;
}
node.rect.height += controlHeight * 1.5f;
// export options
showExport = EditorGUILayout.Foldout(showExport, "Export textures");
if(showExport) {
// size
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel("Texture size:");
exportSize = EditorGUILayout.IntField(exportSize);
EditorGUILayout.EndHorizontal();
if(GUILayout.Button("Save as PNG")) {
string savepath = EditorUtility.SaveFilePanel("Export texture", Application.dataPath, "planet", "");
if(savepath.Length != 0) {
float progress = 0;
float total = 2;
Texture2D temp;
EditorUtility.DisplayProgressBar("Planet generator", "Generating texture...", progress / total);
if(globalMapPreview)
temp = GlobalMapUtility.Generate(exportSize, module);
else
temp = Generate(exportSize);
progress++;
EditorUtility.DisplayProgressBar("Planet generator", "Saving texture...", progress / total);
File.WriteAllBytes(savepath + ".png", temp.EncodeToPNG());
EditorUtility.ClearProgressBar();
AssetDatabase.Refresh();
}
}
node.rect.height += controlHeight * 2f;
}
}
示例2: Generate
private void Generate(Planet planet)
{
float progress = 1;
float total = planet.subdivisions * planet.subdivisions * 6;
planet.Generate(() => {
EditorUtility.DisplayProgressBar("Planet generator", "Generating...", progress / total);
progress++;
});
EditorUtility.ClearProgressBar();
}