浏览代码

clarify InfluenceVolume API and fields

/main
RSlysz 6 年前
当前提交
d4cc0f44
共有 2 个文件被更改,包括 45 次插入39 次删除
  1. 14
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/SerializedInfluenceVolume.cs
  2. 70
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/InfluenceVolume.cs

14
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/SerializedInfluenceVolume.cs


sphereBlendDistance = root.Find((InfluenceVolume i) => i.sphereBlendDistance);
sphereBlendNormalDistance = root.Find((InfluenceVolume i) => i.sphereBlendNormalDistance);
editorAdvancedModeBlendDistancePositive = root.FindPropertyRelative("editorAdvancedModeBlendDistancePositive");
editorAdvancedModeBlendDistanceNegative = root.FindPropertyRelative("editorAdvancedModeBlendDistanceNegative");
editorSimplifiedModeBlendDistance = root.FindPropertyRelative("editorSimplifiedModeBlendDistance");
editorAdvancedModeBlendNormalDistancePositive = root.FindPropertyRelative("editorAdvancedModeBlendNormalDistancePositive");
editorAdvancedModeBlendNormalDistanceNegative = root.FindPropertyRelative("editorAdvancedModeBlendNormalDistanceNegative");
editorSimplifiedModeBlendNormalDistance = root.FindPropertyRelative("editorSimplifiedModeBlendNormalDistance");
editorAdvancedModeEnabled = root.FindPropertyRelative("editorAdvancedModeEnabled");
editorAdvancedModeBlendDistancePositive = root.FindPropertyRelative("m_EditorAdvancedModeBlendDistancePositive");
editorAdvancedModeBlendDistanceNegative = root.FindPropertyRelative("m_EditorAdvancedModeBlendDistanceNegative");
editorSimplifiedModeBlendDistance = root.FindPropertyRelative("m_EditorSimplifiedModeBlendDistance");
editorAdvancedModeBlendNormalDistancePositive = root.FindPropertyRelative("m_EditorAdvancedModeBlendNormalDistancePositive");
editorAdvancedModeBlendNormalDistanceNegative = root.FindPropertyRelative("m_EditorAdvancedModeBlendNormalDistanceNegative");
editorSimplifiedModeBlendNormalDistance = root.FindPropertyRelative("m_EditorSimplifiedModeBlendNormalDistance");
editorAdvancedModeEnabled = root.FindPropertyRelative("m_EditorAdvancedModeEnabled");
//handle data migration from before editor value were saved
if(editorAdvancedModeBlendDistancePositive.vector3Value == Vector3.zero
&& editorAdvancedModeBlendDistanceNegative.vector3Value == Vector3.zero

70
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/InfluenceVolume.cs


using System;
using UnityEngine.Serialization;
using UnityEngine.Experimental.Rendering;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{

Vector3 m_SphereBaseOffset;
// Box
[SerializeField]
Vector3 m_BoxBaseSize = Vector3.one;
[SerializeField, FormerlySerializedAs("m_BoxBaseSize")]
Vector3 m_BoxSize = Vector3.one;
Vector3 m_BoxPositiveFade;
Vector3 m_BoxBlendDistancePositive;
Vector3 m_BoxNegativeFade;
Vector3 m_BoxBlendDistanceNegative;
Vector3 m_BoxNormalPositiveFade;
Vector3 m_BoxBlendNormalDistancePositive;
Vector3 m_BoxNormalNegativeFade;
Vector3 m_BoxBlendNormalDistanceNegative;
Vector3 m_BoxFacePositiveFade = Vector3.one;
Vector3 m_BoxSideFadePositive = Vector3.one;
Vector3 m_BoxFaceNegativeFade = Vector3.one;
Vector3 m_BoxSideFadeNegative = Vector3.one;
[SerializeField] private Vector3 editorAdvancedModeBlendDistancePositive;
[SerializeField] private Vector3 editorAdvancedModeBlendDistanceNegative;
[SerializeField] private float editorSimplifiedModeBlendDistance;
[SerializeField] private Vector3 editorAdvancedModeBlendNormalDistancePositive;
[SerializeField] private Vector3 editorAdvancedModeBlendNormalDistanceNegative;
[SerializeField] private float editorSimplifiedModeBlendNormalDistance;
[SerializeField] private bool editorAdvancedModeEnabled;
[SerializeField, FormerlySerializedAs("editorAdvancedModeBlendDistancePositive")]
Vector3 m_EditorAdvancedModeBlendDistancePositive;
[SerializeField, FormerlySerializedAs("editorAdvancedModeBlendDistanceNegative")]
Vector3 m_EditorAdvancedModeBlendDistanceNegative;
[SerializeField, FormerlySerializedAs("editorSimplifiedModeBlendDistance")]
float m_EditorSimplifiedModeBlendDistance;
[SerializeField, FormerlySerializedAs("editorAdvancedModeBlendNormalDistancePositive")]
Vector3 m_EditorAdvancedModeBlendNormalDistancePositive;
[SerializeField, FormerlySerializedAs("editorAdvancedModeBlendNormalDistanceNegative")]
Vector3 m_EditorAdvancedModeBlendNormalDistanceNegative;
[SerializeField, FormerlySerializedAs("editorSimplifiedModeBlendNormalDistance")]
float m_EditorSimplifiedModeBlendNormalDistance;
[SerializeField, FormerlySerializedAs("editorAdvancedModeEnabled")]
bool m_EditorAdvancedModeEnabled;
// Sphere
[SerializeField, FormerlySerializedAs("m_SphereBaseRadius")]

/// <summary>Offset of this influence volume to the component handling him.</summary>
public Vector3 offset { get { return m_Offset; } set { m_Offset = value; } }
public Vector3 boxSize { get { return m_BoxBaseSize; } set { m_BoxBaseSize = value; } }
public Vector3 boxSize { get { return m_BoxSize; } set { m_BoxSize = value; } }
public Vector3 boxBlendDistancePositive { get { return m_BoxPositiveFade; } set { m_BoxPositiveFade = value; } }
public Vector3 boxBlendDistanceNegative { get { return m_BoxNegativeFade; } set { m_BoxNegativeFade = value; } }
public Vector3 boxBlendDistancePositive { get { return m_BoxBlendDistancePositive; } set { m_BoxBlendDistancePositive = value; } }
public Vector3 boxBlendDistanceNegative { get { return m_BoxBlendDistanceNegative; } set { m_BoxBlendDistanceNegative = value; } }
public Vector3 boxBlendNormalDistancePositive { get { return m_BoxNormalPositiveFade; } set { m_BoxNormalPositiveFade = value; } }
public Vector3 boxBlendNormalDistanceNegative { get { return m_BoxNormalNegativeFade; } set { m_BoxNormalNegativeFade = value; } }
public Vector3 boxBlendNormalDistancePositive { get { return m_BoxBlendNormalDistancePositive; } set { m_BoxBlendNormalDistancePositive = value; } }
public Vector3 boxBlendNormalDistanceNegative { get { return m_BoxBlendNormalDistanceNegative; } set { m_BoxBlendNormalDistanceNegative = value; } }
public Vector3 boxSideFadePositive { get { return m_BoxFacePositiveFade; } set { m_BoxFacePositiveFade = value; } }
public Vector3 boxSideFadeNegative { get { return m_BoxFaceNegativeFade; } set { m_BoxFaceNegativeFade = value; } }
public Vector3 boxSideFadePositive { get { return m_BoxSideFadePositive; } set { m_BoxSideFadePositive = value; } }
public Vector3 boxSideFadeNegative { get { return m_BoxSideFadeNegative; } set { m_BoxSideFadeNegative = value; } }
public float sphereRadius { get { return m_SphereRadius; } set { m_SphereRadius = value; } }

public BoundingSphere GetBoundingSphereAt(Transform transform)
internal BoundingSphere GetBoundingSphereAt(Transform probeTransform)
return new BoundingSphere(transform.TransformPoint(offset), sphereRadius);
return new BoundingSphere(probeTransform.TransformPoint(offset), sphereRadius);
var position = transform.TransformPoint(offset);
var position = probeTransform.TransformPoint(offset);
var radius = Mathf.Max(boxSize.x, Mathf.Max(boxSize.y, boxSize.z));
return new BoundingSphere(position, radius);
}

public Bounds GetBoundsAt(Transform transform)
internal Bounds GetBoundsAt(Transform probeTransform)
return new Bounds(transform.position, Vector3.one * sphereRadius);
return new Bounds(probeTransform.position, Vector3.one * sphereRadius);
var position = transform.TransformPoint(offset);
// TODO: Return a proper AABB based on influence box volume
var position = probeTransform.TransformPoint(offset);
public Vector3 GetWorldPosition(Transform transform)
internal Vector3 GetWorldPosition(Transform probeTransform)
return transform.TransformPoint(offset);
return probeTransform.TransformPoint(offset);
}
internal void MigrateOffsetSphere()

正在加载...
取消
保存