Merging with master

This commit is contained in:
samcake 2016-05-09 12:01:58 -07:00
commit 37f16e9c86
3 changed files with 31 additions and 22 deletions

View file

@ -9,6 +9,9 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
#include <chrono>
#include <thread>
#include <NodeList.h> #include <NodeList.h>
#include <NumericalConstants.h> #include <NumericalConstants.h>
#include <udt/PacketHeaders.h> #include <udt/PacketHeaders.h>
@ -101,13 +104,16 @@ bool OctreeSendThread::process() {
int elapsed = (usecTimestampNow() - start); int elapsed = (usecTimestampNow() - start);
int usecToSleep = OCTREE_SEND_INTERVAL_USECS - elapsed; int usecToSleep = OCTREE_SEND_INTERVAL_USECS - elapsed;
if (usecToSleep > 0) { if (usecToSleep <= 0) {
PerformanceWarning warn(false,"OctreeSendThread... usleep()",false,&_usleepTime,&_usleepCalls);
usleep(usecToSleep);
} else {
const int MIN_USEC_TO_SLEEP = 1; const int MIN_USEC_TO_SLEEP = 1;
usleep(MIN_USEC_TO_SLEEP); usecToSleep = MIN_USEC_TO_SLEEP;
} }
{
PerformanceWarning warn(false,"OctreeSendThread... usleep()",false,&_usleepTime,&_usleepCalls);
std::this_thread::sleep_for(std::chrono::microseconds(usecToSleep));
}
} }
return isStillRunning(); // keep running till they terminate us return isStillRunning(); // keep running till they terminate us

View file

@ -104,40 +104,40 @@ const QImage& image, bool isLinear, bool doCompress) {
if (image.hasAlphaChannel()) { if (image.hasAlphaChannel()) {
gpu::Semantic gpuSemantic; gpu::Semantic gpuSemantic;
gpu::Semantic mipSemantic; gpu::Semantic mipSemantic;
if (!isLinear) { if (isLinear) {
mipSemantic = gpu::SBGRA;
if (doCompress) {
gpuSemantic = gpu::COMPRESSED_SRGBA;
} else {
gpuSemantic = gpu::SRGBA;
}
} else {
mipSemantic = gpu::BGRA; mipSemantic = gpu::BGRA;
if (doCompress) { if (doCompress) {
gpuSemantic = gpu::COMPRESSED_RGBA; gpuSemantic = gpu::COMPRESSED_RGBA;
} else { } else {
gpuSemantic = gpu::RGBA; gpuSemantic = gpu::RGBA;
} }
} else {
mipSemantic = gpu::SBGRA;
if (doCompress) {
gpuSemantic = gpu::COMPRESSED_SRGBA;
} else {
gpuSemantic = gpu::SRGBA;
}
} }
formatGPU = gpu::Element(gpu::VEC4, gpu::NUINT8, gpuSemantic); formatGPU = gpu::Element(gpu::VEC4, gpu::NUINT8, gpuSemantic);
formatMip = gpu::Element(gpu::VEC4, gpu::NUINT8, mipSemantic); formatMip = gpu::Element(gpu::VEC4, gpu::NUINT8, mipSemantic);
} else { } else {
gpu::Semantic gpuSemantic; gpu::Semantic gpuSemantic;
gpu::Semantic mipSemantic; gpu::Semantic mipSemantic;
if (!isLinear) { if (isLinear) {
mipSemantic = gpu::SRGB;
if (doCompress) {
gpuSemantic = gpu::COMPRESSED_SRGB;
} else {
gpuSemantic = gpu::SRGB;
}
} else {
mipSemantic = gpu::RGB; mipSemantic = gpu::RGB;
if (doCompress) { if (doCompress) {
gpuSemantic = gpu::COMPRESSED_RGB; gpuSemantic = gpu::COMPRESSED_RGB;
} else { } else {
gpuSemantic = gpu::RGB; gpuSemantic = gpu::RGB;
} }
} else {
mipSemantic = gpu::SRGB;
if (doCompress) {
gpuSemantic = gpu::COMPRESSED_SRGB;
} else {
gpuSemantic = gpu::SRGB;
}
} }
formatGPU = gpu::Element(gpu::VEC3, gpu::NUINT8, gpuSemantic); formatGPU = gpu::Element(gpu::VEC3, gpu::NUINT8, gpuSemantic);
formatMip = gpu::Element(gpu::VEC3, gpu::NUINT8, mipSemantic); formatMip = gpu::Element(gpu::VEC3, gpu::NUINT8, mipSemantic);

View file

@ -9,6 +9,9 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
#include <chrono>
#include <thread>
#include <cstdio> #include <cstdio>
#include <fstream> #include <fstream>
#include <time.h> #include <time.h>
@ -201,7 +204,7 @@ bool OctreePersistThread::process() {
if (isStillRunning()) { if (isStillRunning()) {
quint64 MSECS_TO_USECS = 1000; quint64 MSECS_TO_USECS = 1000;
quint64 USECS_TO_SLEEP = 10 * MSECS_TO_USECS; // every 10ms quint64 USECS_TO_SLEEP = 10 * MSECS_TO_USECS; // every 10ms
usleep(USECS_TO_SLEEP); std::this_thread::sleep_for(std::chrono::microseconds(USECS_TO_SLEEP));
// do our updates then check to save... // do our updates then check to save...
_tree->update(); _tree->update();