mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-04 03:14:12 +02:00
Add PickTransformNode
This commit is contained in:
parent
3167d3c0c7
commit
b0f8d3e427
5 changed files with 59 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
#include <shared/ReadWriteLockable.h>
|
#include <shared/ReadWriteLockable.h>
|
||||||
|
#include <Transform.h>
|
||||||
|
|
||||||
enum IntersectionType {
|
enum IntersectionType {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
|
|
|
@ -88,6 +88,14 @@ void PickManager::setIncludeItems(unsigned int uid, const QVector<QUuid>& includ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Transform PickManager::getResultTransform(unsigned int uid) const {
|
||||||
|
auto pick = findPick(uid);
|
||||||
|
if (pick) {
|
||||||
|
return pick->getResultTransform();
|
||||||
|
}
|
||||||
|
return Transform();
|
||||||
|
}
|
||||||
|
|
||||||
void PickManager::update() {
|
void PickManager::update() {
|
||||||
uint64_t expiry = usecTimestampNow() + _perFrameTimeBudget;
|
uint64_t expiry = usecTimestampNow() + _perFrameTimeBudget;
|
||||||
std::unordered_map<PickQuery::PickType, std::unordered_map<unsigned int, std::shared_ptr<PickQuery>>> cachedPicks;
|
std::unordered_map<PickQuery::PickType, std::unordered_map<unsigned int, std::shared_ptr<PickQuery>>> cachedPicks;
|
||||||
|
|
|
@ -40,6 +40,8 @@ public:
|
||||||
void setIgnoreItems(unsigned int uid, const QVector<QUuid>& ignore) const;
|
void setIgnoreItems(unsigned int uid, const QVector<QUuid>& ignore) const;
|
||||||
void setIncludeItems(unsigned int uid, const QVector<QUuid>& include) const;
|
void setIncludeItems(unsigned int uid, const QVector<QUuid>& include) const;
|
||||||
|
|
||||||
|
Transform getResultTransform(unsigned int uid) const;
|
||||||
|
|
||||||
bool isLeftHand(unsigned int uid);
|
bool isLeftHand(unsigned int uid);
|
||||||
bool isRightHand(unsigned int uid);
|
bool isRightHand(unsigned int uid);
|
||||||
bool isMouse(unsigned int uid);
|
bool isMouse(unsigned int uid);
|
||||||
|
|
26
libraries/pointers/src/PickTransformNode.cpp
Normal file
26
libraries/pointers/src/PickTransformNode.cpp
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
//
|
||||||
|
// Created by Sabrina Shanman 8/22/2018
|
||||||
|
// Copyright 2018 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 "PickTransformNode.h"
|
||||||
|
|
||||||
|
#include "DependencyManager.h"
|
||||||
|
#include "PickManager.h"
|
||||||
|
|
||||||
|
PickTransformNode::PickTransformNode(unsigned int uid) :
|
||||||
|
_uid(uid)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Transform PickTransformNode::getTransform() {
|
||||||
|
auto pickManager = DependencyManager::get<PickManager>();
|
||||||
|
if (!pickManager) {
|
||||||
|
return Transform();
|
||||||
|
}
|
||||||
|
|
||||||
|
return pickManager->getResultTransform(_uid);
|
||||||
|
}
|
22
libraries/pointers/src/PickTransformNode.h
Normal file
22
libraries/pointers/src/PickTransformNode.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
//
|
||||||
|
// Created by Sabrina Shanman 8/22/2018
|
||||||
|
// Copyright 2018 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_PickTransformNode_h
|
||||||
|
#define hifi_PickTransformNode_h
|
||||||
|
|
||||||
|
#include "TransformNode.h"
|
||||||
|
|
||||||
|
class PickTransformNode : public TransformNode {
|
||||||
|
public:
|
||||||
|
PickTransformNode(unsigned int uid);
|
||||||
|
Transform getTransform() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
unsigned int _uid;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_PickTransformNode_h
|
Loading…
Reference in a new issue