コード例 #1
0
        //
        static protected void Initialize()
        {
            if (initialized)
            {
                return;
            }

            // Determine graphics device type
            device = SystemInfo.graphicsDeviceType;

            // Initialize shader property constants
            ShaderPropertyID.Initialize();

            // Initialize shaders and materials
            int l = shaderPaths.Length;

            shaders   = new Shader[l];
            materials = new Material[l];
            for (int i = 0; i < l; i++)
            {
                Shader shader = Shader.Find(shaderPaths[i]);
                shaders[i] = shader;

                Material material = new Material(shader);
                materials[i] = material;
            }

            // Initialize static RenderTargetIdentifier(s)
            cameraTargetID = new RenderTargetIdentifier(BuiltinRenderTextureType.CameraTarget);

            // Create static quad mesh
            CreateQuad();

            initialized = true;
        }
コード例 #2
0
        //
        private void Awake()
        {
            tr = GetComponent <Transform>();
            ShaderPropertyID.Initialize();

            onceColor = FindObjectOfType <HighlightingRenderer> ().HighlightColor;
        }
コード例 #3
0
        //
        protected virtual void Awake()
        {
            ShaderPropertyID.Initialize();
            go = gameObject;

            refCam = GetComponent <Camera>();
            if (highlighters == null)
            {
                highlighters = new List <Highlighter>();
            }

            // Determine graphics device version
            string version = SystemInfo.graphicsDeviceVersion.ToLower();

            if (version.StartsWith("direct3d 11"))
            {
                graphicsDeviceVersion = D3D11;
            }
            else if (version.StartsWith("opengl"))
            {
                graphicsDeviceVersion = OGL;
            }
            else
            {
                graphicsDeviceVersion = D3D9;
            }
        }
コード例 #4
0
        //
        static protected void Initialize()
        {
            if (initialized)
            {
                return;
            }

            // Determine graphics device version
            string version = SystemInfo.graphicsDeviceVersion.ToLower();

            if (version.Contains("direct3d") || version.Contains("directx"))
            {
                if (version.Contains("direct3d 11") || version.Contains("directx 11"))
                {
                    graphicsDeviceVersion = D3D11;
                }
                else
                {
                    graphicsDeviceVersion = D3D9;
                }
            }
#if UNITY_EDITOR_WIN && (UNITY_ANDROID || UNITY_IOS)
            else if (version.Contains("emulated"))
            {
                graphicsDeviceVersion = D3D9;
            }
#endif
            else
            {
                graphicsDeviceVersion = OGL;
            }

            // Initialize shader property constants
            ShaderPropertyID.Initialize();

            // Initialize shaders and materials
            int l = shaderPaths.Length;
            shaders   = new Shader[l];
            materials = new Material[l];
            for (int i = 0; i < l; i++)
            {
                Shader shader = Shader.Find(shaderPaths[i]);
                shaders[i] = shader;

                Material material = new Material(shader);
                materials[i] = material;
            }
            cutMaterial  = materials[CUT];
            compMaterial = materials[COMP];

            // Initialize static RenderTargetIdentifiers
            cameraTargetID = new RenderTargetIdentifier(BuiltinRenderTextureType.CameraTarget);

            // Create static quad mesh
            CreateQuad();

            initialized = true;
        }
コード例 #5
0
        //
        static protected void Initialize()
        {
            if (initialized)
            {
                return;
            }

            // Determine graphics device version
            string version = SystemInfo.graphicsDeviceVersion.ToLower();

            if (version.StartsWith("direct3d") || version.StartsWith("directx 11"))
            {
                if (version.StartsWith("direct3d 11") || version.StartsWith("directx 11"))
                {
                    graphicsDeviceVersion = D3D11;
                }
                else
                {
                    graphicsDeviceVersion = D3D9;
                }
            }
            else
            {
                graphicsDeviceVersion = OGL;
            }

            // Initialize shader property constants
            ShaderPropertyID.Initialize();

            // Initialize shaders and materials
            int l = shaderPaths.Length;

            shaders   = new Shader[l];
            materials = new Material[l];
            for (int i = 0; i < l; i++)
            {
                Shader shader = Shader.Find(shaderPaths[i]);
                shaders[i] = shader;

                Material material = new Material(shader);
                material.hideFlags = HideFlags.HideAndDontSave;
                materials[i]       = material;
            }
            cutMaterial  = materials[CUT];
            compMaterial = materials[COMP];

            // Initialize static RenderTargetIdentifiers
            highlightingBufferID = new RenderTargetIdentifier(ShaderPropertyID._HighlightingBuffer);
            cameraTargetID       = new RenderTargetIdentifier(BuiltinRenderTextureType.CameraTarget);

            // Create static quad mesh
            CreateQuad();

            initialized = true;
        }
コード例 #6
0
        //
        private void Awake()
        {
            ShaderPropertyID.Initialize();
            tr = GetComponent <Transform>();

            renderersDirty = true;
            seeThrough     = zTest = true;
            mode           = Mode.None;
            stencilRef     = true;

            // Initial highlighting state
            once             = false;
            flashing         = false;
            occluder         = false;
            transitionValue  = transitionTarget = 0f;
            onceColor        = Color.red;
            flashingFreq     = 2f;
            flashingColorMin = new Color(0f, 1f, 1f, 0f);
            flashingColorMax = new Color(0f, 1f, 1f, 1f);
            constantColor    = Color.yellow;
        }
コード例 #7
0
 //
 private void Awake()
 {
     tr = GetComponent <Transform>();
     ShaderPropertyID.Initialize();
 }