protected override void AwakeOverride() { base.AwakeOverride(); string vertShader = PBBuiltinMaterials.geometryShadersSupported ? PBBuiltinMaterials.pointShader : PBBuiltinMaterials.dotShader; m_verticesMaterial = new Material(Shader.Find(vertShader)); m_verticesMaterial.SetColor("_Color", Color.white); m_verticesMaterial.SetInt("_HandleZTest", (int)m_zTest); m_verticesMaterial.SetFloat("_Scale", m_verticesScale); m_edgesMaterial = new Material(PBBuiltinMaterials.LinesMaterial); m_edgesMaterial.SetColor("_Color", Color.white); m_edgesMaterial.SetInt("_HandleZTest", (int)m_zTest); m_edgesMaterial.SetFloat("_Scale", m_edgesScale); m_verticesMesh = new Mesh { name = "UVVertices" }; m_edgesMesh = new Mesh { name = "UVEdges" }; m_graphicsLayer = Window.IOCContainer.Resolve <IRTEGraphicsLayer>(); m_graphicsLayer.Camera.MeshesCache.RefreshMode = CacheRefreshMode.Always; }
protected virtual void Start() { if (transform.parent != null) { RuntimeWindow parent = transform.parent.GetComponentInParent <RuntimeWindow>(); if (parent != null) { Depth = parent.Depth + 1; } } //m_texturePreview.transform.position = new Vector3(ManualUVRenderer.Scale, ManualUVRenderer.Scale, 2) * 0.5f; m_texturePreview.transform.rotation = Quaternion.Euler(90, 180, 0); m_texturePreview.transform.localScale = Vector3.one * 10; m_texturePreview.sharedMaterial.mainTextureScale = Vector2.one * 10; m_graphicsLayer = IOCContainer.Resolve <IRTEGraphicsLayer>(); m_graphicsLayer.Camera.RenderersCache.Add(m_texturePreview); m_materialEditor = IOC.Resolve <IMaterialEditor>(); m_materialEditor.MaterialsApplied += OnMaterialApplied; m_paletteManager = IOC.Resolve <IMaterialPaletteManager>(); m_paletteManager.PaletteChanged += OnPaletteChanged; m_paletteManager.MaterialAdded += OnMaterialsChanged; m_paletteManager.MaterialCreated += OnMaterialsChanged; m_paletteManager.MaterialRemoved += OnMaterialsChanged; }
private void Init() { Camera camera = Window.Camera; IRTEGraphicsLayer graphicsLayer = Window.IOCContainer.Resolve <IRTEGraphicsLayer>(); if (graphicsLayer != null && graphicsLayer.Camera != null) { camera = graphicsLayer.Camera.Camera; } if (camera == null) { return; } IRTEGraphics graphics = IOC.Resolve <IRTEGraphics>(); m_rteCamera = graphics.CreateCamera(camera, CameraEvent.AfterImageEffects, false, true); m_rteCamera.RenderersCache.Add(m_output.GetComponent <Renderer>()); m_rteCamera.RefreshCommandBuffer(); DoSceneGizmo(); if (BtnProjection != null) { BtnProjection.gameObject.SetActive(true); } }
protected override void Start() { base.Start(); m_plane = new Plane(Vector3.forward, 0); m_graphicsLayer = Window.IOCContainer.Resolve <IRTEGraphicsLayer>(); CreateUVRenderers(); m_graphicsLayer.Camera.RenderersCache.Refresh(); m_uvEditor.RefreshPivotPoint(); m_selectionComponent = Window.IOCContainer.Resolve <IRuntimeSelectionComponent>(); m_selectionComponent.BoxSelection.Selection += OnBoxSelection; m_selectionComponent.PositionHandle.BeforeDrag.AddListener(OnBeginMove); m_selectionComponent.PositionHandle.Drag.AddListener(OnMove); m_selectionComponent.PositionHandle.Drop.AddListener(OnEndMove); m_selectionComponent.RotationHandle.BeforeDrag.AddListener(OnBeginRotate); m_selectionComponent.RotationHandle.Drag.AddListener(OnRotate); m_selectionComponent.RotationHandle.Drop.AddListener(OnEndRotate); m_selectionComponent.ScaleHandle.BeforeDrag.AddListener(OnBeginScale); m_selectionComponent.ScaleHandle.Drag.AddListener(OnScale); m_selectionComponent.ScaleHandle.Drop.AddListener(OnEndScale); }
protected override void Start() { m_input = GetComponent <BaseHandleInput>(); if (m_input == null || m_input.Handle != this) { m_input = gameObject.AddComponent <BaseHandleInput>(); m_input.Handle = this; } IRTEGraphicsLayer graphicsLayer = Window.IOCContainer.Resolve <IRTEGraphicsLayer>(); if (graphicsLayer != null) { m_rteCamera = graphicsLayer.Camera; } if (m_rteCamera == null && Window.Camera != null) { IRTEGraphics graphics = IOC.Resolve <IRTEGraphics>(); if (graphics != null) { m_rteCamera = graphics.GetOrCreateCamera(Window.Camera, CameraEvent.AfterImageEffectsOpaque); } if (m_rteCamera == null) { m_rteCamera = Window.Camera.gameObject.AddComponent <RTECamera>(); m_rteCamera.Event = CameraEvent.AfterImageEffectsOpaque; } } if (Model == null && m_rteCamera != null) { m_prevScale = transform.localScale; m_prevCamPosition = m_rteCamera.Camera.transform.position; m_prevCamRotation = m_rteCamera.Camera.transform.rotation; m_prevCamOrthographic = m_rteCamera.Camera.orthographic; m_prevCamOrthographicsSize = m_rteCamera.Camera.orthographicSize; m_prevCamRect = m_rteCamera.Camera.rect; m_rteCamera.CommandBufferRefresh += OnCommandBufferRefresh; m_rteCamera.RefreshCommandBuffer(); } #pragma warning disable CS0618 OnStartOverride(); #pragma warning restore CS0618 }
private void Start() { m_input = GetComponent <BaseHandleInput>(); if (m_input == null || m_input.Handle != this) { m_input = gameObject.AddComponent <BaseHandleInput>(); m_input.Handle = this; } IRTEGraphicsLayer graphicsLayer = Window.IOCContainer.Resolve <IRTEGraphicsLayer>(); if (graphicsLayer != null) { m_rteCamera = graphicsLayer.Camera; } if (m_rteCamera == null && Window.Camera != null) { m_rteCamera = Window.Camera.GetComponent <IRTECamera>(); if (m_rteCamera == null) { m_rteCamera = Window.Camera.gameObject.AddComponent <RTECamera>(); m_rteCamera.Event = UnityEngine.Rendering.CameraEvent.AfterImageEffectsOpaque; } } if (Model == null && m_rteCamera != null) { m_prevScale = transform.localScale; m_prevCamPosition = m_rteCamera.Camera.transform.position; m_prevCamRotation = m_rteCamera.Camera.transform.rotation; m_prevCamOrthographic = m_rteCamera.Camera.orthographic; m_prevCamOrthographicsSize = m_rteCamera.Camera.orthographicSize; m_prevCamRect = m_rteCamera.Camera.rect; m_rteCamera.CommandBufferRefresh += OnCommandBufferRefresh; m_rteCamera.RefreshCommandBuffer(); } OnStartOverride(); }
protected virtual void OnEnable() { Camera camera = Window.Camera; IRTEGraphicsLayer graphicsLayer = Window.IOCContainer.Resolve <IRTEGraphicsLayer>(); if (graphicsLayer != null) { camera = graphicsLayer.Camera.Camera; } m_rteCamera = m_graphics.CreateCamera(camera); m_rteCamera.RenderersCache.Add(m_output.GetComponent <Renderer>()); m_rteCamera.Event = CameraEvent.AfterImageEffects; DoSceneGizmo(); if (BtnProjection != null) { BtnProjection.gameObject.SetActive(true); } }
private IRTECamera GetRTECamera() { if (Window == null || Window.Camera == null) { return(null); } IRTECamera rteCamera; IRTEGraphicsLayer graphicsLayer = Window.IOCContainer.Resolve <IRTEGraphicsLayer>(); if (graphicsLayer == null) { rteCamera = Window.Camera.GetComponent <IRTECamera>(); } else { rteCamera = graphicsLayer.Camera; } return(rteCamera); }
private IRTECamera GetRTECamera() { if (Window == null || Window.Camera == null) { return(null); } IRTECamera rteCamera; IRTEGraphicsLayer graphicsLayer = Window.IOCContainer.Resolve <IRTEGraphicsLayer>(); if (graphicsLayer != null) { rteCamera = graphicsLayer.Camera; } else { IRTEGraphics graphics = IOC.Resolve <IRTEGraphics>(); rteCamera = graphics.GetOrCreateCamera(Window.Camera, CameraEvent.AfterImageEffectsOpaque); } return(rteCamera); }
protected override void Start() { base.Start(); BaseGizmoInput input = GetComponent <BaseGizmoInput>(); if (input == null || input.Gizmo != this) { input = gameObject.AddComponent <BaseGizmoInput>(); input.Gizmo = this; } if (Target == null) { Target = transform; } if (EnableUndo) { if (!RuntimeUndoInput.IsInitialized) { GameObject runtimeUndo = new GameObject(); runtimeUndo.name = "RuntimeUndo"; runtimeUndo.AddComponent <RuntimeUndoInput>(); } } IRTEGraphicsLayer graphicsLayer = Window.IOCContainer.Resolve <IRTEGraphicsLayer>(); if (graphicsLayer != null && !ForceCreateCamera) { m_rteCamera = graphicsLayer.Camera; } if (m_rteCamera == null && SceneCamera != null) { IRTEGraphics graphics = IOC.Resolve <IRTEGraphics>(); if (graphics != null) { m_rteCamera = graphics.GetOrCreateCamera(SceneCamera, CameraEvent); } if (m_rteCamera == null) { m_rteCamera = SceneCamera.gameObject.AddComponent <RTECamera>(); m_rteCamera.Event = CameraEvent; } } if (m_rteCamera != null) { m_prevPosition = transform.position; m_prevRotation = transform.rotation; m_prevScale = transform.localScale; m_prevCamPosition = m_rteCamera.Camera.transform.position; m_prevCamRotation = m_rteCamera.Camera.transform.rotation; m_prevOrthographic = m_rteCamera.Camera.orthographic; m_rteCamera.CommandBufferRefresh += OnCommandBufferRefresh; m_rteCamera.RefreshCommandBuffer(); } #pragma warning disable CS0612 StartOverride(); #pragma warning restore CS0612 }
private void Start() { BaseGizmoInput input = GetComponent <BaseGizmoInput>(); if (input == null || input.Gizmo != this) { input = gameObject.AddComponent <BaseGizmoInput>(); input.Gizmo = this; } if (SceneCamera == null) { SceneCamera = Window.Camera; } if (SceneCamera == null) { SceneCamera = Camera.main; } if (Target == null) { Target = transform; } if (EnableUndo) { if (!RuntimeUndoInput.IsInitialized) { GameObject runtimeUndo = new GameObject(); runtimeUndo.name = "RuntimeUndo"; runtimeUndo.AddComponent <RuntimeUndoInput>(); } } IRTEGraphicsLayer graphicsLayer = Window.IOCContainer.Resolve <IRTEGraphicsLayer>(); if (graphicsLayer != null) { m_rteCamera = graphicsLayer.Camera; } if (m_rteCamera == null && SceneCamera != null) { m_rteCamera = SceneCamera.GetComponent <IRTECamera>(); if (m_rteCamera == null) { m_rteCamera = SceneCamera.gameObject.AddComponent <RTECamera>(); m_rteCamera.Event = UnityEngine.Rendering.CameraEvent.AfterImageEffectsOpaque; } } if (m_rteCamera != null) { m_prevPosition = transform.position; m_prevRotation = transform.rotation; m_prevScale = transform.localScale; m_prevCamPosition = m_rteCamera.Camera.transform.position; m_prevCamRotation = m_rteCamera.Camera.transform.rotation; m_prevOrthographic = m_rteCamera.Camera.orthographic; m_rteCamera.CommandBufferRefresh += OnCommandBufferRefresh; m_rteCamera.RefreshCommandBuffer(); } StartOverride(); }