mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-02 05:01:44 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into daft
This commit is contained in:
commit
dd84bf010b
12 changed files with 84 additions and 53 deletions
|
@ -336,7 +336,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
_enableProcessOctreeThread(true),
|
||||
_octreeProcessor(),
|
||||
_nodeBoundsDisplay(this),
|
||||
_applicationOverlay(),
|
||||
_runningScriptsWidget(NULL),
|
||||
_runningScriptsWidgetWasVisible(false),
|
||||
_trayIcon(new QSystemTrayIcon(_window)),
|
||||
|
@ -347,7 +346,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
_notifiedPacketVersionMismatchThisDomain(false),
|
||||
_domainConnectionRefusals(QList<QString>()),
|
||||
_maxOctreePPS(maxOctreePacketsPerSecond.get()),
|
||||
_lastFaceTrackerUpdate(0)
|
||||
_lastFaceTrackerUpdate(0),
|
||||
_applicationOverlay()
|
||||
{
|
||||
setInstance(this);
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -524,6 +524,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
_window->setVisible(true);
|
||||
_glWidget->setFocusPolicy(Qt::StrongFocus);
|
||||
_glWidget->setFocus();
|
||||
_glWidget->setCursor(Qt::BlankCursor);
|
||||
|
||||
// enable mouse tracking; otherwise, we only get drag events
|
||||
_glWidget->setMouseTracking(true);
|
||||
|
@ -1891,8 +1892,6 @@ void Application::setEnableVRMode(bool enableVRMode) {
|
|||
}
|
||||
|
||||
resizeGL();
|
||||
|
||||
updateCursorVisibility();
|
||||
}
|
||||
|
||||
void Application::setLowVelocityFilter(bool lowVelocityFilter) {
|
||||
|
@ -2401,19 +2400,8 @@ void Application::updateCursor(float deltaTime) {
|
|||
lastMousePos = QCursor::pos();
|
||||
}
|
||||
|
||||
void Application::updateCursorVisibility() {
|
||||
if (!_cursorVisible ||
|
||||
Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode) ||
|
||||
Menu::getInstance()->isOptionChecked(MenuOption::Enable3DTVMode)) {
|
||||
_window->setCursor(Qt::BlankCursor);
|
||||
} else {
|
||||
_window->unsetCursor();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::setCursorVisible(bool visible) {
|
||||
_cursorVisible = visible;
|
||||
updateCursorVisibility();
|
||||
}
|
||||
|
||||
void Application::update(float deltaTime) {
|
||||
|
|
|
@ -475,8 +475,6 @@ private:
|
|||
void updateProjectionMatrix();
|
||||
void updateProjectionMatrix(Camera& camera, bool updateViewFrustum = true);
|
||||
|
||||
void updateCursorVisibility();
|
||||
|
||||
void sendPingPackets();
|
||||
|
||||
void initDisplay();
|
||||
|
|
|
@ -14,7 +14,18 @@
|
|||
|
||||
#include "DeviceTracker.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
#endif
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
|
|
|
@ -267,9 +267,8 @@ void ApplicationOverlay::displayOverlayTexture() {
|
|||
glLoadIdentity();
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_LIGHTING);
|
||||
if (_alpha < 1.0) {
|
||||
glEnable(GL_BLEND);
|
||||
}
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glViewport(0, 0, qApp->getDeviceSize().width(), qApp->getDeviceSize().height());
|
||||
|
||||
static const glm::vec2 topLeft(-1, 1);
|
||||
|
@ -277,9 +276,38 @@ void ApplicationOverlay::displayOverlayTexture() {
|
|||
static const glm::vec2 texCoordTopLeft(0.0f, 1.0f);
|
||||
static const glm::vec2 texCoordBottomRight(1.0f, 0.0f);
|
||||
with_each_texture(_overlays.getTexture(), _newUiTexture, [&] {
|
||||
DependencyManager::get<GeometryCache>()->renderQuad(topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight,
|
||||
DependencyManager::get<GeometryCache>()->renderQuad(
|
||||
topLeft, bottomRight,
|
||||
texCoordTopLeft, texCoordBottomRight,
|
||||
glm::vec4(1.0f, 1.0f, 1.0f, _alpha));
|
||||
});
|
||||
|
||||
if (!_crosshairTexture) {
|
||||
_crosshairTexture = DependencyManager::get<TextureCache>()->
|
||||
getImageTexture(PathUtils::resourcesPath() + "images/sixense-reticle.png");
|
||||
}
|
||||
|
||||
//draw the mouse pointer
|
||||
glm::vec2 canvasSize = qApp->getCanvasSize();
|
||||
glm::vec2 mouseSize = 32.0f / canvasSize;
|
||||
auto mouseTopLeft = topLeft * mouseSize;
|
||||
auto mouseBottomRight = bottomRight * mouseSize;
|
||||
vec2 mousePosition = vec2(qApp->getMouseX(), qApp->getMouseY());
|
||||
mousePosition /= canvasSize;
|
||||
mousePosition *= 2.0f;
|
||||
mousePosition -= 1.0f;
|
||||
mousePosition.y *= -1.0f;
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBindTexture(GL_TEXTURE_2D, gpu::GLBackend::getTextureID(_crosshairTexture));
|
||||
glm::vec4 reticleColor = { RETICLE_COLOR[0], RETICLE_COLOR[1], RETICLE_COLOR[2], 1.0f };
|
||||
DependencyManager::get<GeometryCache>()->renderQuad(
|
||||
mouseTopLeft + mousePosition, mouseBottomRight + mousePosition,
|
||||
texCoordTopLeft, texCoordBottomRight,
|
||||
reticleColor);
|
||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_CONSTANT_ALPHA, GL_ONE);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
} glPopMatrix();
|
||||
}
|
||||
|
||||
|
@ -428,6 +456,9 @@ void ApplicationOverlay::displayOverlayTextureStereo(Camera& whichCamera, float
|
|||
}
|
||||
|
||||
//draw the mouse pointer
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, gpu::GLBackend::getTextureID(_crosshairTexture));
|
||||
glm::vec2 canvasSize = qApp->getCanvasSize();
|
||||
const float reticleSize = 40.0f / canvasSize.x * quadWidth;
|
||||
|
@ -557,7 +588,9 @@ void ApplicationOverlay::renderPointers() {
|
|||
_crosshairTexture = TextureCache::getImageTexture(PathUtils::resourcesPath() + "images/sixense-reticle.png");
|
||||
}
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, gpu::GLBackend::getTextureID(_crosshairTexture));
|
||||
|
||||
|
@ -719,8 +752,14 @@ void ApplicationOverlay::renderControllerPointers() {
|
|||
}
|
||||
|
||||
void ApplicationOverlay::renderPointersOculus() {
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, gpu::GLBackend::getTextureID(_crosshairTexture));
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
//Controller Pointers
|
||||
|
@ -745,6 +784,8 @@ void ApplicationOverlay::renderPointersOculus() {
|
|||
}
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
//Renders a small magnification of the currently bound texture at the coordinates
|
||||
|
|
|
@ -232,7 +232,7 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
|||
|
||||
remapTextures();
|
||||
{
|
||||
float alpha = getLocalRenderAlpha();
|
||||
// float alpha = getLocalRenderAlpha();
|
||||
|
||||
if (!_model || _needsModelReload) {
|
||||
// TODO: this getModel() appears to be about 3% of model render time. We should optimize
|
||||
|
|
|
@ -213,7 +213,7 @@ uint8_t RenderablePolyVoxEntityItem::getVoxel(int x, int y, int z) {
|
|||
// if _voxelSurfaceStyle is SURFACE_EDGED_CUBIC, we maintain an extra layer of
|
||||
// voxels all around the requested voxel space. Having the empty voxels around
|
||||
// the edges changes how the surface extractor behaves.
|
||||
|
||||
|
||||
if (_voxelSurfaceStyle == SURFACE_EDGED_CUBIC) {
|
||||
return _volData->getVoxelAt(x + 1, y + 1, z + 1);
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ void RenderablePolyVoxEntityItem::updateOnCount(int x, int y, int z, uint8_t toV
|
|||
if (!inUserBounds(_volData, _voxelSurfaceStyle, x, y, z)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
uint8_t uVoxelValue = getVoxel(x, y, z);
|
||||
if (toValue != 0) {
|
||||
if (uVoxelValue == 0) {
|
||||
|
@ -347,8 +347,8 @@ void RenderablePolyVoxEntityItem::getModel() {
|
|||
sizeof(PolyVox::PositionMaterialNormal),
|
||||
gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::RAW)));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// auto normalAttrib = mesh->getAttributeBuffer(gpu::Stream::NORMAL);
|
||||
// for (auto normal = normalAttrib.begin<glm::vec3>(); normal != normalAttrib.end<glm::vec3>(); normal++) {
|
||||
// (*normal) = -(*normal);
|
||||
|
@ -363,7 +363,7 @@ void RenderablePolyVoxEntityItem::getModel() {
|
|||
// gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::RAW)));
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef WANT_DEBUG
|
||||
qDebug() << "---- vecIndices.size() =" << vecIndices.size();
|
||||
qDebug() << "---- vecVertices.size() =" << vecVertices.size();
|
||||
|
@ -379,7 +379,7 @@ void RenderablePolyVoxEntityItem::render(RenderArgs* args) {
|
|||
if (_needsModelReload) {
|
||||
getModel();
|
||||
}
|
||||
|
||||
|
||||
Transform transform;
|
||||
transform.setTranslation(getPosition() - getRegistrationPoint() * getDimensions());
|
||||
transform.setRotation(getRotation());
|
||||
|
@ -398,7 +398,7 @@ void RenderablePolyVoxEntityItem::render(RenderArgs* args) {
|
|||
mesh->getVertexBuffer()._stride);
|
||||
batch.setIndexBuffer(gpu::UINT32, mesh->getIndexBuffer()._buffer, 0);
|
||||
batch.drawIndexed(gpu::TRIANGLES, mesh->getNumIndices(), 0);
|
||||
|
||||
|
||||
RenderableDebugableEntityItem::render(this, args);
|
||||
}
|
||||
|
||||
|
@ -448,14 +448,13 @@ bool RenderablePolyVoxEntityItem::findDetailedRayIntersection(const glm::vec3& o
|
|||
glm::vec3 normDirection = glm::normalize(direction);
|
||||
|
||||
// the PolyVox ray intersection code requires a near and far point.
|
||||
glm::vec3 scale = getDimensions() / _voxelVolumeSize; // meters / voxel-units
|
||||
// set ray cast length to long enough to cover all of the voxel space
|
||||
// set ray cast length to long enough to cover all of the voxel space
|
||||
float distanceToEntity = glm::distance(origin, getPosition());
|
||||
float largestDimension = glm::max(getDimensions().x, getDimensions().y, getDimensions().z) * 2.0f;
|
||||
glm::vec3 farPoint = origin + normDirection * (distanceToEntity + largestDimension);
|
||||
glm::vec4 originInVoxel = wtvMatrix * glm::vec4(origin, 1.0f);
|
||||
glm::vec4 farInVoxel = wtvMatrix * glm::vec4(farPoint, 1.0f);
|
||||
|
||||
|
||||
PolyVox::Vector3DFloat startPoint(originInVoxel.x, originInVoxel.y, originInVoxel.z);
|
||||
PolyVox::Vector3DFloat endPoint(farInVoxel.x, farInVoxel.y, farInVoxel.z);
|
||||
|
||||
|
@ -479,7 +478,7 @@ bool RenderablePolyVoxEntityItem::findDetailedRayIntersection(const glm::vec3& o
|
|||
}
|
||||
|
||||
result -= glm::vec4(0.5f, 0.5f, 0.5f, 0.0f);
|
||||
|
||||
|
||||
glm::vec4 intersectedWorldPosition = voxelToWorldMatrix() * result;
|
||||
|
||||
distance = glm::distance(glm::vec3(intersectedWorldPosition), origin);
|
||||
|
@ -556,9 +555,9 @@ void RenderablePolyVoxEntityItem::decompressVolumeData() {
|
|||
<< voxelXSize << voxelYSize << voxelZSize;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int rawSize = voxelXSize * voxelYSize * voxelZSize;
|
||||
|
||||
|
||||
QByteArray compressedData;
|
||||
reader >> compressedData;
|
||||
QByteArray uncompressedData = qUncompress(compressedData);
|
||||
|
@ -635,9 +634,6 @@ void RenderablePolyVoxEntityItem::computeShapeInfo(ShapeInfo& info) {
|
|||
float offL = -0.5f;
|
||||
float offH = 0.5f;
|
||||
|
||||
// float offL = 0.0f;
|
||||
// float offH = 1.0f;
|
||||
|
||||
glm::vec3 p000 = glm::vec3(wToM * glm::vec4(x + offL, y + offL, z + offL, 1.0f));
|
||||
glm::vec3 p001 = glm::vec3(wToM * glm::vec4(x + offL, y + offL, z + offH, 1.0f));
|
||||
glm::vec3 p010 = glm::vec3(wToM * glm::vec4(x + offL, y + offH, z + offL, 1.0f));
|
||||
|
|
|
@ -191,8 +191,8 @@ void RenderableWebEntityItem::render(RenderArgs* args) {
|
|||
}
|
||||
|
||||
void RenderableWebEntityItem::setSourceUrl(const QString& value) {
|
||||
qDebug() << "Setting web entity source URL to " << value;
|
||||
if (_sourceUrl != value) {
|
||||
qDebug() << "Setting web entity source URL to " << value;
|
||||
_sourceUrl = value;
|
||||
if (_webSurface) {
|
||||
AbstractViewStateInterface::instance()->postLambdaEvent([this] {
|
||||
|
|
|
@ -86,6 +86,7 @@ bool LineEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
|
||||
void LineEntityItem::setLinePoints(const QVector<glm::vec3>& points) {
|
||||
QVector<glm::vec3> sanitizedPoints;
|
||||
int invalidPoints = 0;
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
glm::vec3 point = points.at(i);
|
||||
// Make sure all of our points are valid numbers.
|
||||
|
@ -93,9 +94,12 @@ void LineEntityItem::setLinePoints(const QVector<glm::vec3>& points) {
|
|||
if (point.x > 0 && point.y > 0 && point.z > 0){
|
||||
sanitizedPoints << point;
|
||||
} else {
|
||||
qDebug() << "INVALID POINT";
|
||||
++invalidPoints;
|
||||
}
|
||||
}
|
||||
if (invalidPoints > 0) {
|
||||
qDebug() << "Line with" << invalidPoints << "INVALID POINTS";
|
||||
}
|
||||
_points = sanitizedPoints;
|
||||
_pointsChanged = true;
|
||||
}
|
||||
|
|
|
@ -605,9 +605,6 @@ const int NUM_BYTES_STUN_HEADER = 20;
|
|||
|
||||
void LimitedNodeList::sendSTUNRequest() {
|
||||
|
||||
static quint64 lastTimeStamp = usecTimestampNow();
|
||||
lastTimeStamp = usecTimestampNow();
|
||||
|
||||
const int NUM_INITIAL_STUN_REQUESTS_BEFORE_FAIL = 10;
|
||||
|
||||
if (!_hasCompletedInitialSTUN) {
|
||||
|
|
|
@ -78,8 +78,8 @@ Model::Model(QObject* parent) :
|
|||
_showTrueJointTransforms(true),
|
||||
_lodDistance(0.0f),
|
||||
_pupilDilation(0.0f),
|
||||
_isVisible(true),
|
||||
_url("http://invalid.com"),
|
||||
_isVisible(true),
|
||||
_blendNumber(0),
|
||||
_appliedBlendNumber(0),
|
||||
_calculatedMeshPartBoxesValid(false),
|
||||
|
@ -916,8 +916,6 @@ bool Model::addToScene(std::shared_ptr<render::Scene> scene, render::PendingChan
|
|||
|
||||
bool somethingAdded = false;
|
||||
|
||||
qDebug() << "Model::addToScene : " << this->getURL().toString();
|
||||
|
||||
// allow the attachments to add to scene
|
||||
foreach (Model* attachment, _attachments) {
|
||||
bool attachementSomethingAdded = attachment->addToScene(scene, pendingChanges);
|
||||
|
@ -957,7 +955,6 @@ void Model::removeFromScene(std::shared_ptr<render::Scene> scene, render::Pendin
|
|||
}
|
||||
_renderItems.clear();
|
||||
_readyWhenAdded = false;
|
||||
qDebug() << "Model::removeFromScene : " << this->getURL().toString();
|
||||
}
|
||||
|
||||
bool Model::render(RenderArgs* renderArgs, float alpha) {
|
||||
|
@ -2121,8 +2118,8 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran
|
|||
}
|
||||
|
||||
Locations* locations = nullptr;
|
||||
pickPrograms(batch, mode, translucent, alphaThreshold, hasLightmap, hasTangents, hasSpecular, isSkinned, wireframe,
|
||||
args, locations);
|
||||
pickPrograms(batch, mode, translucentMesh, alphaThreshold, hasLightmap, hasTangents, hasSpecular, isSkinned, wireframe,
|
||||
args, locations);
|
||||
|
||||
updateVisibleJointStates();
|
||||
|
||||
|
|
|
@ -312,8 +312,7 @@ protected:
|
|||
float getLimbLength(int jointIndex) const;
|
||||
|
||||
/// Allow sub classes to force invalidating the bboxes
|
||||
void invalidCalculatedMeshBoxes() {
|
||||
qDebug() << "invalidCalculatedMeshBoxes()";
|
||||
void invalidCalculatedMeshBoxes() {
|
||||
_calculatedMeshBoxesValid = false;
|
||||
_calculatedMeshPartBoxesValid = false;
|
||||
_calculatedMeshTrianglesValid = false;
|
||||
|
|
|
@ -174,7 +174,7 @@ void render::renderItems(const SceneContextPointer& sceneContext, const RenderCo
|
|||
auto& scene = sceneContext->_scene;
|
||||
RenderArgs* args = renderContext->args;
|
||||
// render
|
||||
if ((maxDrawnItems < 0) || (maxDrawnItems > inItems.size())) {
|
||||
if ((maxDrawnItems < 0) || (maxDrawnItems > (int) inItems.size())) {
|
||||
for (auto itemDetails : inItems) {
|
||||
auto item = scene->getItem(itemDetails.id);
|
||||
item.render(args);
|
||||
|
|
Loading…
Reference in a new issue