浏览代码
Reflection probe capture material (#1700)
Reflection probe capture material (#1700)
Splitted to long HDReflectionProbeEditor.Gizmos.cs into HDReflectionProbeEditor.Gizmos.cs, HDReflectionProbeEditor.Handles.cs and HDReflectionProbeEditor.Skin.cs Fix HDReflectionProbe's CapturePoint preview material, removing hidden mesh & renderer components Add PlanarReflectionProbe and Proxy icons/main
GitHub
6 年前
当前提交
010c21b8
共有 21 个文件被更改,包括 575 次插入 和 311 次删除
-
11com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/EditorReflectionSystem.cs
-
6com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/EditorReflectionSystemGUI.cs
-
196com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Handles.cs
-
21com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.ProbeUtility.cs
-
14com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.cs
-
55com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditorUtility.cs
-
2com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs
-
4com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Drawers.cs
-
2com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDAdditionalReflectionData.cs
-
2com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/PlanarReflectionProbe.cs.meta
-
2com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ReflectionProxyVolumeComponent.cs.meta
-
8com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Icons.meta
-
188com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Gizmos.cs
-
11com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Gizmos.cs.meta
-
39com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Skin.cs
-
11com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Skin.cs.meta
-
66com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Icons/PlanarReflection.png
-
97com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Icons/PlanarReflection.png.meta
-
54com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Icons/Proxy.png
-
97com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Icons/Proxy.png.meta
|
|||
fileFormatVersion: 2 |
|||
guid: 97dc5286d61263d47b2705992cffe2d9 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEditorInternal; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering |
|||
{ |
|||
partial class HDReflectionProbeEditor |
|||
{ |
|||
static Mesh sphere; |
|||
static Material material; |
|||
|
|||
[DrawGizmo(GizmoType.Active)] |
|||
static void RenderGizmo(ReflectionProbe reflectionProbe, GizmoType gizmoType) |
|||
{ |
|||
var e = GetEditorFor(reflectionProbe); |
|||
if (e == null || !e.sceneViewEditing) |
|||
return; |
|||
|
|||
var reflectionData = reflectionProbe.GetComponent<HDAdditionalReflectionData>(); |
|||
|
|||
switch (EditMode.editMode) |
|||
{ |
|||
// Influence editing
|
|||
case EditMode.SceneViewEditMode.ReflectionProbeBox: |
|||
Gizmos_Influence(reflectionProbe, reflectionData, e, true); |
|||
break; |
|||
// Influence fade editing
|
|||
case EditMode.SceneViewEditMode.GridBox: |
|||
Gizmos_InfluenceFade(reflectionProbe, reflectionData, e, InfluenceType.Standard, true); |
|||
break; |
|||
// Influence normal fade editing
|
|||
case EditMode.SceneViewEditMode.Collider: |
|||
Gizmos_InfluenceFade(reflectionProbe, reflectionData, e, InfluenceType.Normal, true); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
[DrawGizmo(GizmoType.Selected)] |
|||
static void DrawSelectedGizmo(ReflectionProbe reflectionProbe, GizmoType gizmoType) |
|||
{ |
|||
var e = GetEditorFor(reflectionProbe); |
|||
if (e == null) |
|||
return; |
|||
|
|||
var reflectionData = reflectionProbe.GetComponent<HDAdditionalReflectionData>(); |
|||
Gizmos_CapturePoint(reflectionProbe, reflectionData, e); |
|||
|
|||
if (!e.sceneViewEditing) |
|||
return; |
|||
|
|||
//Gizmos_Influence(reflectionProbe, reflectionData, e, false);
|
|||
Gizmos_InfluenceFade(reflectionProbe, reflectionData, null, InfluenceType.Standard, false); |
|||
Gizmos_InfluenceFade(reflectionProbe, reflectionData, null, InfluenceType.Normal, false); |
|||
|
|||
DrawVerticalRay(reflectionProbe.transform); |
|||
} |
|||
|
|||
static void Gizmos_InfluenceFade(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e, InfluenceType type, bool isEdit) |
|||
{ |
|||
var col = Gizmos.color; |
|||
var mat = Gizmos.matrix; |
|||
|
|||
Gizmo6FacesBoxContained box; |
|||
Vector3 boxCenterOffset; |
|||
Vector3 boxSizeOffset; |
|||
float sphereRadiusOffset; |
|||
Color color; |
|||
switch (type) |
|||
{ |
|||
default: |
|||
case InfluenceType.Standard: |
|||
{ |
|||
box = e != null ? e.m_UIState.alternativeBoxBlendHandle : null; |
|||
boxCenterOffset = a.boxBlendCenterOffset; |
|||
boxSizeOffset = a.boxBlendSizeOffset; |
|||
sphereRadiusOffset = a.sphereBlendRadiusOffset; |
|||
color = isEdit ? k_GizmoThemeColorInfluenceBlendFace : k_GizmoThemeColorInfluenceBlend; |
|||
break; |
|||
} |
|||
case InfluenceType.Normal: |
|||
{ |
|||
box = e != null ? e.m_UIState.alternativeBoxBlendNormalHandle : null; |
|||
boxCenterOffset = a.boxBlendNormalCenterOffset; |
|||
boxSizeOffset = a.boxBlendNormalSizeOffset; |
|||
sphereRadiusOffset = a.sphereBlendNormalRadiusOffset; |
|||
color = isEdit ? k_GizmoThemeColorInfluenceNormalBlendFace : k_GizmoThemeColorInfluenceNormalBlend; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
Gizmos.matrix = HDReflectionProbeEditorUtility.GetLocalSpace(p); |
|||
switch (a.influenceShape) |
|||
{ |
|||
case ShapeType.Box: |
|||
{ |
|||
Gizmos.color = color; |
|||
if (e != null) // e == null may occure when editor have still not been created at selection while the tool is not used for this part
|
|||
{ |
|||
box.DrawHull(isEdit); |
|||
} |
|||
else |
|||
{ |
|||
if (isEdit) |
|||
Gizmos.DrawCube(p.center + boxCenterOffset, p.size + boxSizeOffset); |
|||
else |
|||
Gizmos.DrawWireCube(p.center + boxCenterOffset, p.size + boxSizeOffset); |
|||
} |
|||
break; |
|||
} |
|||
case ShapeType.Sphere: |
|||
{ |
|||
Gizmos.color = color; |
|||
if (isEdit) |
|||
Gizmos.DrawSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset); |
|||
else |
|||
Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
Gizmos.matrix = mat; |
|||
Gizmos.color = col; |
|||
} |
|||
|
|||
static void Gizmos_Influence(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e, bool isEdit) |
|||
{ |
|||
var col = Gizmos.color; |
|||
var mat = Gizmos.matrix; |
|||
|
|||
Gizmos.matrix = HDReflectionProbeEditorUtility.GetLocalSpace(p); |
|||
switch (a.influenceShape) |
|||
{ |
|||
case ShapeType.Box: |
|||
{ |
|||
Gizmos.color = k_GizmoThemeColorExtentFace; |
|||
e.m_UIState.alternativeBoxInfluenceHandle.DrawHull(isEdit); |
|||
break; |
|||
} |
|||
case ShapeType.Sphere: |
|||
{ |
|||
Gizmos.color = k_GizmoThemeColorExtentFace; |
|||
if (isEdit) |
|||
Gizmos.DrawSphere(p.center, a.influenceSphereRadius); |
|||
else |
|||
Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
Gizmos.matrix = mat; |
|||
Gizmos.color = col; |
|||
} |
|||
|
|||
static void DrawVerticalRay(Transform transform) |
|||
{ |
|||
Ray ray = new Ray(transform.position, Vector3.down); |
|||
RaycastHit hit; |
|||
if (Physics.Raycast(ray, out hit)) |
|||
{ |
|||
Handles.color = Color.green; |
|||
Handles.zTest = UnityEngine.Rendering.CompareFunction.LessEqual; |
|||
Handles.DrawLine(transform.position - Vector3.up * 0.5f, hit.point); |
|||
Handles.DrawWireDisc(hit.point, hit.normal, 0.5f); |
|||
|
|||
Handles.color = Color.red; |
|||
Handles.zTest = UnityEngine.Rendering.CompareFunction.Greater; |
|||
Handles.DrawLine(transform.position, hit.point); |
|||
Handles.DrawWireDisc(hit.point, hit.normal, 0.5f); |
|||
} |
|||
} |
|||
|
|||
static void Gizmos_CapturePoint(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e) |
|||
{ |
|||
if(sphere == null) |
|||
{ |
|||
sphere = Resources.GetBuiltinResource<Mesh>("New-Sphere.fbx"); |
|||
} |
|||
if(material == null) |
|||
{ |
|||
material = new Material(Shader.Find("Debug/ReflectionProbePreview")); |
|||
} |
|||
material.SetTexture("_Cubemap", p.texture); |
|||
material.SetPass(0); |
|||
Graphics.DrawMeshNow(sphere, Matrix4x4.TRS(p.transform.position, Quaternion.identity, Vector3.one)); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f0521a8f59de2c548bc5a6796cd32be9 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEditor.IMGUI.Controls; |
|||
using UnityEditorInternal; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering |
|||
{ |
|||
partial class HDReflectionProbeEditor |
|||
{ |
|||
internal static Color k_GizmoThemeColorExtent = new Color(255f / 255f, 229f / 255f, 148f / 255f, 80f / 255f); |
|||
internal static Color k_GizmoThemeColorExtentFace = new Color(255f / 255f, 229f / 255f, 148f / 255f, 45f / 255f); |
|||
internal static Color k_GizmoThemeColorInfluenceBlend = new Color(83f / 255f, 255f / 255f, 95f / 255f, 75f / 255f); |
|||
internal static Color k_GizmoThemeColorInfluenceBlendFace = new Color(83f / 255f, 255f / 255f, 95f / 255f, 17f / 255f); |
|||
internal static Color k_GizmoThemeColorInfluenceNormalBlend = new Color(0f / 255f, 229f / 255f, 255f / 255f, 80f / 255f); |
|||
internal static Color k_GizmoThemeColorInfluenceNormalBlendFace = new Color(0f / 255f, 229f / 255f, 255f / 255f, 36f / 255f); |
|||
internal static Color k_GizmoThemeColorProjection = new Color(0x00 / 255f, 0xE5 / 255f, 0xFF / 255f, 0x20 / 255f); |
|||
internal static Color k_GizmoThemeColorProjectionFace = new Color(0x00 / 255f, 0xE5 / 255f, 0xFF / 255f, 0x20 / 255f); |
|||
internal static Color k_GizmoThemeColorDisabled = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f); |
|||
internal static Color k_GizmoThemeColorDisabledFace = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f); |
|||
|
|||
internal static readonly Color[][] k_handlesColor = new Color[][] |
|||
{ |
|||
new Color[] |
|||
{ |
|||
Color.red, |
|||
Color.green, |
|||
Color.blue |
|||
}, |
|||
new Color[] |
|||
{ |
|||
new Color(.5f, 0f, 0f, 1f), |
|||
new Color(0f, .5f, 0f, 1f), |
|||
new Color(0f, 0f, .5f, 1f) |
|||
} |
|||
}; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4bdc573336d075b419133b489a094c6a |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 3b77af68825357f47ae9f6d0b9d30f2d |
|||
TextureImporter: |
|||
fileIDToRecycleName: {} |
|||
externalObjects: {} |
|||
serializedVersion: 6 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 0 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
mipMapsPreserveCoverage: 0 |
|||
alphaTestReferenceValue: 0.5 |
|||
mipMapFadeDistanceStart: 1 |
|||
mipMapFadeDistanceEnd: 3 |
|||
bumpmap: |
|||
convertToNormalMap: 0 |
|||
externalNormalMap: 0 |
|||
heightScale: 0.25 |
|||
normalMapFilter: 0 |
|||
isReadable: 0 |
|||
streamingMipmaps: 0 |
|||
streamingMipmapsPriority: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: -1 |
|||
aniso: -1 |
|||
mipBias: -100 |
|||
wrapU: -1 |
|||
wrapV: -1 |
|||
wrapW: -1 |
|||
nPOTScale: 0 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 0 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spritePixelsToUnits: 100 |
|||
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
|||
spriteGenerateFallbackPhysicsShape: 1 |
|||
alphaUsage: 1 |
|||
alphaIsTransparency: 1 |
|||
spriteTessellationDetail: -1 |
|||
textureType: 0 |
|||
textureShape: 1 |
|||
singleChannelComponent: 0 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
platformSettings: |
|||
- serializedVersion: 2 |
|||
buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
- serializedVersion: 2 |
|||
buildTarget: Standalone |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
bones: [] |
|||
spriteID: |
|||
vertices: [] |
|||
indices: |
|||
edges: [] |
|||
weights: [] |
|||
spritePackingTag: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: a9ddbc20ff7d25948976df9d0f76eaf7 |
|||
TextureImporter: |
|||
fileIDToRecycleName: {} |
|||
externalObjects: {} |
|||
serializedVersion: 6 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 0 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
mipMapsPreserveCoverage: 0 |
|||
alphaTestReferenceValue: 0.5 |
|||
mipMapFadeDistanceStart: 1 |
|||
mipMapFadeDistanceEnd: 3 |
|||
bumpmap: |
|||
convertToNormalMap: 0 |
|||
externalNormalMap: 0 |
|||
heightScale: 0.25 |
|||
normalMapFilter: 0 |
|||
isReadable: 0 |
|||
streamingMipmaps: 0 |
|||
streamingMipmapsPriority: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: -1 |
|||
aniso: -1 |
|||
mipBias: -100 |
|||
wrapU: -1 |
|||
wrapV: -1 |
|||
wrapW: -1 |
|||
nPOTScale: 0 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 0 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spritePixelsToUnits: 100 |
|||
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
|||
spriteGenerateFallbackPhysicsShape: 1 |
|||
alphaUsage: 1 |
|||
alphaIsTransparency: 1 |
|||
spriteTessellationDetail: -1 |
|||
textureType: 0 |
|||
textureShape: 1 |
|||
singleChannelComponent: 0 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
platformSettings: |
|||
- serializedVersion: 2 |
|||
buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
- serializedVersion: 2 |
|||
buildTarget: Standalone |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
bones: [] |
|||
spriteID: 2ff1115d37a2ce24f910473fc18b2af2 |
|||
vertices: [] |
|||
indices: |
|||
edges: [] |
|||
weights: [] |
|||
spritePackingTag: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue