Compare commits
	
		
			No commits in common. "748ea8ac84ec54cf3db9b0e83c7e5ce12c50a30b" and "ab4d9cf4730a4a2751873abbcbdc006eafcd37bc" have entirely different histories.
		
	
	
		
			748ea8ac84
			...
			ab4d9cf473
		
	
		|  | @ -24,8 +24,8 @@ namespace Rokojori | ||||||
|     [Export( PropertyHint.Range, "0,1")] |     [Export( PropertyHint.Range, "0,1")] | ||||||
|     public float lumaTreshold = 0.5f; |     public float lumaTreshold = 0.5f; | ||||||
| 
 | 
 | ||||||
|     [Export( PropertyHint.Range, "0,5")] |     [Export( PropertyHint.Range, "0.5,5")] | ||||||
|     public float lumaSaturate = 0.8f; |     public float lumaSaturate = 1.3f; | ||||||
| 
 | 
 | ||||||
|     [Export( PropertyHint.Range, "0,1")] |     [Export( PropertyHint.Range, "0,1")] | ||||||
|     public float blur = 0.5f; |     public float blur = 0.5f; | ||||||
|  |  | ||||||
|  | @ -38,9 +38,12 @@ namespace Rokojori | ||||||
|     [Export] |     [Export] | ||||||
|     public float maxDistance = 200f; |     public float maxDistance = 200f; | ||||||
| 
 | 
 | ||||||
|  |     [Export] | ||||||
|  |     public float zoomSmoothingCoefficient = 0.1f; | ||||||
|  |     Smoother smoother = new Smoother(); | ||||||
| 
 | 
 | ||||||
|     [Export( PropertyHint.Range, "0,600")] |     [Export( PropertyHint.Range, "0,600")] | ||||||
|     public Smoothing zoomSmoothing; |     public Smoothing zoomSmoothing = new Smoothing(); | ||||||
| 
 | 
 | ||||||
|     public Vector3 moveDirection = Vector3.Zero; |     public Vector3 moveDirection = Vector3.Zero; | ||||||
| 
 | 
 | ||||||
|  | @ -85,11 +88,120 @@ namespace Rokojori | ||||||
| 
 | 
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /* | ||||||
|  |     [ExportGroup("Orbit")] | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public float yawSpeed = 1; | ||||||
|  |      | ||||||
|  |     [Export]  | ||||||
|  |     public float pitchSpeed = 1; | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public Sensor mouseMovementOrbitButton; | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public Sensor[] orbitModifierButtons = []; | ||||||
|  |      | ||||||
|  |     [Export] | ||||||
|  |     public float yawButtonsSpeed = 1; | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public Sensor yawDecreaseButton; | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public Sensor yawIncreaseButton; | ||||||
|  | 
 | ||||||
|  |      | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public float pitchButtonsSpeed = 1; | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public Sensor pitchDecreaseButton; | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public Sensor pitchIncreaseButton; | ||||||
|  | 
 | ||||||
|  |      | ||||||
|  |      | ||||||
|  | 
 | ||||||
|  |     [ExportGroup("Pan")] | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public float panSpeedX = 0.01f; | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public float panSpeedY = 0.01f; | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public Sensor mouseMovementPanButton; | ||||||
|  |      | ||||||
|  |     [Export] | ||||||
|  |     public Sensor[] panModifierButtons = new Sensor[ 0 ]; | ||||||
|  | 
 | ||||||
|  |     [ExportGroup("Zoom")] | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public float zoomStepInPercentage = 10; | ||||||
|  |    | ||||||
|  |     [Export] | ||||||
|  |     public float minDistance = 0.001f; | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public float maxDistance = 200f; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public Sensor zoomInButton; | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public Sensor[] zoomInModifierButtons = new Sensor[ 0 ]; | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public Sensor zoomOutButton; | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public Sensor[] zoomOutModifierButtons = new Sensor[ 0 ]; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public Sensor continousZoomInButton; | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public Sensor continousZoomOutButton; | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public float continousZoomStepInPercentage = 1; | ||||||
|  | 
 | ||||||
|  |      | ||||||
|  | 
 | ||||||
|  |     [ExportGroup("Move")] | ||||||
|  |     [Export] | ||||||
|  |     public Sensor forwardButton; | ||||||
|  |     [Export] | ||||||
|  |     public Sensor backwardsButton; | ||||||
|  |     [Export] | ||||||
|  |     public Sensor leftButton; | ||||||
|  |     [Export] | ||||||
|  |     public Sensor rightButton; | ||||||
|  |     [Export] | ||||||
|  |     public Sensor upButton; | ||||||
|  |     [Export] | ||||||
|  |     public Sensor downButton; | ||||||
|  | 
 | ||||||
|  |     [Export] | ||||||
|  |     public float moveSpeed = 1; | ||||||
|  | 
 | ||||||
|  |     */ | ||||||
|  | 
 | ||||||
|     [Export] |     [Export] | ||||||
|     public float running = 0; |     public float running = 0; | ||||||
| 
 | 
 | ||||||
|     public override void _Process( double delta ) |     public override void _Process( double delta ) | ||||||
|     { |     { | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|       keyboardMouseInputs?.Orbit( this ); |       keyboardMouseInputs?.Orbit( this ); | ||||||
|       controllerInputs?.Orbit( this ); |       controllerInputs?.Orbit( this ); | ||||||
|        |        | ||||||
|  | @ -135,6 +247,10 @@ namespace Rokojori | ||||||
| 
 | 
 | ||||||
|     void Apply( float delta ) |     void Apply( float delta ) | ||||||
|     { |     { | ||||||
|  |       // _smoothDistance = smoother.SmoothWithCoefficient( _smoothDistance, distance, zoomSmoothingCoefficient, delta ); | ||||||
|  | 
 | ||||||
|  |       // _smoothDistance = FrameSmoothing.ComputeCoefficient | ||||||
|  | 
 | ||||||
|       _smoothDistance = Smoothing.Apply( zoomSmoothing, distance, delta ); |       _smoothDistance = Smoothing.Apply( zoomSmoothing, distance, delta ); | ||||||
|       GlobalRotation = new Vector3( Mathf.DegToRad( pitch ), Mathf.DegToRad( yaw ), 0 ); |       GlobalRotation = new Vector3( Mathf.DegToRad( pitch ), Mathf.DegToRad( yaw ), 0 ); | ||||||
| 
 | 
 | ||||||
|  | @ -143,5 +259,92 @@ namespace Rokojori | ||||||
|       GlobalPosition = target + forward; |       GlobalPosition = target + forward; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /* | ||||||
|  |     void OrbitByMouse() | ||||||
|  |     { | ||||||
|  |       if ( ! Sensors.IsActive( mouseMovementOrbitButton ) ) | ||||||
|  |       { | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       yaw   += _motionDelta.X * yawSpeed;  | ||||||
|  |       pitch += _motionDelta.Y * pitchSpeed; | ||||||
|  | 
 | ||||||
|  |       pitch = Mathf.Clamp( pitch, minPitch, maxPitch ); | ||||||
|  |        | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     void Orbit() | ||||||
|  |     { | ||||||
|  |       OrbitByMouse(); | ||||||
|  |       yaw += Sensors.PolarAxis( yawDecreaseButton, yawIncreaseButton ) * yawButtonsSpeed; | ||||||
|  |       pitch += Sensors.PolarAxis( pitchDecreaseButton, pitchIncreaseButton ) * pitchButtonsSpeed; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     void Pan() | ||||||
|  |     { | ||||||
|  |       if ( ! Sensors.IsActive( mouseMovementPanButton ) ) | ||||||
|  |       { | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       var xAmount = _motionDelta.X * _smoothDistance * GlobalBasis.X * panSpeedX; | ||||||
|  |       var yAmount = _motionDelta.Y * _smoothDistance * GlobalBasis.Y * panSpeedY; | ||||||
|  | 
 | ||||||
|  |       target += xAmount + yAmount; | ||||||
|  |        | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     void Zoom() | ||||||
|  |     { | ||||||
|  |       if ( Sensors.IsActive( zoomInButton ) ) | ||||||
|  |       { | ||||||
|  |         distance *= Mathf.Pow( 1 + zoomStepInPercentage / 100f, 1 ); | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       if ( Sensors.IsActive( zoomOutButton ) ) | ||||||
|  |       { | ||||||
|  |         distance *= Mathf.Pow( 1 + zoomStepInPercentage / 100f, -1 ); | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       if ( Sensors.IsActive( continousZoomInButton ) ) | ||||||
|  |       { | ||||||
|  |         distance *= Mathf.Pow( 1 + continousZoomStepInPercentage / 100f, 1 ); | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       if ( Sensors.IsActive( continousZoomOutButton ) ) | ||||||
|  |       { | ||||||
|  |         distance *= Mathf.Pow( 1 + continousZoomStepInPercentage / 100f, -1 ); | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       distance = Mathf.Clamp( distance, minDistance, maxDistance ); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |      | ||||||
|  | 
 | ||||||
|  |     void Move() | ||||||
|  |     { | ||||||
|  |       moveDirection = Vector3.Zero; | ||||||
|  | 
 | ||||||
|  |       if ( Sensors.IsActive( forwardButton ) || Sensors.IsActive( backwardsButton ) ) | ||||||
|  |       { | ||||||
|  |         moveDirection = ( Sensors.GetValue( forwardButton ) - Sensors.GetValue( backwardsButton ) ) * this.GlobalForward(); | ||||||
|  |       } | ||||||
|  |        | ||||||
|  |       if ( Sensors.IsActive( rightButton ) || Sensors.IsActive( leftButton ) ) | ||||||
|  |       { | ||||||
|  |         moveDirection = ( Sensors.GetValue( rightButton ) - Sensors.GetValue( leftButton ) ) * this.GlobalRight(); | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       if ( Sensors.IsActive( upButton ) || Sensors.IsActive( downButton ) ) | ||||||
|  |       { | ||||||
|  |         moveDirection = ( Sensors.GetValue( downButton ) - Sensors.GetValue( upButton ) ) * this.GlobalUp(); | ||||||
|  |       } | ||||||
|  |        | ||||||
|  |       moveDirection = moveDirection.Normalized() * moveSpeed; | ||||||
|  |     } | ||||||
|  |     */ | ||||||
|  | 
 | ||||||
|  |      | ||||||
|   } |   } | ||||||
| } | } | ||||||
		Loading…
	
		Reference in New Issue