Compare commits
6 Commits
version/20
...
version/20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af0f7676c4 | ||
|
|
a3bdfab17b | ||
|
|
44bae773a0 | ||
|
|
5fe527a2d1 | ||
|
|
b79f03c96c | ||
|
|
631fa62495 |
@@ -1 +1 @@
|
||||
2020.3.11
|
||||
2020.3.12
|
||||
|
||||
@@ -298,8 +298,8 @@ namespace canvas
|
||||
{
|
||||
if( camera.valid() && Canvas::getSystemAdapter() )
|
||||
Canvas::getSystemAdapter()->removeCamera(camera.get());
|
||||
camera.release();
|
||||
texture.release();
|
||||
camera = nullptr;
|
||||
texture = nullptr;
|
||||
|
||||
_flags &= ~AVAILABLE;
|
||||
}
|
||||
|
||||
@@ -83,6 +83,8 @@ bool SGMaterialLib::load( const SGPath &fg_root, const SGPath& mpath,
|
||||
options->setObjectCacheHint(osgDB::Options::CACHE_ALL);
|
||||
options->setDatabasePath(fg_root.utf8Str());
|
||||
|
||||
std::lock_guard<std::mutex> g(d->mutex);
|
||||
|
||||
simgear::PropertyList blocks = materialblocks.getChildren("region");
|
||||
simgear::PropertyList::const_iterator block_iter = blocks.begin();
|
||||
|
||||
@@ -153,14 +155,20 @@ bool SGMaterialLib::load( const SGPath &fg_root, const SGPath& mpath,
|
||||
|
||||
// find a material record by material name and tile center
|
||||
SGMaterial *SGMaterialLib::find( const string& material, const SGVec2f center ) const
|
||||
{
|
||||
std::lock_guard<std::mutex> g(d->mutex);
|
||||
return internalFind(material, center);
|
||||
}
|
||||
|
||||
SGMaterial* SGMaterialLib::internalFind(const string& material, const SGVec2f center) const
|
||||
{
|
||||
SGMaterial *result = NULL;
|
||||
const_material_map_iterator it = matlib.find( material );
|
||||
if ( it != end() ) {
|
||||
if (it != end()) {
|
||||
// We now have a list of materials that match this
|
||||
// name. Find the first one that matches.
|
||||
// We start at the end of the list, as the materials
|
||||
// list is ordered with the smallest regions at the end.
|
||||
// We start at the end of the list, as the materials
|
||||
// list is ordered with the smallest regions at the end.
|
||||
material_list::const_reverse_iterator iter = it->second.rbegin();
|
||||
while (iter != it->second.rend()) {
|
||||
result = *iter;
|
||||
@@ -184,11 +192,12 @@ SGMaterial *SGMaterialLib::find( const string& material, const SGGeod& center )
|
||||
SGMaterialCache *SGMaterialLib::generateMatCache(SGVec2f center)
|
||||
{
|
||||
SGMaterialCache* newCache = new SGMaterialCache();
|
||||
std::lock_guard<std::mutex> g(d->mutex);
|
||||
|
||||
material_map::const_reverse_iterator it = matlib.rbegin();
|
||||
for (; it != matlib.rend(); ++it) {
|
||||
newCache->insert(it->first, find(it->first, center));
|
||||
newCache->insert(it->first, internalFind(it->first, center));
|
||||
}
|
||||
|
||||
return newCache;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,10 @@ private:
|
||||
typedef material_map::const_iterator const_material_map_iterator;
|
||||
|
||||
material_map matlib;
|
||||
|
||||
|
||||
|
||||
SGMaterial* internalFind(const std::string& material, const SGVec2f center) const;
|
||||
|
||||
public:
|
||||
|
||||
// Constructor
|
||||
|
||||
@@ -16,23 +16,27 @@
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <simgear_config.h>
|
||||
#endif
|
||||
#include <simgear_config.h>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "SGText.hxx"
|
||||
|
||||
#include <simgear/math/SGMath.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
#include <simgear/misc/strutils.hxx>
|
||||
|
||||
#include <osg/Geode>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osgText/Text>
|
||||
#include <osgText/Font>
|
||||
|
||||
#include <simgear/misc/ResourceManager.hxx>
|
||||
#include <simgear/math/SGMath.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
#include <simgear/misc/strutils.hxx>
|
||||
#include <simgear/scene/material/Effect.hxx>
|
||||
#include <simgear/scene/material/EffectGeode.hxx>
|
||||
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
|
||||
#include <simgear/debug/ErrorReportingCallback.hxx>
|
||||
|
||||
using std::string;
|
||||
|
||||
class SGText::UpdateCallback : public osg::NodeCallback {
|
||||
@@ -95,9 +99,15 @@ osg::Node * SGText::appendText(const SGPropertyNode* configNode,
|
||||
osg::Geode * g = new osg::Geode;
|
||||
g->addDrawable( text );
|
||||
|
||||
SGPath path("Fonts" );
|
||||
path.append( configNode->getStringValue( "font", "Helvetica" ));
|
||||
text->setFont( path.utf8Str() );
|
||||
const std::string requestedFont = configNode->getStringValue("font","Helvetica");
|
||||
const SGPath fontPath = simgear::ResourceManager::instance()->findPath("Fonts/" + requestedFont);
|
||||
if ( !fontPath.isNull() ) {
|
||||
text->setFont( fontPath.utf8Str() );
|
||||
} else {
|
||||
simgear::reportFailure(simgear::LoadFailure::NotFound,
|
||||
simgear::ErrorCode::LoadingTexture,
|
||||
"SGText: couldn;t find font:" + requestedFont);
|
||||
}
|
||||
|
||||
text->setCharacterSize(configNode->getDoubleValue("character-size", 1.0 ),
|
||||
configNode->getDoubleValue("character-aspect-ratio", 1.0 ));
|
||||
|
||||
@@ -512,6 +512,14 @@ void Particles::setupStaticColorComponent(float r1, float g1, float b1, float a1
|
||||
staticColorComponents[7] = a2;
|
||||
}
|
||||
|
||||
ParticlesGlobalManager::~ParticlesGlobalManager()
|
||||
{
|
||||
// break a ref-counting cycle
|
||||
if (d->_commonRoot) {
|
||||
d->_commonRoot->removeUpdateCallback(d.get());
|
||||
}
|
||||
}
|
||||
|
||||
void ParticlesGlobalManager::setWindVector(const osg::Vec3& wind)
|
||||
{
|
||||
std::lock_guard<std::mutex> g(d->_lock);
|
||||
|
||||
@@ -150,7 +150,7 @@ protected:
|
||||
class ParticlesGlobalManager
|
||||
{
|
||||
public:
|
||||
~ParticlesGlobalManager() = default;
|
||||
~ParticlesGlobalManager();
|
||||
|
||||
static ParticlesGlobalManager* instance();
|
||||
static void clear();
|
||||
|
||||
@@ -343,7 +343,7 @@ public:
|
||||
* Schedule this audio sample to stop (or start) playing.
|
||||
*/
|
||||
inline void set_out_of_range(bool oor = true) {
|
||||
_out_of_range = oor; _playing = (!oor && _loop); _changed = true;
|
||||
_out_of_range = oor; _changed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -347,7 +347,9 @@ SGXmlSound::update (double dt)
|
||||
// else
|
||||
// if a property is defined then test if it's value is FALSE
|
||||
// or if the mode is IN_TRANSIT then
|
||||
// test whether the current value matches the previous value.
|
||||
// test whether the current value matches the previous value,
|
||||
// else
|
||||
// check if out of range.
|
||||
if ( // Lisp, anyone?
|
||||
(_condition && !_condition->test()) ||
|
||||
(!_condition && _property &&
|
||||
@@ -355,7 +357,8 @@ SGXmlSound::update (double dt)
|
||||
!curr_value ||
|
||||
( (_mode == SGXmlSound::IN_TRANSIT) && (curr_value == _prev_value) )
|
||||
)
|
||||
)
|
||||
) ||
|
||||
_sample->test_out_of_range()
|
||||
)
|
||||
{
|
||||
if ((_mode != SGXmlSound::IN_TRANSIT) || (_stopping > MAX_TRANSIT_TIME))
|
||||
|
||||
Reference in New Issue
Block a user