1
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ebced055db85844ca525a0ba5c0ccb3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,173 @@
|
||||
#if GRIFFIN
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using TerrainMaterialTemplate = Pinwheel.Griffin.GRuntimeSettings.TerrainRenderingSettings.TerrainMaterialTemplate;
|
||||
|
||||
namespace Pinwheel.Griffin.BuiltinRP
|
||||
{
|
||||
public static class GGriffinBrpInstaller
|
||||
{
|
||||
public static void Install()
|
||||
{
|
||||
GGriffinBrpResources resources = GGriffinBrpResources.Instance;
|
||||
if (resources == null)
|
||||
{
|
||||
Debug.Log("Unable to load Griffin BuiltinRP Resources.");
|
||||
}
|
||||
|
||||
List<TerrainMaterialTemplate> terrainMaterialTemplates = new List<TerrainMaterialTemplate>();
|
||||
#region PBR materials
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.PBR,
|
||||
texturingModel = GTexturingModel.Splat,
|
||||
splatsModel = GSplatsModel.Splats4,
|
||||
material = resources.TerrainPbr4SplatsMaterial
|
||||
});
|
||||
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.PBR,
|
||||
texturingModel = GTexturingModel.Splat,
|
||||
splatsModel = GSplatsModel.Splats4Normals4,
|
||||
material = resources.TerrainPbr4Splats4NormalsMaterial
|
||||
});
|
||||
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.PBR,
|
||||
texturingModel = GTexturingModel.Splat,
|
||||
splatsModel = GSplatsModel.Splats8,
|
||||
material = resources.TerrainPbr8SplatsMaterial
|
||||
});
|
||||
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.PBR,
|
||||
texturingModel = GTexturingModel.GradientLookup,
|
||||
material = resources.TerrainPbrGradientLookupMaterial
|
||||
});
|
||||
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.PBR,
|
||||
texturingModel = GTexturingModel.VertexColor,
|
||||
material = resources.TerrainPbrVertexColorMaterial
|
||||
});
|
||||
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.PBR,
|
||||
texturingModel = GTexturingModel.ColorMap,
|
||||
material = resources.TerrainPbrColorMapMaterial
|
||||
});
|
||||
#endregion
|
||||
#region Lambert materials
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.Lambert,
|
||||
texturingModel = GTexturingModel.Splat,
|
||||
splatsModel = GSplatsModel.Splats4,
|
||||
material = resources.TerrainLambert4SplatsMaterial
|
||||
});
|
||||
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.Lambert,
|
||||
texturingModel = GTexturingModel.Splat,
|
||||
splatsModel = GSplatsModel.Splats4Normals4,
|
||||
material = resources.TerrainLambert4Splats4NormalsMaterial
|
||||
});
|
||||
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.Lambert,
|
||||
texturingModel = GTexturingModel.Splat,
|
||||
splatsModel = GSplatsModel.Splats8,
|
||||
material = resources.TerrainLambert8SplatsMaterial
|
||||
});
|
||||
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.Lambert,
|
||||
texturingModel = GTexturingModel.GradientLookup,
|
||||
material = resources.TerrainLambertGradientLookupMaterial
|
||||
});
|
||||
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.Lambert,
|
||||
texturingModel = GTexturingModel.VertexColor,
|
||||
material = resources.TerrainLambertVertexColorMaterial
|
||||
});
|
||||
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.Lambert,
|
||||
texturingModel = GTexturingModel.ColorMap,
|
||||
material = resources.TerrainLambertColorMapMaterial
|
||||
});
|
||||
#endregion
|
||||
#region Blinn-Phong materials
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.BlinnPhong,
|
||||
texturingModel = GTexturingModel.Splat,
|
||||
splatsModel = GSplatsModel.Splats4,
|
||||
material = resources.TerrainBlinnPhong4SplatsMaterial
|
||||
});
|
||||
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.BlinnPhong,
|
||||
texturingModel = GTexturingModel.Splat,
|
||||
splatsModel = GSplatsModel.Splats4Normals4,
|
||||
material = resources.TerrainBlinnPhong4Splats4NormalsMaterial
|
||||
});
|
||||
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.BlinnPhong,
|
||||
texturingModel = GTexturingModel.Splat,
|
||||
splatsModel = GSplatsModel.Splats8,
|
||||
material = resources.TerrainBlinnPhong8SplatsMaterial
|
||||
});
|
||||
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.BlinnPhong,
|
||||
texturingModel = GTexturingModel.GradientLookup,
|
||||
material = resources.TerrainBlinnPhongGradientLookupMaterial
|
||||
});
|
||||
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.BlinnPhong,
|
||||
texturingModel = GTexturingModel.VertexColor,
|
||||
material = resources.TerrainBlinnPhongVertexColorMaterial
|
||||
});
|
||||
|
||||
terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
|
||||
{
|
||||
lightingModel = GLightingModel.BlinnPhong,
|
||||
texturingModel = GTexturingModel.ColorMap,
|
||||
material = resources.TerrainBlinnPhongColorMapMaterial
|
||||
});
|
||||
#endregion
|
||||
|
||||
GRuntimeSettings.Instance.terrainRendering.builtinRpMaterials = terrainMaterialTemplates;
|
||||
GRuntimeSettings.Instance.foliageRendering.grassMaterial = resources.GrassMaterial;
|
||||
GRuntimeSettings.Instance.foliageRendering.grassBillboardMaterial = resources.GrassBillboardMaterial;
|
||||
GRuntimeSettings.Instance.foliageRendering.grassInteractiveMaterial = resources.GrassInteractiveMaterial;
|
||||
GRuntimeSettings.Instance.foliageRendering.treeBillboardMaterial = resources.TreeBillboardMaterial;
|
||||
|
||||
EditorUtility.SetDirty(GRuntimeSettings.Instance);
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
|
||||
EditorUtility.DisplayDialog("Completed", "Successfully installed Polaris Built-in Render Pipeline support.", "OK");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 908c3c838d2f9a3418d99017718c55f9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,350 @@
|
||||
#if GRIFFIN
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pinwheel.Griffin.BuiltinRP
|
||||
{
|
||||
//[CreateAssetMenu(menuName = "Griffin/BRP Resources")]
|
||||
public class GGriffinBrpResources : ScriptableObject
|
||||
{
|
||||
private static GGriffinBrpResources instance;
|
||||
public static GGriffinBrpResources Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = Resources.Load<GGriffinBrpResources>("GriffinBrpResources");
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Terrain PBR Material")]
|
||||
[SerializeField]
|
||||
private Material terrainPbr4SplatsMaterial;
|
||||
public Material TerrainPbr4SplatsMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainPbr4SplatsMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainPbr4SplatsMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material terrainPbr4Splats4NormalsMaterial;
|
||||
public Material TerrainPbr4Splats4NormalsMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainPbr4Splats4NormalsMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainPbr4Splats4NormalsMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material terrainPbr8SplatsMaterial;
|
||||
public Material TerrainPbr8SplatsMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainPbr8SplatsMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainPbr8SplatsMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material terrainPbrGradientLookupMaterial;
|
||||
public Material TerrainPbrGradientLookupMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainPbrGradientLookupMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainPbrGradientLookupMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material terrainPbrVertexColorMaterial;
|
||||
public Material TerrainPbrVertexColorMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainPbrVertexColorMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainPbrVertexColorMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material terrainPbrColorMapMaterial;
|
||||
public Material TerrainPbrColorMapMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainPbrColorMapMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainPbrColorMapMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Terrain Lambert Material")]
|
||||
[SerializeField]
|
||||
private Material terrainLambert4SplatsMaterial;
|
||||
public Material TerrainLambert4SplatsMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainLambert4SplatsMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainLambert4SplatsMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material terrainLambert4Splats4NormalsMaterial;
|
||||
public Material TerrainLambert4Splats4NormalsMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainLambert4Splats4NormalsMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainLambert4Splats4NormalsMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material terrainLambert8SplatsMaterial;
|
||||
public Material TerrainLambert8SplatsMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainLambert8SplatsMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainLambert8SplatsMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material terrainLambertGradientLookupMaterial;
|
||||
public Material TerrainLambertGradientLookupMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainLambertGradientLookupMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainLambertGradientLookupMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material terrainLambertVertexColorMaterial;
|
||||
public Material TerrainLambertVertexColorMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainLambertVertexColorMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainLambertVertexColorMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material terrainLambertColorMapMaterial;
|
||||
public Material TerrainLambertColorMapMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainLambertColorMapMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainLambertColorMapMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Terrain Blinn-Phong Material")]
|
||||
[SerializeField]
|
||||
private Material terrainBlinnPhong4SplatsMaterial;
|
||||
public Material TerrainBlinnPhong4SplatsMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainBlinnPhong4SplatsMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainBlinnPhong4SplatsMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material terrainBlinnPhong4Splats4NormalsMaterial;
|
||||
public Material TerrainBlinnPhong4Splats4NormalsMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainBlinnPhong4Splats4NormalsMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainBlinnPhong4Splats4NormalsMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material terrainBlinnPhong8SplatsMaterial;
|
||||
public Material TerrainBlinnPhong8SplatsMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainBlinnPhong8SplatsMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainBlinnPhong8SplatsMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material terrainBlinnPhongGradientLookupMaterial;
|
||||
public Material TerrainBlinnPhongGradientLookupMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainBlinnPhongGradientLookupMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainBlinnPhongGradientLookupMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material terrainBlinnPhongVertexColorMaterial;
|
||||
public Material TerrainBlinnPhongVertexColorMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainBlinnPhongVertexColorMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainBlinnPhongVertexColorMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material terrainBlinnPhongColorMapMaterial;
|
||||
public Material TerrainBlinnPhongColorMapMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return terrainBlinnPhongColorMapMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
terrainBlinnPhongColorMapMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Foliage Material")]
|
||||
[SerializeField]
|
||||
private Material grassMaterial;
|
||||
public Material GrassMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return grassMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
grassMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material grassBillboardMaterial;
|
||||
public Material GrassBillboardMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return grassBillboardMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
grassBillboardMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material grassInteractiveMaterial;
|
||||
public Material GrassInteractiveMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return grassInteractiveMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
grassInteractiveMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material treeBillboardMaterial;
|
||||
public Material TreeBillboardMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return treeBillboardMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
treeBillboardMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Material grassPreviewMaterial;
|
||||
public Material GrassPreviewMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return grassPreviewMaterial;
|
||||
}
|
||||
set
|
||||
{
|
||||
grassPreviewMaterial = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fb91ed894068014babda45e4bd0b920
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,48 @@
|
||||
#if GRIFFIN
|
||||
#if GRIFFIN && UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pinwheel.Griffin.BuiltinRP.GriffinExtension
|
||||
{
|
||||
public static class GriffinBrpSupport
|
||||
{
|
||||
public static string GetExtensionName()
|
||||
{
|
||||
return "Built-in Render Pipeline Support";
|
||||
}
|
||||
|
||||
public static string GetPublisherName()
|
||||
{
|
||||
return "Pinwheel Studio";
|
||||
}
|
||||
|
||||
public static string GetDescription()
|
||||
{
|
||||
return "Adding support for BuiltinRP.\n" +
|
||||
"Requires Unity 2018.1 or above.";
|
||||
}
|
||||
|
||||
public static string GetVersion()
|
||||
{
|
||||
return "1.0.2";
|
||||
}
|
||||
|
||||
public static void OpenSupportLink()
|
||||
{
|
||||
GEditorCommon.OpenEmailEditor(
|
||||
GCommon.SUPPORT_EMAIL,
|
||||
"[Polaris] BuiltinRP Support",
|
||||
"YOUR_MESSAGE_HERE");
|
||||
}
|
||||
|
||||
public static void OnGUI()
|
||||
{
|
||||
if (GUILayout.Button("Install"))
|
||||
{
|
||||
GGriffinBrpInstaller.Install();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 832fafa34881943499e9319e0814f5bb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f03e13458dceb9c4e80de383afd659ff
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,47 @@
|
||||
#if GRIFFIN
|
||||
#if GRIFFIN && UNITY_EDITOR && !GRIFFIN_CSHARP_WIZARD
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pinwheel.Griffin.GriffinExtension
|
||||
{
|
||||
public static class CreateExtensionWizardPlaceholder
|
||||
{
|
||||
public static string GetExtensionName()
|
||||
{
|
||||
return "Create Extension Wizard";
|
||||
}
|
||||
|
||||
public static string GetPublisherName()
|
||||
{
|
||||
return "Pinwheel Studio";
|
||||
}
|
||||
|
||||
public static string GetDescription()
|
||||
{
|
||||
return
|
||||
"CSharp Wizard is a free and powerful tool for programmer to generate skeleton code in common scenarios. " +
|
||||
"It can also be used to generate Griffin Extension script file with required functions defined.";
|
||||
}
|
||||
|
||||
public static string GetVersion()
|
||||
{
|
||||
return "v1.0.0";
|
||||
}
|
||||
|
||||
public static void OpenSupportLink()
|
||||
{
|
||||
GEditorCommon.OpenEmailEditor(
|
||||
"customer@pinwheel.studio",
|
||||
"Griffin Extension - CSharp Wizard",
|
||||
"YOUR_MESSAGE_HERE");
|
||||
}
|
||||
|
||||
public static void Button_GetCSharpWizardForFree()
|
||||
{
|
||||
string url = "http://bit.ly/2JfsGTk";
|
||||
Application.OpenURL(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 18a16ddac90f756418e1834cbd13ff74
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,44 @@
|
||||
#if GRIFFIN
|
||||
#if GRIFFIN && UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pinwheel.Griffin.GriffinExtension
|
||||
{
|
||||
public static class MegaWorldPlaceholder
|
||||
{
|
||||
public static string GetExtensionName()
|
||||
{
|
||||
return "Mega World Integration";
|
||||
}
|
||||
|
||||
public static string GetPublisherName()
|
||||
{
|
||||
return "Vladislav Tsurikov";
|
||||
}
|
||||
|
||||
public static string GetDescription()
|
||||
{
|
||||
return "Mega World is an ecosystem of tools for lightning fast creation of beautiful and realistic results and hyper-optimized object rendering.\n" +
|
||||
"This integration enable foliage rendering using MW's Quadro Renderer.";
|
||||
}
|
||||
|
||||
public static string GetVersion()
|
||||
{
|
||||
return "v1.0.0";
|
||||
}
|
||||
|
||||
public static void OpenSupportLink()
|
||||
{
|
||||
string url = "https://assetstore.unity.com/publishers/45764";
|
||||
Application.OpenURL(url);
|
||||
}
|
||||
|
||||
public static void Button_GetMegaWorld()
|
||||
{
|
||||
string url = "https://assetstore.unity.com/packages/tools/terrain/mega-world-163756";
|
||||
Application.OpenURL(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92c454b782785b34e936ca76f9dd1b07
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,47 @@
|
||||
#if GRIFFIN
|
||||
#if GRIFFIN && UNITY_EDITOR && !GRIFFIN_MESH_TO_FILE
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pinwheel.Griffin.GriffinExtension
|
||||
{
|
||||
public static class MeshToFilePlaceholder
|
||||
{
|
||||
public static string GetExtensionName()
|
||||
{
|
||||
return "Mesh To File";
|
||||
}
|
||||
|
||||
public static string GetPublisherName()
|
||||
{
|
||||
return "Pinwheel Studio";
|
||||
}
|
||||
|
||||
public static string GetDescription()
|
||||
{
|
||||
return
|
||||
"Mesh To File is a handy tool for exporting Unity meshes to 3D files. " +
|
||||
"This extension can be used for exporting Polaris terrain mesh.";
|
||||
}
|
||||
|
||||
public static string GetVersion()
|
||||
{
|
||||
return "v1.0.0";
|
||||
}
|
||||
|
||||
public static void OpenSupportLink()
|
||||
{
|
||||
GEditorCommon.OpenEmailEditor(
|
||||
"customer@pinwheel.studio",
|
||||
"Griffin Extension - Mesh To File",
|
||||
"YOUR_MESSAGE_HERE");
|
||||
}
|
||||
|
||||
public static void Button_GetMeshToFile()
|
||||
{
|
||||
string url = "http://bit.ly/2pW6kiI";
|
||||
Application.OpenURL(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bbc03eb773cca91498ca17956574f0e2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,47 @@
|
||||
#if GRIFFIN
|
||||
#if GRIFFIN && UNITY_EDITOR && !POSEIDON
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pinwheel.Griffin.GriffinExtension
|
||||
{
|
||||
public static class PoseidonPlaceholder
|
||||
{
|
||||
public static string GetExtensionName()
|
||||
{
|
||||
return "Poseidon - Low Poly Water System";
|
||||
}
|
||||
|
||||
public static string GetPublisherName()
|
||||
{
|
||||
return "Pinwheel Studio";
|
||||
}
|
||||
|
||||
public static string GetDescription()
|
||||
{
|
||||
return
|
||||
"Poseidon is an user friendly system which help you to create beautiful low poly water-scape. " +
|
||||
"Support for Builtin, Lightweight and Universal Render Pipeline.";
|
||||
}
|
||||
|
||||
public static string GetVersion()
|
||||
{
|
||||
return "v1.0.0";
|
||||
}
|
||||
|
||||
public static void OpenSupportLink()
|
||||
{
|
||||
GEditorCommon.OpenEmailEditor(
|
||||
"customer@pinwheel.studio",
|
||||
"Griffin Extension - Poseidon",
|
||||
"YOUR_MESSAGE_HERE");
|
||||
}
|
||||
|
||||
public static void Button_GetPoseidon()
|
||||
{
|
||||
string url = "http://bit.ly/31KXD8b";
|
||||
Application.OpenURL(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 990460a6d7461684bb30b4e6518b024a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,46 @@
|
||||
#if GRIFFIN
|
||||
#if GRIFFIN && UNITY_EDITOR && !GRIFFIN_URP
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pinwheel.Griffin.GriffinExtension
|
||||
{
|
||||
public static class UniversalRPSupportPlaceholder
|
||||
{
|
||||
public static string GetExtensionName()
|
||||
{
|
||||
return "Universal Render Pipeline Support";
|
||||
}
|
||||
|
||||
public static string GetPublisherName()
|
||||
{
|
||||
return "Pinwheel Studio";
|
||||
}
|
||||
|
||||
public static string GetDescription()
|
||||
{
|
||||
return "Adding support for URP.\n" +
|
||||
"Requires Unity 2019.3 or above.";
|
||||
}
|
||||
|
||||
public static string GetVersion()
|
||||
{
|
||||
return "v1.0.0";
|
||||
}
|
||||
|
||||
public static void OpenSupportLink()
|
||||
{
|
||||
GEditorCommon.OpenEmailEditor(
|
||||
GCommon.SUPPORT_EMAIL,
|
||||
"[Polaris] URP Support",
|
||||
"YOUR_MESSAGE_HERE");
|
||||
}
|
||||
|
||||
public static void Button_Download()
|
||||
{
|
||||
string url = "https://assetstore.unity.com/packages/slug/157785";
|
||||
Application.OpenURL(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c4a16b15dba14794086bac7eb3fe74ce
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,61 @@
|
||||
#if GRIFFIN
|
||||
#if GRIFFIN && UNITY_EDITOR && !GRIFFIN_VEGETATION_STUDIO_PRO
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Pinwheel.Griffin.GriffinExtension
|
||||
{
|
||||
public static class VSPIntegrationPlaceholder
|
||||
{
|
||||
public static string GetExtensionName()
|
||||
{
|
||||
return "Vegetation Studio Pro Integration";
|
||||
}
|
||||
|
||||
public static string GetPublisherName()
|
||||
{
|
||||
return "Pinwheel Studio";
|
||||
}
|
||||
|
||||
public static string GetDescription()
|
||||
{
|
||||
return
|
||||
"Providing quick setup specific for mesh-based terrain and many utility tasks.\n" +
|
||||
"Requires Polaris 2020.2.6 and up.";
|
||||
}
|
||||
|
||||
public static string GetVersion()
|
||||
{
|
||||
return "1.1.0";
|
||||
}
|
||||
|
||||
public static void OpenUserGuide()
|
||||
{
|
||||
Application.OpenURL("https://docs.google.com/document/d/1LQooyrEl2S5qP3w2cvX0RYy1CQvUs6mIBACJ8wNhSnE/edit#heading=h.qvs8ncv8wf1n");
|
||||
}
|
||||
|
||||
public static void OpenSupportLink()
|
||||
{
|
||||
GEditorCommon.OpenEmailEditor(
|
||||
GCommon.SUPPORT_EMAIL,
|
||||
"[Polaris] VSP Integration",
|
||||
"[YOUR_MESSAGE_HERE]");
|
||||
}
|
||||
|
||||
public static void OnGUI()
|
||||
{
|
||||
if (GUILayout.Button("Get Vegetation Studio Pro"))
|
||||
{
|
||||
Application.OpenURL(GAssetLink.VEGETATION_STUDIO_PRO);
|
||||
}
|
||||
if (GUILayout.Button("Get Integration Module"))
|
||||
{
|
||||
Application.OpenURL(GAssetLink.VSP_INTEGRATION);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5f44a4bc62adf34ba40e79197d88cd3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04033ab8492c8ec47b7ed6f327b3d554
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,87 @@
|
||||
#if GRIFFIN
|
||||
#if GRIFFIN && UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Callbacks;
|
||||
using System.IO;
|
||||
#if __MICROSPLAT__
|
||||
using JBooth.MicroSplat;
|
||||
#endif
|
||||
|
||||
namespace Pinwheel.Griffin.MicroSplat.GriffinExtension
|
||||
{
|
||||
public static class GMicroSplatIntegrationExtension
|
||||
{
|
||||
public static string GetExtensionName()
|
||||
{
|
||||
return "MicroSplat Integration";
|
||||
}
|
||||
|
||||
public static string GetPublisherName()
|
||||
{
|
||||
return "Jason Booth";
|
||||
}
|
||||
|
||||
public static string GetDescription()
|
||||
{
|
||||
return "Provide support and make it easier to use MicroSplat shaders on Polaris terrain.";
|
||||
}
|
||||
|
||||
public static string GetVersion()
|
||||
{
|
||||
return "1.0.0";
|
||||
}
|
||||
|
||||
public static void OpenUserGuide()
|
||||
{
|
||||
Application.OpenURL("https://docs.google.com/document/d/1LQooyrEl2S5qP3w2cvX0RYy1CQvUs6mIBACJ8wNhSnE/edit#heading=h.1mgw1o27bmpg");
|
||||
}
|
||||
|
||||
public static void OpenSupportLink()
|
||||
{
|
||||
GEditorCommon.OpenEmailEditor(
|
||||
GCommon.SUPPORT_EMAIL,
|
||||
"[Polaris V2] MicroSplat Integration",
|
||||
"YOUR_MESSAGE_HERE");
|
||||
}
|
||||
|
||||
public static void OnGUI()
|
||||
{
|
||||
if (GUILayout.Button("Get MicroSplat Core Module"))
|
||||
{
|
||||
Application.OpenURL(GAssetLink.MICRO_SPLAT);
|
||||
}
|
||||
if (GUILayout.Button("Get Polaris Integration Module"))
|
||||
{
|
||||
Application.OpenURL(GAssetLink.MICRO_SPLAT_INTEGRATION);
|
||||
}
|
||||
}
|
||||
|
||||
#if __MICROSPLAT_POLARIS__
|
||||
[DidReloadScripts]
|
||||
public static void OnScriptReload()
|
||||
{
|
||||
GStylizedTerrainInspector.GUIInject += InjectTerrainGUI;
|
||||
}
|
||||
|
||||
private static void InjectTerrainGUI(GStylizedTerrain terrain, int order)
|
||||
{
|
||||
if (order != 3)
|
||||
return;
|
||||
string label = "MicroSplat Integration";
|
||||
string id = "terrain-gui-microsplat-integration";
|
||||
GEditorCommon.Foldout(label, false, id, () =>
|
||||
{
|
||||
if (GUILayout.Button("Open Editor"))
|
||||
{
|
||||
GMicroSplatSetupWindow.ShowWindow();
|
||||
}
|
||||
});
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd7d1a9f4fbbf8b48bbe8a14015cd91b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,78 @@
|
||||
#if GRIFFIN
|
||||
#if __MICROSPLAT_POLARIS__
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Pinwheel.Griffin.MicroSplat
|
||||
{
|
||||
//[CreateAssetMenu(menuName = "Polaris V2/MicroSplat Integration Settings")]
|
||||
public class GMicroSplatIntegrationSettings : ScriptableObject
|
||||
{
|
||||
private static GMicroSplatIntegrationSettings instance;
|
||||
public static GMicroSplatIntegrationSettings Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = Resources.Load<GMicroSplatIntegrationSettings>("MicroSplatIntegrationSettings");
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private string dataDirectory;
|
||||
public string DataDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(dataDirectory))
|
||||
{
|
||||
dataDirectory = "Assets/";
|
||||
}
|
||||
return dataDirectory;
|
||||
}
|
||||
set
|
||||
{
|
||||
dataDirectory = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private string shaderNamePrefix;
|
||||
public string ShaderNamePrefix
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(shaderNamePrefix))
|
||||
{
|
||||
shaderNamePrefix = "MicroSplat";
|
||||
}
|
||||
return shaderNamePrefix;
|
||||
}
|
||||
set
|
||||
{
|
||||
shaderNamePrefix = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private bool initTextureEntries;
|
||||
public bool InitTextureEntries
|
||||
{
|
||||
get
|
||||
{
|
||||
return initTextureEntries;
|
||||
}
|
||||
set
|
||||
{
|
||||
initTextureEntries = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b05a21676f6765b46ab63bc360883773
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,104 @@
|
||||
#if GRIFFIN
|
||||
#if __MICROSPLAT_POLARIS__
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using System.IO;
|
||||
using JBooth.MicroSplat;
|
||||
|
||||
namespace Pinwheel.Griffin.MicroSplat
|
||||
{
|
||||
public static class GMicroSplatSetup
|
||||
{
|
||||
private static TextureArrayConfig currentTAConfig;
|
||||
|
||||
public static void Setup(HashSet<GStylizedTerrain> terrains)
|
||||
{
|
||||
GSplatPrototypeGroup splats = null;
|
||||
IEnumerator<GStylizedTerrain> iTerrains = terrains.GetEnumerator();
|
||||
while (iTerrains.MoveNext())
|
||||
{
|
||||
GStylizedTerrain t = iTerrains.Current;
|
||||
if (t == null)
|
||||
continue;
|
||||
Setup(t);
|
||||
if (t.TerrainData != null && t.TerrainData.Shading.Splats != null)
|
||||
{
|
||||
if (splats == null)
|
||||
{
|
||||
splats = t.TerrainData.Shading.Splats;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GMicroSplatIntegrationSettings.Instance.InitTextureEntries)
|
||||
{
|
||||
if (splats != null && currentTAConfig != null)
|
||||
{
|
||||
currentTAConfig.sourceTextures.Clear();
|
||||
currentTAConfig.sourceTextures2.Clear();
|
||||
currentTAConfig.sourceTextures3.Clear();
|
||||
foreach (GSplatPrototype p in splats.Prototypes)
|
||||
{
|
||||
TextureArrayConfig.TextureEntry entry = new TextureArrayConfig.TextureEntry();
|
||||
entry.diffuse = p.Texture;
|
||||
entry.normal = p.NormalMap;
|
||||
currentTAConfig.sourceTextures.Add(entry);
|
||||
currentTAConfig.sourceTextures2.Add(entry);
|
||||
currentTAConfig.sourceTextures3.Add(entry);
|
||||
}
|
||||
TextureArrayConfigEditor.CompileConfig(currentTAConfig);
|
||||
}
|
||||
}
|
||||
|
||||
iTerrains.Reset();
|
||||
while (iTerrains.MoveNext())
|
||||
{
|
||||
GStylizedTerrain t = iTerrains.Current;
|
||||
if (t == null)
|
||||
continue;
|
||||
t.PushControlTexturesToMicroSplat();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Setup(GStylizedTerrain t)
|
||||
{
|
||||
if (t.TerrainData == null)
|
||||
return;
|
||||
|
||||
t.TerrainData.Shading.ShadingSystem = GShadingSystem.MicroSplat;
|
||||
GMicroSplatIntegrationSettings settings = GMicroSplatIntegrationSettings.Instance;
|
||||
MicroSplatPolarisMesh pm = t.gameObject.GetComponent<MicroSplatPolarisMesh>();
|
||||
if (pm != null)
|
||||
{
|
||||
GUtilities.DestroyObject(pm);
|
||||
}
|
||||
|
||||
MeshRenderer[] renderers = t.GetOrCreateChunkRoot().GetComponentsInChildren<MeshRenderer>();
|
||||
List<MeshRenderer> rendererList = new List<MeshRenderer>();
|
||||
rendererList.AddRange(renderers);
|
||||
|
||||
MicroSplatPolarisMeshEditor.PolarisData data = new MicroSplatPolarisMeshEditor.PolarisData();
|
||||
data.basePath = settings.DataDirectory;
|
||||
data.name = settings.ShaderNamePrefix;
|
||||
data.additionalKeywords = new string[0];
|
||||
data.rootObject = t.gameObject;
|
||||
data.renderers = rendererList;
|
||||
MicroSplatPolarisMeshEditor.Setup(data);
|
||||
|
||||
pm = t.gameObject.GetComponent<MicroSplatPolarisMesh>();
|
||||
t.TerrainData.Shading.CustomMaterial = pm.templateMaterial;
|
||||
|
||||
string materialPath = AssetDatabase.GetAssetPath(pm.templateMaterial);
|
||||
string directory = Path.GetDirectoryName(materialPath);
|
||||
string configPath = string.Format("{0}/MicroSplatConfig.asset", directory);
|
||||
TextureArrayConfig config = AssetDatabase.LoadAssetAtPath<TextureArrayConfig>(configPath);
|
||||
t.TerrainData.Shading.MicroSplatTextureArrayConfig = config;
|
||||
|
||||
currentTAConfig = config;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e652596841a33742a9b8269bab2b970
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,117 @@
|
||||
#if GRIFFIN
|
||||
#if __MICROSPLAT_POLARIS__
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Pinwheel.Griffin.MicroSplat
|
||||
{
|
||||
public class GMicroSplatSetupWindow : EditorWindow
|
||||
{
|
||||
private HashSet<GStylizedTerrain> targets;
|
||||
private Vector2 scrollPos;
|
||||
|
||||
[MenuItem("Window/Polaris/Tools/MicroSplat Integration")]
|
||||
public static void ShowWindow()
|
||||
{
|
||||
GMicroSplatSetupWindow window = GetWindow<GMicroSplatSetupWindow>();
|
||||
window.titleContent = new GUIContent("MicroSplat Setup");
|
||||
window.Show();
|
||||
}
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnDisable()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
|
||||
DrawInstructionGUI();
|
||||
DrawSetupGUI();
|
||||
EditorGUILayout.EndScrollView();
|
||||
}
|
||||
|
||||
public void DrawInstructionGUI()
|
||||
{
|
||||
string label = "Instruction";
|
||||
string id = "ms-integration-instruction";
|
||||
|
||||
GEditorCommon.Foldout(label, true, id, () =>
|
||||
{
|
||||
EditorGUILayout.LabelField("This module is used for integration MicroSplat shader to Polaris terrain.");
|
||||
|
||||
GEditorCommon.Header("Setup Steps");
|
||||
EditorGUILayout.LabelField("1. Select a directory for storing MicroSplat files, target terrains will share the same Texture Array Config and shader. Make sure the directory is an empty folder.");
|
||||
EditorGUILayout.LabelField("2. Pick a name for the generated shaders.");
|
||||
EditorGUILayout.LabelField("3. Drop the terrain game objects or the environment root into the selector box.");
|
||||
EditorGUILayout.LabelField("4. Click Setup.");
|
||||
|
||||
GEditorCommon.Header("After Setup");
|
||||
EditorGUILayout.LabelField("1. Texture layers will be fetched from the Splat Prototype Group, for the first time only, if Init Texture Entries is on.");
|
||||
EditorGUILayout.LabelField("2. The Splat Prototype Group serves no purpose after this point. You have to do all material configs on MicroSplat side. Refer to its documentation for more info.");
|
||||
EditorGUILayout.LabelField("3. You can still use texturing tools to edit your terrains, Splat Control Maps will be sync between two systems.");
|
||||
});
|
||||
}
|
||||
|
||||
public void DrawSetupGUI()
|
||||
{
|
||||
string label = "Setup";
|
||||
string id = "ms-integration-setup";
|
||||
|
||||
GEditorCommon.Foldout(label, true, id, () =>
|
||||
{
|
||||
GMicroSplatIntegrationSettings settings = GMicroSplatIntegrationSettings.Instance;
|
||||
string dir = settings.DataDirectory;
|
||||
GEditorCommon.BrowseFolder("Directory", ref dir);
|
||||
settings.DataDirectory = dir;
|
||||
settings.ShaderNamePrefix = EditorGUILayout.TextField("Shader Name", settings.ShaderNamePrefix);
|
||||
if (settings.ShaderNamePrefix.StartsWith("Polaris"))
|
||||
{
|
||||
settings.ShaderNamePrefix = "_" + settings.ShaderNamePrefix;
|
||||
}
|
||||
settings.InitTextureEntries = EditorGUILayout.Toggle("Init Texture Entries", settings.InitTextureEntries);
|
||||
if (targets == null)
|
||||
{
|
||||
targets = new HashSet<GStylizedTerrain>();
|
||||
}
|
||||
EditorGUILayout.LabelField("Target(s)", targets.Count.ToString());
|
||||
|
||||
EditorGUI.indentLevel += 1;
|
||||
IEnumerator<GStylizedTerrain> iTargets = targets.GetEnumerator();
|
||||
while (iTargets.MoveNext())
|
||||
{
|
||||
GStylizedTerrain t = iTargets.Current;
|
||||
if (t == null)
|
||||
continue;
|
||||
EditorGUILayout.LabelField(" ", t.name, GEditorCommon.ItalicLabel);
|
||||
}
|
||||
EditorGUI.indentLevel -= 1;
|
||||
|
||||
Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(GEditorCommon.objectSelectorDragDropHeight));
|
||||
GameObject g = GEditorCommon.ObjectSelectorDragDrop<GameObject>(r, "Drop a Game Object here", "t:GStylizedTerrain", true);
|
||||
if (g != null)
|
||||
{
|
||||
GStylizedTerrain[] terrains = g.GetComponentsInChildren<GStylizedTerrain>();
|
||||
for (int i = 0; i < terrains.Length; ++i)
|
||||
{
|
||||
targets.Add(terrains[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Setup"))
|
||||
{
|
||||
GMicroSplatSetup.Setup(targets);
|
||||
}
|
||||
|
||||
EditorUtility.SetDirty(settings);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42d3a8a8949b3b54181aa62e168f1c71
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 678964909da65f54ab69b8c66bb9aa3e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,62 @@
|
||||
#if GRIFFIN && UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Pinwheel.Griffin.VegetationStudioPro.GriffinExtension
|
||||
{
|
||||
public static class GVSPExtensionEntry
|
||||
{
|
||||
public static string GetExtensionName()
|
||||
{
|
||||
return "Vegetation Studio Pro Integration";
|
||||
}
|
||||
|
||||
public static string GetPublisherName()
|
||||
{
|
||||
return "Pinwheel Studio";
|
||||
}
|
||||
|
||||
public static string GetDescription()
|
||||
{
|
||||
return
|
||||
"Providing quick setup specific for mesh-based terrain and many utility tasks.\n" +
|
||||
"Requires Polaris 2020.2.6 and up.";
|
||||
}
|
||||
|
||||
public static string GetVersion()
|
||||
{
|
||||
return "1.1.0";
|
||||
}
|
||||
|
||||
public static void OpenUserGuide()
|
||||
{
|
||||
Application.OpenURL("https://docs.google.com/document/d/1LQooyrEl2S5qP3w2cvX0RYy1CQvUs6mIBACJ8wNhSnE/edit#heading=h.qvs8ncv8wf1n");
|
||||
}
|
||||
|
||||
public static void OpenSupportLink()
|
||||
{
|
||||
GEditorCommon.OpenEmailEditor(
|
||||
GCommon.SUPPORT_EMAIL,
|
||||
"[Polaris] VSP Integration",
|
||||
"[YOUR_MESSAGE_HERE]");
|
||||
}
|
||||
|
||||
public static void OnGUI()
|
||||
{
|
||||
#if VEGETATION_STUDIO_PRO
|
||||
if (GUILayout.Button("Open Editor"))
|
||||
{
|
||||
GVSPIntegrationEditor.ShowWindow();
|
||||
}
|
||||
#else
|
||||
if (GUILayout.Button("Get Vegetation Studio Pro"))
|
||||
{
|
||||
Application.OpenURL(GAssetLink.VEGETATION_STUDIO_PRO);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3034bc67bfa3cbc4e939235f56c6fad7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,495 @@
|
||||
#if GRIFFIN && VEGETATION_STUDIO_PRO
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Pinwheel.Griffin;
|
||||
using AwesomeTechnologies.MeshTerrains;
|
||||
using AwesomeTechnologies.VegetationSystem;
|
||||
using AwesomeTechnologies.VegetationStudio;
|
||||
using AwesomeTechnologies.TouchReact;
|
||||
using AwesomeTechnologies.ColliderSystem;
|
||||
using AwesomeTechnologies.Vegetation.PersistentStorage;
|
||||
using AwesomeTechnologies.PrefabSpawner;
|
||||
using AwesomeTechnologies.TerrainSystem;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace Pinwheel.Griffin.VegetationStudioPro
|
||||
{
|
||||
public static class GVSPIntegration
|
||||
{
|
||||
public const int VEGETATION_SOURCE_ID = 20;
|
||||
|
||||
public static void SetupMeshTerrainsAndVSPManager()
|
||||
{
|
||||
DisablePolarisFoliageRenderer();
|
||||
SetupMeshTerrainComponents();
|
||||
VegetationStudioManager manager = SetupVegetationStudioManager();
|
||||
VegetationSystemPro vs = manager.GetComponentInChildren<VegetationSystemPro>();
|
||||
vs.AddAllMeshTerrains();
|
||||
|
||||
if (GVSPSettings.Instance.QuickSetup.CreateVegetationPackage)
|
||||
{
|
||||
VegetationPackagePro package = CreateVegetationPackage();
|
||||
vs.VegetationPackageProList.Clear();
|
||||
vs.AddVegetationPackage(package);
|
||||
vs.RefreshVegetationSystem();
|
||||
}
|
||||
if (GVSPSettings.Instance.QuickSetup.CreatePersistentStorage)
|
||||
{
|
||||
PersistentVegetationStorage pvs = manager.GetComponentInChildren<PersistentVegetationStorage>();
|
||||
PersistentVegetationStoragePackage package = CreatePersistentStorage();
|
||||
pvs.PersistentVegetationStoragePackage = package;
|
||||
pvs.InitializePersistentStorage();
|
||||
}
|
||||
}
|
||||
|
||||
internal static void DisablePolarisFoliageRenderer()
|
||||
{
|
||||
GCommon.ForEachTerrain(-1, (t) =>
|
||||
{
|
||||
if (t.TerrainData == null)
|
||||
return;
|
||||
t.TerrainData.Rendering.DrawTrees = false;
|
||||
t.TerrainData.Rendering.DrawGrasses = false;
|
||||
});
|
||||
}
|
||||
|
||||
internal static void SetupMeshTerrainComponents()
|
||||
{
|
||||
GCommon.ForEachTerrain(-1, (t) =>
|
||||
{
|
||||
if (t.TerrainData == null)
|
||||
return;
|
||||
SetupMeshTerrainComponent(t);
|
||||
});
|
||||
}
|
||||
|
||||
internal static void SetupMeshTerrainComponent(GStylizedTerrain t)
|
||||
{
|
||||
MeshTerrain oldMeshTerrainComponent = t.GetComponent<MeshTerrain>();
|
||||
if (oldMeshTerrainComponent)
|
||||
{
|
||||
GUtilities.DestroyObject(oldMeshTerrainComponent);
|
||||
}
|
||||
|
||||
GVSPPolarisTerrain polarisTerrain = t.GetComponent<GVSPPolarisTerrain>();
|
||||
if (polarisTerrain == null)
|
||||
{
|
||||
polarisTerrain = t.gameObject.AddComponent<GVSPPolarisTerrain>();
|
||||
}
|
||||
polarisTerrain.Terrain = t;
|
||||
polarisTerrain.AutoAddToVegegetationSystem = true;
|
||||
polarisTerrain.Filterlods = true;
|
||||
polarisTerrain.MeshTerrainMeshSourceList.Clear();
|
||||
|
||||
GTerrainChunk[] chunks = t.GetChunks();
|
||||
for (int i = 0; i < chunks.Length; ++i)
|
||||
{
|
||||
polarisTerrain.AddMeshRenderer(chunks[i].gameObject, TerrainSourceID.TerrainSourceID1);
|
||||
}
|
||||
polarisTerrain.MeshTerrainData = CreateMeshTerrainDataAsset(t);
|
||||
polarisTerrain.GenerateMeshTerrain();
|
||||
polarisTerrain.NeedGeneration = false;
|
||||
VegetationStudioManager.ClearCache();
|
||||
}
|
||||
|
||||
internal static MeshTerrainData CreateMeshTerrainDataAsset(GStylizedTerrain t)
|
||||
{
|
||||
MeshTerrainData meshTerrainData = ScriptableObject.CreateInstance<MeshTerrainData>();
|
||||
meshTerrainData.name = "VSP_MeshTerrainData_" + t.TerrainData.Id;
|
||||
string fullPath = GCommon.CreateAssetAtSameDirectory(meshTerrainData, t.TerrainData);
|
||||
meshTerrainData = AssetDatabase.LoadAssetAtPath<MeshTerrainData>(fullPath);
|
||||
return meshTerrainData;
|
||||
}
|
||||
|
||||
internal static VegetationStudioManager SetupVegetationStudioManager()
|
||||
{
|
||||
VegetationStudioManager vegetationStudioManager = Object.FindObjectOfType<VegetationStudioManager>();
|
||||
if (vegetationStudioManager)
|
||||
{
|
||||
return vegetationStudioManager;
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject go = new GameObject { name = "VegetationStudioPro" };
|
||||
vegetationStudioManager = go.AddComponent<VegetationStudioManager>();
|
||||
|
||||
GameObject vegetationSystem = new GameObject { name = "VegetationSystemPro" };
|
||||
vegetationSystem.transform.SetParent(go.transform);
|
||||
VegetationSystemPro vegetationSystemPro = vegetationSystem.AddComponent<VegetationSystemPro>();
|
||||
vegetationSystem.AddComponent<TerrainSystemPro>();
|
||||
vegetationSystemPro.AddAllMeshTerrains();
|
||||
|
||||
#if TOUCH_REACT
|
||||
GameObject touchReactSystem = new GameObject { name = "TouchReactSystem" };
|
||||
touchReactSystem.transform.SetParent(go.transform);
|
||||
touchReactSystem.AddComponent<TouchReactSystem>();
|
||||
#endif
|
||||
vegetationSystem.AddComponent<ColliderSystemPro>();
|
||||
vegetationSystem.AddComponent<PersistentVegetationStorage>();
|
||||
RuntimePrefabSpawner runtimePrefabSpawner = vegetationSystem.AddComponent<RuntimePrefabSpawner>();
|
||||
runtimePrefabSpawner.enabled = false;
|
||||
}
|
||||
return vegetationStudioManager;
|
||||
}
|
||||
|
||||
internal static VegetationPackagePro CreateVegetationPackage()
|
||||
{
|
||||
VegetationPackagePro v = ScriptableObject.CreateInstance<VegetationPackagePro>();
|
||||
v.PackageName = "VSP_Vegetation_" + GCommon.GetUniqueID();
|
||||
v.name = v.PackageName;
|
||||
AssetDatabase.CreateAsset(v, "Assets/" + v.name + ".asset");
|
||||
List<GTreePrototypeGroup> trees = GetActiveTreePrototypesGroups();
|
||||
for (int i = 0; i < trees.Count; ++i)
|
||||
{
|
||||
|
||||
GTreePrototypeGroup t = trees[i];
|
||||
for (int j = 0; j < t.Prototypes.Count; ++j)
|
||||
{
|
||||
GTreePrototype proto = t.Prototypes[j];
|
||||
if (proto.Prefab == null)
|
||||
continue;
|
||||
v.AddVegetationItem(proto.Prefab, VegetationType.Tree);
|
||||
}
|
||||
EditorUtility.SetDirty(v);
|
||||
}
|
||||
|
||||
List<GGrassPrototypeGroup> grasses = GetActiveGrassPrototypesGroups();
|
||||
for (int i = 0; i < grasses.Count; ++i)
|
||||
{
|
||||
|
||||
GGrassPrototypeGroup g = grasses[i];
|
||||
for (int j = 0; j < g.Prototypes.Count; ++j)
|
||||
{
|
||||
GGrassPrototype proto = g.Prototypes[j];
|
||||
if (proto.Shape == GGrassShape.DetailObject)
|
||||
{
|
||||
if (proto.Prefab == null)
|
||||
continue;
|
||||
string path = AssetDatabase.GetAssetPath(proto.Prefab);
|
||||
string id = string.IsNullOrEmpty(path) ?
|
||||
System.Guid.NewGuid().ToString() :
|
||||
AssetDatabase.AssetPathToGUID(path); ;
|
||||
v.AddVegetationItem(proto.Prefab, VegetationType.Objects, true, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (proto.Texture == null)
|
||||
continue;
|
||||
string path = AssetDatabase.GetAssetPath(proto.Texture);
|
||||
string id = string.IsNullOrEmpty(path) ?
|
||||
System.Guid.NewGuid().ToString() :
|
||||
AssetDatabase.AssetPathToGUID(path);
|
||||
v.AddVegetationItem(proto.Texture, VegetationType.Grass, true, id);
|
||||
VegetationItemInfoPro item = v.GetVegetationInfo(id);
|
||||
|
||||
SerializedControllerProperty dryColorProps = item.ShaderControllerSettings.ControlerPropertyList.Find(prop => prop.PropertyName.Equals("TintColor1"));
|
||||
if (dryColorProps != null)
|
||||
{
|
||||
dryColorProps.ColorValue = proto.Color;
|
||||
}
|
||||
|
||||
SerializedControllerProperty healthyColorProps = item.ShaderControllerSettings.ControlerPropertyList.Find(prop => prop.PropertyName.Equals("TintColor2"));
|
||||
if (healthyColorProps != null)
|
||||
{
|
||||
healthyColorProps.ColorValue = proto.Color;
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorUtility.SetDirty(v);
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
internal static List<GTreePrototypeGroup> GetActiveTreePrototypesGroups()
|
||||
{
|
||||
List<GTreePrototypeGroup> trees = new List<GTreePrototypeGroup>();
|
||||
IEnumerator<GStylizedTerrain> terrains = GStylizedTerrain.ActiveTerrains.GetEnumerator();
|
||||
while (terrains.MoveNext())
|
||||
{
|
||||
GStylizedTerrain t = terrains.Current;
|
||||
if (t.TerrainData == null)
|
||||
continue;
|
||||
if (t.TerrainData.Foliage.Trees == null)
|
||||
continue;
|
||||
if (t.TerrainData.Foliage.Trees.Prototypes.Count == 0)
|
||||
continue;
|
||||
trees.AddIfNotContains(t.TerrainData.Foliage.Trees);
|
||||
}
|
||||
return trees;
|
||||
}
|
||||
|
||||
internal static List<GGrassPrototypeGroup> GetActiveGrassPrototypesGroups()
|
||||
{
|
||||
List<GGrassPrototypeGroup> trees = new List<GGrassPrototypeGroup>();
|
||||
IEnumerator<GStylizedTerrain> terrains = GStylizedTerrain.ActiveTerrains.GetEnumerator();
|
||||
while (terrains.MoveNext())
|
||||
{
|
||||
GStylizedTerrain t = terrains.Current;
|
||||
if (t.TerrainData == null)
|
||||
continue;
|
||||
if (t.TerrainData.Foliage.Grasses == null)
|
||||
continue;
|
||||
if (t.TerrainData.Foliage.Grasses.Prototypes.Count == 0)
|
||||
continue;
|
||||
trees.AddIfNotContains(t.TerrainData.Foliage.Grasses);
|
||||
}
|
||||
return trees;
|
||||
}
|
||||
|
||||
internal static PersistentVegetationStoragePackage CreatePersistentStorage()
|
||||
{
|
||||
PersistentVegetationStoragePackage package = ScriptableObject.CreateInstance<PersistentVegetationStoragePackage>();
|
||||
package.name = "VSP_PersistentStorage_" + GCommon.GetUniqueID();
|
||||
AssetDatabase.CreateAsset(package, "Assets/" + package.name + ".asset");
|
||||
return package;
|
||||
}
|
||||
|
||||
public static void ImportFoliageAsPersistantData(GStylizedTerrain terrain, VegetationStudioManager vsm)
|
||||
{
|
||||
GTerrainData terrainData = terrain.TerrainData;
|
||||
if (terrainData == null)
|
||||
{
|
||||
Debug.Log("Nothing to import.");
|
||||
return;
|
||||
}
|
||||
if (terrainData.Foliage.TreeInstances.Count == 0 && terrainData.Foliage.GrassInstanceCount == 0)
|
||||
{
|
||||
Debug.Log("Nothing to import.");
|
||||
return;
|
||||
}
|
||||
|
||||
VegetationSystemPro vs = vsm.GetComponentInChildren<VegetationSystemPro>();
|
||||
if (vs == null ||
|
||||
vs.VegetationPackageProList.Count == 0)
|
||||
{
|
||||
Debug.Log("No Vegetation System found.");
|
||||
return;
|
||||
}
|
||||
|
||||
PersistentVegetationStorage pvs = vsm.GetComponentInChildren<PersistentVegetationStorage>();
|
||||
if (pvs == null ||
|
||||
pvs.PersistentVegetationStoragePackage == null)
|
||||
{
|
||||
Debug.Log("No Persistent Vegetation Storage found");
|
||||
return;
|
||||
}
|
||||
|
||||
ImportTrees(terrain, vs.VegetationPackageProList, pvs.PersistentVegetationStoragePackage);
|
||||
ImportGrasses(terrain, vs.VegetationPackageProList, pvs.PersistentVegetationStoragePackage);
|
||||
|
||||
if (GVSPSettings.Instance.Import.SetProceduralDensityToZero)
|
||||
{
|
||||
for (int i = 0; i < vs.VegetationPackageProList.Count; ++i)
|
||||
{
|
||||
SetProceduralDensityToZero(vs.VegetationPackageProList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void ImportTrees(GStylizedTerrain terrain, List<VegetationPackagePro> vegetationPackages, PersistentVegetationStoragePackage persistantStorage)
|
||||
{
|
||||
EditorUtility.DisplayProgressBar(
|
||||
"Importing",
|
||||
"Importing Tree ... 0%",
|
||||
0);
|
||||
|
||||
try
|
||||
{
|
||||
List<GTreePrototype> prototypes = terrain.TerrainData.Foliage.Trees.Prototypes;
|
||||
|
||||
string[] ids = new string[prototypes.Count];
|
||||
for (int i = 0; i < prototypes.Count; ++i)
|
||||
{
|
||||
GTreePrototype proto = prototypes[i];
|
||||
if (proto.Prefab == null)
|
||||
{
|
||||
ids[i] = string.Empty;
|
||||
continue;
|
||||
}
|
||||
string path = AssetDatabase.GetAssetPath(proto.Prefab);
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
string guid = AssetDatabase.AssetPathToGUID(path);
|
||||
ids[i] = VegetationStudioManager.GetVegetationItemID(guid);
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 terrainPos = terrain.transform.position;
|
||||
Vector3 terrainSize = terrain.TerrainData.Geometry.Size;
|
||||
Vector3 position = Vector3.zero;
|
||||
Quaternion rotation = Quaternion.identity;
|
||||
Vector3 scale = Vector3.one;
|
||||
|
||||
float pivotOffset = 0;
|
||||
Quaternion baseRotation = Quaternion.identity;
|
||||
Vector3 baseScale = Vector3.zero;
|
||||
|
||||
List<GTreeInstance> instances = terrain.TerrainData.Foliage.TreeInstances;
|
||||
for (int i = 0; i < instances.Count; ++i)
|
||||
{
|
||||
if (i % 100 == 0)
|
||||
{
|
||||
int percent = (int)(i * 100f / instances.Count);
|
||||
EditorUtility.DisplayProgressBar(
|
||||
"Importing",
|
||||
"Importing Tree ... " + percent.ToString() + "%",
|
||||
i * 1.0f / instances.Count);
|
||||
}
|
||||
|
||||
GTreeInstance tree = instances[i];
|
||||
if (tree.PrototypeIndex < 0 || tree.PrototypeIndex >= prototypes.Count)
|
||||
continue;
|
||||
|
||||
GTreePrototype proto = prototypes[tree.PrototypeIndex];
|
||||
pivotOffset = proto.PivotOffset;
|
||||
baseRotation = proto.BaseRotation;
|
||||
baseScale = proto.BaseScale;
|
||||
|
||||
position.Set(
|
||||
tree.Position.x * terrainSize.x + terrainPos.x,
|
||||
tree.Position.y * terrainSize.y + terrainPos.y + pivotOffset,
|
||||
tree.Position.z * terrainSize.z + terrainPos.z);
|
||||
rotation = tree.Rotation * baseRotation;
|
||||
scale.Set(
|
||||
tree.Scale.x * baseScale.x,
|
||||
tree.Scale.y * baseScale.y,
|
||||
tree.Scale.z * baseScale.z);
|
||||
|
||||
VegetationStudioManager.AddVegetationItemInstance(
|
||||
ids[tree.PrototypeIndex],
|
||||
position,
|
||||
scale,
|
||||
rotation,
|
||||
true,
|
||||
VEGETATION_SOURCE_ID,
|
||||
100,
|
||||
false);
|
||||
}
|
||||
|
||||
VegetationStudioManager.ClearCache();
|
||||
VegetationStudioManager.RefreshVegetationSystem();
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Debug.LogException(e);
|
||||
}
|
||||
EditorUtility.ClearProgressBar();
|
||||
}
|
||||
|
||||
private static void ImportGrasses(GStylizedTerrain terrain, List<VegetationPackagePro> vegetationPackages, PersistentVegetationStoragePackage persistantStorage)
|
||||
{
|
||||
EditorUtility.DisplayProgressBar(
|
||||
"Importing",
|
||||
"Importing Grass ... 0%",
|
||||
0);
|
||||
|
||||
try
|
||||
{
|
||||
List<GGrassPrototype> prototypes = terrain.TerrainData.Foliage.Grasses.Prototypes;
|
||||
|
||||
string[] ids = new string[prototypes.Count];
|
||||
for (int i = 0; i < prototypes.Count; ++i)
|
||||
{
|
||||
GGrassPrototype proto = prototypes[i];
|
||||
string path = null;
|
||||
if (proto.Shape == GGrassShape.DetailObject)
|
||||
{
|
||||
if (proto.Prefab == null)
|
||||
{
|
||||
ids[i] = string.Empty;
|
||||
continue;
|
||||
}
|
||||
path = AssetDatabase.GetAssetPath(proto.Prefab);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (proto.Texture == null)
|
||||
{
|
||||
ids[i] = string.Empty;
|
||||
continue;
|
||||
}
|
||||
path = AssetDatabase.GetAssetPath(proto.Texture);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
string guid = AssetDatabase.AssetPathToGUID(path);
|
||||
ids[i] = VegetationStudioManager.GetVegetationItemID(guid);
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 terrainPos = terrain.transform.position;
|
||||
Vector3 terrainSize = terrain.TerrainData.Geometry.Size;
|
||||
Vector3 position = Vector3.zero;
|
||||
Quaternion rotation = Quaternion.identity;
|
||||
Vector3 scale = Vector3.one;
|
||||
|
||||
float pivotOffset = 0;
|
||||
Vector3 baseScale = Vector3.zero;
|
||||
|
||||
List<GGrassInstance> instances = terrain.TerrainData.Foliage.GetGrassInstances();
|
||||
for (int i = 0; i < instances.Count; ++i)
|
||||
{
|
||||
if (i % 100 == 0)
|
||||
{
|
||||
int percent = (int)(i * 100f / instances.Count);
|
||||
EditorUtility.DisplayProgressBar(
|
||||
"Importing",
|
||||
"Importing Grass ... " + percent.ToString() + "%",
|
||||
i * 1.0f / instances.Count);
|
||||
}
|
||||
|
||||
GGrassInstance grass = instances[i];
|
||||
if (grass.PrototypeIndex < 0 || grass.PrototypeIndex >= prototypes.Count)
|
||||
continue;
|
||||
|
||||
GGrassPrototype proto = prototypes[grass.PrototypeIndex];
|
||||
pivotOffset = proto.PivotOffset;
|
||||
baseScale = proto.Size;
|
||||
|
||||
position.Set(
|
||||
grass.Position.x * terrainSize.x + terrainPos.x,
|
||||
grass.Position.y * terrainSize.y + terrainPos.y + pivotOffset,
|
||||
grass.Position.z * terrainSize.z + terrainPos.z);
|
||||
rotation = grass.Rotation;
|
||||
scale.Set(
|
||||
grass.Scale.x * baseScale.x,
|
||||
grass.Scale.y * baseScale.y,
|
||||
grass.Scale.z * baseScale.z);
|
||||
|
||||
VegetationStudioManager.AddVegetationItemInstance(
|
||||
ids[grass.PrototypeIndex],
|
||||
position,
|
||||
scale,
|
||||
rotation,
|
||||
true,
|
||||
VEGETATION_SOURCE_ID,
|
||||
100,
|
||||
false);
|
||||
}
|
||||
|
||||
VegetationStudioManager.ClearCache();
|
||||
VegetationStudioManager.RefreshVegetationSystem();
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Debug.LogException(e);
|
||||
}
|
||||
EditorUtility.ClearProgressBar();
|
||||
}
|
||||
|
||||
private static void SetProceduralDensityToZero(VegetationPackagePro package)
|
||||
{
|
||||
List<VegetationItemInfoPro> items = package.VegetationInfoList;
|
||||
for (int i = 0; i < items.Count; ++i)
|
||||
{
|
||||
items[i].Density = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 481cdc47a490a7e418ac6a97c6ea19ea
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,114 @@
|
||||
#if GRIFFIN && VEGETATION_STUDIO_PRO
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using AwesomeTechnologies.MeshTerrains;
|
||||
using AwesomeTechnologies.VegetationSystem;
|
||||
using AwesomeTechnologies.VegetationStudio;
|
||||
using AwesomeTechnologies.TouchReact;
|
||||
using AwesomeTechnologies.ColliderSystem;
|
||||
using AwesomeTechnologies.Vegetation.PersistentStorage;
|
||||
using AwesomeTechnologies.PrefabSpawner;
|
||||
|
||||
namespace Pinwheel.Griffin.VegetationStudioPro
|
||||
{
|
||||
public class GVSPIntegrationEditor : EditorWindow
|
||||
{
|
||||
[MenuItem("Window/Polaris/Tools/Vegetation Studio Pro Integration")]
|
||||
public static void ShowWindow()
|
||||
{
|
||||
GVSPIntegrationEditor window = GVSPIntegrationEditor.GetWindow<GVSPIntegrationEditor>();
|
||||
window.titleContent = new GUIContent("VSP Integration");
|
||||
window.Show();
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
EditorGUIUtility.labelWidth = 250;
|
||||
DrawQuickSetupGUI();
|
||||
DrawImportPolarisFoliageGUI();
|
||||
DrawMaskPaintingGUI();
|
||||
DrawSplineMaskingGUI();
|
||||
}
|
||||
|
||||
public void DrawQuickSetupGUI()
|
||||
{
|
||||
string label = "Quick Setup";
|
||||
string id = "quick-setup-vsp-editor";
|
||||
GEditorCommon.Foldout(label, true, id, () =>
|
||||
{
|
||||
const string INSTRUCTION = "Quickly setup Mesh Terrain components for each terrains and create Vegetation Studio Manager instance.";
|
||||
EditorGUILayout.LabelField(INSTRUCTION, GEditorCommon.WordWrapItalicLabel);
|
||||
|
||||
GVSPSettings.GQuickSetupSettings settings = GVSPSettings.Instance.QuickSetup;
|
||||
GUIContent createVegetationContent = new GUIContent(
|
||||
"Create Vegetation Package",
|
||||
"Create a new Vegetation Package from all foliage prototypes in the scene. All prototype will be merged into one package.");
|
||||
settings.CreateVegetationPackage = EditorGUILayout.Toggle(createVegetationContent, settings.CreateVegetationPackage);
|
||||
|
||||
GUIContent createStorageContent = new GUIContent(
|
||||
"Create Persistent Storage",
|
||||
"Create a new Persistent Storage asset, useful if you want to import spawned foliage from Polaris to Vegetation Studio Pro.");
|
||||
settings.CreatePersistentStorage = EditorGUILayout.Toggle(createStorageContent, settings.CreatePersistentStorage);
|
||||
|
||||
GVSPSettings.Instance.QuickSetup = settings;
|
||||
|
||||
if (GUILayout.Button("Setup"))
|
||||
{
|
||||
GVSPIntegration.SetupMeshTerrainsAndVSPManager();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void DrawImportPolarisFoliageGUI()
|
||||
{
|
||||
string label = "Import Polaris Foliage to Persistent Vegetation Storage";
|
||||
string id = "import-polaris-foliage-vsp-editor";
|
||||
GEditorCommon.Foldout(label, false, id, () =>
|
||||
{
|
||||
const string INSTRUCTION = "Import foliage instances from Polaris to Vegetation Studio Pro as persistent data.\n" +
|
||||
"Instances that share the same texture or prefab will be merged into one vegetation type.\n" +
|
||||
"Requires Vegetation Package to be setup beforehand.";
|
||||
EditorGUILayout.LabelField(INSTRUCTION, GEditorCommon.WordWrapItalicLabel);
|
||||
GVSPSettings.GImportSettings settings = GVSPSettings.Instance.Import;
|
||||
settings.VSManager = EditorGUILayout.ObjectField("Vegetation Studio Manager", settings.VSManager, typeof(VegetationStudioManager), true) as VegetationStudioManager;
|
||||
settings.Terrain = EditorGUILayout.ObjectField("Terrain", settings.Terrain, typeof(GStylizedTerrain), true) as GStylizedTerrain;
|
||||
settings.SetProceduralDensityToZero = EditorGUILayout.Toggle("Set Procedural Density To Zero", settings.SetProceduralDensityToZero);
|
||||
GVSPSettings.Instance.Import = settings;
|
||||
if (GUILayout.Button("Import"))
|
||||
{
|
||||
GVSPIntegration.ImportFoliageAsPersistantData(settings.Terrain, settings.VSManager);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void DrawMaskPaintingGUI()
|
||||
{
|
||||
string label = "Mask Painting";
|
||||
string id = "mask-painting-vsp-editor";
|
||||
|
||||
GEditorCommon.Foldout(label, false, id, () =>
|
||||
{
|
||||
EditorGUILayout.LabelField("Paint on terrain mask texture and use that mask with VSP texture rules.", GEditorCommon.WordWrapItalicLabel);
|
||||
EditorGUILayout.LabelField("1. Set mask resolution using the terrain Inspector.", GEditorCommon.WordWrapItalicLabel);
|
||||
EditorGUILayout.LabelField("2. Create Texture Mask Group and configure texture mask rules using VSP Inspector.", GEditorCommon.WordWrapItalicLabel);
|
||||
EditorGUILayout.LabelField("3. Use the Geometry-Texture Painter, Mask mode to paint on specific mask channel.", GEditorCommon.WordWrapItalicLabel);
|
||||
EditorGUILayout.LabelField("4. Click Refresh Vegetation System button in the Inspector, under Mask Painting foldout.", GEditorCommon.WordWrapItalicLabel);
|
||||
});
|
||||
}
|
||||
|
||||
public void DrawSplineMaskingGUI()
|
||||
{
|
||||
string label = "Spline Masking";
|
||||
string id = "spline-masking-vsp-editor";
|
||||
GEditorCommon.Foldout(label, false, id, () =>
|
||||
{
|
||||
const string INSTRUCTION = "Spline Masking adds Line Mask component along a spline to remove foliage from roads, rivers, etc.\n" +
|
||||
"Select a Spline in the scene and add a Spline Masking modifier.";
|
||||
EditorGUILayout.LabelField(INSTRUCTION, GEditorCommon.WordWrapItalicLabel);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eaad0525a2778a74b9d520d0ca5fb389
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,22 @@
|
||||
#if GRIFFIN && VEGETATION_STUDIO_PRO
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using AwesomeTechnologies.MeshTerrains;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Pinwheel.Griffin.VegetationStudioPro
|
||||
{
|
||||
[CustomEditor(typeof(GVSPPolarisTerrain))]
|
||||
public class GVSPPolarisTerrainEditor : MeshTerrainEditor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
GVSPPolarisTerrain instance = (GVSPPolarisTerrain)target;
|
||||
instance.Terrain = EditorGUILayout.ObjectField("Terrain", instance.Terrain, typeof(GStylizedTerrain), true) as GStylizedTerrain;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cfe5e3f24e65b124e8994c348350b130
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,117 @@
|
||||
#if GRIFFIN && VEGETATION_STUDIO_PRO
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using AwesomeTechnologies.MeshTerrains;
|
||||
using AwesomeTechnologies.VegetationSystem;
|
||||
using AwesomeTechnologies.VegetationStudio;
|
||||
using AwesomeTechnologies.TouchReact;
|
||||
using AwesomeTechnologies.ColliderSystem;
|
||||
using AwesomeTechnologies.Vegetation.PersistentStorage;
|
||||
using AwesomeTechnologies.PrefabSpawner;
|
||||
|
||||
namespace Pinwheel.Griffin.VegetationStudioPro
|
||||
{
|
||||
//[CreateAssetMenu(menuName = "Polaris/GVSP Settings")]
|
||||
public class GVSPSettings : ScriptableObject
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct GQuickSetupSettings
|
||||
{
|
||||
[SerializeField]
|
||||
private bool createVegetationPackage;
|
||||
public bool CreateVegetationPackage
|
||||
{
|
||||
get
|
||||
{
|
||||
return createVegetationPackage;
|
||||
}
|
||||
set
|
||||
{
|
||||
createVegetationPackage = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private bool createPersistentStorage;
|
||||
public bool CreatePersistentStorage
|
||||
{
|
||||
get
|
||||
{
|
||||
return createPersistentStorage;
|
||||
}
|
||||
set
|
||||
{
|
||||
createPersistentStorage = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public struct GImportSettings
|
||||
{
|
||||
public VegetationStudioManager VSManager { get; set; }
|
||||
public GStylizedTerrain Terrain { get; set; }
|
||||
|
||||
[SerializeField]
|
||||
private bool setProceduralDensityToZero;
|
||||
public bool SetProceduralDensityToZero
|
||||
{
|
||||
get
|
||||
{
|
||||
return setProceduralDensityToZero;
|
||||
}
|
||||
set
|
||||
{
|
||||
setProceduralDensityToZero = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static GVSPSettings instance;
|
||||
public static GVSPSettings Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = Resources.Load<GVSPSettings>("GVSPSettings");
|
||||
if (instance == null)
|
||||
{
|
||||
instance = ScriptableObject.CreateInstance<GVSPSettings>();
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private GQuickSetupSettings quickSetup;
|
||||
public GQuickSetupSettings QuickSetup
|
||||
{
|
||||
get
|
||||
{
|
||||
return quickSetup;
|
||||
}
|
||||
set
|
||||
{
|
||||
quickSetup = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private GImportSettings import;
|
||||
public GImportSettings Import
|
||||
{
|
||||
get
|
||||
{
|
||||
return import;
|
||||
}
|
||||
set
|
||||
{
|
||||
import = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f76466c9fa43ee4a9e584ca8b5854b4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 510a545d6db8e4a4493d0d84a44d7fba
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,14 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6f76466c9fa43ee4a9e584ca8b5854b4, type: 3}
|
||||
m_Name: GVSPSettings
|
||||
m_EditorClassIdentifier:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cdff7e6312231e04eb49ab886a8c42f2
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user