A real MSVC fix this time
This commit is contained in:
parent
b7dd267807
commit
557474095f
@ -59,8 +59,7 @@ SGMaterial::SGMaterial( const string &texpath )
|
|||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
|
|
||||||
_internal_state st = { NULL, "", false };
|
_internal_state st( NULL, texpath, false );
|
||||||
st.texture_path = texpath;
|
|
||||||
_status.push_back( st );
|
_status.push_back( st );
|
||||||
|
|
||||||
build_ssg_state( true );
|
build_ssg_state( true );
|
||||||
@ -105,7 +104,7 @@ SGMaterial::read_properties( const string &fg_root, const SGPropertyNode * props
|
|||||||
tpath.append("Textures");
|
tpath.append("Textures");
|
||||||
tpath.append(tname);
|
tpath.append(tname);
|
||||||
}
|
}
|
||||||
_internal_state st = { NULL, tpath.str(), false };
|
_internal_state st( NULL, tpath.str(), false );
|
||||||
_status.push_back( st );
|
_status.push_back( st );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +113,7 @@ SGMaterial::read_properties( const string &fg_root, const SGPropertyNode * props
|
|||||||
SGPath tpath( fg_root );
|
SGPath tpath( fg_root );
|
||||||
tpath.append("Textures");
|
tpath.append("Textures");
|
||||||
tpath.append(tname);
|
tpath.append(tname);
|
||||||
_internal_state st = { NULL, tpath.str(), true };
|
_internal_state st( NULL, tpath.str(), true );
|
||||||
_status.push_back( st );
|
_status.push_back( st );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,6 +163,7 @@ void
|
|||||||
SGMaterial::init ()
|
SGMaterial::init ()
|
||||||
{
|
{
|
||||||
_status.clear();
|
_status.clear();
|
||||||
|
_current_ptr = 0;
|
||||||
xsize = 0;
|
xsize = 0;
|
||||||
ysize = 0;
|
ysize = 0;
|
||||||
wrapu = true;
|
wrapu = true;
|
||||||
@ -201,19 +201,17 @@ SGMaterial::load_texture ( int n )
|
|||||||
}
|
}
|
||||||
|
|
||||||
ssgSimpleState *
|
ssgSimpleState *
|
||||||
SGMaterial::get_state (int n) const
|
SGMaterial::get_state (int n)
|
||||||
{
|
{
|
||||||
static unsigned current = 0;
|
|
||||||
|
|
||||||
if (_status.size() == 0) {
|
if (_status.size() == 0) {
|
||||||
SG_LOG( SG_GENERAL, SG_WARN, "No state available.");
|
SG_LOG( SG_GENERAL, SG_WARN, "No state available.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ++current >= _status.size())
|
if ( _current_ptr >= _status.size())
|
||||||
current = 0;
|
_current_ptr = 0;
|
||||||
|
|
||||||
return (n >= 0) ? _status[n].state : _status[current].state;
|
return (n >= 0) ? _status[n].state : _status[_current_ptr++].state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -266,7 +264,7 @@ SGMaterial::build_ssg_state( bool defer_tex_load )
|
|||||||
|
|
||||||
void SGMaterial::set_ssg_state( ssgSimpleState *s )
|
void SGMaterial::set_ssg_state( ssgSimpleState *s )
|
||||||
{
|
{
|
||||||
_internal_state st = { s, "", true };
|
_internal_state st( s, "", true );
|
||||||
st.state->ref();
|
st.state->ref();
|
||||||
_status.push_back( st );
|
_status.push_back( st );
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Get the textured state.
|
* Get the textured state.
|
||||||
*/
|
*/
|
||||||
virtual ssgSimpleState *get_state (int n = -1) const;
|
virtual ssgSimpleState *get_state (int n = -1);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -198,11 +198,13 @@ protected:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
typedef struct {
|
struct _internal_state {
|
||||||
|
_internal_state( ssgSimpleState *s, const string &t, bool l )
|
||||||
|
: state(s), texture_path(t), texture_loaded(l) {}
|
||||||
ssgSimpleState *state;
|
ssgSimpleState *state;
|
||||||
string texture_path;
|
string texture_path;
|
||||||
bool texture_loaded;
|
bool texture_loaded;
|
||||||
} _internal_state;
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -214,6 +216,9 @@ private:
|
|||||||
// texture status
|
// texture status
|
||||||
vector<_internal_state> _status;
|
vector<_internal_state> _status;
|
||||||
|
|
||||||
|
// Round-robin counter
|
||||||
|
int _current_ptr;
|
||||||
|
|
||||||
// texture size
|
// texture size
|
||||||
double xsize, ysize;
|
double xsize, ysize;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user