mirror of
https://github.com/lubosz/overte.git
synced 2025-04-12 17:11:06 +02:00
removing overlays wip
This commit is contained in:
parent
0bfcde67ea
commit
ca8d64bc05
24 changed files with 105 additions and 134 deletions
interface/src
avatar
devices
raypick
libraries
entities-renderer/src
entities/src
graphics-scripting/src/graphics-scripting
pointers/src
|
@ -136,7 +136,7 @@ class MyAvatar : public Avatar {
|
|||
* 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} 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.
|
||||
* <em>Read-only.</em>
|
||||
* @property {number} walkSpeed
|
||||
|
|
|
@ -54,44 +54,47 @@ OtherAvatar::~OtherAvatar() {
|
|||
|
||||
void OtherAvatar::removeOrb() {
|
||||
if (!_otherAvatarOrbMeshPlaceholderID.isNull()) {
|
||||
qApp->getOverlays().deleteOverlay(_otherAvatarOrbMeshPlaceholderID);
|
||||
_otherAvatarOrbMeshPlaceholderID = UNKNOWN_OVERLAY_ID;
|
||||
DependencyManager::get<EntityScriptingInterface>()->deleteEntity(_otherAvatarOrbMeshPlaceholderID);
|
||||
_otherAvatarOrbMeshPlaceholderID = UNKNOWN_ENTITY_ID;
|
||||
}
|
||||
}
|
||||
|
||||
void OtherAvatar::updateOrbPosition() {
|
||||
if (_otherAvatarOrbMeshPlaceholder != nullptr) {
|
||||
_otherAvatarOrbMeshPlaceholder->setWorldPosition(getHead()->getPosition());
|
||||
if (_otherAvatarOrbMeshPlaceholderID.isNull()) {
|
||||
_otherAvatarOrbMeshPlaceholderID = qApp->getOverlays().addOverlay(_otherAvatarOrbMeshPlaceholder);
|
||||
}
|
||||
if (_otherAvatarOrbMeshPlaceholderID.isNull()) {
|
||||
EntityItemProperties properties;
|
||||
properties.setPosition(getHead()->getPosition());
|
||||
DependencyManager::get<EntityScriptingInterface>()->editEntity(_otherAvatarOrbMeshPlaceholderID, properties);
|
||||
}
|
||||
}
|
||||
|
||||
void OtherAvatar::createOrb() {
|
||||
if (_otherAvatarOrbMeshPlaceholderID.isNull()) {
|
||||
_otherAvatarOrbMeshPlaceholder = std::make_shared<Sphere3DOverlay>();
|
||||
_otherAvatarOrbMeshPlaceholder->setAlpha(1.0f);
|
||||
_otherAvatarOrbMeshPlaceholder->setColor(getLoadingOrbColor(_loadingStatus));
|
||||
_otherAvatarOrbMeshPlaceholder->setIsSolid(false);
|
||||
_otherAvatarOrbMeshPlaceholder->setPulseMin(0.5);
|
||||
_otherAvatarOrbMeshPlaceholder->setPulseMax(1.0);
|
||||
_otherAvatarOrbMeshPlaceholder->setColorPulse(1.0);
|
||||
_otherAvatarOrbMeshPlaceholder->setIgnorePickIntersection(true);
|
||||
_otherAvatarOrbMeshPlaceholder->setDrawInFront(false);
|
||||
_otherAvatarOrbMeshPlaceholderID = qApp->getOverlays().addOverlay(_otherAvatarOrbMeshPlaceholder);
|
||||
// Position focus
|
||||
_otherAvatarOrbMeshPlaceholder->setWorldOrientation(glm::quat(0.0f, 0.0f, 0.0f, 1.0));
|
||||
_otherAvatarOrbMeshPlaceholder->setWorldPosition(getHead()->getPosition());
|
||||
_otherAvatarOrbMeshPlaceholder->setDimensions(glm::vec3(0.5f, 0.5f, 0.5f));
|
||||
_otherAvatarOrbMeshPlaceholder->setVisible(true);
|
||||
EntityItemProperties properties;
|
||||
properties.setType(EntityTypes::Sphere);
|
||||
properties.setAlpha(1.0f);
|
||||
properties.setColor(getLoadingOrbColor(_loadingStatus));
|
||||
properties.setPrimitiveMode(PrimitiveMode::LINES);
|
||||
properties.getPulse().setMin(0.5f);
|
||||
properties.getPulse().setMax(1.0f);
|
||||
properties.getPulse().setColorMode(PulseMode::IN_PHASE);
|
||||
properties.setIgnorePickIntersection(true);
|
||||
|
||||
properties.setPosition(getHead()->getPosition());
|
||||
properties.setRotation(glm::quat(0.0f, 0.0f, 0.0f, 1.0));
|
||||
properties.setDimensions(glm::vec3(0.5f, 0.5f, 0.5f));
|
||||
properties.setVisible(true);
|
||||
|
||||
_otherAvatarOrbMeshPlaceholderID = DependencyManager::get<EntityScriptingInterface>()->addEntity(properties, "local");
|
||||
}
|
||||
}
|
||||
|
||||
void OtherAvatar::indicateLoadingStatus(LoadingStatus 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
#include "InterfaceLogging.h"
|
||||
#include "ui/overlays/Overlays.h"
|
||||
#include "ui/overlays/Sphere3DOverlay.h"
|
||||
|
||||
class AvatarManager;
|
||||
class AvatarMotionState;
|
||||
|
@ -59,8 +58,7 @@ protected:
|
|||
void onRemoveAttachedAvatarEntity(const QUuid& id);
|
||||
|
||||
std::vector<QUuid> _attachedAvatarEntities;
|
||||
std::shared_ptr<Sphere3DOverlay> _otherAvatarOrbMeshPlaceholder { nullptr };
|
||||
OverlayID _otherAvatarOrbMeshPlaceholderID { UNKNOWN_OVERLAY_ID };
|
||||
QUuid _otherAvatarOrbMeshPlaceholderID { UNKNOWN_ENTITY_ID };
|
||||
AvatarMotionState* _motionState { nullptr };
|
||||
int32_t _spaceIndex { -1 };
|
||||
uint8_t _workloadRegion { workload::Region::INVALID };
|
||||
|
|
|
@ -194,7 +194,6 @@ DdeFaceTracker::DdeFaceTracker(const QHostAddress& host, quint16 serverPort, qui
|
|||
_calibrationCount(0),
|
||||
_calibrationValues(),
|
||||
_calibrationBillboard(NULL),
|
||||
_calibrationBillboardID(UNKNOWN_OVERLAY_ID),
|
||||
_calibrationMessage(QString()),
|
||||
_isCalibrated(false)
|
||||
{
|
||||
|
|
|
@ -168,7 +168,7 @@ private:
|
|||
int _calibrationCount;
|
||||
QVector<float> _calibrationValues;
|
||||
TextOverlay* _calibrationBillboard;
|
||||
OverlayID _calibrationBillboardID;
|
||||
QUuid _calibrationBillboardID;
|
||||
QString _calibrationMessage;
|
||||
bool _isCalibrated;
|
||||
void addCalibrationDatum();
|
||||
|
|
|
@ -409,10 +409,6 @@ PickResultPointer CollisionPick::getEntityIntersection(const CollisionRegion& pi
|
|||
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) {
|
||||
if (!pick.loaded) {
|
||||
// Cannot compute result
|
||||
|
|
|
@ -54,7 +54,6 @@ public:
|
|||
return std::make_shared<CollisionPickResult>(pickVariant, std::vector<ContactTestResult>(), std::vector<ContactTestResult>());
|
||||
}
|
||||
PickResultPointer getEntityIntersection(const CollisionRegion& pick) override;
|
||||
PickResultPointer getOverlayIntersection(const CollisionRegion& pick) override;
|
||||
PickResultPointer getAvatarIntersection(const CollisionRegion& pick) override;
|
||||
PickResultPointer getHUDIntersection(const CollisionRegion& pick) override;
|
||||
Transform getResultTransform() const override;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#include "PickManager.h"
|
||||
#include "RayPick.h"
|
||||
|
||||
#include "PolyLineEntityItem.h"
|
||||
|
||||
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,
|
||||
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) {
|
||||
auto renderState = std::static_pointer_cast<RenderState>(_renderStates[state]);
|
||||
if (renderState) {
|
||||
updateRenderStateOverlay(renderState->getPathID(), pathProps);
|
||||
updateRenderState(renderState->getPathID(), pathProps);
|
||||
QVariant lineWidth = pathProps.toMap()["lineWidth"];
|
||||
if (lineWidth.isValid()) {
|
||||
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)
|
||||
{
|
||||
if (!_pathID.isNull()) {
|
||||
_pathIgnoreRays = qApp->getOverlays().getProperty(_pathID, "ignorePickIntersection").value.toBool();
|
||||
_lineWidth = qApp->getOverlays().getProperty(_pathID, "lineWidth").value.toFloat();
|
||||
if (!getPathID().isNull()) {
|
||||
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
|
||||
{
|
||||
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() {
|
||||
StartEndRenderState::cleanup();
|
||||
if (!_pathID.isNull()) {
|
||||
qApp->getOverlays().deleteOverlay(_pathID);
|
||||
if (!getPathID().isNull()) {
|
||||
DependencyManager::get<EntityScriptingInterface>()->deleteEntity(getPathID());
|
||||
}
|
||||
}
|
||||
|
||||
void LaserPointer::RenderState::disable() {
|
||||
StartEndRenderState::disable();
|
||||
if (!getPathID().isNull()) {
|
||||
QVariantMap pathProps;
|
||||
pathProps.insert("visible", false);
|
||||
pathProps.insert("ignorePickIntersection", true);
|
||||
qApp->getOverlays().editOverlay(getPathID(), pathProps);
|
||||
EntityItemProperties properties;
|
||||
properties.setVisible(false);
|
||||
properties.setIgnorePickIntersection(true);
|
||||
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,
|
||||
bool faceAvatar, bool followNormal, float followNormalStrength, float distance, const PickResultPointer& pickResult) {
|
||||
StartEndRenderState::update(origin, end, surfaceNormal, parentScale, distanceScaleEnd, centerEndY, faceAvatar, followNormal, followNormalStrength, distance, pickResult);
|
||||
QVariant endVariant = vec3toVariant(end);
|
||||
if (!getPathID().isNull()) {
|
||||
QVariantMap pathProps;
|
||||
pathProps.insert("start", vec3toVariant(origin));
|
||||
pathProps.insert("end", endVariant);
|
||||
pathProps.insert("visible", true);
|
||||
pathProps.insert("ignorePickIntersection", doesPathIgnoreRays());
|
||||
pathProps.insert("lineWidth", getLineWidth() * parentScale);
|
||||
qApp->getOverlays().editOverlay(getPathID(), pathProps);
|
||||
EntityItemProperties properties;
|
||||
QVector<glm::vec3> points;
|
||||
points.append(origin);
|
||||
points.append(end);
|
||||
properties.setLinePoints(points);
|
||||
properties.setVisible(true);
|
||||
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) {
|
||||
// FIXME: we have to keep using the Overlays interface here, because existing scripts use overlay properties to define pointers
|
||||
QUuid startID;
|
||||
if (propMap["start"].isValid()) {
|
||||
QVariantMap startMap = propMap["start"].toMap();
|
||||
|
@ -233,8 +248,6 @@ glm::vec3 LaserPointer::findIntersection(const PickedObject& pickedObject, const
|
|||
switch (pickedObject.type) {
|
||||
case ENTITY:
|
||||
return RayPick::intersectRayWithEntityXYPlane(pickedObject.objectID, origin, direction);
|
||||
case OVERLAY:
|
||||
return RayPick::intersectRayWithOverlayXYPlane(pickedObject.objectID, origin, direction);
|
||||
default:
|
||||
return glm::vec3(NAN);
|
||||
}
|
||||
|
|
|
@ -19,10 +19,10 @@ public:
|
|||
class RenderState : public StartEndRenderState {
|
||||
public:
|
||||
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 bool& doesPathIgnoreRays() const { return _pathIgnoreRays; }
|
||||
const QUuid& getPathID() const { return _pathID; }
|
||||
const bool& doesPathIgnorePicks() const { return _pathIgnorePicks; }
|
||||
|
||||
void setLineWidth(float width) { _lineWidth = width; }
|
||||
float getLineWidth() const { return _lineWidth; }
|
||||
|
@ -33,9 +33,9 @@ public:
|
|||
bool faceAvatar, bool followNormal, float followNormalStrength, float distance, const PickResultPointer& pickResult) override;
|
||||
|
||||
private:
|
||||
OverlayID _pathID;
|
||||
bool _pathIgnoreRays;
|
||||
QUuid _pathID;
|
||||
|
||||
bool _pathIgnorePicks;
|
||||
float _lineWidth;
|
||||
};
|
||||
|
||||
|
|
|
@ -111,10 +111,10 @@ public:
|
|||
* @function LaserPointers.setLockEndUUID
|
||||
* @param {number} id
|
||||
* @param {Uuid} itemID
|
||||
* @param {boolean} isOverlay
|
||||
* @param {boolean} isAvatar
|
||||
* @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
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "Application.h"
|
||||
#include "EntityScriptingInterface.h"
|
||||
#include "PickScriptingInterface.h"
|
||||
#include "ui/overlays/Overlays.h"
|
||||
#include "avatar/AvatarManager.h"
|
||||
#include "scripting/HMDScriptingInterface.h"
|
||||
#include "DependencyManager.h"
|
||||
|
@ -74,19 +73,6 @@ PickResultPointer ParabolaPick::getEntityIntersection(const PickParabola& pick)
|
|||
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) {
|
||||
if (glm::length2(pick.acceleration) > EPSILON && glm::length2(pick.velocity) > EPSILON) {
|
||||
ParabolaToAvatarIntersectionResult avatarRes = DependencyManager::get<AvatarManager>()->findParabolaIntersectionVector(pick, getIncludeItemsAs<EntityItemID>(), getIgnoreItemsAs<EntityItemID>());
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <Pick.h>
|
||||
|
||||
class EntityItemID;
|
||||
class OverlayID;
|
||||
|
||||
class ParabolaPickResult : public PickResult {
|
||||
public:
|
||||
|
@ -80,7 +79,6 @@ public:
|
|||
|
||||
PickResultPointer getDefaultResult(const QVariantMap& pickVariant) const override { return std::make_shared<ParabolaPickResult>(pickVariant); }
|
||||
PickResultPointer getEntityIntersection(const PickParabola& pick) override;
|
||||
PickResultPointer getOverlayIntersection(const PickParabola& pick) override;
|
||||
PickResultPointer getAvatarIntersection(const PickParabola& pick) override;
|
||||
PickResultPointer getHUDIntersection(const PickParabola& pick) override;
|
||||
Transform getResultTransform() const override;
|
||||
|
|
|
@ -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) :
|
||||
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) {
|
||||
// FIXME: we have to keep using the Overlays interface here, because existing scripts use overlay properties to define pointers
|
||||
QUuid startID;
|
||||
if (propMap["start"].isValid()) {
|
||||
QVariantMap startMap = propMap["start"].toMap();
|
||||
|
@ -322,8 +323,6 @@ glm::vec3 ParabolaPointer::findIntersection(const PickedObject& pickedObject, co
|
|||
switch (pickedObject.type) {
|
||||
case ENTITY:
|
||||
//return ParabolaPick::intersectParabolaWithEntityXYPlane(pickedObject.objectID, origin, velocity, acceleration);
|
||||
case OVERLAY:
|
||||
//return ParabolaPick::intersectParabolaWithOverlayXYPlane(pickedObject.objectID, origin, velocity, acceleration);
|
||||
default:
|
||||
return glm::vec3(NAN);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
};
|
||||
|
||||
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);
|
||||
|
||||
void setPathWidth(float width) { _pathWidth = width; }
|
||||
|
|
|
@ -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([&] {
|
||||
_lockEndObject.id = objectID;
|
||||
_lockEndObject.isOverlay = isOverlay;
|
||||
_lockEndObject.isAvatar = isAvatar;
|
||||
_lockEndObject.offsetMat = offsetMat;
|
||||
});
|
||||
}
|
||||
|
@ -97,12 +97,8 @@ PickResultPointer PathPointer::getVisualPickResult(const PickResultPointer& pick
|
|||
glm::quat rot;
|
||||
glm::vec3 dim;
|
||||
glm::vec3 registrationPoint;
|
||||
if (_lockEndObject.isOverlay) {
|
||||
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 {
|
||||
// TODO: use isAvatar
|
||||
{
|
||||
EntityItemProperties props = DependencyManager::get<EntityScriptingInterface>()->getEntityProperties(_lockEndObject.id);
|
||||
glm::mat4 entityMat = createMatFromQuatAndPos(props.getRotation(), props.getPosition());
|
||||
glm::mat4 finalPosAndRotMat = entityMat * _lockEndObject.offsetMat;
|
||||
|
@ -117,7 +113,7 @@ PickResultPointer PathPointer::getVisualPickResult(const PickResultPointer& pick
|
|||
distance = glm::distance(origin, endVec);
|
||||
glm::vec3 normalizedDirection = glm::normalize(direction);
|
||||
|
||||
type = _lockEndObject.isOverlay ? IntersectionType::OVERLAY : IntersectionType::ENTITY;
|
||||
type = IntersectionType::ENTITY;
|
||||
id = _lockEndObject.id;
|
||||
intersection = endVec;
|
||||
surfaceNormal = -normalizedDirection;
|
||||
|
@ -126,8 +122,6 @@ PickResultPointer PathPointer::getVisualPickResult(const PickResultPointer& pick
|
|||
id = getPickedObjectID(pickResult);
|
||||
if (type == IntersectionType::ENTITY) {
|
||||
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) {
|
||||
endVec = DependencyManager::get<AvatarHashMap>()->getAvatar(id)->getPosition();
|
||||
}
|
||||
|
@ -184,8 +178,8 @@ void PathPointer::editRenderState(const std::string& state, const QVariant& star
|
|||
withWriteLock([&] {
|
||||
auto renderState = _renderStates.find(state);
|
||||
if (renderState != _renderStates.end()) {
|
||||
updateRenderStateOverlay(renderState->second->getStartID(), startProps);
|
||||
updateRenderStateOverlay(renderState->second->getEndID(), endProps);
|
||||
updateRenderState(renderState->second->getStartID(), startProps);
|
||||
updateRenderState(renderState->second->getEndID(), endProps);
|
||||
QVariant startDim = startProps.toMap()["dimensions"];
|
||||
if (startDim.isValid()) {
|
||||
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()) {
|
||||
QVariantMap propMap = props.toMap();
|
||||
propMap.remove("visible");
|
||||
|
|
|
@ -19,20 +19,20 @@
|
|||
|
||||
struct LockEndObject {
|
||||
QUuid id { QUuid() };
|
||||
bool isOverlay { false };
|
||||
bool isAvatar { false };
|
||||
glm::mat4 offsetMat { glm::mat4() };
|
||||
};
|
||||
|
||||
class StartEndRenderState {
|
||||
public:
|
||||
StartEndRenderState() {}
|
||||
StartEndRenderState(const OverlayID& startID, const OverlayID& endID);
|
||||
StartEndRenderState(const QUuid& startID, const QUuid& endID);
|
||||
virtual ~StartEndRenderState() = default;
|
||||
|
||||
const OverlayID& getStartID() const { return _startID; }
|
||||
const OverlayID& getEndID() const { return _endID; }
|
||||
const bool& doesStartIgnoreRays() const { return _startIgnoreRays; }
|
||||
const bool& doesEndIgnoreRays() const { return _endIgnoreRays; }
|
||||
const QUuid& getStartID() const { return _startID; }
|
||||
const QUuid& getEndID() const { return _endID; }
|
||||
const bool& doesStartIgnorePicks() const { return _startIgnorePicks; }
|
||||
const bool& doesEndIgnorePicks() const { return _endIgnorePicks; }
|
||||
|
||||
void setStartDim(const glm::vec3& startDim) { _startDim = startDim; }
|
||||
const glm::vec3& getStartDim() const { return _startDim; }
|
||||
|
@ -51,10 +51,10 @@ public:
|
|||
bool isEnabled() const { return _enabled; }
|
||||
|
||||
protected:
|
||||
OverlayID _startID;
|
||||
OverlayID _endID;
|
||||
bool _startIgnoreRays;
|
||||
bool _endIgnoreRays;
|
||||
QUuid _startID;
|
||||
QUuid _endID;
|
||||
bool _startIgnorePicks;
|
||||
bool _endIgnorePicks;
|
||||
|
||||
glm::vec3 _startDim;
|
||||
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 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;
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ void TextEntityRenderer::doRender(RenderArgs* args) {
|
|||
geometryCache->bindSimpleProgram(batch, false, backgroundColor.a < 1.0f, false, false, false);
|
||||
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();
|
||||
transformToTopLeft.setScale(scale); // Scale to have the correct line height
|
||||
batch.setModelTransform(transformToTopLeft);
|
||||
|
|
|
@ -945,12 +945,9 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
|||
*/
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"Material"</code> {@link Entities.EntityType|EntityType} modifies the existing materials on
|
||||
* {@link Entities.EntityType|Model} entities, {@link Entities.EntityType|Shape} entities (albedo only),
|
||||
* {@link Overlays.OverlayType|model overlays}, and avatars.
|
||||
* The <code>"Material"</code> {@link Entities.EntityType|EntityType} modifies the existing materials on entities and avatars.
|
||||
* 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
|
||||
* overlay's ID.
|
||||
* To apply a material to an entity, set the material entity's <code>parentID</code> property to the entity 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 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>.
|
||||
|
|
|
@ -84,8 +84,7 @@ public:
|
|||
* <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>
|
||||
* <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,
|
||||
* {@link Overlays.OverlayType|model overlays}, and avatars.</td>
|
||||
* <tr><td><code>"Material"</code></td><td>Modifies the existing materials on entities and avatars.</td>
|
||||
* <td>{@link Entities.EntityProperties-Material|EntityProperties-Material}</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
const int LineEntityItem::MAX_POINTS_PER_LINE = 70;
|
||||
|
||||
|
||||
EntityItemPointer LineEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
EntityItemPointer entity(new LineEntityItem(entityID), [](EntityItem* ptr) { ptr->deleteLater(); });
|
||||
entity->setProperties(properties);
|
||||
|
|
|
@ -310,7 +310,7 @@ void MaterialEntityItem::removeMaterial() {
|
|||
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())) {
|
||||
return;
|
||||
}
|
||||
|
@ -319,10 +319,6 @@ void MaterialEntityItem::removeMaterial() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (EntityTree::removeMaterialFromOverlay(parentID, material, getParentMaterialName().toStdString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 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());
|
||||
|
||||
// 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())) {
|
||||
return;
|
||||
}
|
||||
|
@ -358,10 +354,6 @@ void MaterialEntityItem::applyMaterial() {
|
|||
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
|
||||
_retryApply = true;
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ namespace scriptable {
|
|||
// 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 {
|
||||
public:
|
||||
NestableType modelProviderType;
|
||||
|
|
|
@ -38,13 +38,13 @@ public:
|
|||
|
||||
public slots:
|
||||
/**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
|
||||
* @param {UUID} entityID - The objectID of the model whose meshes are to be retrieved.
|
||||
* @returns {Graphics.Model} the resulting Model object
|
||||
*/
|
||||
scriptable::ScriptableModelPointer getModel(QUuid uuid);
|
||||
scriptable::ScriptableModelPointer getModel(const QUuid& uuid);
|
||||
|
||||
/**jsdoc
|
||||
* @function Graphics.updateModel
|
||||
|
@ -52,7 +52,7 @@ public slots:
|
|||
* @param {Graphics.Model} model
|
||||
* @returns {boolean}
|
||||
*/
|
||||
bool updateModel(QUuid uuid, const scriptable::ScriptableModelPointer& model);
|
||||
bool updateModel(const QUuid& uuid, const scriptable::ScriptableModelPointer& model);
|
||||
|
||||
/**jsdoc
|
||||
* @function Graphics.canUpdateModel
|
||||
|
@ -61,7 +61,7 @@ public slots:
|
|||
* @param {number} [partNumber=-1]
|
||||
* @returns {boolean}
|
||||
*/
|
||||
bool canUpdateModel(QUuid uuid, int meshIndex = -1, int partNumber = -1);
|
||||
bool canUpdateModel(const QUuid& uuid, int meshIndex = -1, int partNumber = -1);
|
||||
|
||||
/**jsdoc
|
||||
* @function Graphics.newModel
|
||||
|
@ -94,7 +94,7 @@ public slots:
|
|||
QString exportModelToOBJ(const scriptable::ScriptableModel& in);
|
||||
|
||||
private:
|
||||
scriptable::ModelProviderPointer getModelProvider(QUuid uuid);
|
||||
scriptable::ModelProviderPointer getModelProvider(const QUuid& uuid);
|
||||
void jsThrowError(const QString& error);
|
||||
scriptable::MeshPointer getMeshPointer(scriptable::ScriptableMeshPointer meshProxy);
|
||||
scriptable::MeshPointer getMeshPointer(scriptable::ScriptableMesh& meshProxy);
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
enum IntersectionType {
|
||||
NONE = 0,
|
||||
ENTITY,
|
||||
OVERLAY,
|
||||
AVATAR,
|
||||
HUD
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue