Compare commits
5 Commits
debug-grap
...
brokensd
| Author | SHA1 | Date | |
|---|---|---|---|
|
6516b3ee30
|
|||
|
32d0e96958
|
|||
|
087e95b1f7
|
|||
|
e46a51319f
|
|||
|
a3b0306430
|
@@ -52,7 +52,6 @@ pub enum SessionControlInstruction{
|
|||||||
pub enum SessionPlaybackInstruction{
|
pub enum SessionPlaybackInstruction{
|
||||||
SkipForward,
|
SkipForward,
|
||||||
SkipBack,
|
SkipBack,
|
||||||
TogglePaused,
|
|
||||||
DecreaseTimescale,
|
DecreaseTimescale,
|
||||||
IncreaseTimescale,
|
IncreaseTimescale,
|
||||||
}
|
}
|
||||||
@@ -253,7 +252,14 @@ impl InstructionConsumer<Instruction<'_>> for Session{
|
|||||||
// don't flush the buffered instructions in the mouse interpolator
|
// don't flush the buffered instructions in the mouse interpolator
|
||||||
// until the mouse is confirmed to be not moving at a later time
|
// until the mouse is confirmed to be not moving at a later time
|
||||||
// what if they pause for 5ms lmao
|
// what if they pause for 5ms lmao
|
||||||
_=self.simulation.timer.set_paused(ins.time,paused);
|
match &self.view_state{
|
||||||
|
ViewState::Play=>{
|
||||||
|
_=self.simulation.timer.set_paused(ins.time,paused);
|
||||||
|
},
|
||||||
|
ViewState::Replay(bot_id)=>if let Some(replay)=self.replays.get_mut(bot_id){
|
||||||
|
_=replay.simulation.timer.set_paused(ins.time,paused);
|
||||||
|
},
|
||||||
|
}
|
||||||
},
|
},
|
||||||
Instruction::Control(SessionControlInstruction::CopyRecordingIntoReplayAndSpectate)=> if let ViewState::Play=self.view_state{
|
Instruction::Control(SessionControlInstruction::CopyRecordingIntoReplayAndSpectate)=> if let ViewState::Play=self.view_state{
|
||||||
// Bind: B
|
// Bind: B
|
||||||
@@ -374,14 +380,6 @@ impl InstructionConsumer<Instruction<'_>> for Session{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Instruction::Playback(SessionPlaybackInstruction::TogglePaused)=>{
|
|
||||||
match &self.view_state{
|
|
||||||
ViewState::Play=>(),
|
|
||||||
ViewState::Replay(bot_id)=>if let Some(replay)=self.replays.get_mut(bot_id){
|
|
||||||
_=replay.simulation.timer.set_paused(ins.time,!replay.simulation.timer.is_paused());
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Instruction::ChangeMap(complete_map)=>{
|
Instruction::ChangeMap(complete_map)=>{
|
||||||
self.clear_recording();
|
self.clear_recording();
|
||||||
self.change_map(complete_map);
|
self.change_map(complete_map);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ authors = ["Rhys Lloyd <krakow20@gmail.com>"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
bytemuck = "1.14.3"
|
bytemuck = "1.14.3"
|
||||||
glam = "0.30.0"
|
glam = "0.30.0"
|
||||||
regex = { version = "1.11.3", default-features = false }
|
regex = { version = "1.11.3", default-features = false, features = ["unicode-perl"] }
|
||||||
rbx_mesh = "0.5.0"
|
rbx_mesh = "0.5.0"
|
||||||
rbxassetid = { version = "0.1.0", path = "../rbxassetid", registry = "strafesnet" }
|
rbxassetid = { version = "0.1.0", path = "../rbxassetid", registry = "strafesnet" }
|
||||||
roblox_emulator = { version = "0.5.1", path = "../roblox_emulator", default-features = false, registry = "strafesnet" }
|
roblox_emulator = { version = "0.5.1", path = "../roblox_emulator", default-features = false, registry = "strafesnet" }
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,62 +0,0 @@
|
|||||||
# Blender MTL File: 'teslacyberv3.0.blend'
|
|
||||||
# Material Count: 6
|
|
||||||
|
|
||||||
newmtl Material
|
|
||||||
Ns 65.476285
|
|
||||||
Ka 1.000000 1.000000 1.000000
|
|
||||||
Kd 0.411568 0.411568 0.411568
|
|
||||||
Ks 0.614679 0.614679 0.614679
|
|
||||||
Ke 0.000000 0.000000 0.000000
|
|
||||||
Ni 36.750000
|
|
||||||
d 1.000000
|
|
||||||
illum 3
|
|
||||||
|
|
||||||
newmtl Материал
|
|
||||||
Ns 323.999994
|
|
||||||
Ka 1.000000 1.000000 1.000000
|
|
||||||
Kd 0.800000 0.800000 0.800000
|
|
||||||
Ks 0.500000 0.500000 0.500000
|
|
||||||
Ke 0.000000 0.000000 0.000000
|
|
||||||
Ni 1.000000
|
|
||||||
d 1.000000
|
|
||||||
illum 2
|
|
||||||
|
|
||||||
newmtl Материал.001
|
|
||||||
Ns 900.000000
|
|
||||||
Ka 1.000000 1.000000 1.000000
|
|
||||||
Kd 0.026240 0.026240 0.026240
|
|
||||||
Ks 0.000000 0.000000 0.000000
|
|
||||||
Ke 0.000000 0.000000 0.000000
|
|
||||||
Ni 1.450000
|
|
||||||
d 1.000000
|
|
||||||
illum 1
|
|
||||||
|
|
||||||
newmtl Материал.002
|
|
||||||
Ns 0.000000
|
|
||||||
Ka 1.000000 1.000000 1.000000
|
|
||||||
Kd 0.031837 0.032429 0.029425
|
|
||||||
Ks 0.169725 0.169725 0.169725
|
|
||||||
Ke 0.000000 0.000000 0.000000
|
|
||||||
Ni 0.000000
|
|
||||||
d 1.000000
|
|
||||||
illum 2
|
|
||||||
|
|
||||||
newmtl Материал.003
|
|
||||||
Ns 900.000000
|
|
||||||
Ka 1.000000 1.000000 1.000000
|
|
||||||
Kd 0.023585 0.083235 0.095923
|
|
||||||
Ks 1.000000 1.000000 1.000000
|
|
||||||
Ke 0.000000 0.000000 0.000000
|
|
||||||
Ni 45.049999
|
|
||||||
d 1.000000
|
|
||||||
illum 3
|
|
||||||
|
|
||||||
newmtl Материал.004
|
|
||||||
Ns 323.999994
|
|
||||||
Ka 1.000000 1.000000 1.000000
|
|
||||||
Kd 0.800000 0.800000 0.800000
|
|
||||||
Ks 0.500000 0.500000 0.500000
|
|
||||||
Ke 0.000000 0.000000 0.000000
|
|
||||||
Ni 1.000000
|
|
||||||
d 1.000000
|
|
||||||
illum 2
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,7 @@ pub enum Instruction{
|
|||||||
struct WindowContext<'a>{
|
struct WindowContext<'a>{
|
||||||
manual_mouse_lock:bool,
|
manual_mouse_lock:bool,
|
||||||
mouse_pos:glam::DVec2,
|
mouse_pos:glam::DVec2,
|
||||||
|
simulation_paused:bool,
|
||||||
screen_size:glam::UVec2,
|
screen_size:glam::UVec2,
|
||||||
window:&'a winit::window::Window,
|
window:&'a winit::window::Window,
|
||||||
physics_thread:crate::compat_worker::QNWorker<'a,TimedInstruction<PhysicsWorkerInstruction,SessionTime>>,
|
physics_thread:crate::compat_worker::QNWorker<'a,TimedInstruction<PhysicsWorkerInstruction,SessionTime>>,
|
||||||
@@ -24,6 +25,35 @@ impl WindowContext<'_>{
|
|||||||
fn get_middle_of_screen(&self)->winit::dpi::PhysicalPosition<u32>{
|
fn get_middle_of_screen(&self)->winit::dpi::PhysicalPosition<u32>{
|
||||||
winit::dpi::PhysicalPosition::new(self.screen_size.x/2,self.screen_size.y/2)
|
winit::dpi::PhysicalPosition::new(self.screen_size.x/2,self.screen_size.y/2)
|
||||||
}
|
}
|
||||||
|
fn free_mouse(&mut self){
|
||||||
|
self.manual_mouse_lock=false;
|
||||||
|
match self.window.set_cursor_position(self.get_middle_of_screen()){
|
||||||
|
Ok(())=>(),
|
||||||
|
Err(e)=>println!("Could not set cursor position: {:?}",e),
|
||||||
|
}
|
||||||
|
match self.window.set_cursor_grab(winit::window::CursorGrabMode::None){
|
||||||
|
Ok(())=>(),
|
||||||
|
Err(e)=>println!("Could not release cursor: {:?}",e),
|
||||||
|
}
|
||||||
|
self.window.set_cursor_visible(true);
|
||||||
|
}
|
||||||
|
fn lock_mouse(&mut self){
|
||||||
|
//if cursor is outside window don't lock but apparently there's no get pos function
|
||||||
|
//let pos=window.get_cursor_pos();
|
||||||
|
match self.window.set_cursor_grab(winit::window::CursorGrabMode::Locked){
|
||||||
|
Ok(())=>(),
|
||||||
|
Err(_)=>{
|
||||||
|
match self.window.set_cursor_grab(winit::window::CursorGrabMode::Confined){
|
||||||
|
Ok(())=>(),
|
||||||
|
Err(e)=>{
|
||||||
|
self.manual_mouse_lock=true;
|
||||||
|
println!("Could not confine cursor: {:?}",e)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.window.set_cursor_visible(false);
|
||||||
|
}
|
||||||
fn window_event(&mut self,time:SessionTime,event:winit::event::WindowEvent){
|
fn window_event(&mut self,time:SessionTime,event:winit::event::WindowEvent){
|
||||||
match event{
|
match event{
|
||||||
winit::event::WindowEvent::DroppedFile(path)=>{
|
winit::event::WindowEvent::DroppedFile(path)=>{
|
||||||
@@ -34,6 +64,10 @@ impl WindowContext<'_>{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
winit::event::WindowEvent::Focused(state)=>{
|
winit::event::WindowEvent::Focused(state)=>{
|
||||||
|
// don't unpause if manually paused
|
||||||
|
if self.simulation_paused{
|
||||||
|
return;
|
||||||
|
}
|
||||||
//pause unpause
|
//pause unpause
|
||||||
self.physics_thread.send(TimedInstruction{
|
self.physics_thread.send(TimedInstruction{
|
||||||
time,
|
time,
|
||||||
@@ -46,35 +80,8 @@ impl WindowContext<'_>{
|
|||||||
..
|
..
|
||||||
}=>{
|
}=>{
|
||||||
match (logical_key,state){
|
match (logical_key,state){
|
||||||
(winit::keyboard::Key::Named(winit::keyboard::NamedKey::Tab),winit::event::ElementState::Pressed)=>{
|
(winit::keyboard::Key::Named(winit::keyboard::NamedKey::Tab),winit::event::ElementState::Pressed)=>self.free_mouse(),
|
||||||
self.manual_mouse_lock=false;
|
(winit::keyboard::Key::Named(winit::keyboard::NamedKey::Tab),winit::event::ElementState::Released)=>self.lock_mouse(),
|
||||||
match self.window.set_cursor_position(self.get_middle_of_screen()){
|
|
||||||
Ok(())=>(),
|
|
||||||
Err(e)=>println!("Could not set cursor position: {:?}",e),
|
|
||||||
}
|
|
||||||
match self.window.set_cursor_grab(winit::window::CursorGrabMode::None){
|
|
||||||
Ok(())=>(),
|
|
||||||
Err(e)=>println!("Could not release cursor: {:?}",e),
|
|
||||||
}
|
|
||||||
self.window.set_cursor_visible(state.is_pressed());
|
|
||||||
},
|
|
||||||
(winit::keyboard::Key::Named(winit::keyboard::NamedKey::Tab),winit::event::ElementState::Released)=>{
|
|
||||||
//if cursor is outside window don't lock but apparently there's no get pos function
|
|
||||||
//let pos=window.get_cursor_pos();
|
|
||||||
match self.window.set_cursor_grab(winit::window::CursorGrabMode::Locked){
|
|
||||||
Ok(())=>(),
|
|
||||||
Err(_)=>{
|
|
||||||
match self.window.set_cursor_grab(winit::window::CursorGrabMode::Confined){
|
|
||||||
Ok(())=>(),
|
|
||||||
Err(e)=>{
|
|
||||||
self.manual_mouse_lock=true;
|
|
||||||
println!("Could not confine cursor: {:?}",e)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.window.set_cursor_visible(state.is_pressed());
|
|
||||||
},
|
|
||||||
(winit::keyboard::Key::Named(winit::keyboard::NamedKey::F11),winit::event::ElementState::Pressed)=>{
|
(winit::keyboard::Key::Named(winit::keyboard::NamedKey::F11),winit::event::ElementState::Pressed)=>{
|
||||||
if self.window.fullscreen().is_some(){
|
if self.window.fullscreen().is_some(){
|
||||||
self.window.set_fullscreen(None);
|
self.window.set_fullscreen(None);
|
||||||
@@ -90,7 +97,24 @@ impl WindowContext<'_>{
|
|||||||
}
|
}
|
||||||
self.window.set_cursor_visible(true);
|
self.window.set_cursor_visible(true);
|
||||||
},
|
},
|
||||||
|
(winit::keyboard::Key::Named(winit::keyboard::NamedKey::Enter),winit::event::ElementState::Pressed)=>{
|
||||||
|
let paused=!self.simulation_paused;
|
||||||
|
self.simulation_paused=paused;
|
||||||
|
if paused{
|
||||||
|
self.free_mouse();
|
||||||
|
}else{
|
||||||
|
self.lock_mouse();
|
||||||
|
}
|
||||||
|
let instruction=PhysicsWorkerInstruction::SessionControl(SessionControlInstruction::SetPaused(paused));
|
||||||
|
self.physics_thread.send(TimedInstruction{
|
||||||
|
time,
|
||||||
|
instruction,
|
||||||
|
}).unwrap();
|
||||||
|
}
|
||||||
(keycode,state)=>{
|
(keycode,state)=>{
|
||||||
|
if self.simulation_paused{
|
||||||
|
return;
|
||||||
|
}
|
||||||
let s=state.is_pressed();
|
let s=state.is_pressed();
|
||||||
|
|
||||||
// internal variants for this scope
|
// internal variants for this scope
|
||||||
@@ -132,7 +156,6 @@ impl WindowContext<'_>{
|
|||||||
if let Some(session_instruction)=match keycode{
|
if let Some(session_instruction)=match keycode{
|
||||||
winit::keyboard::Key::Named(winit::keyboard::NamedKey::Space)=>input_ctrl!(SetJump,s),
|
winit::keyboard::Key::Named(winit::keyboard::NamedKey::Space)=>input_ctrl!(SetJump,s),
|
||||||
// TODO: bind system so playback pausing can use spacebar
|
// TODO: bind system so playback pausing can use spacebar
|
||||||
winit::keyboard::Key::Named(winit::keyboard::NamedKey::Enter)=>session_playback!(TogglePaused,s),
|
|
||||||
winit::keyboard::Key::Named(winit::keyboard::NamedKey::ArrowUp)=>session_playback!(IncreaseTimescale,s),
|
winit::keyboard::Key::Named(winit::keyboard::NamedKey::ArrowUp)=>session_playback!(IncreaseTimescale,s),
|
||||||
winit::keyboard::Key::Named(winit::keyboard::NamedKey::ArrowDown)=>session_playback!(DecreaseTimescale,s),
|
winit::keyboard::Key::Named(winit::keyboard::NamedKey::ArrowDown)=>session_playback!(DecreaseTimescale,s),
|
||||||
winit::keyboard::Key::Named(winit::keyboard::NamedKey::ArrowLeft)=>session_playback!(SkipBack,s),
|
winit::keyboard::Key::Named(winit::keyboard::NamedKey::ArrowLeft)=>session_playback!(SkipBack,s),
|
||||||
@@ -191,7 +214,7 @@ impl WindowContext<'_>{
|
|||||||
fn device_event(&mut self,time:SessionTime,event:winit::event::DeviceEvent){
|
fn device_event(&mut self,time:SessionTime,event:winit::event::DeviceEvent){
|
||||||
match event{
|
match event{
|
||||||
winit::event::DeviceEvent::MouseMotion{
|
winit::event::DeviceEvent::MouseMotion{
|
||||||
delta,
|
delta:(delta_x,delta_y),
|
||||||
}=>{
|
}=>{
|
||||||
if self.manual_mouse_lock{
|
if self.manual_mouse_lock{
|
||||||
match self.window.set_cursor_position(self.get_middle_of_screen()){
|
match self.window.set_cursor_position(self.get_middle_of_screen()){
|
||||||
@@ -199,7 +222,10 @@ impl WindowContext<'_>{
|
|||||||
Err(e)=>println!("Could not set cursor position: {:?}",e),
|
Err(e)=>println!("Could not set cursor position: {:?}",e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.mouse_pos+=glam::dvec2(delta.0,delta.1);
|
self.mouse_pos+=glam::dvec2(delta_x,delta_y);
|
||||||
|
if self.simulation_paused{
|
||||||
|
return;
|
||||||
|
}
|
||||||
self.physics_thread.send(TimedInstruction{
|
self.physics_thread.send(TimedInstruction{
|
||||||
time,
|
time,
|
||||||
instruction:PhysicsWorkerInstruction::SessionInput(SessionInputInstruction::Mouse(self.mouse_pos.as_ivec2())),
|
instruction:PhysicsWorkerInstruction::SessionInput(SessionInputInstruction::Mouse(self.mouse_pos.as_ivec2())),
|
||||||
@@ -241,6 +267,7 @@ pub fn worker<'a>(
|
|||||||
let mut window_context=WindowContext{
|
let mut window_context=WindowContext{
|
||||||
manual_mouse_lock:false,
|
manual_mouse_lock:false,
|
||||||
mouse_pos:glam::DVec2::ZERO,
|
mouse_pos:glam::DVec2::ZERO,
|
||||||
|
simulation_paused:false,
|
||||||
//make sure to update this!!!!!
|
//make sure to update this!!!!!
|
||||||
screen_size,
|
screen_size,
|
||||||
window,
|
window,
|
||||||
|
|||||||
Reference in New Issue
Block a user