This commit is contained in:
CortexCore
2025-03-14 21:04:19 +08:00
parent ff8670c453
commit 757ffe79ee
1282 changed files with 104378 additions and 3 deletions

View File

@@ -0,0 +1,372 @@
#if GRIFFIN
using UnityEngine;
namespace Pinwheel.Griffin.GroupTool
{
[System.Serializable]
public struct GFoliageOverride
{
[SerializeField]
private bool overrideTrees;
public bool OverrideTrees
{
get
{
return overrideTrees;
}
set
{
overrideTrees = value;
}
}
[SerializeField]
private GTreePrototypeGroup trees;
public GTreePrototypeGroup Trees
{
get
{
return trees;
}
set
{
trees = value;
}
}
[SerializeField]
private bool overrideGrasses;
public bool OverrideGrasses
{
get
{
return overrideGrasses;
}
set
{
overrideGrasses = value;
}
}
[SerializeField]
private GGrassPrototypeGroup grasses;
public GGrassPrototypeGroup Grasses
{
get
{
return grasses;
}
set
{
grasses = value;
}
}
[SerializeField]
private bool overridePatchGridSize;
public bool OverridePatchGridSize
{
get
{
return overridePatchGridSize;
}
set
{
overridePatchGridSize = value;
}
}
[SerializeField]
private int patchGridSize;
public int PatchGridSize
{
get
{
return patchGridSize;
}
set
{
patchGridSize = Mathf.Max(1, value);
}
}
[SerializeField]
private bool overrideTreeSnapMode;
public bool OverrideTreeSnapMode
{
get
{
return overrideTreeSnapMode;
}
set
{
overrideTreeSnapMode = value;
}
}
[SerializeField]
private GSnapMode treeSnapMode;
public GSnapMode TreeSnapMode
{
get
{
return treeSnapMode;
}
set
{
treeSnapMode = value;
}
}
[SerializeField]
private bool overrideTreeSnapLayerMask;
public bool OverrideTreeSnapLayerMask
{
get
{
return overrideTreeSnapLayerMask;
}
set
{
overrideTreeSnapLayerMask = value;
}
}
[SerializeField]
private LayerMask treeSnapLayerMask;
public LayerMask TreeSnapLayerMask
{
get
{
return treeSnapLayerMask;
}
set
{
treeSnapLayerMask = value;
}
}
[SerializeField]
private bool overrideGrassSnapMode;
public bool OverrideGrassSnapMode
{
get
{
return overrideGrassSnapMode;
}
set
{
overrideGrassSnapMode = value;
}
}
[SerializeField]
private GSnapMode grassSnapMode;
public GSnapMode GrassSnapMode
{
get
{
return grassSnapMode;
}
set
{
grassSnapMode = value;
}
}
[SerializeField]
private bool overrideGrassSnapLayerMask;
public bool OverrideGrassSnapLayerMask
{
get
{
return overrideGrassSnapLayerMask;
}
set
{
overrideGrassSnapLayerMask = value;
}
}
[SerializeField]
private LayerMask grassSnapLayerMask;
public LayerMask GrassSnapLayerMask
{
get
{
return grassSnapLayerMask;
}
set
{
grassSnapLayerMask = value;
}
}
[SerializeField]
private bool overrideEnableInteractiveGrass;
public bool OverrideEnableInteractiveGrass
{
get
{
return overrideEnableInteractiveGrass;
}
set
{
overrideEnableInteractiveGrass = value;
}
}
[SerializeField]
private bool enableInteractiveGrass;
public bool EnableInteractiveGrass
{
get
{
return enableInteractiveGrass;
}
set
{
enableInteractiveGrass = value;
}
}
[SerializeField]
private bool overrideVectorFieldMapResolution;
public bool OverrideVectorFieldMapResolution
{
get
{
return overrideVectorFieldMapResolution;
}
set
{
overrideVectorFieldMapResolution = value;
}
}
[SerializeField]
private int vectorFieldMapResolution;
public int VectorFieldMapResolution
{
get
{
return vectorFieldMapResolution;
}
set
{
vectorFieldMapResolution = Mathf.Clamp(Mathf.ClosestPowerOfTwo(value), GCommon.TEXTURE_SIZE_MIN, GCommon.TEXTURE_SIZE_MAX);
}
}
[SerializeField]
private bool overrideBendSensitive;
public bool OverrideBendSensitive
{
get
{
return overrideBendSensitive;
}
set
{
overrideBendSensitive = value;
}
}
[SerializeField]
private float bendSensitive;
public float BendSensitive
{
get
{
return bendSensitive;
}
set
{
bendSensitive = Mathf.Clamp01(value);
}
}
[SerializeField]
private bool overrideRestoreSensitive;
public bool OverrideRestoreSensitive
{
get
{
return overrideRestoreSensitive;
}
set
{
overrideRestoreSensitive = value;
}
}
[SerializeField]
private float restoreSensitive;
public float RestoreSensitive
{
get
{
return restoreSensitive;
}
set
{
restoreSensitive = Mathf.Clamp01(value);
}
}
public void Reset()
{
OverrideTrees = false;
OverrideTreeSnapMode = false;
OverrideTreeSnapLayerMask = false;
OverrideGrasses = false;
OverrideGrassSnapMode = false;
OverrideGrassSnapLayerMask = false;
OverridePatchGridSize = false;
OverrideEnableInteractiveGrass = false;
OverrideVectorFieldMapResolution = false;
OverrideBendSensitive = false;
OverrideRestoreSensitive = false;
TreeSnapMode = GRuntimeSettings.Instance.foliageDefault.treeSnapMode;
TreeSnapLayerMask = GRuntimeSettings.Instance.foliageDefault.treeSnapLayerMask;
GrassSnapMode = GRuntimeSettings.Instance.foliageDefault.grassSnapMode;
GrassSnapLayerMask = GRuntimeSettings.Instance.foliageDefault.grassSnapLayerMask;
PatchGridSize = GRuntimeSettings.Instance.foliageDefault.patchGridSize;
EnableInteractiveGrass = GRuntimeSettings.Instance.foliageDefault.enableInteractiveGrass;
VectorFieldMapResolution = GRuntimeSettings.Instance.foliageDefault.vectorFieldMapResolution;
BendSensitive = GRuntimeSettings.Instance.foliageDefault.bendSensitive;
RestoreSensitive = GRuntimeSettings.Instance.foliageDefault.restoreSensitive;
}
public void Override(GFoliage s)
{
if (OverrideTrees)
s.Trees = Trees;
if (OverrideTreeSnapMode)
s.TreeSnapMode = TreeSnapMode;
if (OverrideTreeSnapLayerMask)
s.TreeSnapLayerMask = TreeSnapLayerMask;
if (OverrideGrasses)
s.Grasses = Grasses;
if (OverrideGrassSnapMode)
s.GrassSnapMode = GrassSnapMode;
if (OverrideGrassSnapLayerMask)
s.GrassSnapLayerMask = GrassSnapLayerMask;
if (OverridePatchGridSize)
s.PatchGridSize = PatchGridSize;
if (OverrideEnableInteractiveGrass)
s.EnableInteractiveGrass = EnableInteractiveGrass;
if (OverrideVectorFieldMapResolution)
s.VectorFieldMapResolution = VectorFieldMapResolution;
if (OverrideBendSensitive)
s.BendSensitive = BendSensitive;
if (OverrideRestoreSensitive)
s.RestoreSensitive = RestoreSensitive;
s.Refresh();
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 82dbb383e80e39144a110def31730641
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,529 @@
#if GRIFFIN
using UnityEngine;
namespace Pinwheel.Griffin.GroupTool
{
[System.Serializable]
public struct GGeometryOverride
{
[SerializeField]
private bool overrideWidth;
public bool OverrideWidth
{
get
{
return overrideWidth;
}
set
{
overrideWidth = value;
}
}
[SerializeField]
private float width;
public float Width
{
get
{
return width;
}
set
{
width = Mathf.Max(1, value);
}
}
[SerializeField]
private bool overrideHeight;
public bool OverrideHeight
{
get
{
return overrideHeight;
}
set
{
overrideHeight = value;
}
}
[SerializeField]
private float height;
public float Height
{
get
{
return height;
}
set
{
height = Mathf.Max(0, value);
}
}
[SerializeField]
private bool overrideLength;
public bool OverrideLength
{
get
{
return overrideLength;
}
set
{
overrideLength = value;
}
}
[SerializeField]
private float length;
public float Length
{
get
{
return length;
}
set
{
length = Mathf.Max(1, value);
}
}
[SerializeField]
private bool overrideHeightMapResolution;
public bool OverrideHeightMapResolution
{
get
{
return overrideHeightMapResolution;
}
set
{
overrideHeightMapResolution = value;
}
}
[SerializeField]
private int heightMapResolution;
public int HeightMapResolution
{
get
{
return heightMapResolution;
}
set
{
heightMapResolution = Mathf.Clamp(Mathf.ClosestPowerOfTwo(value), GCommon.TEXTURE_SIZE_MIN, GCommon.TEXTURE_SIZE_MAX);
}
}
[SerializeField]
private bool overrideMeshBaseResolution;
public bool OverrideMeshBaseResolution
{
get
{
return overrideMeshBaseResolution;
}
set
{
overrideMeshBaseResolution = value;
}
}
[SerializeField]
private int meshBaseResolution;
public int MeshBaseResolution
{
get
{
return meshBaseResolution;
}
set
{
meshBaseResolution = Mathf.Clamp(value, 0, 10);
}
}
[SerializeField]
private bool overrideMeshResolution;
public bool OverrideMeshResolution
{
get
{
return overrideMeshResolution;
}
set
{
overrideMeshResolution = value;
}
}
[SerializeField]
private int meshResolution;
public int MeshResolution
{
get
{
return meshResolution;
}
set
{
meshResolution = Mathf.Clamp(value, 0, 15);
}
}
[SerializeField]
private bool overrideChunkGridSize;
public bool OverrideChunkGridSize
{
get
{
return overrideChunkGridSize;
}
set
{
overrideChunkGridSize = value;
}
}
[SerializeField]
private int chunkGridSize;
public int ChunkGridSize
{
get
{
return chunkGridSize;
}
set
{
chunkGridSize = Mathf.Max(1, value);
}
}
[SerializeField]
private bool overrideLodCount;
public bool OverrideLodCount
{
get
{
return overrideLodCount;
}
set
{
overrideLodCount = value;
}
}
[SerializeField]
private int lodCount;
public int LODCount
{
get
{
return lodCount;
}
set
{
lodCount = Mathf.Clamp(value, 1, GCommon.MAX_LOD_COUNT);
}
}
[SerializeField]
private bool overrideDisplacementSeed;
public bool OverrideDisplacementSeed
{
get
{
return overrideDisplacementSeed;
}
set
{
overrideDisplacementSeed = value;
}
}
[SerializeField]
private int displacementSeed;
public int DisplacementSeed
{
get
{
return displacementSeed;
}
set
{
displacementSeed = value;
}
}
[SerializeField]
private bool overrideDisplacementStrength;
public bool OverrideDisplacementStrength
{
get
{
return overrideDisplacementStrength;
}
set
{
overrideDisplacementStrength = value;
}
}
[SerializeField]
private float displacementStrength;
public float DisplacementStrength
{
get
{
return displacementStrength;
}
set
{
displacementStrength = Mathf.Clamp01(value);
}
}
[SerializeField]
private bool overrideAlbedoToVertexColorMode;
public bool OverrideAlbedoToVertexColorMode
{
get
{
return overrideAlbedoToVertexColorMode;
}
set
{
overrideAlbedoToVertexColorMode = value;
}
}
[SerializeField]
private GAlbedoToVertexColorMode albedoToVertexColorMode;
public GAlbedoToVertexColorMode AlbedoToVertexColorMode
{
get
{
return albedoToVertexColorMode;
}
set
{
albedoToVertexColorMode = value;
}
}
[SerializeField]
private bool overrideStorageMode;
public bool OverrideStorageMode
{
get
{
return overrideStorageMode;
}
set
{
overrideStorageMode = value;
}
}
[SerializeField]
private GGeometry.GStorageMode storageMode;
public GGeometry.GStorageMode StorageMode
{
get
{
return storageMode;
}
set
{
storageMode = value;
}
}
[SerializeField]
private bool overrideAllowTimeSlicedGeneration;
public bool OverrideAllowTimeSlicedGeneration
{
get
{
return overrideAllowTimeSlicedGeneration;
}
set
{
overrideAllowTimeSlicedGeneration = value;
}
}
[SerializeField]
private bool allowTimeSlicedGeneration;
public bool AllowTimeSlicedGeneration
{
get
{
return allowTimeSlicedGeneration;
}
set
{
allowTimeSlicedGeneration = value;
}
}
[SerializeField]
private bool overrideSmoothNormal;
public bool OverrideSmoothNormal
{
get
{
return overrideSmoothNormal;
}
set
{
overrideSmoothNormal = value;
}
}
[SerializeField]
private bool smoothNormal;
public bool SmoothNormal
{
get
{
return smoothNormal;
}
set
{
smoothNormal = value;
}
}
[SerializeField]
private bool overrideUseSmoothNormalMask;
public bool OverrideUseSmoothNormalMask
{
get
{
return overrideUseSmoothNormalMask;
}
set
{
overrideUseSmoothNormalMask = value;
}
}
[SerializeField]
private bool useSmoothNormalMask;
public bool UseSmoothNormalMask
{
get
{
return useSmoothNormalMask;
}
set
{
useSmoothNormalMask = value;
}
}
[SerializeField]
private bool overrideMergeUv;
public bool OverrideMergeUv
{
get
{
return overrideMergeUv;
}
set
{
overrideMergeUv = value;
}
}
[SerializeField]
private bool mergeUv;
public bool MergeUv
{
get
{
return mergeUv;
}
set
{
mergeUv = value;
}
}
public void Reset()
{
OverrideWidth = false;
OverrideHeight = false;
OverrideLength = false;
OverrideHeightMapResolution = false;
OverrideMeshBaseResolution = false;
OverrideMeshResolution = false;
OverrideChunkGridSize = false;
overrideLodCount = false;
OverrideDisplacementSeed = false;
OverrideDisplacementStrength = false;
OverrideAlbedoToVertexColorMode = false;
OverrideStorageMode = false;
OverrideAllowTimeSlicedGeneration = false;
OverrideSmoothNormal = false;
OverrideUseSmoothNormalMask = false;
Width = GRuntimeSettings.Instance.geometryDefault.width;
Height = GRuntimeSettings.Instance.geometryDefault.height;
Length = GRuntimeSettings.Instance.geometryDefault.length;
HeightMapResolution = GRuntimeSettings.Instance.geometryDefault.heightMapResolution;
MeshBaseResolution = GRuntimeSettings.Instance.geometryDefault.meshBaseResolution;
MeshResolution = GRuntimeSettings.Instance.geometryDefault.meshResolution;
ChunkGridSize = GRuntimeSettings.Instance.geometryDefault.chunkGridSize;
LODCount = GRuntimeSettings.Instance.geometryDefault.lodCount;
DisplacementSeed = GRuntimeSettings.Instance.geometryDefault.displacementSeed;
DisplacementStrength = GRuntimeSettings.Instance.geometryDefault.displacementStrength;
AlbedoToVertexColorMode = GRuntimeSettings.Instance.geometryDefault.albedoToVertexColorMode;
StorageMode = GRuntimeSettings.Instance.geometryDefault.storageMode;
AllowTimeSlicedGeneration = GRuntimeSettings.Instance.geometryDefault.allowTimeSlicedGeneration;
SmoothNormal = GRuntimeSettings.Instance.geometryDefault.smoothNormal;
UseSmoothNormalMask = GRuntimeSettings.Instance.geometryDefault.useSmoothNormalMask;
}
public void Override(GGeometry g)
{
if (OverrideWidth)
g.Width = Width;
if (OverrideHeight)
g.Height = Height;
if (OverrideLength)
g.Length = Length;
if (OverrideHeightMapResolution)
g.HeightMapResolution = HeightMapResolution;
if (OverrideMeshBaseResolution)
g.MeshBaseResolution = MeshBaseResolution;
if (OverrideMeshResolution)
g.MeshResolution = MeshResolution;
if (OverrideChunkGridSize)
g.ChunkGridSize = ChunkGridSize;
if (OverrideLodCount)
g.LODCount = LODCount;
if (OverrideDisplacementSeed)
g.DisplacementSeed = DisplacementSeed;
if (OverrideDisplacementStrength)
g.DisplacementStrength = DisplacementStrength;
if (OverrideAlbedoToVertexColorMode)
g.AlbedoToVertexColorMode = AlbedoToVertexColorMode;
if (OverrideStorageMode)
g.StorageMode = StorageMode;
if (OverrideAllowTimeSlicedGeneration)
g.AllowTimeSlicedGeneration = AllowTimeSlicedGeneration;
if (OverrideSmoothNormal)
g.SmoothNormal = SmoothNormal;
if (OverrideUseSmoothNormalMask)
g.UseSmoothNormalMask = UseSmoothNormalMask;
if (OverrideMergeUv)
g.MergeUv = MergeUv;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6ef8358693c8d9d478a74b0d3836aaf5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,51 @@
#if GRIFFIN
using UnityEngine;
namespace Pinwheel.Griffin.GroupTool
{
[System.Serializable]
public struct GMaskOverride
{
[SerializeField]
private bool overrideMaskMapResolution;
public bool OverrideMaskMapResolution
{
get
{
return overrideMaskMapResolution;
}
set
{
overrideMaskMapResolution = value;
}
}
[SerializeField]
private int maskMapResolution;
public int MaskMapResolution
{
get
{
return maskMapResolution;
}
set
{
maskMapResolution = Mathf.Clamp(Mathf.ClosestPowerOfTwo(value), GCommon.TEXTURE_SIZE_MIN, GCommon.TEXTURE_SIZE_MAX);
}
}
public void Reset()
{
OverrideMaskMapResolution = false;
MaskMapResolution = GRuntimeSettings.Instance.maskDefault.maskMapResolution;
}
public void Override(GMask m)
{
if (OverrideMaskMapResolution)
m.MaskMapResolution = MaskMapResolution;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 85faae3e31693d04fbcc6b99403e172a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,307 @@
#if GRIFFIN
using UnityEngine;
namespace Pinwheel.Griffin.GroupTool
{
[System.Serializable]
public struct GRenderingOverride
{
[SerializeField]
private bool overrideCastShadow;
public bool OverrideCastShadow
{
get
{
return overrideCastShadow;
}
set
{
overrideCastShadow = value;
}
}
[SerializeField]
private bool castShadow;
public bool CastShadow
{
get
{
return castShadow;
}
set
{
castShadow = value;
}
}
[SerializeField]
private bool overrideReceiveShadow;
public bool OverrideReceiveShadow
{
get
{
return overrideReceiveShadow;
}
set
{
overrideReceiveShadow = value;
}
}
[SerializeField]
private bool receiveShadow;
public bool ReceiveShadow
{
get
{
return receiveShadow;
}
set
{
receiveShadow = value;
}
}
[SerializeField]
private bool overrideDrawTrees;
public bool OverrideDrawTrees
{
get
{
return overrideDrawTrees;
}
set
{
overrideDrawTrees = value;
}
}
[SerializeField]
private bool drawTrees;
public bool DrawTrees
{
get
{
return drawTrees;
}
set
{
drawTrees = value;
}
}
[SerializeField]
private bool overrideEnableInstancing;
public bool OverrideEnableInstancing
{
get
{
return overrideEnableInstancing;
}
set
{
overrideEnableInstancing = value;
}
}
[SerializeField]
private bool enableInstancing;
public bool EnableInstancing
{
get
{
return enableInstancing;
}
set
{
enableInstancing = value;
}
}
[SerializeField]
private bool overrideBillboardStart;
public bool OverrideBillboardStart
{
get
{
return overrideBillboardStart;
}
set
{
overrideBillboardStart = value;
}
}
[SerializeField]
private float billboardStart;
public float BillboardStart
{
get
{
return billboardStart;
}
set
{
billboardStart = Mathf.Clamp(value, 0, GCommon.MAX_TREE_DISTANCE);
}
}
[SerializeField]
private bool overrideTreeDistance;
public bool OverrideTreeDistance
{
get
{
return overrideTreeDistance;
}
set
{
overrideTreeDistance = value;
}
}
[SerializeField]
private float treeDistance;
public float TreeDistance
{
get
{
return treeDistance;
}
set
{
treeDistance = Mathf.Clamp(value, 0, GCommon.MAX_TREE_DISTANCE);
}
}
[SerializeField]
private bool overrideDrawGrasses;
public bool OverrideDrawGrasses
{
get
{
return overrideDrawGrasses;
}
set
{
overrideDrawGrasses = value;
}
}
[SerializeField]
private bool drawGrasses;
public bool DrawGrasses
{
get
{
return drawGrasses;
}
set
{
drawGrasses = value;
}
}
[SerializeField]
private bool overrideGrassDistance;
public bool OverrideGrassDistance
{
get
{
return overrideGrassDistance;
}
set
{
overrideGrassDistance = value;
}
}
[SerializeField]
private float grassDistance;
public float GrassDistance
{
get
{
return grassDistance;
}
set
{
grassDistance = Mathf.Clamp(value, 0, GCommon.MAX_GRASS_DISTANCE);
}
}
[SerializeField]
private bool overrideGrassFadeStart;
public bool OverrideGrassFadeStart
{
get
{
return overrideGrassFadeStart;
}
set
{
overrideGrassFadeStart = value;
}
}
[SerializeField]
private float grassFadeStart;
public float GrassFadeStart
{
get
{
return grassFadeStart;
}
set
{
grassFadeStart = Mathf.Clamp(value, 0f, 1f);
}
}
public void Reset()
{
OverrideCastShadow = false;
OverrideReceiveShadow = false;
OverrideDrawTrees = false;
OverrideEnableInstancing = false;
OverrideBillboardStart = false;
OverrideTreeDistance = false;
OverrideDrawGrasses = false;
OverrideGrassDistance = false;
OverrideGrassFadeStart = false;
CastShadow = GRuntimeSettings.Instance.renderingDefault.terrainCastShadow;
ReceiveShadow = GRuntimeSettings.Instance.renderingDefault.terrainReceiveShadow;
DrawTrees = GRuntimeSettings.Instance.renderingDefault.drawTrees;
EnableInstancing = GRuntimeSettings.Instance.renderingDefault.enableInstancing;
BillboardStart = GRuntimeSettings.Instance.renderingDefault.billboardStart;
TreeDistance = GRuntimeSettings.Instance.renderingDefault.treeDistance;
DrawGrasses = GRuntimeSettings.Instance.renderingDefault.drawGrasses;
GrassDistance = GRuntimeSettings.Instance.renderingDefault.grassDistance;
GrassFadeStart = GRuntimeSettings.Instance.renderingDefault.grassFadeStart;
}
public void Override(GRendering r)
{
if (OverrideCastShadow)
r.CastShadow = CastShadow;
if (OverrideReceiveShadow)
r.ReceiveShadow = ReceiveShadow;
if (OverrideDrawTrees)
r.DrawTrees = DrawTrees;
if (OverrideEnableInstancing)
r.EnableInstancing = EnableInstancing;
if (OverrideBillboardStart)
r.BillboardStart = BillboardStart;
if (OverrideTreeDistance)
r.TreeDistance = TreeDistance;
if (OverrideDrawGrasses)
r.DrawGrasses = DrawGrasses;
if (OverrideGrassDistance)
r.GrassDistance = GrassDistance;
if (OverrideGrassFadeStart)
r.GrassFadeStart = GrassFadeStart;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 016c8a6f9bf9ab54d93663e513c2e80f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,658 @@
#if GRIFFIN
using UnityEngine;
namespace Pinwheel.Griffin.GroupTool
{
[System.Serializable]
public struct GShadingOverride
{
[SerializeField]
private bool overrideCustomMaterial;
public bool OverrideCustomMaterial
{
get
{
return overrideCustomMaterial;
}
set
{
overrideCustomMaterial = value;
}
}
[SerializeField]
private Material customMaterial;
public Material CustomMaterial
{
get
{
return customMaterial;
}
set
{
customMaterial = value;
}
}
[SerializeField]
private bool overrideAlbedoMapResolution;
public bool OverrideAlbedoMapResolution
{
get
{
return overrideAlbedoMapResolution;
}
set
{
overrideAlbedoMapResolution = value;
}
}
[SerializeField]
private int albedoMapResolution;
public int AlbedoMapResolution
{
get
{
return albedoMapResolution;
}
set
{
albedoMapResolution = Mathf.Clamp(Mathf.ClosestPowerOfTwo(value), GCommon.TEXTURE_SIZE_MIN, GCommon.TEXTURE_SIZE_MAX);
}
}
[SerializeField]
private bool overrideMetallicMapResolution;
public bool OverrideMetallicMapResolution
{
get
{
return overrideMetallicMapResolution;
}
set
{
overrideMetallicMapResolution = value;
}
}
[SerializeField]
private int metallicMapResolution;
public int MetallicMapResolution
{
get
{
return metallicMapResolution;
}
set
{
metallicMapResolution = Mathf.Clamp(Mathf.ClosestPowerOfTwo(value), GCommon.TEXTURE_SIZE_MIN, GCommon.TEXTURE_SIZE_MAX);
}
}
[SerializeField]
private bool overrideAlbedoMapPropertyName;
public bool OverrideAlbedoMapPropertyName
{
get
{
return overrideAlbedoMapPropertyName;
}
set
{
overrideAlbedoMapPropertyName = value;
}
}
[SerializeField]
private string albedoMapPropertyName;
public string AlbedoMapPropertyName
{
get
{
return albedoMapPropertyName;
}
set
{
albedoMapPropertyName = value;
}
}
[SerializeField]
private bool overrideMetallicMapPropertyName;
public bool OverrideMetallicMapPropertyName
{
get
{
return overrideMetallicMapPropertyName;
}
set
{
overrideMetallicMapPropertyName = value;
}
}
[SerializeField]
private string metallicMapPropertyName;
public string MetallicMapPropertyName
{
get
{
return metallicMapPropertyName;
}
set
{
metallicMapPropertyName = value;
}
}
[SerializeField]
private bool overrideColorByHeight;
public bool OverrideColorByHeight
{
get
{
return overrideColorByHeight;
}
set
{
overrideColorByHeight = value;
}
}
[SerializeField]
private Gradient colorByHeight;
public Gradient ColorByHeight
{
get
{
if (colorByHeight == null)
{
colorByHeight = GUtilities.Clone(GRuntimeSettings.Instance.shadingDefault.colorByHeight);
}
return colorByHeight;
}
set
{
colorByHeight = value;
}
}
[SerializeField]
private bool overrideColorByNormal;
public bool OverrideColorByNormal
{
get
{
return overrideColorByNormal;
}
set
{
overrideColorByNormal = value;
}
}
[SerializeField]
private Gradient colorByNormal;
public Gradient ColorByNormal
{
get
{
if (colorByNormal == null)
{
colorByNormal = GUtilities.Clone(GRuntimeSettings.Instance.shadingDefault.colorByNormal);
}
return colorByNormal;
}
set
{
colorByNormal = value;
}
}
[SerializeField]
private bool overrideColorBlendCurve;
public bool OverrideColorBlendCurve
{
get
{
return overrideColorBlendCurve;
}
set
{
overrideColorBlendCurve = value;
}
}
[SerializeField]
private AnimationCurve colorBlendCurve;
public AnimationCurve ColorBlendCurve
{
get
{
if (colorBlendCurve == null)
{
colorBlendCurve = GUtilities.Clone(GRuntimeSettings.Instance.shadingDefault.colorBlendCurve);
}
return colorBlendCurve;
}
set
{
colorBlendCurve = value;
}
}
[SerializeField]
private bool overrideColorByHeightPropertyName;
public bool OverrideColorByHeightPropertyName
{
get
{
return overrideColorByHeightPropertyName;
}
set
{
overrideColorByHeightPropertyName = value;
}
}
[SerializeField]
private string colorByHeightPropertyName;
public string ColorByHeightPropertyName
{
get
{
return colorByHeightPropertyName;
}
set
{
colorByHeightPropertyName = value;
}
}
[SerializeField]
private bool overrideColorByNormalPropertyName;
public bool OverrideColorByNormalPropertyName
{
get
{
return overrideColorByNormalPropertyName;
}
set
{
overrideColorByNormalPropertyName = value;
}
}
[SerializeField]
private string colorByNormalPropertyName;
public string ColorByNormalPropertyName
{
get
{
return colorByNormalPropertyName;
}
set
{
colorByNormalPropertyName = value;
}
}
[SerializeField]
private bool overrideColorBlendPropertyName;
public bool OverrideColorBlendPropertyName
{
get
{
return overrideColorBlendPropertyName;
}
set
{
overrideColorBlendPropertyName = value;
}
}
[SerializeField]
private string colorBlendPropertyName;
public string ColorBlendPropertyName
{
get
{
return colorBlendPropertyName;
}
set
{
colorBlendPropertyName = value;
}
}
[SerializeField]
private bool overrideDimensionPropertyName;
public bool OverrideDimensionPropertyName
{
get
{
return overrideDimensionPropertyName;
}
set
{
overrideDimensionPropertyName = value;
}
}
[SerializeField]
private string dimensionPropertyName;
public string DimensionPropertyName
{
get
{
return dimensionPropertyName;
}
set
{
dimensionPropertyName = value;
}
}
[SerializeField]
private bool overrideSplats;
public bool OverrideSplats
{
get
{
return overrideSplats;
}
set
{
overrideSplats = value;
}
}
[SerializeField]
private GSplatPrototypeGroup splats;
public GSplatPrototypeGroup Splats
{
get
{
return splats;
}
set
{
splats = value;
}
}
[SerializeField]
private bool overrideSplatControlResolution;
public bool OverrideSplatControlResolution
{
get
{
return overrideSplatControlResolution;
}
set
{
overrideSplatControlResolution = value;
}
}
[SerializeField]
private int splatControlResolution;
public int SplatControlResolution
{
get
{
return splatControlResolution;
}
set
{
splatControlResolution = Mathf.Clamp(Mathf.ClosestPowerOfTwo(value), GCommon.TEXTURE_SIZE_MIN, GCommon.TEXTURE_SIZE_MAX);
}
}
[SerializeField]
private bool overrideSplatControlMapPropertyName;
public bool OverrideSplatControlMapPropertyName
{
get
{
return overrideSplatControlMapPropertyName;
}
set
{
overrideSplatControlMapPropertyName = value;
}
}
[SerializeField]
private string splatControlMapPropertyName;
public string SplatControlMapPropertyName
{
get
{
return splatControlMapPropertyName;
}
set
{
splatControlMapPropertyName = value;
}
}
[SerializeField]
private bool overrideSplatMapPropertyName;
public bool OverrideSplatMapPropertyName
{
get
{
return overrideSplatMapPropertyName;
}
set
{
overrideSplatMapPropertyName = value;
}
}
[SerializeField]
private string splatMapPropertyName;
public string SplatMapPropertyName
{
get
{
return splatMapPropertyName;
}
set
{
splatMapPropertyName = value;
}
}
[SerializeField]
private bool overrideSplatNormalPropertyName;
public bool OverrideSplatNormalPropertyName
{
get
{
return overrideSplatNormalPropertyName;
}
set
{
overrideSplatNormalPropertyName = value;
}
}
[SerializeField]
private string splatNormalPropertyName;
public string SplatNormalPropertyName
{
get
{
return splatNormalPropertyName;
}
set
{
splatNormalPropertyName = value;
}
}
[SerializeField]
private bool overrideSplatMetallicPropertyName;
public bool OverrideSplatMetallicPropertyName
{
get
{
return overrideSplatMetallicPropertyName;
}
set
{
overrideSplatMetallicPropertyName = value;
}
}
[SerializeField]
private string splatMetallicPropertyName;
public string SplatMetallicPropertyName
{
get
{
return splatMetallicPropertyName;
}
set
{
splatMetallicPropertyName = value;
}
}
[SerializeField]
private bool overrideSplatSmoothnessPropertyName;
public bool OverrideSplatSmoothnessPropertyName
{
get
{
return overrideSplatSmoothnessPropertyName;
}
set
{
overrideSplatSmoothnessPropertyName = value;
}
}
[SerializeField]
private string splatSmoothnessPropertyName;
public string SplatSmoothnessPropertyName
{
get
{
return splatSmoothnessPropertyName;
}
set
{
splatSmoothnessPropertyName = value;
}
}
public void Reset()
{
OverrideCustomMaterial = false;
OverrideCustomMaterial = false;
OverrideAlbedoMapResolution = false;
OverrideMetallicMapResolution = false;
OverrideAlbedoMapPropertyName = false;
OverrideMetallicMapPropertyName = false;
OverrideColorByHeight = false;
OverrideColorByNormal = false;
OverrideColorBlendCurve = false;
OverrideColorByHeightPropertyName = false;
OverrideColorByNormalPropertyName = false;
OverrideColorBlendPropertyName = false;
OverrideDimensionPropertyName = false;
OverrideSplatControlResolution = false;
OverrideSplatControlMapPropertyName = false;
OverrideSplatMapPropertyName = false;
OverrideSplatNormalPropertyName = false;
OverrideSplatMetallicPropertyName = false;
OverrideSplatSmoothnessPropertyName = false;
CustomMaterial = null;
AlbedoMapResolution = GRuntimeSettings.Instance.shadingDefault.albedoMapResolution; ;
MetallicMapResolution = GRuntimeSettings.Instance.shadingDefault.metallicMapResolution; ;
AlbedoMapPropertyName = GRuntimeSettings.Instance.shadingDefault.albedoMapPropertyName;
MetallicMapPropertyName = GRuntimeSettings.Instance.shadingDefault.metallicMapPropertyName;
ColorByHeight = GUtilities.Clone(GRuntimeSettings.Instance.shadingDefault.colorByHeight);
ColorByNormal = GUtilities.Clone(GRuntimeSettings.Instance.shadingDefault.colorByNormal);
ColorBlendCurve = GUtilities.Clone(GRuntimeSettings.Instance.shadingDefault.colorBlendCurve);
ColorByHeightPropertyName = GRuntimeSettings.Instance.shadingDefault.colorByHeightPropertyName;
ColorByNormalPropertyName = GRuntimeSettings.Instance.shadingDefault.colorByNormalPropertyName;
ColorBlendPropertyName = GRuntimeSettings.Instance.shadingDefault.colorBlendPropertyName;
DimensionPropertyName = GRuntimeSettings.Instance.shadingDefault.dimensionPropertyName;
SplatControlResolution = GRuntimeSettings.Instance.shadingDefault.splatControlResolution;
SplatControlMapPropertyName = GRuntimeSettings.Instance.shadingDefault.splatControlMapPropertyName;
SplatMapPropertyName = GRuntimeSettings.Instance.shadingDefault.splatMapPropertyName;
SplatNormalPropertyName = GRuntimeSettings.Instance.shadingDefault.splatNormalPropertyName;
SplatMetallicPropertyName = GRuntimeSettings.Instance.shadingDefault.splatMetallicPropertyName;
SplatSmoothnessPropertyName = GRuntimeSettings.Instance.shadingDefault.splatSmoothnessPropertyName;
}
public void Override(GShading s)
{
if (OverrideCustomMaterial && CustomMaterial != null)
{
if (s.CustomMaterial == null)
{
Material mat = Object.Instantiate(CustomMaterial);
mat.name = "TerrainMaterial_" + s.TerrainData.Id;
#if UNITY_EDITOR
UnityEditor.AssetDatabase.CreateAsset(mat, string.Format("Assets/{0}.mat", mat.name));
#endif
s.CustomMaterial = mat;
}
else
{
s.CustomMaterial.shader = CustomMaterial.shader;
}
s.UpdateMaterials();
}
if (OverrideAlbedoMapResolution)
s.AlbedoMapResolution = AlbedoMapResolution;
if (OverrideMetallicMapResolution)
s.MetallicMapResolution = MetallicMapResolution;
if (OverrideAlbedoMapPropertyName)
s.AlbedoMapPropertyName = AlbedoMapPropertyName;
if (OverrideMetallicMapPropertyName)
s.MetallicMapPropertyName = MetallicMapPropertyName;
if (OverrideColorByHeight)
s.ColorByHeight = GUtilities.Clone(ColorByHeight);
if (OverrideColorByNormal)
s.ColorByNormal = GUtilities.Clone(ColorByNormal);
if (OverrideColorBlendCurve)
s.ColorBlendCurve = GUtilities.Clone(ColorBlendCurve);
if (OverrideColorByHeightPropertyName)
s.ColorByHeightPropertyName = ColorByHeightPropertyName;
if (OverrideColorByNormalPropertyName)
s.ColorByNormalPropertyName = ColorByNormalPropertyName;
if (OverrideColorBlendPropertyName)
s.ColorBlendPropertyName = ColorBlendPropertyName;
if (OverrideDimensionPropertyName)
s.DimensionPropertyName = DimensionPropertyName;
if (OverrideSplats)
s.Splats = Splats;
if (OverrideSplatControlResolution)
s.SplatControlResolution = SplatControlResolution;
if (OverrideSplatControlMapPropertyName)
s.SplatControlMapPropertyName = SplatControlMapPropertyName;
if (OverrideSplatMapPropertyName)
s.SplatMapPropertyName = SplatMapPropertyName;
if (OverrideSplatNormalPropertyName)
s.SplatNormalPropertyName = SplatNormalPropertyName;
if (OverrideSplatMetallicPropertyName)
s.SplatMetallicPropertyName = SplatMetallicPropertyName;
if (OverrideSplatSmoothnessPropertyName)
s.SplatSmoothnessPropertyName = SplatSmoothnessPropertyName;
if (OverrideColorByHeight || OverrideColorByNormal || OverrideColorBlendCurve)
{
s.UpdateLookupTextures();
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b9b722fe46ac65b4c9a7e95eef08626e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,261 @@
#if GRIFFIN
using System.Collections.Generic;
using UnityEngine;
namespace Pinwheel.Griffin.GroupTool
{
[System.Serializable]
[ExecuteInEditMode]
public class GTerrainGroup : MonoBehaviour
{
[SerializeField]
private int groupId;
public int GroupId
{
get
{
return groupId;
}
set
{
groupId = value;
}
}
[SerializeField]
private bool deferredUpdate;
public bool DeferredUpdate
{
get
{
return deferredUpdate;
}
set
{
deferredUpdate = value;
}
}
[SerializeField]
private GGeometryOverride geometryOverride;
public GGeometryOverride GeometryOverride
{
get
{
return geometryOverride;
}
set
{
geometryOverride = value;
}
}
[SerializeField]
private GShadingOverride shadingOverride;
public GShadingOverride ShadingOverride
{
get
{
return shadingOverride;
}
set
{
shadingOverride = value;
}
}
[SerializeField]
private GRenderingOverride renderingOverride;
public GRenderingOverride RenderingOverride
{
get
{
return renderingOverride;
}
set
{
renderingOverride = value;
}
}
[SerializeField]
private GFoliageOverride foliageOverride;
public GFoliageOverride FoliageOverride
{
get
{
return foliageOverride;
}
set
{
foliageOverride = value;
}
}
[SerializeField]
private GMaskOverride maskOverride;
public GMaskOverride MaskOverride
{
get
{
return maskOverride;
}
set
{
maskOverride = value;
}
}
private void Reset()
{
geometryOverride.Reset();
shadingOverride.Reset();
renderingOverride.Reset();
foliageOverride.Reset();
maskOverride.Reset();
}
public void ResetGeometry()
{
geometryOverride.Reset();
}
public void ResetShading()
{
shadingOverride.Reset();
}
public void ResetRendering()
{
renderingOverride.Reset();
}
public void ResetFoliage()
{
foliageOverride.Reset();
}
public void ResetMask()
{
maskOverride.Reset();
}
public void OverrideGeometry()
{
IEnumerator<GStylizedTerrain> terrains = GStylizedTerrain.ActiveTerrains.GetEnumerator();
while (terrains.MoveNext())
{
if (terrains.Current.TerrainData != null &&
(terrains.Current.GroupId == GroupId || GroupId < 0))
{
GeometryOverride.Override(terrains.Current.TerrainData.Geometry);
terrains.Current.TerrainData.Geometry.SetRegionDirty(new Rect(0, 0, 1, 1));
terrains.Current.TerrainData.SetDirty(GTerrainData.DirtyFlags.GeometryTimeSliced);
}
}
GStylizedTerrain.MatchEdges(GroupId);
}
public void OverrideShading()
{
IEnumerator<GStylizedTerrain> terrains = GStylizedTerrain.ActiveTerrains.GetEnumerator();
while (terrains.MoveNext())
{
if (terrains.Current.TerrainData != null &&
(terrains.Current.GroupId == GroupId || GroupId < 0))
{
ShadingOverride.Override(terrains.Current.TerrainData.Shading);
terrains.Current.TerrainData.SetDirty(GTerrainData.DirtyFlags.Shading);
}
}
}
public void OverrideRendering()
{
IEnumerator<GStylizedTerrain> terrains = GStylizedTerrain.ActiveTerrains.GetEnumerator();
while (terrains.MoveNext())
{
if (terrains.Current.TerrainData != null &&
(terrains.Current.GroupId == GroupId || GroupId < 0))
{
RenderingOverride.Override(terrains.Current.TerrainData.Rendering);
terrains.Current.TerrainData.SetDirty(GTerrainData.DirtyFlags.Rendering);
}
}
}
public void OverrideFoliage()
{
IEnumerator<GStylizedTerrain> terrains = GStylizedTerrain.ActiveTerrains.GetEnumerator();
while (terrains.MoveNext())
{
if (terrains.Current.TerrainData != null &&
(terrains.Current.GroupId == GroupId || GroupId < 0))
{
FoliageOverride.Override(terrains.Current.TerrainData.Foliage);
terrains.Current.TerrainData.SetDirty(GTerrainData.DirtyFlags.Foliage);
}
}
}
public void OverrideMask()
{
IEnumerator<GStylizedTerrain> terrains = GStylizedTerrain.ActiveTerrains.GetEnumerator();
while (terrains.MoveNext())
{
if (terrains.Current.TerrainData != null &&
(terrains.Current.GroupId == GroupId || GroupId < 0))
{
MaskOverride.Override(terrains.Current.TerrainData.Mask);
terrains.Current.TerrainData.SetDirty(GTerrainData.DirtyFlags.Mask);
}
}
}
public void ReArrange()
{
IEnumerator<GStylizedTerrain> terrains = GStylizedTerrain.ActiveTerrains.GetEnumerator();
while (terrains.MoveNext())
{
if (terrains.Current.TerrainData != null &&
(terrains.Current.GroupId == GroupId || GroupId < 0))
{
GStylizedTerrain t = terrains.Current;
if (t.TopNeighbor != null)
{
t.transform.rotation = Quaternion.identity;
t.transform.localScale = Vector3.one;
t.TopNeighbor.transform.position = t.transform.position + Vector3.forward * t.TerrainData.Geometry.Length;
t.TopNeighbor.transform.rotation = Quaternion.identity;
t.TopNeighbor.transform.localScale = Vector3.one;
}
if (t.BottomNeighbor != null)
{
t.transform.rotation = Quaternion.identity;
t.transform.localScale = Vector3.one;
t.BottomNeighbor.transform.position = t.transform.position + Vector3.back * t.TerrainData.Geometry.Length;
t.BottomNeighbor.transform.rotation = Quaternion.identity;
t.BottomNeighbor.transform.localScale = Vector3.one;
}
if (t.LeftNeighbor != null)
{
t.transform.rotation = Quaternion.identity;
t.transform.localScale = Vector3.one;
t.LeftNeighbor.transform.position = t.transform.position + Vector3.left * t.TerrainData.Geometry.Width;
t.LeftNeighbor.transform.rotation = Quaternion.identity;
t.LeftNeighbor.transform.localScale = Vector3.one;
}
if (t.RightNeighbor != null)
{
t.transform.rotation = Quaternion.identity;
t.transform.localScale = Vector3.one;
t.RightNeighbor.transform.position = t.transform.position + Vector3.right * t.TerrainData.Geometry.Width;
t.RightNeighbor.transform.rotation = Quaternion.identity;
t.RightNeighbor.transform.localScale = Vector3.one;
}
}
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0338fdd710d53df45988339dca82e73e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: