mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 17:59:33 +02:00
resolve conflicts on merge with upstream/master
This commit is contained in:
commit
6cff75f7c1
36 changed files with 254 additions and 107 deletions
|
@ -18,6 +18,7 @@
|
||||||
#include <AccountManager.h>
|
#include <AccountManager.h>
|
||||||
#include <AddressManager.h>
|
#include <AddressManager.h>
|
||||||
#include <Assignment.h>
|
#include <Assignment.h>
|
||||||
|
#include <AvatarHashMap.h>
|
||||||
#include <EntityScriptingInterface.h>
|
#include <EntityScriptingInterface.h>
|
||||||
#include <LogHandler.h>
|
#include <LogHandler.h>
|
||||||
#include <LogUtils.h>
|
#include <LogUtils.h>
|
||||||
|
@ -53,7 +54,10 @@ AssignmentClient::AssignmentClient(int ppid, Assignment::Type requestAssignmentT
|
||||||
// create a NodeList as an unassigned client
|
// create a NodeList as an unassigned client
|
||||||
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
||||||
auto addressManager = DependencyManager::set<AddressManager>();
|
auto addressManager = DependencyManager::set<AddressManager>();
|
||||||
auto nodeList = DependencyManager::set<NodeList>(NodeType::Unassigned);
|
auto nodeList = DependencyManager::set<NodeList>(NodeType::Unassigned); // Order is important
|
||||||
|
|
||||||
|
auto animationCache = DependencyManager::set<AnimationCache>();
|
||||||
|
auto avatarHashMap = DependencyManager::set<AvatarHashMap>();
|
||||||
auto entityScriptingInterface = DependencyManager::set<EntityScriptingInterface>();
|
auto entityScriptingInterface = DependencyManager::set<EntityScriptingInterface>();
|
||||||
|
|
||||||
// make up a uuid for this child so the parent can tell us apart. This id will be changed
|
// make up a uuid for this child so the parent can tell us apart. This id will be changed
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
const QString ASSIGNMENT_CLIENT_MONITOR_TARGET_NAME = "assignment-client-monitor";
|
const QString ASSIGNMENT_CLIENT_MONITOR_TARGET_NAME = "assignment-client-monitor";
|
||||||
|
const int WAIT_FOR_CHILD_MSECS = 500;
|
||||||
|
|
||||||
AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmentClientForks,
|
AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmentClientForks,
|
||||||
const unsigned int minAssignmentClientForks,
|
const unsigned int minAssignmentClientForks,
|
||||||
|
@ -92,7 +93,26 @@ void AssignmentClientMonitor::stopChildProcesses() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// try to give all the children time to shutdown
|
// try to give all the children time to shutdown
|
||||||
waitOnChildren(15000);
|
waitOnChildren(WAIT_FOR_CHILD_MSECS);
|
||||||
|
|
||||||
|
// ask more firmly
|
||||||
|
QMutableListIterator<QProcess*> i(_childProcesses);
|
||||||
|
while (i.hasNext()) {
|
||||||
|
QProcess* childProcess = i.next();
|
||||||
|
childProcess->terminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
// try to give all the children time to shutdown
|
||||||
|
waitOnChildren(WAIT_FOR_CHILD_MSECS);
|
||||||
|
|
||||||
|
// ask even more firmly
|
||||||
|
QMutableListIterator<QProcess*> j(_childProcesses);
|
||||||
|
while (j.hasNext()) {
|
||||||
|
QProcess* childProcess = j.next();
|
||||||
|
childProcess->kill();
|
||||||
|
}
|
||||||
|
|
||||||
|
waitOnChildren(WAIT_FOR_CHILD_MSECS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssignmentClientMonitor::aboutToQuit() {
|
void AssignmentClientMonitor::aboutToQuit() {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
//For procedural walk animation
|
//For procedural walk animation
|
||||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||||
Script.include("proceduralAnimationAPI.js");
|
Script.include(HIFI_PUBLIC_BUCKET + "scripts/acScripts/proceduralAnimationAPI.js");
|
||||||
|
|
||||||
var procAnimAPI = new ProcAnimAPI();
|
var procAnimAPI = new ProcAnimAPI();
|
||||||
|
|
||||||
|
|
|
@ -208,8 +208,8 @@ var toolBar = (function () {
|
||||||
visible: false
|
visible: false
|
||||||
});
|
});
|
||||||
newZoneButton = toolBar.addTool({
|
newZoneButton = toolBar.addTool({
|
||||||
imageURL: toolIconUrl + "zonecube3.svg",
|
imageURL: toolIconUrl + "zonecube_text.svg",
|
||||||
subImage: { x: 0, y: Tool.IMAGE_WIDTH + 208, width: 256, height: 256 },
|
subImage: { x: 0, y: 128, width: 128, height: 128 },
|
||||||
width: toolWidth,
|
width: toolWidth,
|
||||||
height: toolHeight,
|
height: toolHeight,
|
||||||
alpha: 0.9,
|
alpha: 0.9,
|
||||||
|
|
|
@ -989,11 +989,12 @@ bool Application::importSVOFromURL(const QString& urlString) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Application::event(QEvent* event) {
|
bool Application::event(QEvent* event) {
|
||||||
switch (event->type()) {
|
if ((int)event->type() == (int)Lambda) {
|
||||||
case Lambda:
|
((LambdaEvent*)event)->call();
|
||||||
((LambdaEvent*)event)->call();
|
return true;
|
||||||
return true;
|
}
|
||||||
|
|
||||||
|
switch (event->type()) {
|
||||||
case QEvent::MouseMove:
|
case QEvent::MouseMove:
|
||||||
mouseMoveEvent((QMouseEvent*)event);
|
mouseMoveEvent((QMouseEvent*)event);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1467,6 +1468,9 @@ void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) {
|
void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) {
|
||||||
|
// Inhibit the menu if the user is using alt-mouse dragging
|
||||||
|
_altPressed = false;
|
||||||
|
|
||||||
if (!_aboutToQuit) {
|
if (!_aboutToQuit) {
|
||||||
_entities.mousePressEvent(event, deviceID);
|
_entities.mousePressEvent(event, deviceID);
|
||||||
}
|
}
|
||||||
|
@ -1541,6 +1545,7 @@ void Application::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::touchUpdateEvent(QTouchEvent* event) {
|
void Application::touchUpdateEvent(QTouchEvent* event) {
|
||||||
|
_altPressed = false;
|
||||||
if (event->type() == QEvent::TouchUpdate) {
|
if (event->type() == QEvent::TouchUpdate) {
|
||||||
TouchEvent thisEvent(*event, _lastTouchEvent);
|
TouchEvent thisEvent(*event, _lastTouchEvent);
|
||||||
_controllerScriptingInterface.emitTouchUpdateEvent(thisEvent); // send events to any registered scripts
|
_controllerScriptingInterface.emitTouchUpdateEvent(thisEvent); // send events to any registered scripts
|
||||||
|
@ -1576,6 +1581,7 @@ void Application::touchUpdateEvent(QTouchEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::touchBeginEvent(QTouchEvent* event) {
|
void Application::touchBeginEvent(QTouchEvent* event) {
|
||||||
|
_altPressed = false;
|
||||||
TouchEvent thisEvent(*event); // on touch begin, we don't compare to last event
|
TouchEvent thisEvent(*event); // on touch begin, we don't compare to last event
|
||||||
_controllerScriptingInterface.emitTouchBeginEvent(thisEvent); // send events to any registered scripts
|
_controllerScriptingInterface.emitTouchBeginEvent(thisEvent); // send events to any registered scripts
|
||||||
|
|
||||||
|
@ -1590,6 +1596,7 @@ void Application::touchBeginEvent(QTouchEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::touchEndEvent(QTouchEvent* event) {
|
void Application::touchEndEvent(QTouchEvent* event) {
|
||||||
|
_altPressed = false;
|
||||||
TouchEvent thisEvent(*event, _lastTouchEvent);
|
TouchEvent thisEvent(*event, _lastTouchEvent);
|
||||||
_controllerScriptingInterface.emitTouchEndEvent(thisEvent); // send events to any registered scripts
|
_controllerScriptingInterface.emitTouchEndEvent(thisEvent); // send events to any registered scripts
|
||||||
_lastTouchEvent = thisEvent;
|
_lastTouchEvent = thisEvent;
|
||||||
|
@ -1606,7 +1613,7 @@ void Application::touchEndEvent(QTouchEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::wheelEvent(QWheelEvent* event) {
|
void Application::wheelEvent(QWheelEvent* event) {
|
||||||
|
_altPressed = false;
|
||||||
_controllerScriptingInterface.emitWheelEvent(event); // send events to any registered scripts
|
_controllerScriptingInterface.emitWheelEvent(event); // send events to any registered scripts
|
||||||
|
|
||||||
// if one of our scripts have asked to capture this event, then stop processing it
|
// if one of our scripts have asked to capture this event, then stop processing it
|
||||||
|
|
|
@ -439,7 +439,7 @@ Menu::Menu() {
|
||||||
addCheckableActionToQMenuAndActionHash(leapOptionsMenu, MenuOption::LeapMotionOnHMD, 0, false);
|
addCheckableActionToQMenuAndActionHash(leapOptionsMenu, MenuOption::LeapMotionOnHMD, 0, false);
|
||||||
|
|
||||||
#ifdef HAVE_RSSDK
|
#ifdef HAVE_RSSDK
|
||||||
QMenu* realSenseOptionsMenu = handOptionsMenu->addMenu("RealSense");
|
MenuWrapper* realSenseOptionsMenu = handOptionsMenu->addMenu("RealSense");
|
||||||
addActionToQMenuAndActionHash(realSenseOptionsMenu, MenuOption::LoadRSSDKFile, 0,
|
addActionToQMenuAndActionHash(realSenseOptionsMenu, MenuOption::LoadRSSDKFile, 0,
|
||||||
RealSense::getInstance(), SLOT(loadRSSDKFile()));
|
RealSense::getInstance(), SLOT(loadRSSDKFile()));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -137,9 +137,6 @@ struct Packet {
|
||||||
|
|
||||||
const float STARTING_DDE_MESSAGE_TIME = 0.033f;
|
const float STARTING_DDE_MESSAGE_TIME = 0.033f;
|
||||||
|
|
||||||
const int FPS_TIMER_DELAY = 2000; // ms
|
|
||||||
const int FPS_TIMER_DURATION = 2000; // ms
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
// warning C4351: new behavior: elements of array 'DdeFaceTracker::_lastEyeBlinks' will be default initialized
|
// warning C4351: new behavior: elements of array 'DdeFaceTracker::_lastEyeBlinks' will be default initialized
|
||||||
// warning C4351: new behavior: elements of array 'DdeFaceTracker::_filteredEyeBlinks' will be default initialized
|
// warning C4351: new behavior: elements of array 'DdeFaceTracker::_filteredEyeBlinks' will be default initialized
|
||||||
|
|
|
@ -461,7 +461,7 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// Ensure the frame counter always increments by exactly 1
|
// Ensure the frame counter always increments by exactly 1
|
||||||
static int oldFrameIndex = -1;
|
static int oldFrameIndex = -1;
|
||||||
assert(oldFrameIndex == -1 || oldFrameIndex == _frameIndex - 1);
|
assert(oldFrameIndex == -1 || (unsigned int)oldFrameIndex == _frameIndex - 1);
|
||||||
oldFrameIndex = _frameIndex;
|
oldFrameIndex = _frameIndex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -981,7 +981,7 @@ void AudioClient::selectAudioSourceSine440() {
|
||||||
_noiseSourceEnabled = false;
|
_noiseSourceEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioClient::outputLocalInjector(bool isStereo, qreal volume, AudioInjector* injector) {
|
bool AudioClient::outputLocalInjector(bool isStereo, AudioInjector* injector) {
|
||||||
if (injector->getLocalBuffer()) {
|
if (injector->getLocalBuffer()) {
|
||||||
QAudioFormat localFormat = _desiredOutputFormat;
|
QAudioFormat localFormat = _desiredOutputFormat;
|
||||||
localFormat.setChannelCount(isStereo ? 2 : 1);
|
localFormat.setChannelCount(isStereo ? 2 : 1);
|
||||||
|
@ -990,8 +990,6 @@ bool AudioClient::outputLocalInjector(bool isStereo, qreal volume, AudioInjector
|
||||||
localFormat,
|
localFormat,
|
||||||
injector->getLocalBuffer());
|
injector->getLocalBuffer());
|
||||||
|
|
||||||
localOutput->setVolume(volume);
|
|
||||||
|
|
||||||
// move the localOutput to the same thread as the local injector buffer
|
// move the localOutput to the same thread as the local injector buffer
|
||||||
localOutput->moveToThread(injector->getLocalBuffer()->thread());
|
localOutput->moveToThread(injector->getLocalBuffer()->thread());
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ public slots:
|
||||||
|
|
||||||
void setOutputBufferSize(int numFrames);
|
void setOutputBufferSize(int numFrames);
|
||||||
|
|
||||||
virtual bool outputLocalInjector(bool isStereo, qreal volume, AudioInjector* injector);
|
virtual bool outputLocalInjector(bool isStereo, AudioInjector* injector);
|
||||||
|
|
||||||
bool switchInputToAudioDevice(const QString& inputDeviceName);
|
bool switchInputToAudioDevice(const QString& inputDeviceName);
|
||||||
bool switchOutputToAudioDevice(const QString& outputDeviceName);
|
bool switchOutputToAudioDevice(const QString& outputDeviceName);
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
AbstractAudioInterface(QObject* parent = 0) : QObject(parent) {};
|
AbstractAudioInterface(QObject* parent = 0) : QObject(parent) {};
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual bool outputLocalInjector(bool isStereo, qreal volume, AudioInjector* injector) = 0;
|
virtual bool outputLocalInjector(bool isStereo, AudioInjector* injector) = 0;
|
||||||
|
|
||||||
virtual void enableAudioSourceInject(bool enable) = 0;
|
virtual void enableAudioSourceInject(bool enable) = 0;
|
||||||
virtual void selectAudioSourcePinkNoise() = 0;
|
virtual void selectAudioSourcePinkNoise() = 0;
|
||||||
|
|
|
@ -105,11 +105,12 @@ void AudioInjector::injectLocally() {
|
||||||
|
|
||||||
_localBuffer->open(QIODevice::ReadOnly);
|
_localBuffer->open(QIODevice::ReadOnly);
|
||||||
_localBuffer->setShouldLoop(_options.loop);
|
_localBuffer->setShouldLoop(_options.loop);
|
||||||
|
_localBuffer->setVolume(_options.volume);
|
||||||
|
|
||||||
// give our current send position to the local buffer
|
// give our current send position to the local buffer
|
||||||
_localBuffer->setCurrentOffset(_currentSendPosition);
|
_localBuffer->setCurrentOffset(_currentSendPosition);
|
||||||
|
|
||||||
success = _localAudioInterface->outputLocalInjector(_options.stereo, _options.volume, this);
|
success = _localAudioInterface->outputLocalInjector(_options.stereo, this);
|
||||||
|
|
||||||
// if we're not looping and the buffer tells us it is empty then emit finished
|
// if we're not looping and the buffer tells us it is empty then emit finished
|
||||||
connect(_localBuffer, &AudioInjectorLocalBuffer::bufferEmpty, this, &AudioInjector::stop);
|
connect(_localBuffer, &AudioInjectorLocalBuffer::bufferEmpty, this, &AudioInjector::stop);
|
||||||
|
|
|
@ -16,7 +16,8 @@ AudioInjectorLocalBuffer::AudioInjectorLocalBuffer(const QByteArray& rawAudioArr
|
||||||
_rawAudioArray(rawAudioArray),
|
_rawAudioArray(rawAudioArray),
|
||||||
_shouldLoop(false),
|
_shouldLoop(false),
|
||||||
_isStopped(false),
|
_isStopped(false),
|
||||||
_currentOffset(0)
|
_currentOffset(0),
|
||||||
|
_volume(1.0f)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,6 +36,18 @@ bool AudioInjectorLocalBuffer::seek(qint64 pos) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void copy(char* to, char* from, int size, qreal factor) {
|
||||||
|
int16_t* toArray = (int16_t*) to;
|
||||||
|
int16_t* fromArray = (int16_t*) from;
|
||||||
|
int sampleSize = size / sizeof(int16_t);
|
||||||
|
|
||||||
|
for (int i = 0; i < sampleSize; i++) {
|
||||||
|
*toArray = factor * (*fromArray);
|
||||||
|
toArray++;
|
||||||
|
fromArray++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
qint64 AudioInjectorLocalBuffer::readData(char* data, qint64 maxSize) {
|
qint64 AudioInjectorLocalBuffer::readData(char* data, qint64 maxSize) {
|
||||||
if (!_isStopped) {
|
if (!_isStopped) {
|
||||||
|
|
||||||
|
@ -47,7 +60,7 @@ qint64 AudioInjectorLocalBuffer::readData(char* data, qint64 maxSize) {
|
||||||
bytesRead = bytesToEnd;
|
bytesRead = bytesToEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(data, _rawAudioArray.data() + _currentOffset, bytesRead);
|
copy(data, _rawAudioArray.data() + _currentOffset, bytesRead, _volume);
|
||||||
|
|
||||||
// now check if we are supposed to loop and if we can copy more from the beginning
|
// now check if we are supposed to loop and if we can copy more from the beginning
|
||||||
if (_shouldLoop && maxSize != bytesRead) {
|
if (_shouldLoop && maxSize != bytesRead) {
|
||||||
|
@ -78,7 +91,7 @@ qint64 AudioInjectorLocalBuffer::recursiveReadFromFront(char* data, qint64 maxSi
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy that amount
|
// copy that amount
|
||||||
memcpy(data, _rawAudioArray.data(), bytesRead);
|
copy(data, _rawAudioArray.data(), bytesRead, _volume);
|
||||||
|
|
||||||
// check if we need to call ourselves again and pull from the front again
|
// check if we need to call ourselves again and pull from the front again
|
||||||
if (bytesRead < maxSize) {
|
if (bytesRead < maxSize) {
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
#include <QtCore/qiodevice.h>
|
#include <QtCore/qiodevice.h>
|
||||||
|
|
||||||
|
#include <glm/detail/func_common.hpp>
|
||||||
|
|
||||||
class AudioInjectorLocalBuffer : public QIODevice {
|
class AudioInjectorLocalBuffer : public QIODevice {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -27,12 +29,13 @@ public:
|
||||||
qint64 writeData(const char* data, qint64 maxSize) { return 0; }
|
qint64 writeData(const char* data, qint64 maxSize) { return 0; }
|
||||||
|
|
||||||
void setShouldLoop(bool shouldLoop) { _shouldLoop = shouldLoop; }
|
void setShouldLoop(bool shouldLoop) { _shouldLoop = shouldLoop; }
|
||||||
|
|
||||||
void setCurrentOffset(int currentOffset) { _currentOffset = currentOffset; }
|
void setCurrentOffset(int currentOffset) { _currentOffset = currentOffset; }
|
||||||
|
void setVolume(float volume) { _volume = glm::clamp(volume, 0.0f, 1.0f); }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void bufferEmpty();
|
void bufferEmpty();
|
||||||
private:
|
|
||||||
|
|
||||||
|
private:
|
||||||
qint64 recursiveReadFromFront(char* data, qint64 maxSize);
|
qint64 recursiveReadFromFront(char* data, qint64 maxSize);
|
||||||
|
|
||||||
QByteArray _rawAudioArray;
|
QByteArray _rawAudioArray;
|
||||||
|
@ -40,6 +43,7 @@ private:
|
||||||
bool _isStopped;
|
bool _isStopped;
|
||||||
|
|
||||||
int _currentOffset;
|
int _currentOffset;
|
||||||
|
float _volume;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_AudioInjectorLocalBuffer_h
|
#endif // hifi_AudioInjectorLocalBuffer_h
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// RenderableBoxEntityItem.cpp
|
// RenderableBoxEntityItem.cpp
|
||||||
// interface/src
|
// libraries/entities-renderer/src/
|
||||||
//
|
//
|
||||||
// Created by Brad Hefta-Gaub on 8/6/14.
|
// Created by Brad Hefta-Gaub on 8/6/14.
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
|
@ -36,8 +36,9 @@ void RenderableBoxEntityItem::render(RenderArgs* args) {
|
||||||
getColor()[BLUE_INDEX] / MAX_COLOR, getLocalRenderAlpha());
|
getColor()[BLUE_INDEX] / MAX_COLOR, getLocalRenderAlpha());
|
||||||
|
|
||||||
|
|
||||||
|
bool debugSimulationOwnership = args->_debugFlags & RenderArgs::RENDER_DEBUG_SIMULATION_OWNERSHIP;
|
||||||
bool highlightSimulationOwnership = false;
|
bool highlightSimulationOwnership = false;
|
||||||
if (args->_debugFlags & RenderArgs::RENDER_DEBUG_SIMULATION_OWNERSHIP) {
|
if (debugSimulationOwnership) {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
const QUuid& myNodeID = nodeList->getSessionUUID();
|
const QUuid& myNodeID = nodeList->getSessionUUID();
|
||||||
highlightSimulationOwnership = (getSimulatorID() == myNodeID);
|
highlightSimulationOwnership = (getSimulatorID() == myNodeID);
|
||||||
|
@ -58,4 +59,6 @@ void RenderableBoxEntityItem::render(RenderArgs* args) {
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
|
RenderableDebugableEntityItem::render(this, args);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// RenderableBoxEntityItem.h
|
// RenderableBoxEntityItem.h
|
||||||
// interface/src/entities
|
// libraries/entities-renderer/src/
|
||||||
//
|
//
|
||||||
// Created by Brad Hefta-Gaub on 8/6/14.
|
// Created by Brad Hefta-Gaub on 8/6/14.
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
|
@ -13,8 +13,9 @@
|
||||||
#define hifi_RenderableBoxEntityItem_h
|
#define hifi_RenderableBoxEntityItem_h
|
||||||
|
|
||||||
#include <BoxEntityItem.h>
|
#include <BoxEntityItem.h>
|
||||||
|
#include "RenderableDebugableEntityItem.h"
|
||||||
|
|
||||||
class RenderableBoxEntityItem : public BoxEntityItem {
|
class RenderableBoxEntityItem : public BoxEntityItem {
|
||||||
public:
|
public:
|
||||||
static EntityItem* factory(const EntityItemID& entityID, const EntityItemProperties& properties);
|
static EntityItem* factory(const EntityItemID& entityID, const EntityItemProperties& properties);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
//
|
||||||
|
// RenderableDebugableEntityItem.cpp
|
||||||
|
// libraries/entities-renderer/src/
|
||||||
|
//
|
||||||
|
// Created by Seth Alves on 5/1/15.
|
||||||
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <glm/gtx/quaternion.hpp>
|
||||||
|
#include <gpu/GPUConfig.h>
|
||||||
|
#include <DeferredLightingEffect.h>
|
||||||
|
|
||||||
|
#include "RenderableDebugableEntityItem.h"
|
||||||
|
|
||||||
|
|
||||||
|
void RenderableDebugableEntityItem::renderBoundingBox(EntityItem* entity, RenderArgs* args, bool puffedOut) {
|
||||||
|
glm::vec3 position = entity->getPosition();
|
||||||
|
glm::vec3 center = entity->getCenter();
|
||||||
|
glm::vec3 dimensions = entity->getDimensions();
|
||||||
|
glm::quat rotation = entity->getRotation();
|
||||||
|
glm::vec4 greenColor(0.0f, 1.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
glPushMatrix();
|
||||||
|
glTranslatef(position.x, position.y, position.z);
|
||||||
|
glm::vec3 axis = glm::axis(rotation);
|
||||||
|
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
|
||||||
|
glPushMatrix();
|
||||||
|
glm::vec3 positionToCenter = center - position;
|
||||||
|
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
||||||
|
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||||
|
if (puffedOut) {
|
||||||
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(1.2f, greenColor);
|
||||||
|
} else {
|
||||||
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(1.0f, greenColor);
|
||||||
|
}
|
||||||
|
glPopMatrix();
|
||||||
|
glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RenderableDebugableEntityItem::render(EntityItem* entity, RenderArgs* args) {
|
||||||
|
bool debugSimulationOwnership = args->_debugFlags & RenderArgs::RENDER_DEBUG_SIMULATION_OWNERSHIP;
|
||||||
|
|
||||||
|
if (debugSimulationOwnership) {
|
||||||
|
quint64 now = usecTimestampNow();
|
||||||
|
if (now - entity->getLastEditedFromRemote() < 0.1f * USECS_PER_SECOND) {
|
||||||
|
renderBoundingBox(entity, args, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
//
|
||||||
|
// RenderableDebugableEntityItem.h
|
||||||
|
// libraries/entities-renderer/src/
|
||||||
|
//
|
||||||
|
// Created by Seth Alves on 5/1/15.
|
||||||
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_RenderableDebugableEntityItem_h
|
||||||
|
#define hifi_RenderableDebugableEntityItem_h
|
||||||
|
|
||||||
|
#include <EntityItem.h>
|
||||||
|
|
||||||
|
class RenderableDebugableEntityItem {
|
||||||
|
public:
|
||||||
|
static void renderBoundingBox(EntityItem* entity, RenderArgs* args, bool puffedOut);
|
||||||
|
static void render(EntityItem* entity, RenderArgs* args);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_RenderableDebugableEntityItem_h
|
|
@ -108,34 +108,6 @@ void RenderableModelEntityItem::remapTextures() {
|
||||||
_currentTextures = _textures;
|
_currentTextures = _textures;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RenderableModelEntityItem::renderBoundingBox(RenderArgs* args) {
|
|
||||||
glm::vec3 position = getPosition();
|
|
||||||
glm::vec3 center = getCenter();
|
|
||||||
glm::vec3 dimensions = getDimensions();
|
|
||||||
glm::quat rotation = getRotation();
|
|
||||||
// float size = glm::length(dimensions) / 2.0f;
|
|
||||||
|
|
||||||
const float MAX_COLOR = 255.0f;
|
|
||||||
glm::vec4 cubeColor(getColor()[RED_INDEX] / MAX_COLOR,
|
|
||||||
getColor()[GREEN_INDEX] / MAX_COLOR,
|
|
||||||
getColor()[BLUE_INDEX] / MAX_COLOR,
|
|
||||||
getLocalRenderAlpha());
|
|
||||||
|
|
||||||
glPushMatrix();
|
|
||||||
glTranslatef(position.x, position.y, position.z);
|
|
||||||
glm::vec3 axis = glm::axis(rotation);
|
|
||||||
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
|
|
||||||
glPushMatrix();
|
|
||||||
glm::vec3 positionToCenter = center - position;
|
|
||||||
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
|
||||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
|
||||||
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(1.0f, cubeColor);
|
|
||||||
glPopMatrix();
|
|
||||||
glPopMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void RenderableModelEntityItem::render(RenderArgs* args) {
|
void RenderableModelEntityItem::render(RenderArgs* args) {
|
||||||
PerformanceTimer perfTimer("RMEIrender");
|
PerformanceTimer perfTimer("RMEIrender");
|
||||||
assert(getType() == EntityTypes::Model);
|
assert(getType() == EntityTypes::Model);
|
||||||
|
@ -145,8 +117,9 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
||||||
glm::vec3 position = getPosition();
|
glm::vec3 position = getPosition();
|
||||||
glm::vec3 dimensions = getDimensions();
|
glm::vec3 dimensions = getDimensions();
|
||||||
|
|
||||||
|
bool debugSimulationOwnership = args->_debugFlags & RenderArgs::RENDER_DEBUG_SIMULATION_OWNERSHIP;
|
||||||
bool highlightSimulationOwnership = false;
|
bool highlightSimulationOwnership = false;
|
||||||
if (args->_debugFlags & RenderArgs::RENDER_DEBUG_SIMULATION_OWNERSHIP) {
|
if (debugSimulationOwnership) {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
const QUuid& myNodeID = nodeList->getSessionUUID();
|
const QUuid& myNodeID = nodeList->getSessionUUID();
|
||||||
highlightSimulationOwnership = (getSimulatorID() == myNodeID);
|
highlightSimulationOwnership = (getSimulatorID() == myNodeID);
|
||||||
|
@ -219,8 +192,10 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!didDraw) {
|
if (!didDraw) {
|
||||||
renderBoundingBox(args);
|
RenderableDebugableEntityItem::renderBoundingBox(this, args, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RenderableDebugableEntityItem::render(this, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
Model* RenderableModelEntityItem::getModel(EntityTreeRenderer* renderer) {
|
Model* RenderableModelEntityItem::getModel(EntityTreeRenderer* renderer) {
|
||||||
|
|
|
@ -16,11 +16,12 @@
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
#include <ModelEntityItem.h>
|
#include <ModelEntityItem.h>
|
||||||
|
#include "RenderableDebugableEntityItem.h"
|
||||||
|
|
||||||
class Model;
|
class Model;
|
||||||
class EntityTreeRenderer;
|
class EntityTreeRenderer;
|
||||||
|
|
||||||
class RenderableModelEntityItem : public ModelEntityItem {
|
class RenderableModelEntityItem : public ModelEntityItem {
|
||||||
public:
|
public:
|
||||||
static EntityItem* factory(const EntityItemID& entityID, const EntityItemProperties& properties);
|
static EntityItem* factory(const EntityItemID& entityID, const EntityItemProperties& properties);
|
||||||
|
|
||||||
|
@ -42,7 +43,6 @@ public:
|
||||||
|
|
||||||
virtual void somethingChangedNotification() { _needsInitialSimulation = true; }
|
virtual void somethingChangedNotification() { _needsInitialSimulation = true; }
|
||||||
|
|
||||||
void renderBoundingBox(RenderArgs* args);
|
|
||||||
virtual void render(RenderArgs* args);
|
virtual void render(RenderArgs* args);
|
||||||
virtual bool supportsDetailedRayIntersection() const { return true; }
|
virtual bool supportsDetailedRayIntersection() const { return true; }
|
||||||
virtual bool findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
virtual bool findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
||||||
|
|
|
@ -74,6 +74,12 @@ void RenderableZoneEntityItem::initialSimulation() {
|
||||||
_needsInitialSimulation = false;
|
_needsInitialSimulation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RenderableZoneEntityItem::render(RenderArgs* args) {
|
||||||
|
if (_drawZoneBoundaries) {
|
||||||
|
// TODO: Draw the zone boundaries...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool RenderableZoneEntityItem::contains(const glm::vec3& point) const {
|
bool RenderableZoneEntityItem::contains(const glm::vec3& point) const {
|
||||||
if (getShapeType() != SHAPE_TYPE_COMPOUND) {
|
if (getShapeType() != SHAPE_TYPE_COMPOUND) {
|
||||||
return EntityItem::contains(point);
|
return EntityItem::contains(point);
|
||||||
|
@ -92,4 +98,4 @@ bool RenderableZoneEntityItem::contains(const glm::vec3& point) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ public:
|
||||||
ReadBitstreamToTreeParams& args,
|
ReadBitstreamToTreeParams& args,
|
||||||
EntityPropertyFlags& propertyFlags, bool overwriteLocalData);
|
EntityPropertyFlags& propertyFlags, bool overwriteLocalData);
|
||||||
|
|
||||||
|
virtual void render(RenderArgs* args);
|
||||||
virtual bool contains(const glm::vec3& point) const;
|
virtual bool contains(const glm::vec3& point) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -45,4 +46,4 @@ private:
|
||||||
bool _needsInitialSimulation;
|
bool _needsInitialSimulation;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_RenderableZoneEntityItem_h
|
#endif // hifi_RenderableZoneEntityItem_h
|
||||||
|
|
|
@ -307,7 +307,9 @@ public:
|
||||||
glm::mat4 getWorldToEntityMatrix() const;
|
glm::mat4 getWorldToEntityMatrix() const;
|
||||||
glm::vec3 worldToEntity(const glm::vec3& point) const;
|
glm::vec3 worldToEntity(const glm::vec3& point) const;
|
||||||
glm::vec3 entityToWorld(const glm::vec3& point) const;
|
glm::vec3 entityToWorld(const glm::vec3& point) const;
|
||||||
|
|
||||||
|
quint64 getLastEditedFromRemote() { return _lastEditedFromRemote; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
static bool _sendPhysicsUpdates;
|
static bool _sendPhysicsUpdates;
|
||||||
|
|
|
@ -324,6 +324,14 @@ bool EntityScriptingInterface::getZonesArePickable() const {
|
||||||
return ZoneEntityItem::getZonesArePickable();
|
return ZoneEntityItem::getZonesArePickable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntityScriptingInterface::setDrawZoneBoundaries(bool value) {
|
||||||
|
ZoneEntityItem::setDrawZoneBoundaries(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EntityScriptingInterface::getDrawZoneBoundaries() const {
|
||||||
|
return ZoneEntityItem::getDrawZoneBoundaries();
|
||||||
|
}
|
||||||
|
|
||||||
void EntityScriptingInterface::setSendPhysicsUpdates(bool value) {
|
void EntityScriptingInterface::setSendPhysicsUpdates(bool value) {
|
||||||
EntityItem::setSendPhysicsUpdates(value);
|
EntityItem::setSendPhysicsUpdates(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,6 +114,9 @@ public slots:
|
||||||
Q_INVOKABLE void setZonesArePickable(bool value);
|
Q_INVOKABLE void setZonesArePickable(bool value);
|
||||||
Q_INVOKABLE bool getZonesArePickable() const;
|
Q_INVOKABLE bool getZonesArePickable() const;
|
||||||
|
|
||||||
|
Q_INVOKABLE void setDrawZoneBoundaries(bool value);
|
||||||
|
Q_INVOKABLE bool getDrawZoneBoundaries() const;
|
||||||
|
|
||||||
Q_INVOKABLE void setSendPhysicsUpdates(bool value);
|
Q_INVOKABLE void setSendPhysicsUpdates(bool value);
|
||||||
Q_INVOKABLE bool getSendPhysicsUpdates() const;
|
Q_INVOKABLE bool getSendPhysicsUpdates() const;
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "EntityTreeElement.h"
|
#include "EntityTreeElement.h"
|
||||||
|
|
||||||
bool ZoneEntityItem::_zonesArePickable = false;
|
bool ZoneEntityItem::_zonesArePickable = false;
|
||||||
|
bool ZoneEntityItem::_drawZoneBoundaries = false;
|
||||||
|
|
||||||
const xColor ZoneEntityItem::DEFAULT_KEYLIGHT_COLOR = { 255, 255, 255 };
|
const xColor ZoneEntityItem::DEFAULT_KEYLIGHT_COLOR = { 255, 255, 255 };
|
||||||
const float ZoneEntityItem::DEFAULT_KEYLIGHT_INTENSITY = 1.0f;
|
const float ZoneEntityItem::DEFAULT_KEYLIGHT_INTENSITY = 1.0f;
|
||||||
|
|
|
@ -91,6 +91,9 @@ public:
|
||||||
|
|
||||||
static bool getZonesArePickable() { return _zonesArePickable; }
|
static bool getZonesArePickable() { return _zonesArePickable; }
|
||||||
static void setZonesArePickable(bool value) { _zonesArePickable = value; }
|
static void setZonesArePickable(bool value) { _zonesArePickable = value; }
|
||||||
|
|
||||||
|
static bool getDrawZoneBoundaries() { return _drawZoneBoundaries; }
|
||||||
|
static void setDrawZoneBoundaries(bool value) { _drawZoneBoundaries = value; }
|
||||||
|
|
||||||
virtual bool isReadyToComputeShape() { return false; }
|
virtual bool isReadyToComputeShape() { return false; }
|
||||||
void updateShapeType(ShapeType type) { _shapeType = type; }
|
void updateShapeType(ShapeType type) { _shapeType = type; }
|
||||||
|
@ -136,6 +139,7 @@ protected:
|
||||||
ShapeType _shapeType = SHAPE_TYPE_NONE;
|
ShapeType _shapeType = SHAPE_TYPE_NONE;
|
||||||
QString _compoundShapeURL;
|
QString _compoundShapeURL;
|
||||||
|
|
||||||
|
static bool _drawZoneBoundaries;
|
||||||
static bool _zonesArePickable;
|
static bool _zonesArePickable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1747,8 +1747,12 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
|
||||||
material.id = getID(object.properties);
|
material.id = getID(object.properties);
|
||||||
|
|
||||||
material._material = model::MaterialPointer(new model::Material());
|
material._material = model::MaterialPointer(new model::Material());
|
||||||
material._material->setEmissive(material.emissive);
|
material._material->setEmissive(material.emissive);
|
||||||
material._material->setDiffuse(material.diffuse);
|
if (glm::all(glm::equal(material.diffuse, glm::vec3(0.0f)))) {
|
||||||
|
material._material->setDiffuse(material.diffuse);
|
||||||
|
} else {
|
||||||
|
material._material->setDiffuse(material.diffuse);
|
||||||
|
}
|
||||||
material._material->setSpecular(material.specular);
|
material._material->setSpecular(material.specular);
|
||||||
material._material->setShininess(material.shininess);
|
material._material->setShininess(material.shininess);
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ GLBackend::GLFramebuffer* GLBackend::syncGPUObject(const Framebuffer& framebuffe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if (GPU_FEATURE_PROFILE == GPU_LEGACY)
|
#if (GPU_FEATURE_PROFILE == GPU_LEGACY)
|
||||||
// for reasons that i don;t understand yet, it seems that on mac gl, a fbo must have a color buffer...
|
// for reasons that i don't understand yet, it seems that on mac gl, a fbo must have a color buffer...
|
||||||
else {
|
else {
|
||||||
GLuint renderBuffer = 0;
|
GLuint renderBuffer = 0;
|
||||||
glGenRenderbuffers(1, &renderBuffer);
|
glGenRenderbuffers(1, &renderBuffer);
|
||||||
|
@ -83,7 +83,7 @@ GLBackend::GLFramebuffer* GLBackend::syncGPUObject(const Framebuffer& framebuffe
|
||||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA, framebuffer.getWidth(), framebuffer.getHeight());
|
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA, framebuffer.getWidth(), framebuffer.getHeight());
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderBuffer);
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderBuffer);
|
||||||
CHECK_GL_ERROR();
|
(void) CHECK_GL_ERROR();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,8 @@ public:
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void render(RenderArgs::RenderMode renderMode = RenderArgs::DEFAULT_RENDER_MODE,
|
virtual void render(RenderArgs::RenderMode renderMode = RenderArgs::DEFAULT_RENDER_MODE,
|
||||||
RenderArgs::RenderSide renderSide = RenderArgs::MONO) { /* swallow these */ }
|
RenderArgs::RenderSide renderSide = RenderArgs::MONO,
|
||||||
|
RenderArgs::DebugFlags renderDebugFlags = RenderArgs::RENDER_DEBUG_NONE) { /* swallow these */ }
|
||||||
|
|
||||||
void setJurisdictionListener(JurisdictionListener* jurisdictionListener) { _jurisdictionListener = jurisdictionListener; }
|
void setJurisdictionListener(JurisdictionListener* jurisdictionListener) { _jurisdictionListener = jurisdictionListener; }
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,6 @@
|
||||||
#include "PhysicsHelpers.h"
|
#include "PhysicsHelpers.h"
|
||||||
#include "PhysicsLogging.h"
|
#include "PhysicsLogging.h"
|
||||||
|
|
||||||
const float DEFAULT_FRICTION = 0.5f;
|
|
||||||
const float MAX_FRICTION = 10.0f;
|
|
||||||
|
|
||||||
const float DEFAULT_RESTITUTION = 0.5f;
|
|
||||||
|
|
||||||
// origin of physics simulation in world-frame
|
// origin of physics simulation in world-frame
|
||||||
glm::vec3 _worldOffset(0.0f);
|
glm::vec3 _worldOffset(0.0f);
|
||||||
|
|
||||||
|
|
|
@ -376,11 +376,14 @@ void PhysicsEngine::doOwnershipInfection(const btCollisionObject* objectA, const
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
QUuid myNodeID = nodeList->getSessionUUID();
|
QUuid myNodeID = nodeList->getSessionUUID();
|
||||||
|
|
||||||
|
if (myNodeID.isNull()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const btCollisionObject* characterCollisionObject =
|
const btCollisionObject* characterCollisionObject =
|
||||||
_characterController ? _characterController->getCollisionObject() : NULL;
|
_characterController ? _characterController->getCollisionObject() : NULL;
|
||||||
|
|
||||||
assert(!myNodeID.isNull());
|
|
||||||
|
|
||||||
ObjectMotionState* a = static_cast<ObjectMotionState*>(objectA->getUserPointer());
|
ObjectMotionState* a = static_cast<ObjectMotionState*>(objectA->getUserPointer());
|
||||||
ObjectMotionState* b = static_cast<ObjectMotionState*>(objectB->getUserPointer());
|
ObjectMotionState* b = static_cast<ObjectMotionState*>(objectB->getUserPointer());
|
||||||
EntityItem* entityA = a ? a->getEntity() : NULL;
|
EntityItem* entityA = a ? a->getEntity() : NULL;
|
||||||
|
|
|
@ -24,7 +24,7 @@ void FboCache::lockTexture(int texture) {
|
||||||
withLock(_lock, [&] {
|
withLock(_lock, [&] {
|
||||||
Q_ASSERT(_fboMap.count(texture));
|
Q_ASSERT(_fboMap.count(texture));
|
||||||
if (!_fboLocks.count(texture)) {
|
if (!_fboLocks.count(texture)) {
|
||||||
Q_ASSERT(_readyFboQueue.front()->texture() == texture);
|
Q_ASSERT(_readyFboQueue.front()->texture() == (GLuint)texture);
|
||||||
_readyFboQueue.pop_front();
|
_readyFboQueue.pop_front();
|
||||||
_fboLocks[texture] = 1;
|
_fboLocks[texture] = 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <QRunnable>
|
#include <QRunnable>
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
|
#include <qimagereader.h>
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/random.hpp>
|
#include <glm/gtc/random.hpp>
|
||||||
|
@ -28,6 +29,8 @@
|
||||||
|
|
||||||
#include "gpu/GLBackend.h"
|
#include "gpu/GLBackend.h"
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
TextureCache::TextureCache() :
|
TextureCache::TextureCache() :
|
||||||
_permutationNormalTexture(0),
|
_permutationNormalTexture(0),
|
||||||
_whiteTexture(0),
|
_whiteTexture(0),
|
||||||
|
@ -344,27 +347,7 @@ NetworkTexture::NetworkTexture(const QUrl& url, TextureType type, const QByteArr
|
||||||
_loaded = true;
|
_loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// default to white/blue/black
|
std::string theName = url.toString().toStdString();
|
||||||
/* glBindTexture(GL_TEXTURE_2D, getID());
|
|
||||||
switch (type) {
|
|
||||||
case NORMAL_TEXTURE:
|
|
||||||
loadSingleColorTexture(OPAQUE_BLUE);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SPECULAR_TEXTURE:
|
|
||||||
loadSingleColorTexture(OPAQUE_BLACK);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SPLAT_TEXTURE:
|
|
||||||
loadSingleColorTexture(TRANSPARENT_WHITE);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
loadSingleColorTexture(OPAQUE_WHITE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
*/
|
|
||||||
// if we have content, load it after we have our self pointer
|
// if we have content, load it after we have our self pointer
|
||||||
if (!content.isEmpty()) {
|
if (!content.isEmpty()) {
|
||||||
_startedLoading = true;
|
_startedLoading = true;
|
||||||
|
@ -396,6 +379,18 @@ ImageReader::ImageReader(const QWeakPointer<Resource>& texture, QNetworkReply* r
|
||||||
_content(content) {
|
_content(content) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::once_flag onceListSuppoertedFormatsflag;
|
||||||
|
void listSupportedImageFormats() {
|
||||||
|
std::call_once(onceListSuppoertedFormatsflag, [](){
|
||||||
|
auto supportedFormats = QImageReader::supportedImageFormats();
|
||||||
|
QString formats;
|
||||||
|
foreach(const QByteArray& f, supportedFormats) {
|
||||||
|
formats += QString(f) + ",";
|
||||||
|
}
|
||||||
|
qCDebug(renderutils) << "List of supported Image formats:" << formats;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void ImageReader::run() {
|
void ImageReader::run() {
|
||||||
QSharedPointer<Resource> texture = _texture.toStrongRef();
|
QSharedPointer<Resource> texture = _texture.toStrongRef();
|
||||||
if (texture.isNull()) {
|
if (texture.isNull()) {
|
||||||
|
@ -409,11 +404,29 @@ void ImageReader::run() {
|
||||||
_content = _reply->readAll();
|
_content = _reply->readAll();
|
||||||
_reply->deleteLater();
|
_reply->deleteLater();
|
||||||
}
|
}
|
||||||
QImage image = QImage::fromData(_content);
|
|
||||||
|
|
||||||
|
listSupportedImageFormats();
|
||||||
|
|
||||||
|
// try to help the QImage loader by extracting the image file format from the url filename ext
|
||||||
|
// Some tga are not created properly for example without it
|
||||||
|
auto filename = _url.fileName().toStdString();
|
||||||
|
auto filenameExtension = filename.substr(filename.find_last_of('.') + 1);
|
||||||
|
QImage image = QImage::fromData(_content, filenameExtension.c_str());
|
||||||
|
|
||||||
|
// Note that QImage.format is the pixel format which is different from the "format" of the image file...
|
||||||
|
auto imageFormat = image.format();
|
||||||
int originalWidth = image.width();
|
int originalWidth = image.width();
|
||||||
int originalHeight = image.height();
|
int originalHeight = image.height();
|
||||||
|
|
||||||
|
if (originalWidth == 0 || originalHeight == 0 || imageFormat == QImage::Format_Invalid) {
|
||||||
|
if (filenameExtension.empty()) {
|
||||||
|
qCDebug(renderutils) << "QImage failed to create from content, no file extension:" << _url;
|
||||||
|
} else {
|
||||||
|
qCDebug(renderutils) << "QImage failed to create from content" << _url;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// enforce a fixed maximum area (1024 * 2048)
|
// enforce a fixed maximum area (1024 * 2048)
|
||||||
const int MAXIMUM_AREA_SIZE = 2097152;
|
const int MAXIMUM_AREA_SIZE = 2097152;
|
||||||
int imageArea = image.width() * image.height();
|
int imageArea = image.width() * image.height();
|
||||||
|
|
|
@ -102,9 +102,12 @@ class QQuickMenuItem;
|
||||||
QObject* addItem(QObject* parent, const QString& text) {
|
QObject* addItem(QObject* parent, const QString& text) {
|
||||||
// FIXME add more checking here to ensure no name conflicts
|
// FIXME add more checking here to ensure no name conflicts
|
||||||
QQuickMenuItem* returnedValue{ nullptr };
|
QQuickMenuItem* returnedValue{ nullptr };
|
||||||
bool invokeResult = QMetaObject::invokeMethod(parent, "addItem", Qt::DirectConnection,
|
#ifndef QT_NO_DEBUG
|
||||||
Q_RETURN_ARG(QQuickMenuItem*, returnedValue),
|
bool invokeResult =
|
||||||
Q_ARG(QString, text));
|
#endif
|
||||||
|
QMetaObject::invokeMethod(parent, "addItem", Qt::DirectConnection, Q_RETURN_ARG(QQuickMenuItem*, returnedValue),
|
||||||
|
Q_ARG(QString, text));
|
||||||
|
|
||||||
Q_ASSERT(invokeResult);
|
Q_ASSERT(invokeResult);
|
||||||
QObject* result = reinterpret_cast<QObject*>(returnedValue);
|
QObject* result = reinterpret_cast<QObject*>(returnedValue);
|
||||||
return result;
|
return result;
|
||||||
|
@ -203,9 +206,11 @@ void VrMenu::insertAction(QAction* before, QAction* action) {
|
||||||
result = ::addItem(menu, action->text());
|
result = ::addItem(menu, action->text());
|
||||||
} else {
|
} else {
|
||||||
QQuickMenuItem* returnedValue{ nullptr };
|
QQuickMenuItem* returnedValue{ nullptr };
|
||||||
bool invokeResult = QMetaObject::invokeMethod(menu, "insertItem", Qt::DirectConnection,
|
#ifndef QT_NO_DEBUG
|
||||||
Q_RETURN_ARG(QQuickMenuItem*, returnedValue),
|
bool invokeResult =
|
||||||
Q_ARG(int, index), Q_ARG(QString, action->text()));
|
#endif
|
||||||
|
QMetaObject::invokeMethod(menu, "insertItem", Qt::DirectConnection, Q_RETURN_ARG(QQuickMenuItem*, returnedValue),
|
||||||
|
Q_ARG(int, index), Q_ARG(QString, action->text()));
|
||||||
Q_ASSERT(invokeResult);
|
Q_ASSERT(invokeResult);
|
||||||
result = reinterpret_cast<QObject*>(returnedValue);
|
result = reinterpret_cast<QObject*>(returnedValue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,7 +315,7 @@ VHACDUtilApp::VHACDUtilApp(int argc, char* argv[]) :
|
||||||
|
|
||||||
if (splitModel) {
|
if (splitModel) {
|
||||||
QVector<QString> infileExtensions = {"fbx", "obj"};
|
QVector<QString> infileExtensions = {"fbx", "obj"};
|
||||||
QString baseFileName = fileNameWithoutExtension(inputFilename, infileExtensions);
|
QString baseFileName = fileNameWithoutExtension(outputFilename, infileExtensions);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
foreach (const FBXMesh& mesh, fbx.meshes) {
|
foreach (const FBXMesh& mesh, fbx.meshes) {
|
||||||
foreach (const FBXMeshPart &meshPart, mesh.parts) {
|
foreach (const FBXMeshPart &meshPart, mesh.parts) {
|
||||||
|
|
Loading…
Reference in a new issue