static Texture GetTexture(HDReflectionProbeEditor e, Object target)
        {
            HDProbe additional = e.GetTarget(target);

            if (additional != null && additional.mode == UnityEngine.Rendering.ReflectionProbeMode.Realtime)
            {
                return(additional.realtimeTexture);
            }
            else
            {
                var p = target as ReflectionProbe;
                if (p != null)
                {
                    return(p.texture);
                }
            }
            return(null);
        }
Exemple #2
0
        static void Gizmos_CapturePoint(HDReflectionProbeEditor e)
        {
            if (sphere == null)
            {
                sphere = Resources.GetBuiltinResource <Mesh>("New-Sphere.fbx");
            }
            if (material == null)
            {
                material = new Material(Shader.Find("Debug/ReflectionProbePreview"));
            }

            foreach (ReflectionProbe target in e.targets)
            {
                material.SetTexture("_Cubemap", GetTexture(e, target));
                material.SetPass(0);
                Graphics.DrawMeshNow(sphere, Matrix4x4.TRS(target.transform.position, Quaternion.identity, Vector3.one * capturePointPreviewSize));
            }
        }
 static void PerformOperations(HDReflectionProbeUI s, SerializedHDReflectionProbe p, HDReflectionProbeEditor o)
 {
 }
        internal override HDProbe GetTarget(Object editorTarget)
        {
            HDReflectionProbeEditor e = s_ReflectionProbeEditors[(ReflectionProbe)editorTarget];

            return((HDProbe)e.m_AdditionalDataSerializedObject.targetObjects.First(a => ((HDAdditionalReflectionData)a).reflectionProbe == editorTarget));
        }
Exemple #5
0
 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));
 }
Exemple #6
0
        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;
        }
Exemple #7
0
        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;
        }
Exemple #8
0
        static Texture GetTexture(HDReflectionProbeEditor e, Object target)
        {
            HDProbe probe = e.GetTarget(target);

            return(probe.texture);
        }