removing overlays wip

This commit is contained in:
SamGondelman 2019-01-24 14:59:45 -08:00
parent 0bfcde67ea
commit ca8d64bc05
24 changed files with 105 additions and 134 deletions

View file

@ -136,7 +136,7 @@ class MyAvatar : public Avatar {
* your avatar when rolling your HMD in degrees per second. * your avatar when rolling your HMD in degrees per second.
* @property {number} userHeight=1.75 - The height of the user in sensor space. * @property {number} userHeight=1.75 - The height of the user in sensor space.
* @property {number} userEyeHeight=1.65 - The estimated height of the user's eyes in sensor space. <em>Read-only.</em> * @property {number} userEyeHeight=1.65 - The estimated height of the user's eyes in sensor space. <em>Read-only.</em>
* @property {Uuid} SELF_ID - UUID representing "my avatar". Only use for local-only entities and overlays in situations * @property {Uuid} SELF_ID - UUID representing "my avatar". Only use for local-only entities in situations
* where MyAvatar.sessionUUID is not available (e.g., if not connected to a domain). Note: Likely to be deprecated. * where MyAvatar.sessionUUID is not available (e.g., if not connected to a domain). Note: Likely to be deprecated.
* <em>Read-only.</em> * <em>Read-only.</em>
* @property {number} walkSpeed * @property {number} walkSpeed

View file

@ -54,44 +54,47 @@ OtherAvatar::~OtherAvatar() {
void OtherAvatar::removeOrb() { void OtherAvatar::removeOrb() {
if (!_otherAvatarOrbMeshPlaceholderID.isNull()) { if (!_otherAvatarOrbMeshPlaceholderID.isNull()) {
qApp->getOverlays().deleteOverlay(_otherAvatarOrbMeshPlaceholderID); DependencyManager::get<EntityScriptingInterface>()->deleteEntity(_otherAvatarOrbMeshPlaceholderID);
_otherAvatarOrbMeshPlaceholderID = UNKNOWN_OVERLAY_ID; _otherAvatarOrbMeshPlaceholderID = UNKNOWN_ENTITY_ID;
} }
} }
void OtherAvatar::updateOrbPosition() { void OtherAvatar::updateOrbPosition() {
if (_otherAvatarOrbMeshPlaceholder != nullptr) { if (_otherAvatarOrbMeshPlaceholderID.isNull()) {
_otherAvatarOrbMeshPlaceholder->setWorldPosition(getHead()->getPosition()); EntityItemProperties properties;
if (_otherAvatarOrbMeshPlaceholderID.isNull()) { properties.setPosition(getHead()->getPosition());
_otherAvatarOrbMeshPlaceholderID = qApp->getOverlays().addOverlay(_otherAvatarOrbMeshPlaceholder); DependencyManager::get<EntityScriptingInterface>()->editEntity(_otherAvatarOrbMeshPlaceholderID, properties);
}
} }
} }
void OtherAvatar::createOrb() { void OtherAvatar::createOrb() {
if (_otherAvatarOrbMeshPlaceholderID.isNull()) { if (_otherAvatarOrbMeshPlaceholderID.isNull()) {
_otherAvatarOrbMeshPlaceholder = std::make_shared<Sphere3DOverlay>(); EntityItemProperties properties;
_otherAvatarOrbMeshPlaceholder->setAlpha(1.0f); properties.setType(EntityTypes::Sphere);
_otherAvatarOrbMeshPlaceholder->setColor(getLoadingOrbColor(_loadingStatus)); properties.setAlpha(1.0f);
_otherAvatarOrbMeshPlaceholder->setIsSolid(false); properties.setColor(getLoadingOrbColor(_loadingStatus));
_otherAvatarOrbMeshPlaceholder->setPulseMin(0.5); properties.setPrimitiveMode(PrimitiveMode::LINES);
_otherAvatarOrbMeshPlaceholder->setPulseMax(1.0); properties.getPulse().setMin(0.5f);
_otherAvatarOrbMeshPlaceholder->setColorPulse(1.0); properties.getPulse().setMax(1.0f);
_otherAvatarOrbMeshPlaceholder->setIgnorePickIntersection(true); properties.getPulse().setColorMode(PulseMode::IN_PHASE);
_otherAvatarOrbMeshPlaceholder->setDrawInFront(false); properties.setIgnorePickIntersection(true);
_otherAvatarOrbMeshPlaceholderID = qApp->getOverlays().addOverlay(_otherAvatarOrbMeshPlaceholder);
// Position focus properties.setPosition(getHead()->getPosition());
_otherAvatarOrbMeshPlaceholder->setWorldOrientation(glm::quat(0.0f, 0.0f, 0.0f, 1.0)); properties.setRotation(glm::quat(0.0f, 0.0f, 0.0f, 1.0));
_otherAvatarOrbMeshPlaceholder->setWorldPosition(getHead()->getPosition()); properties.setDimensions(glm::vec3(0.5f, 0.5f, 0.5f));
_otherAvatarOrbMeshPlaceholder->setDimensions(glm::vec3(0.5f, 0.5f, 0.5f)); properties.setVisible(true);
_otherAvatarOrbMeshPlaceholder->setVisible(true);
_otherAvatarOrbMeshPlaceholderID = DependencyManager::get<EntityScriptingInterface>()->addEntity(properties, "local");
} }
} }
void OtherAvatar::indicateLoadingStatus(LoadingStatus loadingStatus) { void OtherAvatar::indicateLoadingStatus(LoadingStatus loadingStatus) {
Avatar::indicateLoadingStatus(loadingStatus); Avatar::indicateLoadingStatus(loadingStatus);
if (_otherAvatarOrbMeshPlaceholder) {
_otherAvatarOrbMeshPlaceholder->setColor(getLoadingOrbColor(_loadingStatus)); if (_otherAvatarOrbMeshPlaceholderID != UNKNOWN_ENTITY_ID) {
EntityItemProperties properties;
properties.setColor(getLoadingOrbColor(_loadingStatus));
DependencyManager::get<EntityScriptingInterface>()->editEntity(_otherAvatarOrbMeshPlaceholderID, properties);
} }
} }

View file

@ -17,7 +17,6 @@
#include "InterfaceLogging.h" #include "InterfaceLogging.h"
#include "ui/overlays/Overlays.h" #include "ui/overlays/Overlays.h"
#include "ui/overlays/Sphere3DOverlay.h"
class AvatarManager; class AvatarManager;
class AvatarMotionState; class AvatarMotionState;
@ -59,8 +58,7 @@ protected:
void onRemoveAttachedAvatarEntity(const QUuid& id); void onRemoveAttachedAvatarEntity(const QUuid& id);
std::vector<QUuid> _attachedAvatarEntities; std::vector<QUuid> _attachedAvatarEntities;
std::shared_ptr<Sphere3DOverlay> _otherAvatarOrbMeshPlaceholder { nullptr }; QUuid _otherAvatarOrbMeshPlaceholderID { UNKNOWN_ENTITY_ID };
OverlayID _otherAvatarOrbMeshPlaceholderID { UNKNOWN_OVERLAY_ID };
AvatarMotionState* _motionState { nullptr }; AvatarMotionState* _motionState { nullptr };
int32_t _spaceIndex { -1 }; int32_t _spaceIndex { -1 };
uint8_t _workloadRegion { workload::Region::INVALID }; uint8_t _workloadRegion { workload::Region::INVALID };

View file

@ -194,7 +194,6 @@ DdeFaceTracker::DdeFaceTracker(const QHostAddress& host, quint16 serverPort, qui
_calibrationCount(0), _calibrationCount(0),
_calibrationValues(), _calibrationValues(),
_calibrationBillboard(NULL), _calibrationBillboard(NULL),
_calibrationBillboardID(UNKNOWN_OVERLAY_ID),
_calibrationMessage(QString()), _calibrationMessage(QString()),
_isCalibrated(false) _isCalibrated(false)
{ {

View file

@ -168,7 +168,7 @@ private:
int _calibrationCount; int _calibrationCount;
QVector<float> _calibrationValues; QVector<float> _calibrationValues;
TextOverlay* _calibrationBillboard; TextOverlay* _calibrationBillboard;
OverlayID _calibrationBillboardID; QUuid _calibrationBillboardID;
QString _calibrationMessage; QString _calibrationMessage;
bool _isCalibrated; bool _isCalibrated;
void addCalibrationDatum(); void addCalibrationDatum();

View file

@ -409,10 +409,6 @@ PickResultPointer CollisionPick::getEntityIntersection(const CollisionRegion& pi
return std::make_shared<CollisionPickResult>(pick, entityIntersections, std::vector<ContactTestResult>()); return std::make_shared<CollisionPickResult>(pick, entityIntersections, std::vector<ContactTestResult>());
} }
PickResultPointer CollisionPick::getOverlayIntersection(const CollisionRegion& pick) {
return std::make_shared<CollisionPickResult>(pick, std::vector<ContactTestResult>(), std::vector<ContactTestResult>());
}
PickResultPointer CollisionPick::getAvatarIntersection(const CollisionRegion& pick) { PickResultPointer CollisionPick::getAvatarIntersection(const CollisionRegion& pick) {
if (!pick.loaded) { if (!pick.loaded) {
// Cannot compute result // Cannot compute result

View file

@ -54,7 +54,6 @@ public:
return std::make_shared<CollisionPickResult>(pickVariant, std::vector<ContactTestResult>(), std::vector<ContactTestResult>()); return std::make_shared<CollisionPickResult>(pickVariant, std::vector<ContactTestResult>(), std::vector<ContactTestResult>());
} }
PickResultPointer getEntityIntersection(const CollisionRegion& pick) override; PickResultPointer getEntityIntersection(const CollisionRegion& pick) override;
PickResultPointer getOverlayIntersection(const CollisionRegion& pick) override;
PickResultPointer getAvatarIntersection(const CollisionRegion& pick) override; PickResultPointer getAvatarIntersection(const CollisionRegion& pick) override;
PickResultPointer getHUDIntersection(const CollisionRegion& pick) override; PickResultPointer getHUDIntersection(const CollisionRegion& pick) override;
Transform getResultTransform() const override; Transform getResultTransform() const override;

View file

@ -17,6 +17,8 @@
#include "PickManager.h" #include "PickManager.h"
#include "RayPick.h" #include "RayPick.h"
#include "PolyLineEntityItem.h"
LaserPointer::LaserPointer(const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates, bool hover, LaserPointer::LaserPointer(const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates, bool hover,
const PointerTriggers& triggers, bool faceAvatar, bool followNormal, float followNormalTime, bool centerEndY, bool lockEnd, const PointerTriggers& triggers, bool faceAvatar, bool followNormal, float followNormalTime, bool centerEndY, bool lockEnd,
bool distanceScaleEnd, bool scaleWithParent, bool enabled) : bool distanceScaleEnd, bool scaleWithParent, bool enabled) :
@ -28,7 +30,7 @@ LaserPointer::LaserPointer(const QVariant& rayProps, const RenderStateMap& rende
void LaserPointer::editRenderStatePath(const std::string& state, const QVariant& pathProps) { void LaserPointer::editRenderStatePath(const std::string& state, const QVariant& pathProps) {
auto renderState = std::static_pointer_cast<RenderState>(_renderStates[state]); auto renderState = std::static_pointer_cast<RenderState>(_renderStates[state]);
if (renderState) { if (renderState) {
updateRenderStateOverlay(renderState->getPathID(), pathProps); updateRenderState(renderState->getPathID(), pathProps);
QVariant lineWidth = pathProps.toMap()["lineWidth"]; QVariant lineWidth = pathProps.toMap()["lineWidth"];
if (lineWidth.isValid()) { if (lineWidth.isValid()) {
renderState->setLineWidth(lineWidth.toFloat()); renderState->setLineWidth(lineWidth.toFloat());
@ -121,48 +123,61 @@ void LaserPointer::setVisualPickResultInternal(PickResultPointer pickResult, Int
} }
} }
LaserPointer::RenderState::RenderState(const OverlayID& startID, const OverlayID& pathID, const OverlayID& endID) : LaserPointer::RenderState::RenderState(const QUuid& startID, const QUuid& pathID, const QUuid& endID) :
StartEndRenderState(startID, endID), _pathID(pathID) StartEndRenderState(startID, endID), _pathID(pathID)
{ {
if (!_pathID.isNull()) { if (!getPathID().isNull()) {
_pathIgnoreRays = qApp->getOverlays().getProperty(_pathID, "ignorePickIntersection").value.toBool(); auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
_lineWidth = qApp->getOverlays().getProperty(_pathID, "lineWidth").value.toFloat(); {
EntityPropertyFlags desiredProperties;
desiredProperties += PROP_IGNORE_PICK_INTERSECTION;
_pathIgnorePicks = entityScriptingInterface->getEntityProperties(getPathID(), desiredProperties).getIgnorePickIntersection();
}
{
EntityPropertyFlags desiredProperties;
desiredProperties += PROP_STROKE_WIDTHS;
auto widths = entityScriptingInterface->getEntityProperties(getPathID(), desiredProperties).getStrokeWidths();
_lineWidth = widths.length() == 0 ? PolyLineEntityItem::DEFAULT_LINE_WIDTH : widths[0];
}
} }
} }
void LaserPointer::RenderState::cleanup() { void LaserPointer::RenderState::cleanup() {
StartEndRenderState::cleanup(); StartEndRenderState::cleanup();
if (!_pathID.isNull()) { if (!getPathID().isNull()) {
qApp->getOverlays().deleteOverlay(_pathID); DependencyManager::get<EntityScriptingInterface>()->deleteEntity(getPathID());
} }
} }
void LaserPointer::RenderState::disable() { void LaserPointer::RenderState::disable() {
StartEndRenderState::disable(); StartEndRenderState::disable();
if (!getPathID().isNull()) { if (!getPathID().isNull()) {
QVariantMap pathProps; EntityItemProperties properties;
pathProps.insert("visible", false); properties.setVisible(false);
pathProps.insert("ignorePickIntersection", true); properties.setIgnorePickIntersection(true);
qApp->getOverlays().editOverlay(getPathID(), pathProps); DependencyManager::get<EntityScriptingInterface>()->editEntity(getPathID(), properties);
} }
} }
void LaserPointer::RenderState::update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, float parentScale, bool distanceScaleEnd, bool centerEndY, void LaserPointer::RenderState::update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, float parentScale, bool distanceScaleEnd, bool centerEndY,
bool faceAvatar, bool followNormal, float followNormalStrength, float distance, const PickResultPointer& pickResult) { bool faceAvatar, bool followNormal, float followNormalStrength, float distance, const PickResultPointer& pickResult) {
StartEndRenderState::update(origin, end, surfaceNormal, parentScale, distanceScaleEnd, centerEndY, faceAvatar, followNormal, followNormalStrength, distance, pickResult); StartEndRenderState::update(origin, end, surfaceNormal, parentScale, distanceScaleEnd, centerEndY, faceAvatar, followNormal, followNormalStrength, distance, pickResult);
QVariant endVariant = vec3toVariant(end);
if (!getPathID().isNull()) { if (!getPathID().isNull()) {
QVariantMap pathProps; EntityItemProperties properties;
pathProps.insert("start", vec3toVariant(origin)); QVector<glm::vec3> points;
pathProps.insert("end", endVariant); points.append(origin);
pathProps.insert("visible", true); points.append(end);
pathProps.insert("ignorePickIntersection", doesPathIgnoreRays()); properties.setLinePoints(points);
pathProps.insert("lineWidth", getLineWidth() * parentScale); properties.setVisible(true);
qApp->getOverlays().editOverlay(getPathID(), pathProps); properties.setIgnorePickIntersection(doesPathIgnorePicks());
QVector<float> widths;
widths.append(getLineWidth() * parentScale);
DependencyManager::get<EntityScriptingInterface>()->editEntity(getPathID(), properties);
} }
} }
std::shared_ptr<StartEndRenderState> LaserPointer::buildRenderState(const QVariantMap& propMap) { std::shared_ptr<StartEndRenderState> LaserPointer::buildRenderState(const QVariantMap& propMap) {
// FIXME: we have to keep using the Overlays interface here, because existing scripts use overlay properties to define pointers
QUuid startID; QUuid startID;
if (propMap["start"].isValid()) { if (propMap["start"].isValid()) {
QVariantMap startMap = propMap["start"].toMap(); QVariantMap startMap = propMap["start"].toMap();
@ -233,8 +248,6 @@ glm::vec3 LaserPointer::findIntersection(const PickedObject& pickedObject, const
switch (pickedObject.type) { switch (pickedObject.type) {
case ENTITY: case ENTITY:
return RayPick::intersectRayWithEntityXYPlane(pickedObject.objectID, origin, direction); return RayPick::intersectRayWithEntityXYPlane(pickedObject.objectID, origin, direction);
case OVERLAY:
return RayPick::intersectRayWithOverlayXYPlane(pickedObject.objectID, origin, direction);
default: default:
return glm::vec3(NAN); return glm::vec3(NAN);
} }

View file

@ -19,10 +19,10 @@ public:
class RenderState : public StartEndRenderState { class RenderState : public StartEndRenderState {
public: public:
RenderState() {} RenderState() {}
RenderState(const OverlayID& startID, const OverlayID& pathID, const OverlayID& endID); RenderState(const QUuid& startID, const QUuid& pathID, const QUuid& endID);
const OverlayID& getPathID() const { return _pathID; } const QUuid& getPathID() const { return _pathID; }
const bool& doesPathIgnoreRays() const { return _pathIgnoreRays; } const bool& doesPathIgnorePicks() const { return _pathIgnorePicks; }
void setLineWidth(float width) { _lineWidth = width; } void setLineWidth(float width) { _lineWidth = width; }
float getLineWidth() const { return _lineWidth; } float getLineWidth() const { return _lineWidth; }
@ -33,9 +33,9 @@ public:
bool faceAvatar, bool followNormal, float followNormalStrength, float distance, const PickResultPointer& pickResult) override; bool faceAvatar, bool followNormal, float followNormalStrength, float distance, const PickResultPointer& pickResult) override;
private: private:
OverlayID _pathID; QUuid _pathID;
bool _pathIgnoreRays;
bool _pathIgnorePicks;
float _lineWidth; float _lineWidth;
}; };

View file

@ -111,10 +111,10 @@ public:
* @function LaserPointers.setLockEndUUID * @function LaserPointers.setLockEndUUID
* @param {number} id * @param {number} id
* @param {Uuid} itemID * @param {Uuid} itemID
* @param {boolean} isOverlay * @param {boolean} isAvatar
* @param {Mat4} [offsetMat] * @param {Mat4} [offsetMat]
*/ */
Q_INVOKABLE void setLockEndUUID(unsigned int uid, const QUuid& objectID, bool isOverlay, const glm::mat4& offsetMat = glm::mat4()) const { DependencyManager::get<PointerManager>()->setLockEndUUID(uid, objectID, isOverlay, offsetMat); } Q_INVOKABLE void setLockEndUUID(unsigned int uid, const QUuid& objectID, bool isAvatar, const glm::mat4& offsetMat = glm::mat4()) const { DependencyManager::get<PointerManager>()->setLockEndUUID(uid, objectID, isAvatar, offsetMat); }
/**jsdoc /**jsdoc

View file

@ -10,7 +10,6 @@
#include "Application.h" #include "Application.h"
#include "EntityScriptingInterface.h" #include "EntityScriptingInterface.h"
#include "PickScriptingInterface.h" #include "PickScriptingInterface.h"
#include "ui/overlays/Overlays.h"
#include "avatar/AvatarManager.h" #include "avatar/AvatarManager.h"
#include "scripting/HMDScriptingInterface.h" #include "scripting/HMDScriptingInterface.h"
#include "DependencyManager.h" #include "DependencyManager.h"
@ -74,19 +73,6 @@ PickResultPointer ParabolaPick::getEntityIntersection(const PickParabola& pick)
return std::make_shared<ParabolaPickResult>(pick.toVariantMap()); return std::make_shared<ParabolaPickResult>(pick.toVariantMap());
} }
PickResultPointer ParabolaPick::getOverlayIntersection(const PickParabola& pick) {
if (glm::length2(pick.acceleration) > EPSILON && glm::length2(pick.velocity) > EPSILON) {
bool precisionPicking = !(getFilter().isCoarse() || DependencyManager::get<PickManager>()->getForceCoarsePicking());
ParabolaToOverlayIntersectionResult overlayRes =
qApp->getOverlays().findParabolaIntersectionVector(pick, precisionPicking,
getIncludeItemsAs<OverlayID>(), getIgnoreItemsAs<OverlayID>(), !getFilter().doesPickInvisible(), !getFilter().doesPickNonCollidable());
if (overlayRes.intersects) {
return std::make_shared<ParabolaPickResult>(IntersectionType::OVERLAY, overlayRes.overlayID, overlayRes.distance, overlayRes.parabolicDistance, overlayRes.intersection, pick, overlayRes.surfaceNormal, overlayRes.extraInfo);
}
}
return std::make_shared<ParabolaPickResult>(pick.toVariantMap());
}
PickResultPointer ParabolaPick::getAvatarIntersection(const PickParabola& pick) { PickResultPointer ParabolaPick::getAvatarIntersection(const PickParabola& pick) {
if (glm::length2(pick.acceleration) > EPSILON && glm::length2(pick.velocity) > EPSILON) { if (glm::length2(pick.acceleration) > EPSILON && glm::length2(pick.velocity) > EPSILON) {
ParabolaToAvatarIntersectionResult avatarRes = DependencyManager::get<AvatarManager>()->findParabolaIntersectionVector(pick, getIncludeItemsAs<EntityItemID>(), getIgnoreItemsAs<EntityItemID>()); ParabolaToAvatarIntersectionResult avatarRes = DependencyManager::get<AvatarManager>()->findParabolaIntersectionVector(pick, getIncludeItemsAs<EntityItemID>(), getIgnoreItemsAs<EntityItemID>());

View file

@ -12,7 +12,6 @@
#include <Pick.h> #include <Pick.h>
class EntityItemID; class EntityItemID;
class OverlayID;
class ParabolaPickResult : public PickResult { class ParabolaPickResult : public PickResult {
public: public:
@ -80,7 +79,6 @@ public:
PickResultPointer getDefaultResult(const QVariantMap& pickVariant) const override { return std::make_shared<ParabolaPickResult>(pickVariant); } PickResultPointer getDefaultResult(const QVariantMap& pickVariant) const override { return std::make_shared<ParabolaPickResult>(pickVariant); }
PickResultPointer getEntityIntersection(const PickParabola& pick) override; PickResultPointer getEntityIntersection(const PickParabola& pick) override;
PickResultPointer getOverlayIntersection(const PickParabola& pick) override;
PickResultPointer getAvatarIntersection(const PickParabola& pick) override; PickResultPointer getAvatarIntersection(const PickParabola& pick) override;
PickResultPointer getHUDIntersection(const PickParabola& pick) override; PickResultPointer getHUDIntersection(const PickParabola& pick) override;
Transform getResultTransform() const override; Transform getResultTransform() const override;

View file

@ -149,7 +149,7 @@ void ParabolaPointer::setVisualPickResultInternal(PickResultPointer pickResult,
} }
} }
ParabolaPointer::RenderState::RenderState(const OverlayID& startID, const OverlayID& endID, const glm::vec3& pathColor, float pathAlpha, float pathWidth, ParabolaPointer::RenderState::RenderState(const QUuid& startID, const QUuid& endID, const glm::vec3& pathColor, float pathAlpha, float pathWidth,
bool isVisibleInSecondaryCamera, bool drawInFront, bool pathEnabled) : bool isVisibleInSecondaryCamera, bool drawInFront, bool pathEnabled) :
StartEndRenderState(startID, endID) StartEndRenderState(startID, endID)
{ {
@ -230,6 +230,7 @@ void ParabolaPointer::RenderState::update(const glm::vec3& origin, const glm::ve
} }
std::shared_ptr<StartEndRenderState> ParabolaPointer::buildRenderState(const QVariantMap& propMap) { std::shared_ptr<StartEndRenderState> ParabolaPointer::buildRenderState(const QVariantMap& propMap) {
// FIXME: we have to keep using the Overlays interface here, because existing scripts use overlay properties to define pointers
QUuid startID; QUuid startID;
if (propMap["start"].isValid()) { if (propMap["start"].isValid()) {
QVariantMap startMap = propMap["start"].toMap(); QVariantMap startMap = propMap["start"].toMap();
@ -322,8 +323,6 @@ glm::vec3 ParabolaPointer::findIntersection(const PickedObject& pickedObject, co
switch (pickedObject.type) { switch (pickedObject.type) {
case ENTITY: case ENTITY:
//return ParabolaPick::intersectParabolaWithEntityXYPlane(pickedObject.objectID, origin, velocity, acceleration); //return ParabolaPick::intersectParabolaWithEntityXYPlane(pickedObject.objectID, origin, velocity, acceleration);
case OVERLAY:
//return ParabolaPick::intersectParabolaWithOverlayXYPlane(pickedObject.objectID, origin, velocity, acceleration);
default: default:
return glm::vec3(NAN); return glm::vec3(NAN);
} }

View file

@ -79,7 +79,7 @@ public:
}; };
RenderState() {} RenderState() {}
RenderState(const OverlayID& startID, const OverlayID& endID, const glm::vec3& pathColor, float pathAlpha, float parentScale, RenderState(const QUuid& startID, const QUuid& endID, const glm::vec3& pathColor, float pathAlpha, float parentScale,
bool isVisibleInSecondaryCamera, bool drawInFront, bool pathEnabled); bool isVisibleInSecondaryCamera, bool drawInFront, bool pathEnabled);
void setPathWidth(float width) { _pathWidth = width; } void setPathWidth(float width) { _pathWidth = width; }

View file

@ -73,10 +73,10 @@ void PathPointer::setLength(float length) {
}); });
} }
void PathPointer::setLockEndUUID(const QUuid& objectID, const bool isOverlay, const glm::mat4& offsetMat) { void PathPointer::setLockEndUUID(const QUuid& objectID, bool isAvatar, const glm::mat4& offsetMat) {
withWriteLock([&] { withWriteLock([&] {
_lockEndObject.id = objectID; _lockEndObject.id = objectID;
_lockEndObject.isOverlay = isOverlay; _lockEndObject.isAvatar = isAvatar;
_lockEndObject.offsetMat = offsetMat; _lockEndObject.offsetMat = offsetMat;
}); });
} }
@ -97,12 +97,8 @@ PickResultPointer PathPointer::getVisualPickResult(const PickResultPointer& pick
glm::quat rot; glm::quat rot;
glm::vec3 dim; glm::vec3 dim;
glm::vec3 registrationPoint; glm::vec3 registrationPoint;
if (_lockEndObject.isOverlay) { // TODO: use isAvatar
pos = vec3FromVariant(qApp->getOverlays().getProperty(_lockEndObject.id, "position").value); {
rot = quatFromVariant(qApp->getOverlays().getProperty(_lockEndObject.id, "rotation").value);
dim = vec3FromVariant(qApp->getOverlays().getProperty(_lockEndObject.id, "dimensions").value);
registrationPoint = glm::vec3(0.5f);
} else {
EntityItemProperties props = DependencyManager::get<EntityScriptingInterface>()->getEntityProperties(_lockEndObject.id); EntityItemProperties props = DependencyManager::get<EntityScriptingInterface>()->getEntityProperties(_lockEndObject.id);
glm::mat4 entityMat = createMatFromQuatAndPos(props.getRotation(), props.getPosition()); glm::mat4 entityMat = createMatFromQuatAndPos(props.getRotation(), props.getPosition());
glm::mat4 finalPosAndRotMat = entityMat * _lockEndObject.offsetMat; glm::mat4 finalPosAndRotMat = entityMat * _lockEndObject.offsetMat;
@ -117,7 +113,7 @@ PickResultPointer PathPointer::getVisualPickResult(const PickResultPointer& pick
distance = glm::distance(origin, endVec); distance = glm::distance(origin, endVec);
glm::vec3 normalizedDirection = glm::normalize(direction); glm::vec3 normalizedDirection = glm::normalize(direction);
type = _lockEndObject.isOverlay ? IntersectionType::OVERLAY : IntersectionType::ENTITY; type = IntersectionType::ENTITY;
id = _lockEndObject.id; id = _lockEndObject.id;
intersection = endVec; intersection = endVec;
surfaceNormal = -normalizedDirection; surfaceNormal = -normalizedDirection;
@ -126,8 +122,6 @@ PickResultPointer PathPointer::getVisualPickResult(const PickResultPointer& pick
id = getPickedObjectID(pickResult); id = getPickedObjectID(pickResult);
if (type == IntersectionType::ENTITY) { if (type == IntersectionType::ENTITY) {
endVec = DependencyManager::get<EntityScriptingInterface>()->getEntityTransform(id)[3]; endVec = DependencyManager::get<EntityScriptingInterface>()->getEntityTransform(id)[3];
} else if (type == IntersectionType::OVERLAY) {
endVec = vec3FromVariant(qApp->getOverlays().getProperty(id, "position").value);
} else if (type == IntersectionType::AVATAR) { } else if (type == IntersectionType::AVATAR) {
endVec = DependencyManager::get<AvatarHashMap>()->getAvatar(id)->getPosition(); endVec = DependencyManager::get<AvatarHashMap>()->getAvatar(id)->getPosition();
} }
@ -184,8 +178,8 @@ void PathPointer::editRenderState(const std::string& state, const QVariant& star
withWriteLock([&] { withWriteLock([&] {
auto renderState = _renderStates.find(state); auto renderState = _renderStates.find(state);
if (renderState != _renderStates.end()) { if (renderState != _renderStates.end()) {
updateRenderStateOverlay(renderState->second->getStartID(), startProps); updateRenderState(renderState->second->getStartID(), startProps);
updateRenderStateOverlay(renderState->second->getEndID(), endProps); updateRenderState(renderState->second->getEndID(), endProps);
QVariant startDim = startProps.toMap()["dimensions"]; QVariant startDim = startProps.toMap()["dimensions"];
if (startDim.isValid()) { if (startDim.isValid()) {
renderState->second->setStartDim(vec3FromVariant(startDim)); renderState->second->setStartDim(vec3FromVariant(startDim));
@ -204,7 +198,7 @@ void PathPointer::editRenderState(const std::string& state, const QVariant& star
}); });
} }
void PathPointer::updateRenderStateOverlay(const OverlayID& id, const QVariant& props) { void PathPointer::updateRenderState(const QUuid& id, const QVariant& props) {
if (!id.isNull() && props.isValid()) { if (!id.isNull() && props.isValid()) {
QVariantMap propMap = props.toMap(); QVariantMap propMap = props.toMap();
propMap.remove("visible"); propMap.remove("visible");

View file

@ -19,20 +19,20 @@
struct LockEndObject { struct LockEndObject {
QUuid id { QUuid() }; QUuid id { QUuid() };
bool isOverlay { false }; bool isAvatar { false };
glm::mat4 offsetMat { glm::mat4() }; glm::mat4 offsetMat { glm::mat4() };
}; };
class StartEndRenderState { class StartEndRenderState {
public: public:
StartEndRenderState() {} StartEndRenderState() {}
StartEndRenderState(const OverlayID& startID, const OverlayID& endID); StartEndRenderState(const QUuid& startID, const QUuid& endID);
virtual ~StartEndRenderState() = default; virtual ~StartEndRenderState() = default;
const OverlayID& getStartID() const { return _startID; } const QUuid& getStartID() const { return _startID; }
const OverlayID& getEndID() const { return _endID; } const QUuid& getEndID() const { return _endID; }
const bool& doesStartIgnoreRays() const { return _startIgnoreRays; } const bool& doesStartIgnorePicks() const { return _startIgnorePicks; }
const bool& doesEndIgnoreRays() const { return _endIgnoreRays; } const bool& doesEndIgnorePicks() const { return _endIgnorePicks; }
void setStartDim(const glm::vec3& startDim) { _startDim = startDim; } void setStartDim(const glm::vec3& startDim) { _startDim = startDim; }
const glm::vec3& getStartDim() const { return _startDim; } const glm::vec3& getStartDim() const { return _startDim; }
@ -51,10 +51,10 @@ public:
bool isEnabled() const { return _enabled; } bool isEnabled() const { return _enabled; }
protected: protected:
OverlayID _startID; QUuid _startID;
OverlayID _endID; QUuid _endID;
bool _startIgnoreRays; bool _startIgnorePicks;
bool _endIgnoreRays; bool _endIgnorePicks;
glm::vec3 _startDim; glm::vec3 _startDim;
glm::vec3 _endDim; glm::vec3 _endDim;
@ -82,7 +82,7 @@ public:
void editRenderState(const std::string& state, const QVariant& startProps, const QVariant& pathProps, const QVariant& endProps) override; void editRenderState(const std::string& state, const QVariant& startProps, const QVariant& pathProps, const QVariant& endProps) override;
void setLength(float length) override; void setLength(float length) override;
void setLockEndUUID(const QUuid& objectID, bool isOverlay, const glm::mat4& offsetMat = glm::mat4()) override; void setLockEndUUID(const QUuid& objectID, bool isAvatar, const glm::mat4& offsetMat = glm::mat4()) override;
void updateVisuals(const PickResultPointer& prevRayPickResult) override; void updateVisuals(const PickResultPointer& prevRayPickResult) override;

View file

@ -199,7 +199,7 @@ void TextEntityRenderer::doRender(RenderArgs* args) {
geometryCache->bindSimpleProgram(batch, false, backgroundColor.a < 1.0f, false, false, false); geometryCache->bindSimpleProgram(batch, false, backgroundColor.a < 1.0f, false, false, false);
geometryCache->renderQuad(batch, minCorner, maxCorner, backgroundColor, _geometryID); geometryCache->renderQuad(batch, minCorner, maxCorner, backgroundColor, _geometryID);
// FIXME: Factor out textRenderer so that Text3DOverlay overlay parts can be grouped by pipeline for a gpu performance increase. // FIXME: Factor out textRenderer so that text parts can be grouped by pipeline for a gpu performance increase.
float scale = _lineHeight / _textRenderer->getFontSize(); float scale = _lineHeight / _textRenderer->getFontSize();
transformToTopLeft.setScale(scale); // Scale to have the correct line height transformToTopLeft.setScale(scale); // Scale to have the correct line height
batch.setModelTransform(transformToTopLeft); batch.setModelTransform(transformToTopLeft);

View file

@ -945,12 +945,9 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
*/ */
/**jsdoc /**jsdoc
* The <code>"Material"</code> {@link Entities.EntityType|EntityType} modifies the existing materials on * The <code>"Material"</code> {@link Entities.EntityType|EntityType} modifies the existing materials on entities and avatars.
* {@link Entities.EntityType|Model} entities, {@link Entities.EntityType|Shape} entities (albedo only),
* {@link Overlays.OverlayType|model overlays}, and avatars.
* It has properties in addition to the common {@link Entities.EntityProperties|EntityProperties}.<br /> * It has properties in addition to the common {@link Entities.EntityProperties|EntityProperties}.<br />
* To apply a material to an entity or overlay, set the material entity's <code>parentID</code> property to the entity or * To apply a material to an entity, set the material entity's <code>parentID</code> property to the entity ID.
* overlay's ID.
* To apply a material to an avatar, set the material entity's <code>parentID</code> property to the avatar's session UUID. * To apply a material to an avatar, set the material entity's <code>parentID</code> property to the avatar's session UUID.
* To apply a material to your avatar such that it persists across domains and log-ins, create the material as an avatar entity * To apply a material to your avatar such that it persists across domains and log-ins, create the material as an avatar entity
* by setting the <code>entityHostType</code> parameter in {@link Entities.addEntity} to <code>"avatar"</code>. * by setting the <code>entityHostType</code> parameter in {@link Entities.addEntity} to <code>"avatar"</code>.

View file

@ -84,8 +84,7 @@ public:
* <td>{@link Entities.EntityProperties-Light|EntityProperties-Light}</td></tr> * <td>{@link Entities.EntityProperties-Light|EntityProperties-Light}</td></tr>
* <tr><td><code>"Zone"</code></td><td>A volume of lighting effects and avatar permissions.</td> * <tr><td><code>"Zone"</code></td><td>A volume of lighting effects and avatar permissions.</td>
* <td>{@link Entities.EntityProperties-Zone|EntityProperties-Zone}</td></tr> * <td>{@link Entities.EntityProperties-Zone|EntityProperties-Zone}</td></tr>
* <tr><td><code>"Material"</code></td><td>Modifies the existing materials on Model entities, Shape entities, * <tr><td><code>"Material"</code></td><td>Modifies the existing materials on entities and avatars.</td>
* {@link Overlays.OverlayType|model overlays}, and avatars.</td>
* <td>{@link Entities.EntityProperties-Material|EntityProperties-Material}</td></tr> * <td>{@link Entities.EntityProperties-Material|EntityProperties-Material}</td></tr>
* </tbody> * </tbody>
* </table> * </table>

View file

@ -23,7 +23,6 @@
const int LineEntityItem::MAX_POINTS_PER_LINE = 70; const int LineEntityItem::MAX_POINTS_PER_LINE = 70;
EntityItemPointer LineEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { EntityItemPointer LineEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
EntityItemPointer entity(new LineEntityItem(entityID), [](EntityItem* ptr) { ptr->deleteLater(); }); EntityItemPointer entity(new LineEntityItem(entityID), [](EntityItem* ptr) { ptr->deleteLater(); });
entity->setProperties(properties); entity->setProperties(properties);

View file

@ -310,7 +310,7 @@ void MaterialEntityItem::removeMaterial() {
return; return;
} }
// Our parent could be an entity, an avatar, or an overlay // Our parent could be an entity or an avatar
if (EntityTree::removeMaterialFromEntity(parentID, material, getParentMaterialName().toStdString())) { if (EntityTree::removeMaterialFromEntity(parentID, material, getParentMaterialName().toStdString())) {
return; return;
} }
@ -319,10 +319,6 @@ void MaterialEntityItem::removeMaterial() {
return; return;
} }
if (EntityTree::removeMaterialFromOverlay(parentID, material, getParentMaterialName().toStdString())) {
return;
}
// if a remove fails, our parent is gone, so we don't need to retry // if a remove fails, our parent is gone, so we don't need to retry
} }
@ -349,7 +345,7 @@ void MaterialEntityItem::applyMaterial() {
graphics::MaterialLayer materialLayer = graphics::MaterialLayer(material, getPriority()); graphics::MaterialLayer materialLayer = graphics::MaterialLayer(material, getPriority());
// Our parent could be an entity, an avatar, or an overlay // Our parent could be an entity or an avatar
if (EntityTree::addMaterialToEntity(parentID, materialLayer, getParentMaterialName().toStdString())) { if (EntityTree::addMaterialToEntity(parentID, materialLayer, getParentMaterialName().toStdString())) {
return; return;
} }
@ -358,10 +354,6 @@ void MaterialEntityItem::applyMaterial() {
return; return;
} }
if (EntityTree::addMaterialToOverlay(parentID, materialLayer, getParentMaterialName().toStdString())) {
return;
}
// if we've reached this point, we couldn't find our parent, so we need to try again later // if we've reached this point, we couldn't find our parent, so we need to try again later
_retryApply = true; _retryApply = true;
} }

View file

@ -149,7 +149,7 @@ namespace scriptable {
// QVariantMap armature; // QVariantMap armature;
}; };
// mixin class for Avatar/Entity/Overlay Rendering that expose their in-memory graphics::Meshes // mixin class for Avatar + Entity Rendering that expose their in-memory graphics::Meshes
class ModelProvider { class ModelProvider {
public: public:
NestableType modelProviderType; NestableType modelProviderType;

View file

@ -38,13 +38,13 @@ public:
public slots: public slots:
/**jsdoc /**jsdoc
* Returns a model reference object associated with the specified UUID ({@link EntityID}, {@link OverlayID}, or {@link AvatarID}). * Returns a model reference object associated with the specified UUID ({@link EntityID} or {@link AvatarID}).
* *
* @function Graphics.getModel * @function Graphics.getModel
* @param {UUID} entityID - The objectID of the model whose meshes are to be retrieved. * @param {UUID} entityID - The objectID of the model whose meshes are to be retrieved.
* @returns {Graphics.Model} the resulting Model object * @returns {Graphics.Model} the resulting Model object
*/ */
scriptable::ScriptableModelPointer getModel(QUuid uuid); scriptable::ScriptableModelPointer getModel(const QUuid& uuid);
/**jsdoc /**jsdoc
* @function Graphics.updateModel * @function Graphics.updateModel
@ -52,7 +52,7 @@ public slots:
* @param {Graphics.Model} model * @param {Graphics.Model} model
* @returns {boolean} * @returns {boolean}
*/ */
bool updateModel(QUuid uuid, const scriptable::ScriptableModelPointer& model); bool updateModel(const QUuid& uuid, const scriptable::ScriptableModelPointer& model);
/**jsdoc /**jsdoc
* @function Graphics.canUpdateModel * @function Graphics.canUpdateModel
@ -61,7 +61,7 @@ public slots:
* @param {number} [partNumber=-1] * @param {number} [partNumber=-1]
* @returns {boolean} * @returns {boolean}
*/ */
bool canUpdateModel(QUuid uuid, int meshIndex = -1, int partNumber = -1); bool canUpdateModel(const QUuid& uuid, int meshIndex = -1, int partNumber = -1);
/**jsdoc /**jsdoc
* @function Graphics.newModel * @function Graphics.newModel
@ -94,7 +94,7 @@ public slots:
QString exportModelToOBJ(const scriptable::ScriptableModel& in); QString exportModelToOBJ(const scriptable::ScriptableModel& in);
private: private:
scriptable::ModelProviderPointer getModelProvider(QUuid uuid); scriptable::ModelProviderPointer getModelProvider(const QUuid& uuid);
void jsThrowError(const QString& error); void jsThrowError(const QString& error);
scriptable::MeshPointer getMeshPointer(scriptable::ScriptableMeshPointer meshProxy); scriptable::MeshPointer getMeshPointer(scriptable::ScriptableMeshPointer meshProxy);
scriptable::MeshPointer getMeshPointer(scriptable::ScriptableMesh& meshProxy); scriptable::MeshPointer getMeshPointer(scriptable::ScriptableMesh& meshProxy);

View file

@ -23,7 +23,6 @@
enum IntersectionType { enum IntersectionType {
NONE = 0, NONE = 0,
ENTITY, ENTITY,
OVERLAY,
AVATAR, AVATAR,
HUD HUD
}; };