protected override void Start() { base.Start(); if (m_source == null) { m_source = GetComponent <AudioSource>(); } if (m_source == null) { Debug.LogError("Set AudioSource"); } if (m_max) { m_gizmo = gameObject.AddComponent <AudioSourceGizmo>(); m_gizmo.LineColor = LineColor; m_gizmo.HandlesColor = HandlesColor; m_gizmo.SelectionColor = SelectionColor; m_gizmo.SelectionMargin = SelectionMargin; m_gizmo.EnableUndo = EnableUndo; m_gizmo.m_max = !m_max; m_gizmo.Window = Window; } RTECamera.RefreshCommandBuffer(); }
public void Init(Camera camera) { /* * if (m_camera != null) * { * m_camera.RemoveCommandBuffer(CameraEvent.BeforeImageEffects, m_commandBuffer); * } * * if (m_commandBuffer == null) * { * m_commandBuffer = new CommandBuffer(); * }*/ if (m_rteCamera != null) { m_rteCamera.CommandBufferRefresh -= OnCommandBufferRefresh; Destroy(m_rteCamera); m_rteCamera = null; } m_camera = camera; //m_camera.AddCommandBuffer(CameraEvent.BeforeImageEffects, m_commandBuffer); m_rteCamera = m_camera.gameObject.AddComponent <RTECamera>(); m_rteCamera.Event = CameraEvent.BeforeImageEffects; m_rteCamera.CommandBufferRefresh += OnCommandBufferRefresh; }
private void OnDestroy() { if (m_rteCamera != null) { m_rteCamera.CommandBufferRefresh -= OnCommandBufferRefresh; Destroy(m_rteCamera); m_rteCamera = null; } }
protected virtual void OnEnable() { m_rteCamera = Window.Camera.gameObject.AddComponent <RTECamera>(); m_rteCamera.Event = CameraEvent.AfterForwardAlpha; m_rteCamera.CommandBufferRefresh += OnCommandBufferRefresh; Rebuild(); m_rteCamera.RefreshCommandBuffer(); }
protected bool TryRefreshCommandBuffer() { if (Model == null && RTECamera != null) { RTECamera.RefreshCommandBuffer(); return(true); } return(false); }
private void Init() { m_rteCamera = Window.Camera.gameObject.AddComponent <RTECamera>(); m_rteCamera.Event = CameraEvent.AfterForwardAlpha; m_rteCamera.CommandBufferRefresh += OnCommandBufferRefresh; Rebuild(); m_rteCamera.RefreshCommandBuffer(); }
public void Init(Camera camera) { if (m_rteCamera != null) { m_rteCamera.CommandBufferRefresh -= OnCommandBufferRefresh; Destroy(m_rteCamera); m_rteCamera = null; } m_camera = camera; m_rteCamera = m_camera.gameObject.AddComponent <RTECamera>(); m_rteCamera.Event = CameraEvent.BeforeImageEffects; m_rteCamera.CommandBufferRefresh += OnCommandBufferRefresh; }
private void OnDestroy() { /* * if (m_camera != null) * { * m_camera.RemoveCommandBuffer(CameraEvent.BeforeImageEffects, m_commandBuffer); * } */ if (m_rteCamera != null) { m_rteCamera.CommandBufferRefresh -= OnCommandBufferRefresh; Destroy(m_rteCamera); m_rteCamera = null; } }
protected override void Awake() { base.Awake(); RuntimeHandlesComponent.InitializeIfRequired(ref Appearance); if (Pivot == null) { Pivot = transform; } m_collidersGO = new GameObject(); m_collidersGO.transform.SetParent(transform, false); m_collidersGO.transform.position = GetGizmoPosition(); m_collidersGO.transform.rotation = Quaternion.identity; m_collidersGO.name = "Colliders"; m_colliderProj = m_collidersGO.AddComponent <BoxCollider>(); m_colliderUp = m_collidersGO.AddComponent <BoxCollider>(); m_colliderDown = m_collidersGO.AddComponent <BoxCollider>(); m_colliderLeft = m_collidersGO.AddComponent <BoxCollider>(); m_colliderRight = m_collidersGO.AddComponent <BoxCollider>(); m_colliderForward = m_collidersGO.AddComponent <BoxCollider>(); m_colliderBackward = m_collidersGO.AddComponent <BoxCollider>(); m_colliders = new[] { m_colliderProj, m_colliderUp, m_colliderDown, m_colliderRight, m_colliderLeft, m_colliderForward, m_colliderBackward }; DisableColliders(); m_camera = GetComponent <Camera>(); m_rteGizmoCamera = m_camera.gameObject.AddComponent <RTECamera>(); m_rteGizmoCamera.Event = CameraEvent.BeforeImageEffects; m_rteGizmoCamera.CommandBufferRefresh += OnCommandBufferRefresh; m_propertyBlocks = new[] { new MaterialPropertyBlock(), new MaterialPropertyBlock(), new MaterialPropertyBlock() }; m_cameraUtility = IOC.Resolve <IRenderPipelineCameraUtility>(); if (m_cameraUtility != null) { m_cameraUtility.SetBackgroundColor(m_camera, new Color(0, 0, 0, 0)); m_cameraUtility.EnablePostProcessing(m_camera, false); m_cameraUtility.PostProcessingEnabled += OnPostProcessingEnabled; } m_material = new Material(Shader.Find("Battlehub/RTHandles/RawImage")); m_output = new GameObject("SceneGizmoOutput"); m_output.gameObject.SetActive(false); m_output.transform.SetParent(Window.Camera.transform, false); m_output.transform.localPosition = Vector3.forward * m_camera.nearClipPlane; m_output.AddComponent <MeshFilter>().sharedMesh = Appearance.CreateRawImageMesh(); m_output.AddComponent <MeshRenderer>().sharedMaterial = m_material; m_graphics = IOC.Resolve <IRTEGraphics>(); m_camera.clearFlags = CameraClearFlags.SolidColor; m_camera.backgroundColor = new Color(0, 0, 0, 0); m_camera.cullingMask = 0; m_camera.orthographic = Window.Camera.orthographic; m_camera.rect = new Rect(0, 0, 1, 1); m_camera.stereoTargetEye = StereoTargetEyeMask.None; m_screenHeight = Screen.height; m_screenWidth = Screen.width; UpdateLayout(); InitColliders(); UpdateAlpha(ref m_xAlpha, Vector3.right, 1); UpdateAlpha(ref m_yAlpha, Vector3.up, 1); UpdateAlpha(ref m_zAlpha, Vector3.forward, 1); if (Run.Instance == null) { GameObject runGO = new GameObject(); runGO.name = "Run"; runGO.AddComponent <Run>(); } if (BtnProjection != null) { BtnProjection.onClick.AddListener(OnBtnModeClick); SetTextColor(); } if (!GetComponent <SceneGizmoInput>()) { gameObject.AddComponent <SceneGizmoInput>(); } }