17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 03:59:19 +02:00

feat(roads): right of way and lane turns at junctions, road weights, kerbs, medians and forking roads, banks to the ground, roundabouts, pedestrian crossings, spawn sets by count; fix(editor): model skin export, placement on the ground under the orthophoto

This commit is contained in:
2026-10-04 01:55:35 +02:00
parent 3ce9102da0
commit 27a94509c4
17 changed files with 2198 additions and 244 deletions

View File

@@ -251,6 +251,7 @@ TAnimModel::TAnimModel( scene::node_data const &Nodedata ) : basic_node( Nodedat
bool TAnimModel::Init(std::string const &asName, std::string const &asReplacableTexture)
{
m_skintoken = asReplacableTexture;
if( asReplacableTexture.substr( 0, 1 ) == "*" ) {
// od gwiazdki zaczynają się teksty na wyświetlaczach
asText = asReplacableTexture.substr( 1, asReplacableTexture.length() - 1 ); // zapamiętanie tekstu
@@ -806,13 +807,18 @@ TAnimModel::export_as_text_( std::ostream &Output ) const {
}
Output << modelfile << ' ';
// texture
auto texturefile { (
m_materialdata.replacable_skins[ 1 ] != null_handle ?
GfxRenderer->Material( m_materialdata.replacable_skins[ 1 ] )->GetName() :
"none" ) };
if( texturefile.find( paths::textures ) == 0 ) {
// don't include 'textures/' in the path
texturefile.erase( 0, std::string{ paths::textures }.size() );
// the skin goes out the way it came in. the materials it was turned into can't give it back: they don't tell
// a set of skins from a single one, a text for a display from no skin at all, or what a texture was to be generated from
auto texturefile { m_skintoken };
if( texturefile.empty() ) {
texturefile = (
m_materialdata.replacable_skins[ 1 ] != null_handle ?
GfxRenderer->Material( m_materialdata.replacable_skins[ 1 ] )->GetName() :
"none" );
if( texturefile.find( paths::textures ) == 0 ) {
// don't include 'textures/' in the path
texturefile.erase( 0, std::string{ paths::textures }.size() );
}
}
if( contains( texturefile, ' ' ) ) {
Output << "\"" << texturefile << "\"" << ' ';
@@ -827,6 +833,23 @@ TAnimModel::export_as_text_( std::ostream &Output ) const {
Output << lsLights[ lightidx ] << ' ';
}
}
// colors given to the lights; goes right after the lights, the way it's read
if( std::any_of( std::begin( m_lightcolors ), std::begin( m_lightcolors ) + iNumLights, []( glm::vec3 const &Color ) { return Color.r >= 0.f; } ) ) {
Output << "lightcolors ";
for( int lightidx = 0; lightidx < iNumLights; ++lightidx ) {
auto const &color { m_lightcolors[ lightidx ] };
if( color.r < 0.f ) {
// the light was left with the color the model gives it
Output << "-1 ";
continue;
}
auto const component = []( float const Value ) { return std::clamp( static_cast<int>( std::lround( Value * 255.f ) ), 0, 255 ); };
Output
<< std::hex << std::setfill( '0' ) << std::setw( 6 )
<< ( component( color.r ) << 16 | component( color.g ) << 8 | component( color.b ) )
<< std::dec << std::setfill( ' ' ) << ' ';
}
}
// potential light transition switch
if( false == m_transition ) {
Output << "notransition" << ' ';