More SGPath / UTF-8 fixes
Use SGPath in more public APIs, so FlightGear doesn’t have to convert and guess the conversion itself.
This commit is contained in:
parent
c3a169319c
commit
c8d802bc1d
@ -71,10 +71,10 @@ static const uint32_t EndianMagic = 0x11223344;
|
|||||||
* gzContainerWriter
|
* gzContainerWriter
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
gzContainerWriter::gzContainerWriter(const std::string& name,
|
gzContainerWriter::gzContainerWriter(const SGPath& name,
|
||||||
const std::string& fileMagic) :
|
const std::string& fileMagic) :
|
||||||
sg_gzofstream(name, ios_out | ios_binary),
|
sg_gzofstream(name, ios_out | ios_binary),
|
||||||
filename(name)
|
filename(name.utf8Str())
|
||||||
{
|
{
|
||||||
/* write byte-order marker **************************************/
|
/* write byte-order marker **************************************/
|
||||||
write((char*)&EndianMagic, sizeof(EndianMagic));
|
write((char*)&EndianMagic, sizeof(EndianMagic));
|
||||||
@ -138,10 +138,10 @@ gzContainerWriter::writeContainer(ContainerType Type, SGPropertyNode* root)
|
|||||||
* gzContainerReader
|
* gzContainerReader
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
gzContainerReader::gzContainerReader(const std::string& name,
|
gzContainerReader::gzContainerReader(const SGPath& name,
|
||||||
const std::string& fileMagic) :
|
const std::string& fileMagic) :
|
||||||
sg_gzifstream(SGPath(name), ios_in | ios_binary),
|
sg_gzifstream(SGPath(name), ios_in | ios_binary),
|
||||||
filename(name)
|
filename(name.utf8Str())
|
||||||
{
|
{
|
||||||
bool ok = (good() && !eof());
|
bool ok = (good() && !eof());
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ typedef int ContainerType;
|
|||||||
class gzContainerReader : public sg_gzifstream
|
class gzContainerReader : public sg_gzifstream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
gzContainerReader( const std::string& name,
|
gzContainerReader( const SGPath& name,
|
||||||
const std::string& fileMagic);
|
const std::string& fileMagic);
|
||||||
|
|
||||||
bool readContainerHeader(ContainerType* pType, size_t* pSize);
|
bool readContainerHeader(ContainerType* pType, size_t* pSize);
|
||||||
@ -48,7 +48,7 @@ private:
|
|||||||
class gzContainerWriter : public sg_gzofstream
|
class gzContainerWriter : public sg_gzofstream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
gzContainerWriter( const std::string& name,
|
gzContainerWriter( const SGPath& name,
|
||||||
const std::string& fileMagic);
|
const std::string& fileMagic);
|
||||||
|
|
||||||
bool writeContainerHeader(ContainerType Type, size_t Size);
|
bool writeContainerHeader(ContainerType Type, size_t Size);
|
||||||
|
@ -93,7 +93,7 @@ SGMakeState(const SGPath &path, const char* colorTexture,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
SGCloudLayer::SGCloudLayer( const string &tex_path ) :
|
SGCloudLayer::SGCloudLayer( const SGPath &tex_path ) :
|
||||||
cloud_root(new osg::Switch),
|
cloud_root(new osg::Switch),
|
||||||
layer_root(new osg::Switch),
|
layer_root(new osg::Switch),
|
||||||
group_top(new osg::Group),
|
group_top(new osg::Group),
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#include <osg/Switch>
|
#include <osg/Switch>
|
||||||
|
|
||||||
class SGCloudField;
|
class SGCloudField;
|
||||||
|
class SGPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class layer to model a single cloud layer
|
* A class layer to model a single cloud layer
|
||||||
@ -73,7 +74,7 @@ public:
|
|||||||
* Constructor
|
* Constructor
|
||||||
* @param tex_path the path to the set of cloud textures
|
* @param tex_path the path to the set of cloud textures
|
||||||
*/
|
*/
|
||||||
SGCloudLayer( const std::string &tex_path );
|
SGCloudLayer( const SGPath &tex_path );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
|
@ -296,8 +296,9 @@ void SGSky::set_3dCloudUseImpostors(bool imp)
|
|||||||
SGCloudField::setUseImpostors(imp);
|
SGCloudField::setUseImpostors(imp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SGSky::texture_path( const std::string& path ) {
|
void SGSky::set_texture_path( const SGPath& path )
|
||||||
tex_path = SGPath( path );
|
{
|
||||||
|
tex_path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
// modify the current visibility based on cloud layers, thickness,
|
// modify the current visibility based on cloud layers, thickness,
|
||||||
|
@ -326,7 +326,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @param path Base path to texture locations
|
* @param path Base path to texture locations
|
||||||
*/
|
*/
|
||||||
void texture_path( const std::string& path );
|
void set_texture_path( const SGPath& path );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current sun color
|
* Get the current sun color
|
||||||
|
Loading…
Reference in New Issue
Block a user