Compare commits
10 Commits
version/20
...
version/20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a157e50302 | ||
|
|
70e6b6b13f | ||
|
|
c457561472 | ||
|
|
2b5ac6350d | ||
|
|
1c30b29168 | ||
|
|
ce9f476ddb | ||
|
|
2621418d3a | ||
|
|
174b341bef | ||
|
|
df33713069 | ||
|
|
cde75530fe |
@@ -1 +1 @@
|
||||
2020.3.10
|
||||
2020.3.11
|
||||
|
||||
@@ -774,7 +774,7 @@ private:
|
||||
|
||||
if (!ok) {
|
||||
SG_LOG(SG_TERRASYNC, SG_WARN, "removal failed for:" << path);
|
||||
throw sg_io_exception("Failed to remove existing file/dir:", path);
|
||||
throw sg_io_exception("Failed to remove existing file/dir:", path, "", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1424,7 +1424,8 @@ HTTPRepository::failure() const
|
||||
SG_LOG(SG_TERRASYNC, SG_WARN,
|
||||
"failed to update entry:" << relativePath << " status/code: "
|
||||
<< innerResultCodeAsString(fileStatus)
|
||||
<< "/" << fileStatus);
|
||||
<< "/" << fileStatus
|
||||
<< "\nrepo:" << baseUrl);
|
||||
|
||||
simgear::reportFailure(simgear::LoadFailure::NetworkError, simgear::ErrorCode::TerraSync,
|
||||
"failed to update entry:" + innerResultCodeAsString(fileStatus),
|
||||
|
||||
@@ -48,9 +48,11 @@ static std::string gzErrorMessage(gzFile fd)
|
||||
|
||||
if (errNum == Z_ERRNO) {
|
||||
return simgear::strutils::error_string(errno);
|
||||
} else {
|
||||
} else if (gzMsg) {
|
||||
return {gzMsg};
|
||||
}
|
||||
|
||||
return {"GZError: no string code for code:" + std::to_string(errNum)};
|
||||
}
|
||||
|
||||
void sgReadChar ( gzFile fd, char *var )
|
||||
|
||||
@@ -161,7 +161,7 @@ setFlag( int& mode,
|
||||
string message = "Unrecognized flag value '";
|
||||
message += flag;
|
||||
message += '\'';
|
||||
throw sg_io_exception(message, location, SG_ORIGIN);
|
||||
throw sg_io_exception(message, location, SG_ORIGIN, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ PropsVisitor::startElement (const char * name, const XMLAttributes &atts)
|
||||
string message = "Root element name is ";
|
||||
message += name;
|
||||
message += "; expected PropertyList";
|
||||
throw sg_io_exception(message, location, SG_ORIGIN);
|
||||
throw sg_io_exception(message, location, SG_ORIGIN, false);
|
||||
}
|
||||
|
||||
// Check for an include.
|
||||
@@ -188,7 +188,7 @@ PropsVisitor::startElement (const char * name, const XMLAttributes &atts)
|
||||
{
|
||||
string message ="Cannot open file ";
|
||||
message += attval;
|
||||
throw sg_io_exception(message, location, SG_ORIGIN);
|
||||
throw sg_io_exception(message, location, SG_ORIGIN, false);
|
||||
}
|
||||
readProperties(path, _root, 0, _extended);
|
||||
} catch (sg_io_exception &e) {
|
||||
@@ -278,7 +278,7 @@ PropsVisitor::startElement (const char * name, const XMLAttributes &atts)
|
||||
{
|
||||
string message ="Cannot open file ";
|
||||
message += val;
|
||||
throw sg_io_exception(message, location, SG_ORIGIN);
|
||||
throw sg_io_exception(message, location, SG_ORIGIN, false);
|
||||
}
|
||||
readProperties(path, node, 0, _extended);
|
||||
}
|
||||
@@ -353,7 +353,7 @@ PropsVisitor::endElement (const char * name)
|
||||
string message = "Unrecognized data type '";
|
||||
message += st.type;
|
||||
message += '\'';
|
||||
throw sg_io_exception(message, location, SG_ORIGIN);
|
||||
throw sg_io_exception(message, location, SG_ORIGIN, false);
|
||||
}
|
||||
if( !ret )
|
||||
SG_LOG
|
||||
@@ -701,7 +701,7 @@ writeProperties (const SGPath &path, const SGPropertyNode * start_node,
|
||||
if (output.good()) {
|
||||
writeProperties(output, start_node, write_all, archive_flag);
|
||||
} else {
|
||||
throw sg_io_exception("Cannot open file", sg_location(path.utf8Str()));
|
||||
throw sg_io_exception("Cannot open file", sg_location(path.utf8Str()), "", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -770,7 +770,7 @@ copyPropertyValue(const SGPropertyNode *in, SGPropertyNode *out)
|
||||
break;
|
||||
string message = "Unknown internal SGPropertyNode type";
|
||||
message += in->getType();
|
||||
throw sg_error(message, SG_ORIGIN);
|
||||
throw sg_error(message, SG_ORIGIN, false);
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
||||
@@ -457,9 +457,6 @@ SGAnimation::~SGAnimation()
|
||||
}
|
||||
if (!info.empty())
|
||||
{
|
||||
reportFailure(LoadFailure::Misconfigured, ErrorCode::XMLModelLoad,
|
||||
"Could not find at least one of the following object for animation:" + info,
|
||||
SGPath::fromUtf8(_modelData.getPath()));
|
||||
SG_LOG(SG_IO, SG_DEV_ALERT, "Could not find at least one of the following"
|
||||
" objects for animation: " << info << " in file: " << _modelData.getPath());
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
|
||||
#include <simgear/scene/util/OptionsReadFileCallback.hxx>
|
||||
#include <simgear/scene/util/SGNodeMasks.hxx>
|
||||
#include <simgear/debug/ErrorReportingCallback.hxx>
|
||||
|
||||
#include "SGNodeTriangles.hxx"
|
||||
#include "GroundLightManager.hxx"
|
||||
@@ -55,9 +56,11 @@ typedef std::list<SGDirectionalLightBin> SGDirectionalLightListBin;
|
||||
#define SG_SIMPLIFIER_RATIO (0.001)
|
||||
#define SG_SIMPLIFIER_MAX_LENGTH (1000.0)
|
||||
#define SG_SIMPLIFIER_MAX_ERROR (2000.0)
|
||||
#define SG_TILE_MIN_EXPIRY (180.0)
|
||||
|
||||
using namespace simgear;
|
||||
|
||||
using ReadResult = osgDB::ReaderWriter::ReadResult;
|
||||
|
||||
// QuadTreeBuilder is used by Random Objects Generator
|
||||
typedef std::pair<osg::Node*, int> ModelLOD;
|
||||
struct MakeQuadLeaf {
|
||||
@@ -97,47 +100,59 @@ public:
|
||||
SG_LOG( SG_TERRAIN, SG_DEBUG, "SGTileDetailsCallback::~SGTileDetailsCallback() num cbs left " << num_tdcb );
|
||||
}
|
||||
|
||||
virtual osgDB::ReaderWriter::ReadResult readNode(
|
||||
const std::string&, const osgDB::Options*)
|
||||
ReadResult readNode(const std::string&, const osgDB::Options*) override
|
||||
{
|
||||
SGMaterialLibPtr matlib;
|
||||
osg::ref_ptr<SGMaterialCache> matcache;
|
||||
|
||||
osg::ref_ptr<osg::Group> group = new osg::Group;
|
||||
group->setDataVariance(osg::Object::STATIC);
|
||||
osg::ref_ptr<osg::Group> group;
|
||||
simgear::ErrorReportContext ec{"btg", _path};
|
||||
|
||||
// generate textured triangle list
|
||||
std::vector<SGTriangleInfo> matTris;
|
||||
GetNodeTriangles nodeTris(_gbs_center, &matTris);
|
||||
_rootNode->accept( nodeTris );
|
||||
try {
|
||||
group = new osg::Group;
|
||||
SGMaterialLibPtr matlib;
|
||||
osg::ref_ptr<SGMaterialCache> matcache;
|
||||
group->setDataVariance(osg::Object::STATIC);
|
||||
|
||||
// build matcache
|
||||
matlib = _options->getMaterialLib();
|
||||
if (matlib) {
|
||||
SGGeod geodPos = SGGeod::fromCart(_gbs_center);
|
||||
matcache = matlib->generateMatCache(geodPos);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// TEST : See if we can regenerate landclass shapes from node
|
||||
for ( unsigned int i=0; i<matTris.size(); i++ ) {
|
||||
matTris[i].dumpBorder(_gbs_center);
|
||||
}
|
||||
#endif
|
||||
// generate textured triangle list
|
||||
std::vector<SGTriangleInfo> matTris;
|
||||
GetNodeTriangles nodeTris(_gbs_center, &matTris);
|
||||
_rootNode->accept( nodeTris );
|
||||
|
||||
osg::Node* node = loadTerrain();
|
||||
if (node) {
|
||||
group->addChild(node);
|
||||
}
|
||||
// build matcache
|
||||
matlib = _options->getMaterialLib();
|
||||
if (matlib) {
|
||||
SGGeod geodPos = SGGeod::fromCart(_gbs_center);
|
||||
matcache = matlib->generateMatCache(geodPos);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// TEST : See if we can regenerate landclass shapes from node
|
||||
for ( unsigned int i=0; i<matTris.size(); i++ ) {
|
||||
matTris[i].dumpBorder(_gbs_center);
|
||||
}
|
||||
#endif
|
||||
|
||||
osg::LOD* lightLOD = generateLightingTileObjects(matTris, matcache);
|
||||
if (lightLOD) {
|
||||
group->addChild(lightLOD);
|
||||
}
|
||||
osg::Node* node = loadTerrain();
|
||||
if (node) {
|
||||
group->addChild(node);
|
||||
}
|
||||
|
||||
osg::LOD* objectLOD = generateRandomTileObjects(matTris, matcache);
|
||||
if (objectLOD) {
|
||||
group->addChild(objectLOD);
|
||||
osg::LOD* lightLOD = generateLightingTileObjects(matTris, matcache);
|
||||
if (lightLOD) {
|
||||
group->addChild(lightLOD);
|
||||
}
|
||||
|
||||
osg::LOD* objectLOD = generateRandomTileObjects(matTris, matcache);
|
||||
if (objectLOD) {
|
||||
group->addChild(objectLOD);
|
||||
}
|
||||
} catch (sg_exception& sge) {
|
||||
simgear::reportFailure(simgear::LoadFailure::BadData, simgear::ErrorCode::BTGLoad,
|
||||
"Failed to load BTG file:" + sge.getFormattedMessage(),
|
||||
sge.getLocation());
|
||||
return ReadResult::ERROR_IN_READING_FILE;
|
||||
} catch (std::bad_alloc &e) {
|
||||
simgear::reportFailure(simgear::LoadFailure::OutOfMemory, simgear::ErrorCode::BTGLoad,
|
||||
"Out of memory loading tile details", sg_location{_path});
|
||||
return ReadResult::INSUFFICIENT_MEMORY_TO_LOAD;
|
||||
}
|
||||
|
||||
return group.release();
|
||||
|
||||
Reference in New Issue
Block a user