mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-20 03:25:58 +02:00
feat(terrain): binary terrain files (.btf) made out of text terrain files (.txtf) named by terrain directives, checked against length and checksum of the text and loaded section by section when needed; -btf command line conversion; SBT files no longer generated, only loaded
This commit is contained in:
@@ -19,6 +19,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "utilities/Timer.h"
|
||||
#include "utilities/Logs.h"
|
||||
#include "scene/sn_utils.h"
|
||||
#include "scene/sceneterrain.h"
|
||||
#include "rendering/renderer.h"
|
||||
#include "widgets/map_objects.h"
|
||||
|
||||
@@ -1007,6 +1008,12 @@ basic_section::center( glm::dvec3 Center ) {
|
||||
void
|
||||
basic_section::create_geometry() {
|
||||
|
||||
if( false == m_terrain.empty() ) {
|
||||
// this is the first thing done with a section about to be drawn or modified, which makes it
|
||||
// the moment for the geometry kept in binary terrain files to arrive
|
||||
load_terrain();
|
||||
}
|
||||
|
||||
if( true == m_geometrycreated ) { return; }
|
||||
else {
|
||||
// mark it done for future checks
|
||||
@@ -1026,6 +1033,18 @@ basic_section::create_geometry() {
|
||||
}
|
||||
}
|
||||
|
||||
// loads geometry of the section kept in binary terrain files, if any is waiting
|
||||
void
|
||||
basic_section::load_terrain() {
|
||||
|
||||
// the list is emptied first, as loading can lead back here
|
||||
auto const blocks { std::move( m_terrain ) };
|
||||
m_terrain.clear();
|
||||
for( auto const &block : blocks ) {
|
||||
terrain_file::load( *this, block );
|
||||
}
|
||||
}
|
||||
|
||||
void basic_section::create_map_geometry(const gfx::geometrybank_handle handle)
|
||||
{
|
||||
std::vector<gfx::basic_vertex> lines;
|
||||
@@ -1777,6 +1796,16 @@ void basic_region::create_map_geometry()
|
||||
}
|
||||
}
|
||||
|
||||
// loads all geometry kept in binary terrain files which wasn't needed so far
|
||||
void basic_region::load_terrain()
|
||||
{
|
||||
for( auto *section : m_sections ) {
|
||||
if( section != nullptr ) {
|
||||
section->load_terrain();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void basic_region::update_poi_geometry()
|
||||
{
|
||||
std::vector<gfx::basic_vertex> vertices;
|
||||
|
||||
Reference in New Issue
Block a user