void DoPano() { MaterialProperty panoSphereMode = FindProperty("_OverlayMode"); OverlayMode panoMode = (OverlayMode)panoSphereMode.floatValue; EditorGUI.BeginChangeCheck(); panoMode = (OverlayMode)EditorGUILayout.EnumPopup(MakeLabel("Overlay Mode"), panoMode); if (EditorGUI.EndChangeCheck()) { RecordAction("Overlay Mode"); panoSphereMode.floatValue = (float)panoMode; } switch (panoMode) { case OverlayMode.PanoSphere: DoPanoSphere(); break; case OverlayMode.PanoScreen: DoPanoScreen(); break; case OverlayMode.UVScroll: DoUVScroll(); break; case OverlayMode.None: default: break; } }
private void LayerDragItemsDelta(ILayer layer, OverlayMode overlayMode) { Layerage layerage = LayerManager.FindFirstLayerage(layer); this.DragDestinationLayerage = layerage; this.DragLayerOverlayMode = overlayMode; }
public SceneOW(OverworldEditor f, Overworld ow, DungeonMain mform) { owForm = f; mainForm = mform; this.ow = ow; //graphics = Graphics.FromImage(scene_bitmap); //this.Image = new Bitmap(4096, 4096); this.MouseUp += new MouseEventHandler(onMouseUp); this.MouseMove += new MouseEventHandler(onMouseMove); this.MouseDoubleClick += new MouseEventHandler(onMouseDoubleClick); this.MouseWheel += SceneOW_MouseWheel; tilesgfxBitmap = new Bitmap(512, 512, 512, PixelFormat.Format8bppIndexed, temptilesgfxPtr); tilemode = new TileMode(this); exitmode = new ExitMode(this); doorMode = new DoorMode(this); entranceMode = new EntranceMode(this); selectedMode = ObjectMode.Tile; itemMode = new ItemMode(this); spriteMode = new SpriteMode(this); transportMode = new TransportMode(this); overlayMode = new OverlayMode(this); gravestoneMode = new GravestoneMode(this); //this.Width = 8192; //this.Height = 8192; //this.Size = new Size(8192, 8192); //this.Refresh(); }
private static Vector3 Operate(Vector3 a, Vector3 b, OverlayMode mode) { switch (mode) { case OverlayMode.COVER: return(b); case OverlayMode.ADD: return(a + b); case OverlayMode.MINUS: return(a - b); case OverlayMode.MULTIPLY: return(new Vector3(a.x * b.x, a.y * b.y, a.z * b.z)); case OverlayMode.DIVIDE: if (b.x == 0 || b.y == 0 || b.z == 0) { throw new DivideByZeroException("Can't use divide mode for this vector"); } return(new Vector3(a.x / b.x, a.y / b.y, a.z / b.z)); case OverlayMode.AVERAGE: return((a + b) / 2); default: throw new InvalidOperationException("No such an OverlayMode: " + mode.ToString()); } }
private static float Operate(float a, float b, OverlayMode mode) { switch (mode) { case OverlayMode.COVER: return(b); case OverlayMode.ADD: return(a + b); case OverlayMode.MINUS: return(a - b); case OverlayMode.MULTIPLY: return(a * b); case OverlayMode.DIVIDE: if (b == 0) { throw new DivideByZeroException("Can't use divide mode for this float"); } return(a / b); case OverlayMode.AVERAGE: return((a + b) / 2); default: throw new InvalidOperationException("No such an OverlayMode: " + mode.ToString()); } }
/// <summary> /// The size filter. /// </summary> /// <param name="params"></param> /// <param name="size">Particle start size.</param> /// <param name="mode"></param> /// <returns></returns> public static List <EmitParams> Size(List <EmitParams> @params, float size, OverlayMode mode = OverlayMode.COVER) { Parallel.For(0, @params.Count, i => { @params[i].startSize = Operate(@params[i].startSize, size, mode); }); return(@params); }
public void SetOverlayMode(OverlayMode mode) { Texture2D tex; if (mode == OverlayMode.Targeting) tex = TargetTex; else tex = SelectionTex; go.renderer.material.SetTexture("_MainTex", tex); }
private static Color32 Operate(Color32 a, Color32 b, OverlayMode mode) { byte trans(int i) { if (i < 0) { return(0); } if (i > 255) { return(255); } return((byte)i); } switch (mode) { case OverlayMode.COVER: return(b); case OverlayMode.ADD: return(new Color32( trans(a.r * a.a / 255 + b.r * b.a / 255), trans(a.g * a.a / 255 + b.g * b.a / 255), trans(a.b * a.a / 255 + b.b * b.a / 255), trans(a.a + b.a))); case OverlayMode.MINUS: return(new Color32( trans(a.r * a.a / 255 - b.r * b.a / 255), trans(a.g * a.a / 255 - b.g * b.a / 255), trans(a.b * a.a / 255 - b.b * b.a / 255), trans(a.a + b.a))); case OverlayMode.MULTIPLY: return(new Color32( trans((a.r * a.a / 255) * (b.r * b.a / 255)), trans((a.g * a.a / 255) * (b.g * b.a / 255)), trans((a.b * a.a / 255) * (b.b * b.a / 255)), trans(a.a + b.a))); case OverlayMode.AVERAGE: return(new Color32( trans((a.r * a.a / 255 + b.r * b.a / 255) / 2), trans((a.g * a.a / 255 + b.g * b.a / 255) / 2), trans((a.b * a.a / 255 + b.b * b.a / 255) / 2), trans((a.a + b.a) / 2))); default: throw new InvalidOperationException("No such an OverlayMode: " + mode.ToString()); } }
// public void DisplayProgress(string description, CancellationTokenSource cancellationTokenSource, ProgressStep step, params ProgressStep[] moreSteps) // { // ShowOverlay(); // // _progressOverlay.DisplayProgress(description, cancellationTokenSource, step, moreSteps); // } public void AskForResize(Rectangle current, Action<Rectangle?> resultCallback) { _currentMode = OverlayMode.ResizeTargetOverlay; SetClickAbility(true); ShowOverlay(); _resizeOverlay.AskForResize(current, resultRectangle => { _currentMode = OverlayMode.TextOverlay; SetClickAbility(false); resultCallback(resultRectangle); }); }
public void SetOverlayMode(OverlayMode mode) { Texture2D tex; if (mode == OverlayMode.Targeting) { tex = TargetTex; } else { tex = SelectionTex; } go.GetComponent <Renderer>().material.SetTexture("_MainTex", tex); }
private void LayerDragItemsCompleted() { // History LayeragesArrangeHistory history = new LayeragesArrangeHistory(HistoryType.LayeragesArrange_LayersArrange); this.ViewModel.HistoryPush(history); LayerManager.DragComplete(this.DragDestinationLayerage, this.DragSourceLayerage, this.DragLayerOverlayMode, this.DragLayerIsSelected); this.SelectionViewModel.SetMode(); // Selection LayerManager.ArrangeLayers(); LayerManager.ArrangeLayersBackground(); this.ViewModel.Invalidate(); // Invalidate this.DragSourceLayerage = null; this.DragDestinationLayerage = null; this.DragLayerIsSelected = false; this.DragLayerOverlayMode = OverlayMode.None; }
private void ConstructPointer(ILayer layer) { this.PointerEntered += (s, e) => this.ClickMode = ClickMode.Hover; this.PointerPressed += (s, e) => this.ClickMode = ClickMode.Press; this.PointerExited += (s, e) => this.ClickMode = ClickMode.Release; this.PointerMoved += (s, e) => { if (LayerManager.IsOverlay) { Point position = e.GetCurrentPoint(this).Position; OverlayMode overlayMode = this.GetOverlay(position.Y); this.OverlayMode = overlayMode; LayerManager.DragItemsDelta?.Invoke(layer, overlayMode); // Delegate } }; this.PointerExited += (s, e) => this.OverlayMode = OverlayMode.None; this.PointerReleased += (s, e) => this.OverlayMode = OverlayMode.None; }
/// <summary> /// The cone filter. /// </summary> /// <param name="params"></param> /// <param name="radius">Particle distance from origin point.</param> /// <param name="theta">Half vertex angle.</param> /// <param name="speed">Particle speed.</param> /// <param name="mode"></param> /// <returns></returns> public static List <EmitParams> Cone(List <EmitParams> @params, float radius, float theta, float speed, OverlayMode mode = OverlayMode.COVER) { float dphi = 360.0f / @params.Count; Parallel.For(0, @params.Count, i => { float phi = i * dphi; @params[i].position = Operate(@params[i].position, new Sphere(radius, theta, phi).vector3, mode); @params[i].velocity = Operate(@params[i].velocity, new Sphere(speed, theta, phi).vector3, mode); @params[i].rotation3D = (Quaternion.LookRotation(@params[i].velocity) * Quaternion.Euler(@params[i].rotation3D)).eulerAngles; }); return(@params); }
/// <summary> /// The random size filter. /// </summary> /// <param name="params"></param> /// <param name="min">Random min.</param> /// <param name="max">Random max.</param> /// <param name="mode"></param> /// <returns></returns> public static List <EmitParams> RandomSize(List <EmitParams> @params, float min, float max, OverlayMode mode = OverlayMode.COVER) { for (int i = 0; i < @params.Count; i++) { @params[i].startSize = Operate(@params[i].startSize, Random.Range(min, max), mode); } return(@params); }
// -------------------------------------------------------------------------------------------- // // Private Unity Component Events // -------------------------------------------------------------------------------------------- // void Awake() { if (App.Config.IsMobileHardware && m_GvrOverlayPrefab != null) { m_OverlayMode = OverlayMode.Mobile; m_MobileOverlay = Instantiate(m_GvrOverlayPrefab); m_MobileOverlay.gameObject.SetActive(false); } else if (App.Config.m_SdkMode == SdkMode.SteamVR && m_SteamVROverlay != null) { m_OverlayMode = OverlayMode.Steam; } #if OCULUS_SUPPORTED else if (App.Config.m_SdkMode == SdkMode.Oculus) { m_OverlayMode = OverlayMode.OVR; var gobj = new GameObject("Oculus Overlay"); gobj.transform.SetParent(m_VrSystem.transform, worldPositionStays: false); m_OVROverlay = gobj.AddComponent <OVROverlay>(); m_OVROverlay.isDynamic = true; m_OVROverlay.compositionDepth = 0; m_OVROverlay.currentOverlayType = OVROverlay.OverlayType.Overlay; m_OVROverlay.currentOverlayShape = OVROverlay.OverlayShape.Quad; m_OVROverlay.noDepthBufferTesting = true; m_OVROverlay.enabled = false; } #endif // OCULUS_SUPPORTED if (App.Config.m_SdkMode == SdkMode.Oculus) { #if OCULUS_SUPPORTED // ---------------------------------------------------------------------------------------- // // OculusVR // ---------------------------------------------------------------------------------------- // OVRManager manager = gameObject.AddComponent <OVRManager>(); manager.trackingOriginType = OVRManager.TrackingOrigin.FloorLevel; manager.useRecommendedMSAALevel = false; SetControllerStyle(TiltBrush.ControllerStyle.OculusTouch); // adding components to the VR Camera needed for fading view and getting controller poses. m_VrCamera.gameObject.AddComponent <OculusCameraFade>(); m_VrCamera.gameObject.AddComponent <OculusPreCullHook>(); #endif // OCULUS_SUPPORTED } else if (App.Config.m_SdkMode == SdkMode.SteamVR) { // ---------------------------------------------------------------------------------------- // // SteamVR // ---------------------------------------------------------------------------------------- // // SteamVR_Render needs to be instantiated from our version of the prefab before any other // SteamVR objects are instantiated because otherwise, those other objects will instantiate // their own version of SteamVR_Render, which won't have the same connections as our prefab. // Ideally, this instantiation would occur in a place that is guaranteed to happen first but // since we don't have an appropriate place for that now, it's being placed right before the // first call that would otherwise instantiate it. Instantiate(App.Config.m_SteamVrRenderPrefab); if (App.Config.VrHardware == VrHardware.Rift) { SetControllerStyle(TiltBrush.ControllerStyle.OculusTouch); } else if (App.Config.VrHardware == VrHardware.Wmr) { SetControllerStyle(TiltBrush.ControllerStyle.Wmr); } else { SetControllerStyle(TiltBrush.ControllerStyle.InitializingSteamVR); } m_VrCamera.gameObject.AddComponent <SteamVR_Camera>(); } else if (App.Config.m_SdkMode == SdkMode.Gvr) { // ---------------------------------------------------------------------------------------- // // GoogleVR // ---------------------------------------------------------------------------------------- // SetControllerStyle(TiltBrush.ControllerStyle.Gvr); // Custom controls parenting for GVR. m_VrControls.transform.parent = null; // TODO: Why is this offset needed? This should also be in a prefab, not here. var pos = m_VrSystem.gameObject.transform.localPosition; pos.y += 15f; m_VrSystem.gameObject.transform.localPosition = pos; pos = m_VrControls.gameObject.transform.localPosition; pos.y += 15f; m_VrControls.gameObject.transform.localPosition = pos; #if UNITY_EDITOR && false // Instant preview m_VrCamera.gameObject.AddComponent <InstantPreviewHelper>(); var ip = m_VrCamera.gameObject.AddComponent <Gvr.Internal.InstantPreview>(); ip.OutputResolution = Gvr.Internal.InstantPreview.Resolutions.Big; ip.MultisampleCount = Gvr.Internal.InstantPreview.MultisampleCounts.One; ip.BitRate = Gvr.Internal.InstantPreview.BitRates._16000; #endif // Custom controls parenting for GVR. m_VrControls.transform.parent = m_VrCamera.transform.parent; } else if (App.Config.m_SdkMode == SdkMode.Monoscopic) { // ---------------------------------------------------------------------------------------- // // Monoscopic // ---------------------------------------------------------------------------------------- // m_VrCamera.gameObject.AddComponent <MonoCameraControlScript>(); SetControllerStyle(TiltBrush.ControllerStyle.None); // Offset for head position, since camera height is set by the VR system. m_VrCamera.transform.localPosition = new Vector3(0f, 1.5f, 0f); } else { // ---------------------------------------------------------------------------------------- // // Non-VR // ---------------------------------------------------------------------------------------- // SetControllerStyle(TiltBrush.ControllerStyle.None); // Offset for head position, since camera height is set by the VR system. m_VrCamera.transform.localPosition = new Vector3(0f, 1.5f, 0f); } m_VrCamera.gameObject.SetActive(true); m_VrSystem.SetActive(m_VrCamera.gameObject.activeSelf); }
/// <summary> /// The gradual change size filter. /// </summary> /// <param name="params"></param> /// <param name="fromSize">Size of the first particle.</param> /// <param name="toSize">Size gradually change to.</param> /// <param name="mode"></param> /// <returns></returns> public static List <EmitParams> Size(List <EmitParams> @params, float fromSize, float toSize, OverlayMode mode = OverlayMode.COVER) { float dsize = (toSize - fromSize) / @params.Count; Parallel.For(0, @params.Count, i => { @params[i].startSize = Operate(@params[i].startSize, fromSize + dsize * i, mode); }); return(@params); }
/// <summary> /// Drag complete. /// </summary> /// <param name="destination"> The destination layerage. </param> /// <param name="source"> The source layerage. </param> /// <param name="destinationOverlayMode"> The destination OverlayMode. </param> /// <param name="sourceIsSelected"> The source SelectMode. </param> public static void DragComplete(Layerage destination, Layerage source, OverlayMode destinationOverlayMode, bool sourceIsSelected) { if (source is null) { return; } if (destination is null) { return; } ILayer destinationLayer = destination.Self; ILayer sourceLayer = source.Self; destinationLayer.Control.OverlayMode = OverlayMode.None; if (destinationLayer.IsSelected) { return; } if (destinationOverlayMode == OverlayMode.None) { return; } if (source == destination) { return; } if (sourceIsSelected == false) { switch (destinationOverlayMode) { case OverlayMode.Top: LayerManager.Insert(destination, source, isBottomInsert: false); break; case OverlayMode.Center: LayerManager.Add(destination, source); break; case OverlayMode.Bottom: LayerManager.Insert(destination, source, isBottomInsert: true); break; } } else { // Layerages IEnumerable <Layerage> selectedLayerages = LayerManager.GetAllSelected(); switch (destinationOverlayMode) { case OverlayMode.Top: LayerManager.InsertRange(destination, selectedLayerages, isBottomInsert: false); break; case OverlayMode.Center: LayerManager.AddRange(destination, selectedLayerages); break; case OverlayMode.Bottom: LayerManager.InsertRange(destination, selectedLayerages, isBottomInsert: true); break; } } }