Merge branch 'master' of github.com:highfidelity/hifi into overlay-visible-in-2nd-cam

This commit is contained in:
Seth Alves 2018-03-14 09:00:21 -07:00
commit 21088cfbcc
9 changed files with 31 additions and 24 deletions

View file

@ -42,7 +42,7 @@ AvatarMixer::AvatarMixer(ReceivedMessage& message) :
ThreadedAssignment(message) ThreadedAssignment(message)
{ {
// make sure we hear about node kills so we can tell the other nodes // make sure we hear about node kills so we can tell the other nodes
connect(DependencyManager::get<NodeList>().data(), &NodeList::nodeKilled, this, &AvatarMixer::nodeKilled); connect(DependencyManager::get<NodeList>().data(), &NodeList::nodeKilled, this, &AvatarMixer::handleAvatarKilled);
auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver(); auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver();
packetReceiver.registerListener(PacketType::AvatarData, this, "queueIncomingPacket"); packetReceiver.registerListener(PacketType::AvatarData, this, "queueIncomingPacket");
@ -423,14 +423,15 @@ void AvatarMixer::throttle(std::chrono::microseconds duration, int frame) {
} }
} }
void AvatarMixer::nodeKilled(SharedNodePointer killedNode) {
if (killedNode->getType() == NodeType::Agent void AvatarMixer::handleAvatarKilled(SharedNodePointer avatarNode) {
&& killedNode->getLinkedData()) { if (avatarNode->getType() == NodeType::Agent
&& avatarNode->getLinkedData()) {
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
{ // decrement sessionDisplayNames table and possibly remove { // decrement sessionDisplayNames table and possibly remove
QMutexLocker nodeDataLocker(&killedNode->getLinkedData()->getMutex()); QMutexLocker nodeDataLocker(&avatarNode->getLinkedData()->getMutex());
AvatarMixerClientData* nodeData = dynamic_cast<AvatarMixerClientData*>(killedNode->getLinkedData()); AvatarMixerClientData* nodeData = dynamic_cast<AvatarMixerClientData*>(avatarNode->getLinkedData());
const QString& baseDisplayName = nodeData->getBaseDisplayName(); const QString& baseDisplayName = nodeData->getBaseDisplayName();
// No sense guarding against very rare case of a node with no entry, as this will work without the guard and do one less lookup in the common case. // No sense guarding against very rare case of a node with no entry, as this will work without the guard and do one less lookup in the common case.
if (--_sessionDisplayNames[baseDisplayName].second <= 0) { if (--_sessionDisplayNames[baseDisplayName].second <= 0) {
@ -447,12 +448,12 @@ void AvatarMixer::nodeKilled(SharedNodePointer killedNode) {
// we relay avatar kill packets to agents that are not upstream // we relay avatar kill packets to agents that are not upstream
// and downstream avatar mixers, if the node that was just killed was being replicated // and downstream avatar mixers, if the node that was just killed was being replicated
return (node->getType() == NodeType::Agent && !node->isUpstream()) || return (node->getType() == NodeType::Agent && !node->isUpstream()) ||
(killedNode->isReplicated() && shouldReplicateTo(*killedNode, *node)); (avatarNode->isReplicated() && shouldReplicateTo(*avatarNode, *node));
}, [&](const SharedNodePointer& node) { }, [&](const SharedNodePointer& node) {
if (node->getType() == NodeType::Agent) { if (node->getType() == NodeType::Agent) {
if (!killPacket) { if (!killPacket) {
killPacket = NLPacket::create(PacketType::KillAvatar, NUM_BYTES_RFC4122_UUID + sizeof(KillAvatarReason)); killPacket = NLPacket::create(PacketType::KillAvatar, NUM_BYTES_RFC4122_UUID + sizeof(KillAvatarReason));
killPacket->write(killedNode->getUUID().toRfc4122()); killPacket->write(avatarNode->getUUID().toRfc4122());
killPacket->writePrimitive(KillAvatarReason::AvatarDisconnected); killPacket->writePrimitive(KillAvatarReason::AvatarDisconnected);
} }
@ -462,7 +463,7 @@ void AvatarMixer::nodeKilled(SharedNodePointer killedNode) {
if (!replicatedKillPacket) { if (!replicatedKillPacket) {
replicatedKillPacket = NLPacket::create(PacketType::ReplicatedKillAvatar, replicatedKillPacket = NLPacket::create(PacketType::ReplicatedKillAvatar,
NUM_BYTES_RFC4122_UUID + sizeof(KillAvatarReason)); NUM_BYTES_RFC4122_UUID + sizeof(KillAvatarReason));
replicatedKillPacket->write(killedNode->getUUID().toRfc4122()); replicatedKillPacket->write(avatarNode->getUUID().toRfc4122());
replicatedKillPacket->writePrimitive(KillAvatarReason::AvatarDisconnected); replicatedKillPacket->writePrimitive(KillAvatarReason::AvatarDisconnected);
} }
@ -479,7 +480,7 @@ void AvatarMixer::nodeKilled(SharedNodePointer killedNode) {
return false; return false;
} }
if (node->getUUID() == killedNode->getUUID()) { if (node->getUUID() == avatarNode->getUUID()) {
return false; return false;
} }
@ -489,7 +490,7 @@ void AvatarMixer::nodeKilled(SharedNodePointer killedNode) {
QMetaObject::invokeMethod(node->getLinkedData(), QMetaObject::invokeMethod(node->getLinkedData(),
"cleanupKilledNode", "cleanupKilledNode",
Qt::AutoConnection, Qt::AutoConnection,
Q_ARG(const QUuid&, QUuid(killedNode->getUUID()))); Q_ARG(const QUuid&, QUuid(avatarNode->getUUID())));
} }
); );
} }
@ -605,7 +606,9 @@ void AvatarMixer::handleAvatarIdentityPacket(QSharedPointer<ReceivedMessage> mes
void AvatarMixer::handleKillAvatarPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer node) { void AvatarMixer::handleKillAvatarPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer node) {
auto start = usecTimestampNow(); auto start = usecTimestampNow();
DependencyManager::get<NodeList>()->processKillNode(*message); handleAvatarKilled(node);
node->setLinkedData(nullptr);
auto end = usecTimestampNow(); auto end = usecTimestampNow();
_handleKillAvatarPacketElapsedTime += (end - start); _handleKillAvatarPacketElapsedTime += (end - start);

View file

@ -39,7 +39,7 @@ public slots:
/// runs the avatar mixer /// runs the avatar mixer
void run() override; void run() override;
void nodeKilled(SharedNodePointer killedNode); void handleAvatarKilled(SharedNodePointer killedNode);
void sendStatsPacket() override; void sendStatsPacket() override;

View file

@ -114,7 +114,7 @@ void Text3DOverlay::render(RenderArgs* args) {
glm::vec3 topLeft(-halfDimensions.x, -halfDimensions.y, SLIGHTLY_BEHIND); glm::vec3 topLeft(-halfDimensions.x, -halfDimensions.y, SLIGHTLY_BEHIND);
glm::vec3 bottomRight(halfDimensions.x, halfDimensions.y, SLIGHTLY_BEHIND); glm::vec3 bottomRight(halfDimensions.x, halfDimensions.y, SLIGHTLY_BEHIND);
DependencyManager::get<GeometryCache>()->bindSimpleProgram(batch, false, quadColor.a < 1.0f, false, false, false, false); DependencyManager::get<GeometryCache>()->bindSimpleProgram(batch, false, quadColor.a < 1.0f, false, false, false);
DependencyManager::get<GeometryCache>()->renderQuad(batch, topLeft, bottomRight, quadColor, _geometryId); DependencyManager::get<GeometryCache>()->renderQuad(batch, topLeft, bottomRight, quadColor, _geometryId);
// Same font properties as textSize() // Same font properties as textSize()

View file

@ -111,7 +111,7 @@ void TextEntityRenderer::doRender(RenderArgs* args) {
if (!_geometryID) { if (!_geometryID) {
_geometryID = geometryCache->allocateID(); _geometryID = geometryCache->allocateID();
} }
geometryCache->bindSimpleProgram(batch, false, transparent, false, false, false, false); geometryCache->bindSimpleProgram(batch, false, transparent, false, false, false);
geometryCache->renderQuad(batch, minCorner, maxCorner, backgroundColor, _geometryID); geometryCache->renderQuad(batch, minCorner, maxCorner, backgroundColor, _geometryID);
float scale = _lineHeight / _textRenderer->getFontSize(); float scale = _lineHeight / _textRenderer->getFontSize();

View file

@ -576,7 +576,7 @@ void Connection::processControl(ControlPacketPointer controlPacket) {
// where the other end expired our connection. Let's reset. // where the other end expired our connection. Let's reset.
#ifdef UDT_CONNECTION_DEBUG #ifdef UDT_CONNECTION_DEBUG
qCDebug(networking) << "Got handshake request, stopping SendQueue"; qCDebug(networking) << "Got HandshakeRequest from" << _destination << ", stopping SendQueue";
#endif #endif
_hasReceivedHandshakeACK = false; _hasReceivedHandshakeACK = false;
stopSendQueue(); stopSendQueue();

View file

@ -402,6 +402,10 @@ void Socket::readPendingDatagrams() {
packet->getDataSize(), packet->getDataSize(),
packet->getPayloadSize())) { packet->getPayloadSize())) {
// the connection could not be created or indicated that we should not continue processing this packet // the connection could not be created or indicated that we should not continue processing this packet
#ifdef UDT_CONNECTION_DEBUG
qCDebug(networking) << "Can't process packet: version" << (unsigned int)NLPacket::versionInHeader(*packet)
<< ", type" << NLPacket::typeInHeader(*packet);
#endif
continue; continue;
} }
} }

View file

@ -2110,7 +2110,7 @@ static void buildWebShader(const gpu::ShaderPointer& vertShader, const gpu::Shad
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
PrepareStencil::testMaskDrawShapeNoAA(*state); PrepareStencil::testMaskDrawShape(*state);
pipelinePointerOut = gpu::Pipeline::create(shaderPointerOut, state); pipelinePointerOut = gpu::Pipeline::create(shaderPointerOut, state);
} }
@ -2122,11 +2122,11 @@ void GeometryCache::bindWebBrowserProgram(gpu::Batch& batch, bool transparent) {
gpu::PipelinePointer GeometryCache::getWebBrowserProgram(bool transparent) { gpu::PipelinePointer GeometryCache::getWebBrowserProgram(bool transparent) {
static std::once_flag once; static std::once_flag once;
std::call_once(once, [&]() { std::call_once(once, [&]() {
buildWebShader(simple_vert::getShader(), simple_opaque_web_browser_frag::getShader(), false, _simpleOpaqueWebBrowserShader, _simpleOpaqueWebBrowserPipelineNoAA); buildWebShader(simple_vert::getShader(), simple_opaque_web_browser_frag::getShader(), false, _simpleOpaqueWebBrowserShader, _simpleOpaqueWebBrowserPipeline);
buildWebShader(simple_vert::getShader(), simple_transparent_web_browser_frag::getShader(), true, _simpleTransparentWebBrowserShader, _simpleTransparentWebBrowserPipelineNoAA); buildWebShader(simple_vert::getShader(), simple_transparent_web_browser_frag::getShader(), true, _simpleTransparentWebBrowserShader, _simpleTransparentWebBrowserPipeline);
}); });
return transparent ? _simpleTransparentWebBrowserPipelineNoAA : _simpleOpaqueWebBrowserPipelineNoAA; return transparent ? _simpleTransparentWebBrowserPipeline : _simpleOpaqueWebBrowserPipeline;
} }
void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool transparent, bool culled, bool unlit, bool depthBiased, bool isAntiAliased) { void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool transparent, bool culled, bool unlit, bool depthBiased, bool isAntiAliased) {

View file

@ -475,9 +475,9 @@ private:
static QHash<SimpleProgramKey, gpu::PipelinePointer> _simplePrograms; static QHash<SimpleProgramKey, gpu::PipelinePointer> _simplePrograms;
gpu::ShaderPointer _simpleOpaqueWebBrowserShader; gpu::ShaderPointer _simpleOpaqueWebBrowserShader;
gpu::PipelinePointer _simpleOpaqueWebBrowserPipelineNoAA; gpu::PipelinePointer _simpleOpaqueWebBrowserPipeline;
gpu::ShaderPointer _simpleTransparentWebBrowserShader; gpu::ShaderPointer _simpleTransparentWebBrowserShader;
gpu::PipelinePointer _simpleTransparentWebBrowserPipelineNoAA; gpu::PipelinePointer _simpleTransparentWebBrowserPipeline;
static render::ShapePipelinePointer getShapePipeline(bool textured = false, bool transparent = false, bool culled = true, static render::ShapePipelinePointer getShapePipeline(bool textured = false, bool transparent = false, bool culled = true,
bool unlit = false, bool depthBias = false); bool unlit = false, bool depthBias = false);

View file

@ -243,7 +243,7 @@ void Font::setupGPU() {
state->setBlendFunction(false, state->setBlendFunction(false,
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
PrepareStencil::testMaskDrawShapeNoAA(*state); PrepareStencil::testMaskDrawShape(*state);
_pipeline = gpu::Pipeline::create(program, state); _pipeline = gpu::Pipeline::create(program, state);
auto transparentState = std::make_shared<gpu::State>(); auto transparentState = std::make_shared<gpu::State>();
@ -252,7 +252,7 @@ void Font::setupGPU() {
transparentState->setBlendFunction(true, transparentState->setBlendFunction(true,
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
PrepareStencil::testMaskDrawShapeNoAA(*transparentState); PrepareStencil::testMaskDrawShape(*transparentState);
_transparentPipeline = gpu::Pipeline::create(programTransparent, transparentState); _transparentPipeline = gpu::Pipeline::create(programTransparent, transparentState);
} }