Compare commits
10 Commits
version/20
...
version/20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8dec1cb38c | ||
|
|
f25e95958a | ||
|
|
08108d9cf1 | ||
|
|
02cfd941c9 | ||
|
|
75b5a927c8 | ||
|
|
e4b58b65f3 | ||
|
|
b1334bf9a0 | ||
|
|
2a9767b568 | ||
|
|
29f6d06f1a | ||
|
|
fcd8ebb8a3 |
@@ -10,6 +10,12 @@ if(COMMAND cmake_policy)
|
||||
if(POLICY CMP0067)
|
||||
cmake_policy(SET CMP0067 NEW)
|
||||
endif()
|
||||
|
||||
# OpenGL VND policy : use the old definition for now, until we can audit this
|
||||
if(POLICY CMP0072)
|
||||
cmake_policy(SET CMP0072 OLD)
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0093)
|
||||
cmake_policy(SET CMP0093 NEW)
|
||||
endif()
|
||||
@@ -219,7 +225,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD
|
||||
endif()
|
||||
|
||||
find_package(Boost REQUIRED)
|
||||
set (BOOST_CXX_FLAGS "-DBOOST_BIMAP_DISABLE_SERIALIZATION")
|
||||
set (BOOST_CXX_FLAGS "-DBOOST_BIMAP_DISABLE_SERIALIZATION -DBOOST_NO_STDLIB_CONFIG")
|
||||
include(BoostTestTargets)
|
||||
|
||||
if(SIMGEAR_HEADLESS)
|
||||
|
||||
@@ -107,6 +107,8 @@ public:
|
||||
unsigned int bytesTransferred;
|
||||
unsigned int lastTransferRate;
|
||||
uint64_t totalBytesDownloaded;
|
||||
|
||||
SGPath tlsCertificatePath;
|
||||
};
|
||||
|
||||
Client::Client() :
|
||||
@@ -122,6 +124,8 @@ Client::Client() :
|
||||
d->maxPipelineDepth = 5;
|
||||
setUserAgent("SimGear-" SG_STRINGIZE(SIMGEAR_VERSION));
|
||||
|
||||
d->tlsCertificatePath = SGPath::fromEnv("SIMGEAR_TLS_CERT_PATH");
|
||||
|
||||
static bool didInitCurlGlobal = false;
|
||||
if (!didInitCurlGlobal) {
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
@@ -275,6 +279,11 @@ void Client::makeRequest(const Request_ptr& r)
|
||||
|
||||
curl_easy_setopt(curlRequest, CURLOPT_FOLLOWLOCATION, 1);
|
||||
|
||||
if (!d->tlsCertificatePath.isNull()) {
|
||||
const auto utf8 = d->tlsCertificatePath.utf8Str();
|
||||
curl_easy_setopt(curlRequest, CURLOPT_CAINFO, utf8.c_str());
|
||||
}
|
||||
|
||||
if (!d->proxy.empty()) {
|
||||
curl_easy_setopt(curlRequest, CURLOPT_PROXY, d->proxy.c_str());
|
||||
curl_easy_setopt(curlRequest, CURLOPT_PROXYPORT, d->proxyPort);
|
||||
|
||||
@@ -635,7 +635,7 @@ void ArchiveExtractor::extractBytes(const uint8_t* bytes, size_t count)
|
||||
d.reset(new ZipExtractorPrivate(this));
|
||||
}
|
||||
else {
|
||||
SG_LOG(SG_IO, SG_ALERT, "Invcalid archive type");
|
||||
SG_LOG(SG_IO, SG_WARN, "Invalid archive type");
|
||||
_invalidDataType = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "NasalString.hxx"
|
||||
|
||||
#include <cassert>
|
||||
#include <stdexcept> // for std::runtime_error
|
||||
|
||||
namespace nasal
|
||||
{
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
|
||||
#include <simgear/structure/map.hxx>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#if BOOST_VERSION >= 105600
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#else
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#endif
|
||||
|
||||
namespace nasal
|
||||
{
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
m_extractPath = aOwner->path().dir();
|
||||
m_extractPath.append("_extract_" + aOwner->package()->md5());
|
||||
|
||||
// clean up any existing files
|
||||
// clean up any existing files (eg from previous failed download)
|
||||
Dir d(m_extractPath);
|
||||
if (d.exists()) {
|
||||
d.remove(true /* recursive */);
|
||||
@@ -106,7 +106,9 @@ protected:
|
||||
Request::responseHeadersComplete();
|
||||
|
||||
Dir d(m_extractPath);
|
||||
d.create(0755);
|
||||
if (!d.create(0755)) {
|
||||
SG_LOG(SG_GENERAL, SG_WARN, "Failed to create extraction directory" << d.path());
|
||||
}
|
||||
|
||||
m_extractor.reset(new ArchiveExtractor(m_extractPath));
|
||||
memset(&m_md5, 0, sizeof(SG_MD5_CTX));
|
||||
@@ -115,11 +117,20 @@ protected:
|
||||
|
||||
void gotBodyData(const char* s, int n) override
|
||||
{
|
||||
// if there's a pre-existing error, discard byte sinstead of pushing
|
||||
// more through the extactor
|
||||
if (m_extractor->hasError()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const uint8_t* ubytes = (uint8_t*) s;
|
||||
SG_MD5Update(&m_md5, ubytes, n);
|
||||
m_downloaded += n;
|
||||
m_owner->installProgress(m_downloaded, responseLength());
|
||||
m_extractor->extractBytes(ubytes, n);
|
||||
if (m_extractor->hasError()) {
|
||||
SG_LOG(SG_GENERAL, SG_WARN, "archive extraction failed (from " + m_activeURL + ")");
|
||||
}
|
||||
}
|
||||
|
||||
void onDone() override
|
||||
@@ -214,7 +225,9 @@ private:
|
||||
dir.remove(true /* recursive */);
|
||||
}
|
||||
|
||||
const auto canRetry = (aReason == Delegate::FAIL_NOT_FOUND) || (aReason == Delegate::FAIL_DOWNLOAD);
|
||||
const auto canRetry = (aReason == Delegate::FAIL_NOT_FOUND) ||
|
||||
(aReason == Delegate::FAIL_DOWNLOAD) || (aReason == Delegate::FAIL_CHECKSUM);
|
||||
|
||||
if (canRetry && !m_urls.empty()) {
|
||||
SG_LOG(SG_GENERAL, SG_WARN, "archive download failed from:" << m_activeURL
|
||||
<< "\n\twill retry with next mirror");
|
||||
@@ -226,7 +239,6 @@ private:
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO - try other mirrors
|
||||
m_owner->m_download.reset(); // ensure we get cleaned up
|
||||
m_owner->installResult(aReason);
|
||||
}
|
||||
|
||||
@@ -122,14 +122,17 @@ void printPackageInfo(pkg::Package* pkg)
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
||||
sglog().setLogLevels( SG_ALL, SG_INFO );
|
||||
|
||||
HTTP::Client* http = new HTTP::Client();
|
||||
pkg::Root* root = new pkg::Root(Dir::current().path(), "");
|
||||
|
||||
|
||||
SGPath rootPath = SGPath::fromEnv("SG_PKG_ROOT", Dir::current().path());
|
||||
pkg::Root* root = new pkg::Root(rootPath, "2019.1.1");
|
||||
|
||||
MyDelegate dlg;
|
||||
root->addDelegate(&dlg);
|
||||
|
||||
cout << "Package root is:" << Dir::current().path() << endl;
|
||||
cout << "Package root is:" << rootPath << endl;
|
||||
cout << "have " << root->catalogs().size() << " catalog(s)" << endl;
|
||||
|
||||
root->setHTTPClient(http);
|
||||
|
||||
@@ -55,13 +55,18 @@ namespace boost {
|
||||
struct disable_if : public disable_if_c<Cond::value, T> {};
|
||||
}
|
||||
#else
|
||||
# include <boost/utility.hpp>
|
||||
# include <boost/type_traits/is_enum.hpp>
|
||||
#if BOOST_VERSION >= 105600
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#else
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#endif
|
||||
|
||||
# include <simgear/debug/logstream.hxx>
|
||||
# include <simgear/math/SGMathFwd.hxx>
|
||||
# include <simgear/math/sg_types.hxx>
|
||||
#endif
|
||||
|
||||
#include <simgear/structure/SGReferenced.hxx>
|
||||
#include <simgear/structure/SGSharedPtr.hxx>
|
||||
|
||||
|
||||
@@ -136,11 +136,19 @@ osg::Vec2d eventToWindowCoords(const osgGA::GUIEventAdapter& ea)
|
||||
|
||||
virtual void update(double dt, int keyModState)
|
||||
{
|
||||
if (!_condition || _condition->test()) {
|
||||
SG_UNUSED(keyModState);
|
||||
if (!_repeatable)
|
||||
return;
|
||||
SG_UNUSED(keyModState);
|
||||
if (_condition && !_condition->test()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_repeatable)
|
||||
return;
|
||||
|
||||
const bool zeroInterval = (_repeatInterval <= 0.0);
|
||||
if (zeroInterval) {
|
||||
// fire once per frame
|
||||
fireBindingList(_bindingsDown);
|
||||
} else {
|
||||
_repeatTime += dt;
|
||||
while (_repeatInterval < _repeatTime) {
|
||||
_repeatTime -= _repeatInterval;
|
||||
@@ -682,12 +690,18 @@ public:
|
||||
if (_hasDragged) {
|
||||
return;
|
||||
}
|
||||
|
||||
_repeatTime += dt;
|
||||
while (_repeatInterval < _repeatTime) {
|
||||
_repeatTime -= _repeatInterval;
|
||||
|
||||
const bool zeroInterval = (_repeatInterval <= 0.0);
|
||||
if (zeroInterval) {
|
||||
// fire once per frame
|
||||
fire(keyModState & osgGA::GUIEventAdapter::MODKEY_SHIFT, _direction);
|
||||
} // of repeat iteration
|
||||
} else {
|
||||
_repeatTime += dt;
|
||||
while (_repeatInterval < _repeatTime) {
|
||||
_repeatTime -= _repeatInterval;
|
||||
fire(keyModState & osgGA::GUIEventAdapter::MODKEY_SHIFT, _direction);
|
||||
} // of repeat iteration
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool hover( const osg::Vec2d& windowPos,
|
||||
|
||||
@@ -353,10 +353,6 @@ void SGSampleGroup::update_sample_config( SGSoundSample *sample )
|
||||
velocity = sample->get_velocity();
|
||||
}
|
||||
|
||||
if (_smgr->bad_doppler_effect()) {
|
||||
velocity *= 100.0f;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (length(position) > 20000)
|
||||
printf("%s source and listener distance greater than 20km!\n",
|
||||
|
||||
@@ -50,6 +50,7 @@ using std::vector;
|
||||
|
||||
|
||||
#define MAX_SOURCES 128
|
||||
#define SPEED_OF_SOUND 340.4f
|
||||
|
||||
#ifndef ALC_ALL_DEVICES_SPECIFIER
|
||||
# define ALC_ALL_DEVICES_SPECIFIER 0x1013
|
||||
@@ -218,8 +219,8 @@ void SGSoundMgr::init()
|
||||
alListenerfv( AL_POSITION, SGVec3f::zeros().data() );
|
||||
alListenerfv( AL_VELOCITY, SGVec3f::zeros().data() );
|
||||
|
||||
alDopplerFactor(1.0);
|
||||
alDopplerVelocity(340.3); // speed of sound in meters per second.
|
||||
alDopplerFactor(1.0f);
|
||||
alDopplerVelocity(SPEED_OF_SOUND);
|
||||
|
||||
// gain = AL_REFERENCE_DISTANCE / (AL_REFERENCE_DISTANCE +
|
||||
// AL_ROLLOFF_FACTOR * (distance - AL_REFERENCE_DISTANCE));
|
||||
@@ -248,8 +249,10 @@ void SGSoundMgr::init()
|
||||
_renderer = (const char *)alGetString(AL_RENDERER);
|
||||
|
||||
if (_vendor == "Creative Labs Inc.") {
|
||||
alDopplerFactor(100.0f);
|
||||
_bad_doppler = true;
|
||||
} else if (_vendor == "OpenAL Community" && _renderer == "OpenAL Soft") {
|
||||
alDopplerFactor(100.0f);
|
||||
_bad_doppler = true;
|
||||
}
|
||||
|
||||
@@ -392,14 +395,20 @@ if (isNaN(toVec3f(_velocity).data())) printf("NaN in listener velocity\n");
|
||||
SGVec3d velocity = SGVec3d::zeros();
|
||||
if ( _velocity[0] || _velocity[1] || _velocity[2] ) {
|
||||
velocity = hlOr.backTransform(_velocity*SG_FEET_TO_METER);
|
||||
}
|
||||
|
||||
if ( _bad_doppler ) {
|
||||
velocity *= 100.0f;
|
||||
if ( _bad_doppler ) {
|
||||
double fact = 100.0;
|
||||
double mag = length( velocity );
|
||||
|
||||
if (mag > SPEED_OF_SOUND) {
|
||||
fact *= SPEED_OF_SOUND / mag;
|
||||
}
|
||||
alDopplerFactor(fact);
|
||||
}
|
||||
}
|
||||
|
||||
alListenerfv( AL_VELOCITY, toVec3f(velocity).data() );
|
||||
// alDopplerVelocity(340.3); // TODO: altitude dependent
|
||||
// alDopplerVelocity(SPEED_OF_SOUND);
|
||||
testForError("update");
|
||||
_changed = false;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,11 @@
|
||||
#include "SGSharedPtr.hxx"
|
||||
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
#if BOOST_VERSION >= 105600
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#else
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
|
||||
Reference in New Issue
Block a user