열차 목업의 내부 확인용 프로젝트
smchoi
2024-06-14 3d45944b4b2abc384e2539fa72cd7925bbcf2543
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//////////////////////////////////////////////////////
// MK Glow Pipeline Properties                      //
//                                                    //
// Created by Michael Kremmel                       //
// www.michaelkremmel.de                            //
// Copyright © 2020 All rights reserved.           
 //
//////////////////////////////////////////////////////
 
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
namespace MK.Glow
{
    #if UNITY_2018_3_OR_NEWER
    using XRSettings = UnityEngine.XR.XRSettings;
    #endif
 
    /// <summary>
    /// Contains all PipelineProperties used in MK Glow
    /// </summary>
    internal static class PipelineProperties
    {
        //For even super large displays preserve some extra memory to prevent erros and gc.
        internal static readonly int renderBufferSize = 15;
        internal static bool scriptableRenderPipelineActive{ get { return UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset != null; } }
        #if UNITY_2018_3_OR_NEWER
        #if ENABLE_VR
        internal static bool xrEnabled { get{ return XRSettings.enabled; } }
        internal static bool singlePassStereoDoubleWideEnabled { get{ return XRSettings.enabled && XRSettings.stereoRenderingMode == XRSettings.StereoRenderingMode.SinglePass; } }
        internal static bool singlePassStereoInstancedEnabled { get{ return XRSettings.enabled && (XRSettings.stereoRenderingMode == XRSettings.StereoRenderingMode.SinglePassInstanced || XRSettings.stereoRenderingMode == XRSettings.StereoRenderingMode.SinglePassMultiview); } }
        #else
        internal static bool xrEnabled { get{ return false; } }
        internal static bool singlePassStereoDoubleWideEnabled { get{ return false; } }
        internal static bool singlePassStereoInstancedEnabled { get{ return false; } }
        #endif
        #else
        //No proper way of detecting stereo rendering mode so just return false
        internal static bool xrEnabled { get{ return false; } }
        internal static bool singlePassStereoDoubleWideEnabled { get{ return false; } }
        internal static bool singlePassStereoInstancedEnabled { get{ return false; } }
        #endif
 
        /// <summary>
        /// Shader PipelineProperties as IDs
        /// </summary>
        internal static class ShaderProperties
        {
            /// <summary>
            /// Representation of a render property based on unity version
            /// The id of the given name will be autogenerated
            /// </summary>
            internal class DefaultProperty
            {
                protected string _name;
                internal string name
                {
                    get{return _name;}
                }
                #if UNITY_2017_3_OR_NEWER
                protected int _id;
                internal int id
                {
                    get{return _id;}
                }
                #else
                internal string id
                {
                    get{return _name;}
                }
                #endif
 
                internal DefaultProperty(string name)
                {
                    this._name = name;
                    #if UNITY_2017_3_OR_NEWER
                    this._id = Shader.PropertyToID(name);
                    #endif
                }
            }
 
            //Main, Bloom
            internal static readonly DefaultProperty singlePassStereoScale           = new DefaultProperty("_SinglePassStereoScale");
            internal static readonly DefaultProperty viewMatrix                      = new DefaultProperty("_ViewMatrix");
            internal static readonly DefaultProperty sourceTex                       = new DefaultProperty("_SourceTex");
            internal static readonly DefaultProperty targetTex                       = new DefaultProperty("_TargetTex");
            internal static readonly DefaultProperty copyTargetTex                   = new DefaultProperty("_CopyTargetTex");
            internal static readonly DefaultProperty bloomTex                        = new DefaultProperty("_BloomTex");
            internal static readonly DefaultProperty bloomTargetTex                  = new DefaultProperty("_BloomTargetTex");
            internal static readonly DefaultProperty bloomSpread                     = new DefaultProperty("_BloomSpread");
            internal static readonly DefaultProperty bloomThreshold                  = new DefaultProperty("_BloomThreshold");
            internal static readonly DefaultProperty bloomIntensity                  = new DefaultProperty("_BloomIntensity");
            internal static readonly DefaultProperty higherMipBloomTex               = new DefaultProperty("_HigherMipBloomTex");
 
            //Lens Surface
            internal static readonly DefaultProperty lensSurfaceDirtTex              = new DefaultProperty("_LensSurfaceDirtTex");
            internal static readonly DefaultProperty lensSurfaceDiffractionTex       = new DefaultProperty("_LensSurfaceDiffractionTex");
            internal static readonly DefaultProperty lensSurfaceDirtIntensity        = new DefaultProperty("_LensSurfaceDirtIntensity");
            internal static readonly DefaultProperty lensSurfaceDiffractionIntensity = new DefaultProperty("_LensSurfaceDiffractionIntensity");
            internal static readonly DefaultProperty lensSurfaceDirtTexST            = new DefaultProperty("_LensSurfaceDirtTex_ST");
        }
 
        /// <summary>
        /// CommandBuffer PipelineProperties as strings
        /// </summary>
        internal static class CommandBufferProperties
        {
            //Main
            internal static readonly string commandBufferName         = "MK Glow";
            internal static readonly string selectiveRenderBuffer     = "_SelectiveRenderBuffer";
            internal static readonly string bloomDownsampleBuffer     = "_BloomDownsampleBuffer";
            internal static readonly string bloomUpsampleBuffer       = "_BloomUpsampleBuffer";
            internal static readonly string sourceBuffer              = "_SourceBuffer";
 
            //Buffer Samples
            internal static readonly string sampleDownsample          = "Downsample";
            internal static readonly string samplePreSample           = "Presample";
            internal static readonly string sampleUpsample            = "Upsample";
            internal static readonly string sampleComposite           = "Composite";
            internal static readonly string sampleCreateBuffers       = "Create Mip Buffers";
            internal static readonly string sampleClearBuffers        = "Clear Mip Buffers";
            internal static readonly string sampleSetup               = "Setup Constant Buffer";
            internal static readonly string sampleCopySource          = "Copy Source";
            internal static readonly string sampleReplacement         = "Render Replacement";
            internal static readonly string samplePrepare             = "Prepare";
        }
    }
}