mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 20:59:19 +02:00
Merge branch 'milek-dev' into gfx-work
This commit is contained in:
12
Camera.cpp
12
Camera.cpp
@@ -73,10 +73,14 @@ TCamera::OnCommand( command_data const &Command ) {
|
|||||||
30.0 :
|
30.0 :
|
||||||
1.0 );
|
1.0 );
|
||||||
|
|
||||||
|
// threshold position on stick between walk lerp and walk/run lerp
|
||||||
|
auto const stickthreshold = 2.0 / 3.0;
|
||||||
|
|
||||||
// left-right
|
// left-right
|
||||||
auto const movexparam { Command.param1 };
|
auto const movexparam { Command.param1 };
|
||||||
// 2/3rd of the stick range enables walk speed, past that we lerp between walk and run speed
|
// 2/3rd of the stick range lerps walk speed, past that we lerp between max walk and run speed
|
||||||
auto const movex { walkspeed + ( std::max( 0.0, std::abs( movexparam ) - 0.65 ) / 0.35 ) * std::max( 0.0, movespeed - walkspeed ) };
|
auto const movex { walkspeed * std::min(std::abs(movexparam) * (1.0 / stickthreshold), 1.0)
|
||||||
|
+ ( std::max( 0.0, std::abs( movexparam ) - stickthreshold ) / (1.0 - stickthreshold) ) * std::max( 0.0, movespeed - walkspeed ) };
|
||||||
|
|
||||||
m_moverate.x = (
|
m_moverate.x = (
|
||||||
movexparam > 0.0 ? movex * speedmultiplier :
|
movexparam > 0.0 ? movex * speedmultiplier :
|
||||||
@@ -85,7 +89,9 @@ TCamera::OnCommand( command_data const &Command ) {
|
|||||||
|
|
||||||
// forward-back
|
// forward-back
|
||||||
double const movezparam { Command.param2 };
|
double const movezparam { Command.param2 };
|
||||||
auto const movez { walkspeed + ( std::max( 0.0, std::abs( movezparam ) - 0.65 ) / 0.35 ) * std::max( 0.0, movespeed - walkspeed ) };
|
auto const movez { walkspeed * std::min(std::abs(movezparam) * (1.0 / stickthreshold), 1.0)
|
||||||
|
+ ( std::max( 0.0, std::abs( movezparam ) - stickthreshold ) / (1.0 - stickthreshold) ) * std::max( 0.0, movespeed - walkspeed ) };
|
||||||
|
|
||||||
// NOTE: z-axis is flipped given world coordinate system
|
// NOTE: z-axis is flipped given world coordinate system
|
||||||
m_moverate.z = (
|
m_moverate.z = (
|
||||||
movezparam > 0.0 ? -movez * speedmultiplier :
|
movezparam > 0.0 ? -movez * speedmultiplier :
|
||||||
|
|||||||
@@ -529,7 +529,8 @@ glm::vec3
|
|||||||
TTraction::wire_color() const {
|
TTraction::wire_color() const {
|
||||||
|
|
||||||
glm::vec3 color;
|
glm::vec3 color;
|
||||||
if( false == DebugModeFlag ) {
|
if( !DebugModeFlag || GfxRenderer.settings.force_normal_traction_render )
|
||||||
|
{
|
||||||
switch( Material ) { // Ra: kolory podzieliłem przez 2, bo po zmianie ambient za jasne były
|
switch( Material ) { // Ra: kolory podzieliłem przez 2, bo po zmianie ambient za jasne były
|
||||||
// trzeba uwzględnić kierunek świecenia Słońca - tylko ze Słońcem widać kolor
|
// trzeba uwzględnić kierunek świecenia Słońca - tylko ze Słońcem widać kolor
|
||||||
case 1: {
|
case 1: {
|
||||||
|
|||||||
@@ -362,6 +362,14 @@ debug_panel::render() {
|
|||||||
// toggles
|
// toggles
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::Checkbox( "Debug Mode", &DebugModeFlag );
|
ImGui::Checkbox( "Debug Mode", &DebugModeFlag );
|
||||||
|
if( DebugModeFlag )
|
||||||
|
{
|
||||||
|
ImGui::Indent();
|
||||||
|
ImGui::Checkbox(
|
||||||
|
"Draw normal traction",
|
||||||
|
&GfxRenderer.settings.force_normal_traction_render );
|
||||||
|
ImGui::Unindent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -228,12 +228,12 @@ keyboard_input::poll() {
|
|||||||
|
|
||||||
glm::vec2 const movementhorizontal {
|
glm::vec2 const movementhorizontal {
|
||||||
// x-axis
|
// x-axis
|
||||||
( Global.shiftState ? 1.f : 0.5f ) *
|
( Global.shiftState ? 1.f : 0.66f ) *
|
||||||
( input::keys[ m_bindingscache.left ] != GLFW_RELEASE ? -1.f :
|
( input::keys[ m_bindingscache.left ] != GLFW_RELEASE ? -1.f :
|
||||||
input::keys[ m_bindingscache.right ] != GLFW_RELEASE ? 1.f :
|
input::keys[ m_bindingscache.right ] != GLFW_RELEASE ? 1.f :
|
||||||
0.f ),
|
0.f ),
|
||||||
// z-axis
|
// z-axis
|
||||||
( Global.shiftState ? 1.f : 0.5f ) *
|
( Global.shiftState ? 1.f : 0.66f ) *
|
||||||
( input::keys[ m_bindingscache.forward ] != GLFW_RELEASE ? 1.f :
|
( input::keys[ m_bindingscache.forward ] != GLFW_RELEASE ? 1.f :
|
||||||
input::keys[ m_bindingscache.back ] != GLFW_RELEASE ? -1.f :
|
input::keys[ m_bindingscache.back ] != GLFW_RELEASE ? -1.f :
|
||||||
0.f ) };
|
0.f ) };
|
||||||
@@ -254,7 +254,7 @@ keyboard_input::poll() {
|
|||||||
|
|
||||||
float const movementvertical {
|
float const movementvertical {
|
||||||
// y-axis
|
// y-axis
|
||||||
( Global.shiftState ? 1.f : 0.5f ) *
|
( Global.shiftState ? 1.f : 0.66f ) *
|
||||||
( input::keys[ m_bindingscache.up ] != GLFW_RELEASE ? 1.f :
|
( input::keys[ m_bindingscache.up ] != GLFW_RELEASE ? 1.f :
|
||||||
input::keys[ m_bindingscache.down ] != GLFW_RELEASE ? -1.f :
|
input::keys[ m_bindingscache.down ] != GLFW_RELEASE ? -1.f :
|
||||||
0.f ) };
|
0.f ) };
|
||||||
|
|||||||
@@ -121,6 +121,12 @@ class opengl_renderer
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// types
|
// types
|
||||||
|
/// Renderer runtime settings
|
||||||
|
struct Settings
|
||||||
|
{
|
||||||
|
/** Force normal render of traction, when user is in debug mode. */
|
||||||
|
bool force_normal_traction_render { false };
|
||||||
|
} settings;
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
bool Init(GLFWwindow *Window);
|
bool Init(GLFWwindow *Window);
|
||||||
|
|||||||
Reference in New Issue
Block a user