16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-20 00:59:19 +02:00

Merge branch 'tmj-dev' into milek-dev

This commit is contained in:
milek7
2018-06-30 18:45:58 +02:00
37 changed files with 672 additions and 498 deletions

View File

@@ -266,6 +266,8 @@ ui_layer::update() {
"" ) );
}
EditorModeFlag = ( Global.iTextMode == GLFW_KEY_F11 );
switch( Global.iTextMode ) {
case( GLFW_KEY_F1 ) : {
@@ -689,19 +691,7 @@ ui_layer::update() {
uitextline3 =
"vehicles: " + to_string( Timer::subsystem.sim_dynamics.average(), 2 ) + " msec"
+ " update total: " + to_string( Timer::subsystem.sim_total.average(), 2 ) + " msec";
break;
}
case( GLFW_KEY_F10 ) : {
uitextline1 = "Press [Y] key to quit / Aby zakonczyc program, przycisnij klawisz [Y].";
break;
}
case( GLFW_KEY_F11 ): {
// scenario inspector
// current event queue
auto const time { Timer::GetTime() };
auto const *event { simulation::Events.begin() };
auto eventtableindex{ 0 };
@@ -727,6 +717,139 @@ ui_layer::update() {
break;
}
case( GLFW_KEY_F10 ) : {
uitextline1 = "Press [Y] key to quit / Aby zakonczyc program, przycisnij klawisz [Y].";
break;
}
case( GLFW_KEY_F11 ): {
// scenario inspector
auto const *node { editor::Node };
if( node == nullptr ) { break; }
uitextline1 =
"Node name: " + node->name()
+ "; location: [" + to_string( node->location().x, 2 ) + ", " + to_string( node->location().y, 2 ) + ", " + to_string( node->location().z, 2 ) + "]"
+ " (distance: " + to_string( glm::length( glm::dvec3{ node->location().x, 0.0, node->location().z } -glm::dvec3{ Global.pCameraPosition.x, 0.0, Global.pCameraPosition.z } ), 1 ) + " m)";
// subclass-specific data
// TBD, TODO: specialized data dump method in each node subclass, or data imports in the panel for provided subclass pointer?
if( typeid( *node ) == typeid( TAnimModel ) ) {
auto const *subnode = static_cast<TAnimModel const *>( node );
uitextline2 = "angle: " + to_string( clamp_circular( subnode->vAngle.y, 360.0 ), 2 ) + " deg";
uitextline2 += "; lights: ";
if( subnode->iNumLights > 0 ) {
uitextline2 += '[';
for( int lightidx = 0; lightidx < subnode->iNumLights; ++lightidx ) {
uitextline2 += to_string( subnode->lsLights[ lightidx ] );
if( lightidx < subnode->iNumLights - 1 ) {
uitextline2 += ", ";
}
}
uitextline2 += ']';
}
else {
uitextline2 += "none";
}
// 3d shape
auto modelfile { (
subnode->pModel ?
subnode->pModel->NameGet() :
"none" ) };
if( modelfile.find( szModelPath ) == 0 ) {
// don't include 'models/' in the path
modelfile.erase( 0, std::string{ szModelPath }.size() );
}
// texture
auto texturefile { (
subnode->Material()->replacable_skins[ 1 ] != null_handle ?
GfxRenderer.Material( subnode->Material()->replacable_skins[ 1 ] ).name :
"none" ) };
if( texturefile.find( szTexturePath ) == 0 ) {
// don't include 'textures/' in the path
texturefile.erase( 0, std::string{ szTexturePath }.size() );
}
uitextline3 = "mesh: " + modelfile;
uitextline4 = "skin: " + texturefile;
}
else if( typeid( *node ) == typeid( TTrack ) ) {
auto const *subnode = static_cast<TTrack const *>( node );
// basic attributes
uitextline2 =
"isolated: " + ( subnode->pIsolated ? subnode->pIsolated->asName : "none" )
+ "; velocity: " + to_string( subnode->SwitchExtension ? subnode->SwitchExtension->fVelocity : subnode->fVelocity )
+ "; width: " + to_string( subnode->fTrackWidth ) + " m"
+ "; friction: " + to_string( subnode->fFriction, 2 )
+ "; quality: " + to_string( subnode->iQualityFlag );
// textures
auto texturefile { (
subnode->m_material1 != null_handle ?
GfxRenderer.Material( subnode->m_material1 ).name :
"none" ) };
if( texturefile.find( szTexturePath ) == 0 ) {
texturefile.erase( 0, std::string{ szTexturePath }.size() );
}
auto texturefile2{ (
subnode->m_material2 != null_handle ?
GfxRenderer.Material( subnode->m_material2 ).name :
"none" ) };
if( texturefile2.find( szTexturePath ) == 0 ) {
texturefile2.erase( 0, std::string{ szTexturePath }.size() );
}
uitextline2 += "; skins: [" + texturefile + ", " + texturefile2 + "]";
// paths
uitextline3 = "paths: ";
for( auto const &path : subnode->m_paths ) {
uitextline3 +=
"["
+ to_string( path.points[ segment_data::point::start ].x, 3 ) + ", "
+ to_string( path.points[ segment_data::point::start ].y, 3 ) + ", "
+ to_string( path.points[ segment_data::point::start ].z, 3 ) + "]->"
+ "["
+ to_string( path.points[ segment_data::point::end ].x, 3 ) + ", "
+ to_string( path.points[ segment_data::point::end ].y, 3 ) + ", "
+ to_string( path.points[ segment_data::point::end ].z, 3 ) + "] ";
}
// events
std::vector< std::pair< std::string, TTrack::event_sequence const * > > const eventsequences {
{ "ev0", &subnode->m_events0 }, { "ev0all", &subnode->m_events0all },
{ "ev1", &subnode->m_events1 }, { "ev1all", &subnode->m_events1all },
{ "ev2", &subnode->m_events2 }, { "ev2all", &subnode->m_events2all } };
for( auto const &eventsequence : eventsequences ) {
if( eventsequence.second->empty() ) { continue; }
uitextline4 += eventsequence.first + ": [";
for( auto const &event : *( eventsequence.second ) ) {
if( uitextline4.back() != '[' ) {
uitextline4 += ", ";
}
if( event.second ) {
uitextline4 += event.second->asName;
}
}
uitextline4 += "] ";
}
}
else if( typeid( *node ) == typeid( TMemCell ) ) {
auto const *subnode = static_cast<TMemCell const *>( node );
uitextline2 =
"data: [" + subnode->Text() + "]"
+ " [" + to_string( subnode->Value1(), 2 ) + "]"
+ " [" + to_string( subnode->Value2(), 2 ) + "]";
uitextline3 = "track: " + ( subnode->asTrackName.empty() ? "none" : subnode->asTrackName );
}
break;
}
case( GLFW_KEY_F12 ) : {
// opcje włączenia i wyłączenia logowania
uitextline1 = "[0] Debugmode " + std::string( DebugModeFlag ? "(on)" : "(off)" );