コード例 #1
0
        public Cockpit(FContext context)
        {
            PositionMode   = MovementMode.TrackPosition;
            GrabFocus      = false;
            bStaticUpdated = false;

            this.context   = context;
            vUIElements    = new List <SceneUIElement> ();
            UIElementLayer = FPlatform.HUDLayer;

            Layouts       = new Dictionary <string, ICockpitLayout>();
            defaultLayout = null;

            vKeyHandlers   = new List <IShortcutKeyHandler>();
            InputBehaviors = new InputBehaviorSet()
            {
                DefaultSource = this
            };
            OverrideBehaviors = new InputBehaviorSet()
            {
                DefaultSource = this
            };
            HUDAnimator = new GenericAnimator();

            TiltAngle          = ShiftAngle = 0.0f;
            DefaultCursorDepth = -1;
        }
コード例 #2
0
 public BaseSO()
 {
     uuid            = System.Guid.NewGuid().ToString();
     displayMaterial = null;
     vMaterialStack  = new List <fMaterial>();
     inputBehaviours = new InputBehaviorSet();
 }
コード例 #3
0
        public DrawSurfaceCurveTool(FScene scene, SceneObject target)
        {
            this.scene  = scene;
            this.target = target;

            behaviors = new InputBehaviorSet();

            // TODO is this where we should be doing this??
            behaviors.Add(
                new DrawSurfaceCurveTool_2DBehavior(scene.Context)
            {
                Priority = 5
            });
            behaviors.Add(
                new DrawSurfaceCurveTool_SpatialDeviceBehavior(scene.Context)
            {
                Priority = 5
            });


            // shut off transform gizmo
            scene.Context.TransformManager.PushOverrideGizmoType(TransformManager.NoGizmoType);

            scene.SelectionChangedEvent += Scene_SelectionChangedEvent;

            // restore radius
            //if (SavedSettings.Restore("DrawSurfaceCurveTool_width") != null)
            //    width = (float)SavedSettings.Restore("DrawSurfaceCurveTool_width");
        }
コード例 #4
0
        public SurfaceBrushTool(FScene scene, DMeshSO target)
        {
            this.scene  = scene;
            this.target = target;

            behaviors = new InputBehaviorSet();

            // TODO is this where we should be doing this??
            behaviors.Add(
                new SurfaceBrushTool_2DInputBehavior(this, scene.Context)
            {
                Priority = 5
            });
            if (FPlatform.IsUsingVR())
            {
                behaviors.Add(
                    new SurfaceBrushTool_SpatialBehavior(this, scene.Context)
                {
                    Priority = 5
                });
            }

            // shut off transform gizmo
            scene.Context.TransformManager.PushOverrideGizmoType(TransformManager.NoGizmoType);

            Indicators = new ToolIndicatorSet(this, scene);
        }
コード例 #5
0
        public BaseSingleClickTool(FScene scene)
        {
            this.Scene = scene;

            // do this here ??
            behaviors = new InputBehaviorSet();
            behaviors.Add(
                new BaseSingleClickTool_2DBehavior(scene.Context, ObjectFilter)
            {
                Priority = 5
            });
        }
コード例 #6
0
 public void Remove(InputBehaviorSet behaviors)
 {
     if (behaviors == null)
     {
         return;
     }
     foreach (var b in behaviors.Behaviors)
     {
         Behaviors.Remove(b);
     }
     Behaviors.Sort((x, y) => x.Priority.CompareTo(y.Priority));
 }
コード例 #7
0
 public void Remove(InputBehaviorSet behaviors)
 {
     if (behaviors == null)
     {
         return;
     }
     foreach (var binfo in behaviors.Behaviors)
     {
         int idx = Behaviors.FindIndex((x) => { return(x.b == binfo.b); });
         Behaviors.RemoveAt(idx);
     }
     behaviors_modified();
 }
コード例 #8
0
        public CurveSelectFacesTool(FScene scene, DMeshSO target)
        {
            Scene  = scene;
            Target = target;

            behaviors = new InputBehaviorSet();

            // TODO is this where we should be doing this??
            behaviors.Add(
                new CurveSelectFacesTool_2DBehavior(this, scene.Context)
            {
                Priority = 5
            });

            Indicators = new ToolIndicatorSet(this, scene);
        }
コード例 #9
0
 public void Add(InputBehaviorSet behaviors, string new_group = "")
 {
     if (behaviors == null)
     {
         return;
     }
     foreach (BehaviorInfo b in behaviors.Behaviors)
     {
         BehaviorInfo bcopy = b;
         if (new_group != "")
         {
             bcopy.group = new_group;
         }
         Behaviors.Add(bcopy);
     }
     behaviors_modified();
 }
コード例 #10
0
        public DrawPrimitivesTool(FScene scene)
        {
            this.scene = scene;

            behaviors = new InputBehaviorSet();

            // TODO is this where we should be doing this??
            behaviors.Add(
                new DrawPrimitivesTool_MouseBehavior(scene.Context)
            {
                Priority = 5
            });
            behaviors.Add(
                new DrawPrimitivesTool_SpatialDeviceBehavior(scene.Context)
            {
                Priority = 5
            });

            // shut off transform gizmo
            scene.Context.TransformManager.SetOverrideGizmoType(TransformManager.NoGizmoType);
        }
コード例 #11
0
        public SculptCurveTool(FScene scene, List <SceneObject> targets)
        {
            this.scene = scene;

            behaviors = new InputBehaviorSet();

            // TODO is this where we should be doing this??
            behaviors.Add(
                new SculptCurveTool_2DInputBehavior(this, scene.Context)
            {
                Priority = 5
            });
            behaviors.Add(
                new SculptCurveTool_SpatialBehavior(this, scene.Context)
            {
                Priority = 5
            });

            // shut off transform gizmo
            scene.Context.TransformManager.PushOverrideGizmoType(TransformManager.NoGizmoType);

            scene.SelectionChangedEvent += Scene_SelectionChangedEvent;
            // initialize active set with input selection
            Scene_SelectionChangedEvent(null, null);


            indicators     = new ToolIndicatorSet(this, scene);
            brushIndicator = new BrushCursorSphere()
            {
                PositionF = () => { return(lastBrushPos.Origin); },
                Radius    = fDimension.World(() => { return(radius.WorldValue); })
            };
            moveSphereMat   = MaterialUtil.CreateTransparentMaterialF(Colorf.CornflowerBlue, 0.2f);
            smoothSphereMat = MaterialUtil.CreateTransparentMaterialF(Colorf.ForestGreen, 0.2f);
            indicators.AddIndicator(brushIndicator);
            brushIndicator.material = moveSphereMat;

            SmoothAlpha      = 0.15f;
            SmoothIterations = 5;
        }
コード例 #12
0
        public BaseSurfacePointTool(FScene scene)
        {
            this.Scene = scene;

            // do this here ??
            behaviors = new InputBehaviorSet();
            behaviors.Add(
                new BaseSurfacePointTool_2DBehavior(scene.Context, ObjectFilter)
            {
                Priority = 5
            });
            if (FPlatform.IsUsingVR())
            {
                behaviors.Add(
                    new BaseSurfacePointTool_SpatialBehavior(scene.Context, ObjectFilter)
                {
                    Priority = 5
                });
            }

            // shut off transform gizmo
            Scene.Context.TransformManager.PushOverrideGizmoType(TransformManager.NoGizmoType);
        }
コード例 #13
0
ファイル: FContext.cs プロジェクト: Alan-Baylis/frame3Sharp
        // Use this for initialization
        public void Start(SceneOptions options)
        {
            this.options = options;

            DebugUtil.LogLevel = options.LogLevel;
            FPlatform.InitializeMainThreadID();

            // initialize VR platform if VR is active
            if (gs.VRPlatform.VREnabled)
            {
                if (options.Use2DCockpit)
                {
                    throw new Exception("FContext.Start: cannot use 2D Orthographic Cockpit with VR!");
                }
                if (options.SpatialCameraRig != null)
                {
                    gs.VRPlatform.Initialize(options.SpatialCameraRig);
                }
            }

            InputExtension.Get.Start();

            nextFrameActions = new ActionSet();

            // intialize camera stuff
            camTracker = new CameraTracking();
            camTracker.Initialize(this);

            GetScene();
            if (options.SceneInitializer != null)
            {
                options.SceneInitializer.Initialize(GetScene());
            }

            if (options.DefaultGizmoBuilder != null)
            {
                transformManager = new TransformManager(options.DefaultGizmoBuilder);
            }
            else
            {
                transformManager = new TransformManager(new AxisTransformGizmoBuilder());
            }
            if (options.EnableTransforms)
            {
                transformManager.Initialize(this);
            }

            toolManager = new ToolManager();
            toolManager.Initialize(this);
            toolManager.OnToolActivationChanged += OnToolActivationChanged;

            MouseController.Start();
            SpatialController.Start();

            // [RMS] hardcode starting cam target point to origin
            ActiveCamera.SetTarget(Vector3f.Zero);

            if (options.MouseCameraControls != null)
            {
                MouseCameraController = options.MouseCameraControls;
            }

            // apply initial transformation to scene
            ActiveCamera.Manipulator().SceneTranslate(Scene, SceneGraphConfig.InitialSceneTranslate, true);

            // create behavior sets
            inputBehaviors    = new InputBehaviorSet();
            overrideBehaviors = new InputBehaviorSet();

            // cockpit needs to go last because UI setup may depend on above
            cockpitStack = new Stack <Cockpit>();
            if (options.EnableCockpit)
            {
                PushCockpit(options.CockpitInitializer);
            }


            captureMouse     = null;
            captureTouch     = null;
            captureLeft      = captureRight = null;
            bInCameraControl = false;

            // [RMS] this locks cursor to game unless user presses escape or exits
            if (FPlatform.IsUsingVR() || options.UseSystemMouseCursor == false)
            {
                Cursor.lockState = CursorLockMode.Locked;
            }

            // set hacky hackenstein global
            ActiveContext_HACK = this;

            startup_checks();
        }