void Update() { if (Input.GetMouseButtonDown(0)) { HolographicEffect.CallScan(transform.position); } }
void OnRenderObject() { if (m_Renderers != null) { HolographicEffect.CallRender(transform.position, m_Renderers); } }
void Awake() { if (m_IsInitialized) { return; } instance = this; if (effectShader == null || !effectShader.isSupported) { return; } if (worldRenderShader == null || !worldRenderShader.isSupported) { return; } m_ReplaceMaterial = new Material(Shader.Find("Unlit/Color")); m_EffectMaterial = new Material(effectShader); m_WorldRenderMaterial = new Material(worldRenderShader); if (holographicTex) { m_EffectMaterial.SetTexture("_EffectTex", holographicTex); } m_EffectMaterial.SetVector("_EffectScale", new Vector4(((float)Screen.width) / effectSize, ((float)Screen.height) / effectSize, 0, 0)); m_RenderTexture = new RenderTexture(Screen.width, Screen.height, 16); m_CommandBuffer = new CommandBuffer(); m_CommandBuffer.name = "[Holographic Effect]"; m_Camera = GetComponent <Camera>(); m_Camera.AddCommandBuffer(CameraEvent.BeforeImageEffectsOpaque, m_CommandBuffer); m_Camera.depthTextureMode |= DepthTextureMode.Depth; m_IsInitialized = true; }