mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 22:44:15 +02:00
lazy load stars file only if stars render enabled
This commit is contained in:
parent
3c150c3ec6
commit
78c62f29c3
3 changed files with 9 additions and 5 deletions
|
@ -1654,8 +1654,6 @@ void Application::init() {
|
|||
_headMouseX = _mouseX = _glWidget->width() / 2;
|
||||
_headMouseY = _mouseY = _glWidget->height() / 2;
|
||||
|
||||
_stars.readInput(STAR_FILE, STAR_CACHE_FILE, 0);
|
||||
|
||||
_myAvatar.init();
|
||||
_myAvatar.setPosition(START_LOCATION);
|
||||
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
|
||||
|
@ -1681,7 +1679,6 @@ void Application::init() {
|
|||
|
||||
printLog("Loaded settings.\n");
|
||||
|
||||
|
||||
sendAvatarVoxelURLMessage(_myAvatar.getVoxels()->getVoxelURL());
|
||||
}
|
||||
|
||||
|
@ -2238,6 +2235,9 @@ void Application::displaySide(Camera& whichCamera) {
|
|||
glMateriali(GL_FRONT, GL_SHININESS, 96);
|
||||
|
||||
if (_renderStarsOn->isChecked()) {
|
||||
if (!_stars.getFileLoaded()) {
|
||||
_stars.readInput(STAR_FILE, STAR_CACHE_FILE, 0);
|
||||
}
|
||||
// should be the first rendering pass - w/o depth buffer / lighting
|
||||
|
||||
// compute starfield alpha based on distance from atmosphere
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#undef __interface__Starfield_impl__
|
||||
|
||||
Stars::Stars() :
|
||||
_controller(0l) {
|
||||
_controller(0l), _fileLoaded(false) {
|
||||
_controller = new starfield::Controller;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,8 @@ Stars::~Stars() {
|
|||
}
|
||||
|
||||
bool Stars::readInput(const char* url, const char* cacheFile, unsigned limit) {
|
||||
return _controller->readInput(url, cacheFile, limit);
|
||||
_fileLoaded = _controller->readInput(url, cacheFile, limit);
|
||||
return _fileLoaded;
|
||||
}
|
||||
|
||||
bool Stars::setResolution(unsigned k) {
|
||||
|
|
|
@ -65,6 +65,7 @@ class Stars {
|
|||
float changeLOD(float factor,
|
||||
float overalloc = 0.25, float realloc = 0.15);
|
||||
|
||||
bool getFileLoaded() const { return _fileLoaded; };
|
||||
private:
|
||||
// don't copy/assign
|
||||
Stars(Stars const&); // = delete;
|
||||
|
@ -73,6 +74,8 @@ class Stars {
|
|||
// variables
|
||||
|
||||
starfield::Controller* _controller;
|
||||
|
||||
bool _fileLoaded;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue