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

Merge branch 'tmj-dev'

This commit is contained in:
milek7
2018-02-16 15:25:53 +01:00
113 changed files with 4617 additions and 4057 deletions

View File

@@ -55,7 +55,7 @@ basic_cell::update_traction( TDynamicObject *Vehicle, int const Pantographindex
// jeśli ponad pantografem (bo może łapać druty spod wiaduktu)
auto const fHorizontal = std::abs( glm::dot( vGdzie, vLeft ) ) - pantograph->fWidth;
if( ( Global::bEnableTraction )
if( ( Global.bEnableTraction )
&& ( fVertical < pantograph->PantWys - 0.15 ) ) {
// jeśli drut jest niżej niż 15cm pod ślizgiem przełączamy w tryb połamania, o ile jedzie;
// (bEnableTraction) aby dało się jeździć na koślawych sceneriach
@@ -105,10 +105,10 @@ basic_cell::update_events() {
// event launchers
for( auto *launcher : m_eventlaunchers ) {
if( ( true == launcher->check_conditions() )
&& ( SquareMagnitude( launcher->location() - Global::pCameraPosition ) < launcher->dRadius ) ) {
&& ( SquareMagnitude( launcher->location() - Global.pCameraPosition ) < launcher->dRadius ) ) {
WriteLog( "Eventlauncher " + launcher->name() );
if( ( true == Global::shiftState )
if( ( true == Global.shiftState )
&& ( launcher->Event2 != nullptr ) ) {
simulation::Events.AddToQuery( launcher->Event2, nullptr );
}
@@ -649,6 +649,12 @@ void
basic_section::insert( shape_node Shape ) {
auto const &shapedata = Shape.data();
// re-calculate section radius, in case shape geometry extends outside the section's boundaries
m_area.radius = std::max<float>(
m_area.radius,
static_cast<float>( glm::length( m_area.center - shapedata.area.center ) + shapedata.area.radius ) );
if( ( true == shapedata.translucent )
|| ( shapedata.rangesquared_max <= 90000.0 )
|| ( shapedata.rangesquared_min > 0.0 ) ) {
@@ -657,11 +663,6 @@ basic_section::insert( shape_node Shape ) {
}
else {
// large, opaque shapes are placed on section level
// re-calculate section radius, in case shape geometry extends outside the section's boundaries
m_area.radius = std::max<float>(
m_area.radius,
static_cast<float>( glm::length( m_area.center - Shape.data().area.center ) + Shape.data().area.radius ) );
for( auto &shape : m_shapes ) {
// check first if the shape can't be merged with one of the shapes already present in the section
if( true == shape.merge( Shape ) ) {
@@ -828,9 +829,9 @@ void
basic_region::update_events() {
// render events and sounds from sectors near enough to the viewer
auto const range = EU07_SECTIONSIZE; // arbitrary range
auto const &sectionlist = sections( Global::pCameraPosition, range );
auto const &sectionlist = sections( Global.pCameraPosition, range );
for( auto *section : sectionlist ) {
section->update_events( Global::pCameraPosition, range );
section->update_events( Global.pCameraPosition, range );
}
}
@@ -839,9 +840,9 @@ void
basic_region::update_sounds() {
// render events and sounds from sectors near enough to the viewer
auto const range = 2750.f; // audible range of 100 db sound
auto const &sectionlist = sections( Global::pCameraPosition, range );
auto const &sectionlist = sections( Global.pCameraPosition, range );
for( auto *section : sectionlist ) {
section->update_sounds( Global::pCameraPosition, range );
section->update_sounds( Global.pCameraPosition, range );
}
}
@@ -873,7 +874,7 @@ basic_region::serialize( std::string const &Scenariofile ) const {
// trim leading $ char rainsted utility may add to the base name for modified .scn files
filename.erase( 0, 1 );
}
filename = Global::asCurrentSceneryPath + filename;
filename = Global.asCurrentSceneryPath + filename;
if( ( filename.rfind( '.' ) != std::string::npos )
&& ( filename.rfind( '.' ) != filename.rfind( ".." ) + 1 ) ) {
// trim extension, it's typically going to be for different file type
@@ -916,7 +917,7 @@ basic_region::deserialize( std::string const &Scenariofile ) {
// trim leading $ char rainsted utility may add to the base name for modified .scn files
filename.erase( 0, 1 );
}
filename = Global::asCurrentSceneryPath + filename;
filename = Global.asCurrentSceneryPath + filename;
if( ( filename.rfind( '.' ) != std::string::npos )
&& ( filename.rfind( '.' ) != filename.rfind( ".." ) + 1 ) ) {
// trim extension, it's typically going to be for different file type
@@ -1038,13 +1039,12 @@ basic_region::insert_shape( shape_node Shape, scratch_data &Scratchpad, bool con
while( true == RaTriangleDivider( shapes[ index ], shapes ) ) {
; // all work is done during expression check
}
// with the trimming done we can calculate shape's bounding radius
shape.compute_radius();
}
}
// move the data into appropriate section(s)
for( auto &shape : shapes ) {
// with the potential splitting done we can calculate each chunk's bounding radius
shape.compute_radius();
if( point_inside( shape.m_data.area.center ) ) {
// NOTE: nodes placed outside of region boundaries are discarded
section( shape.m_data.area.center ).insert( shape );