mirror of
https://github.com/maxartz15/SceneDebugViewer.git
synced 2024-11-21 19:15:36 +01:00
Pressets.
This commit is contained in:
parent
1e21d42722
commit
12a4122134
28
Editor/Presets/Base.asset
Normal file
28
Editor/Presets/Base.asset
Normal file
@ -0,0 +1,28 @@
|
||||
%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: 1aa272ccd1306c545b68254a527f8025, type: 3}
|
||||
m_Name: Overdraw
|
||||
m_EditorClassIdentifier:
|
||||
content:
|
||||
m_Text:
|
||||
m_Image: {fileID: 2800000, guid: 0723191ce0fb9d44ebece6c36fe4776f, type: 3}
|
||||
m_Tooltip: Overdraw - Preview the scene overdraw.
|
||||
shader: {fileID: 4800000, guid: 9f96928510529524c9190ccf618ceaf8, type: 3}
|
||||
replacementTag:
|
||||
parameters:
|
||||
- m_name: _RS_Color
|
||||
m_parameterType: 2
|
||||
m_texture: {fileID: 0}
|
||||
m_vector: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_color: {r: 1, g: 0, b: 0, a: 0.101960786}
|
||||
m_float: 0
|
||||
m_int: 0
|
8
Editor/Presets/Base.asset.meta
Normal file
8
Editor/Presets/Base.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b98c958d2eea9db40b45a1697314e455
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -10,19 +10,26 @@ MonoBehaviour:
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1aa272ccd1306c545b68254a527f8025, type: 3}
|
||||
m_Name: Overdraw
|
||||
m_Name: GridUnlit
|
||||
m_EditorClassIdentifier:
|
||||
content:
|
||||
m_Text:
|
||||
m_Image: {fileID: 10309, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Tooltip:
|
||||
shader: {fileID: 4800000, guid: 9f96928510529524c9190ccf618ceaf8, type: 3}
|
||||
m_Image: {fileID: 2800000, guid: 258ec05c639dc22449b3ca11da10d2ae, type: 3}
|
||||
m_Tooltip: Grid Unlit - View the scene with an unlit grid texture.
|
||||
shader: {fileID: 4800000, guid: 938a5e8d620c4b943bb6b2b15202678c, type: 3}
|
||||
replacementTag:
|
||||
parameters:
|
||||
- m_name: _RS_Color
|
||||
m_parameterType: 2
|
||||
m_texture: {fileID: 0}
|
||||
- m_name: _RS_Texture
|
||||
m_parameterType: 0
|
||||
m_texture: {fileID: 2800000, guid: 60a6c65bf59247d41bcc18553d97d2c5, type: 3}
|
||||
m_vector: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_color: {r: 1, g: 0, b: 0, a: 0.14901961}
|
||||
m_float: 0
|
||||
m_int: 0
|
||||
- m_name: _RS_Sharpness
|
||||
m_parameterType: 3
|
||||
m_texture: {fileID: 2800000, guid: 60a6c65bf59247d41bcc18553d97d2c5, type: 3}
|
||||
m_vector: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_color: {r: 1, g: 0, b: 0, a: 0.14901961}
|
||||
m_float: 10
|
||||
m_int: 0
|
||||
|
@ -14,8 +14,8 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
content:
|
||||
m_Text:
|
||||
m_Image: {fileID: 10309, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Tooltip:
|
||||
m_Image: {fileID: 2800000, guid: 0723191ce0fb9d44ebece6c36fe4776f, type: 3}
|
||||
m_Tooltip: Overdraw - Preview the scene overdraw.
|
||||
shader: {fileID: 4800000, guid: 9f96928510529524c9190ccf618ceaf8, type: 3}
|
||||
replacementTag:
|
||||
parameters:
|
||||
@ -23,6 +23,6 @@ MonoBehaviour:
|
||||
m_parameterType: 2
|
||||
m_texture: {fileID: 0}
|
||||
m_vector: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_color: {r: 1, g: 0, b: 0, a: 0.14901961}
|
||||
m_color: {r: 1, g: 0, b: 0, a: 0.101960786}
|
||||
m_float: 0
|
||||
m_int: 0
|
||||
|
@ -1,4 +1,3 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
@ -8,6 +7,7 @@ namespace TAO.SceneDebugViewer.Editor
|
||||
[CreateAssetMenu(menuName = "SceneDebugViewer/ReplacementShaderSetup")]
|
||||
public class ReplacementShaderSetupScriptableObject : ScriptableObject
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[Header("GUI")]
|
||||
public GUIContent content = new GUIContent();
|
||||
[Header("Shader")]
|
||||
@ -80,5 +80,6 @@ namespace TAO.SceneDebugViewer.Editor
|
||||
Float,
|
||||
Int
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
@ -1,31 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TAO.SceneDebugViewer.Editor
|
||||
{
|
||||
public class SceneDebugViewerWindow : EditorWindow
|
||||
{
|
||||
static List<ReplacementShaderSetupScriptableObject> options = new List<ReplacementShaderSetupScriptableObject>();
|
||||
private static SceneDebugViewerWindow window = null;
|
||||
private static List<ReplacementShaderSetupScriptableObject> options = new List<ReplacementShaderSetupScriptableObject>();
|
||||
|
||||
[MenuItem("Window/SceneDebugViewer")]
|
||||
static void Init()
|
||||
{
|
||||
options.Clear();
|
||||
Load();
|
||||
|
||||
string[] guids = AssetDatabase.FindAssets("t:ReplacementShaderSetupScriptableObject", null);
|
||||
foreach (string guid in guids)
|
||||
{
|
||||
options.Add((ReplacementShaderSetupScriptableObject)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid), typeof(ReplacementShaderSetupScriptableObject)));
|
||||
}
|
||||
|
||||
SceneDebugViewerWindow window = (SceneDebugViewerWindow)EditorWindow.GetWindow(typeof(SceneDebugViewerWindow));
|
||||
window = (SceneDebugViewerWindow)GetWindow(typeof(SceneDebugViewerWindow));
|
||||
window.titleContent = new GUIContent("SDV");
|
||||
window.Show();
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (GUILayout.Button("Reset"))
|
||||
using (new GUILayout.VerticalScope())
|
||||
{
|
||||
if (GUILayout.Button("Reload"))
|
||||
{
|
||||
Load();
|
||||
}
|
||||
|
||||
GUILayout.Space(6);
|
||||
|
||||
if (GUILayout.Button("Default", GUILayout.Height(44)))
|
||||
{
|
||||
foreach (SceneView s in SceneView.sceneViews)
|
||||
{
|
||||
@ -34,13 +39,29 @@ namespace TAO.SceneDebugViewer.Editor
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.Space(6);
|
||||
|
||||
// TODO: Horizontal and vertical grid/table selection drawer.
|
||||
foreach (var o in options)
|
||||
{
|
||||
if (GUILayout.Button(o.content))
|
||||
if (GUILayout.Button(o.content, GUILayout.Height(44)))
|
||||
{
|
||||
o.Replace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void Load()
|
||||
{
|
||||
options.Clear();
|
||||
|
||||
string[] guids = AssetDatabase.FindAssets("t:ReplacementShaderSetupScriptableObject", null);
|
||||
|
||||
foreach (string guid in guids)
|
||||
{
|
||||
options.Add((ReplacementShaderSetupScriptableObject)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid), typeof(ReplacementShaderSetupScriptableObject)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
34
Runtime/Shaders/Surface.shader
Normal file
34
Runtime/Shaders/Surface.shader
Normal file
@ -0,0 +1,34 @@
|
||||
Shader "Hidden/Surface"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 200
|
||||
|
||||
CGPROGRAM
|
||||
// Physically based Standard lighting model, and enable shadows on all light types
|
||||
#pragma surface surf Standard fullforwardshadows
|
||||
|
||||
// Use shader model 3.0 target, to get nicer looking lighting
|
||||
#pragma target 3.0
|
||||
|
||||
sampler2D _RS_Texture;
|
||||
fixed4 _RS_Color;
|
||||
half _RS_Metallic;
|
||||
half _RS_Glossiness;
|
||||
|
||||
struct Input
|
||||
{
|
||||
float2 uv_RS_Texture;
|
||||
};
|
||||
|
||||
void surf (Input IN, inout SurfaceOutputStandard o)
|
||||
{
|
||||
o.Albedo = tex2D(_RS_Texture, IN.uv_RS_Texture) * _RS_Color;
|
||||
o.Metallic = _RS_Metallic;
|
||||
o.Smoothness = _RS_Glossiness;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
}
|
10
Runtime/Shaders/Surface.shader.meta
Normal file
10
Runtime/Shaders/Surface.shader.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 442bea547b43fe643959790eb5b87ede
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -29,7 +29,7 @@ Shader "Hidden/TriPlanarTexture"
|
||||
|
||||
sampler2D _RS_Texture;
|
||||
float4 _RS_Texture_ST;
|
||||
float _RS_Float;
|
||||
float _RS_Sharpness;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
@ -57,7 +57,7 @@ Shader "Hidden/TriPlanarTexture"
|
||||
//show texture on both sides of the object (positive and negative)
|
||||
weights = abs(weights);
|
||||
//make the transition sharper
|
||||
weights = pow(weights, _RS_Float);
|
||||
weights = pow(weights, _RS_Sharpness);
|
||||
//make it so the sum of all components is 1
|
||||
weights = weights / (weights.x + weights.y + weights.z);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user