Merge pull request #641 from ZappoMan/bug_fixes

Two small bug fixes
This commit is contained in:
Philip Rosedale 2013-07-11 07:46:57 -07:00
commit 8ea2b46264
4 changed files with 10 additions and 6 deletions

View file

@ -1689,8 +1689,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);
@ -1716,7 +1714,6 @@ void Application::init() {
printLog("Loaded settings.\n");
sendAvatarVoxelURLMessage(_myAvatar.getVoxels()->getVoxelURL());
_palette.init(_glWidget->width(), _glWidget->height());
@ -2290,6 +2287,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

View file

@ -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) {

View file

@ -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;
};

View file

@ -1284,6 +1284,7 @@ int VoxelTree::encodeTreeBitstreamRecursion(VoxelNode* node, unsigned char* outp
if (params.viewFrustum && childNode->isColored() && !childNode->isLeaf()) {
int grandChildrenInView = 0;
int grandChildrenInLOD = 0;
float grandChildBoundaryDistance = boundaryDistanceForRenderLevel(childNode->getLevel() + 2);
for (int grandChildIndex = 0; grandChildIndex < NUMBER_OF_CHILDREN; grandChildIndex++) {
VoxelNode* grandChild = childNode->getChildAtIndex(grandChildIndex);
@ -1291,7 +1292,6 @@ int VoxelTree::encodeTreeBitstreamRecursion(VoxelNode* node, unsigned char* outp
grandChildrenInView++;
float grandChildDistance = grandChild->distanceToCamera(*params.viewFrustum);
float grandChildBoundaryDistance = boundaryDistanceForRenderLevel(grandChild->getLevel() + 1);
if (grandChildDistance < grandChildBoundaryDistance) {
grandChildrenInLOD++;
}