std::array<EntityItemID, 3> PolyVoxEntityItem::getPNeigborIDs() const { std::array<EntityItemID, 3> result; withReadLock([&] { result = { { _xPNeighborID, _yPNeighborID, _zPNeighborID } }; }); return result; }
QString PolyLineEntityItem::getTextures() const { QString result; withReadLock([&] { result = _textures; }); return result; }
QString PolyVoxEntityItem::getZTextureURL() const { QString result; withReadLock([&] { result = _zTextureURL; }); return result; }
void ObjectDynamic::removeFromSimulation(EntitySimulationPointer simulation) const { QUuid myID; withReadLock([&]{ myID = _id; }); simulation->removeDynamic(myID); }
// Note: The "type" property is set in EntityItem::getActionArguments(). QVariantMap ObjectDynamic::getArguments() { QVariantMap arguments; withReadLock([&]{ if (_expires == 0) { arguments["ttl"] = 0.0f; } else { quint64 now = usecTimestampNow(); arguments["ttl"] = (float)(_expires - now) / (float)USECS_PER_SECOND; } arguments["tag"] = _tag; EntityItemPointer entity = _ownerEntity.lock(); if (entity) { ObjectMotionState* motionState = static_cast<ObjectMotionState*>(entity->getPhysicsInfo()); if (motionState) { arguments["::active"] = motionState->isActive(); arguments["::motion-type"] = motionTypeToString(motionState->getMotionType()); } else { arguments["::no-motion-state"] = true; } } arguments["isMine"] = isMine(); }); return arguments; }
bool TextEntityItem::getFaceCamera() const { bool result; withReadLock([&] { result = _faceCamera; }); return result; }
xColor TextEntityItem::getBackgroundColorX() const { xColor result; withReadLock([&] { result = { _backgroundColor[RED_INDEX], _backgroundColor[GREEN_INDEX], _backgroundColor[BLUE_INDEX] }; }); return result; }
float TextEntityItem::getLineHeight() const { float result; withReadLock([&] { result = _lineHeight; }); return result; }
void ObjectAction::removeFromSimulation(EntitySimulation* simulation) const { QUuid myID; withReadLock([&]{ myID = _id; }); simulation->removeAction(myID); }
QVector<glm::vec3> PolyLineEntityItem::getStrokeColors() const { QVector<glm::vec3> result; withReadLock([&] { result = _strokeColors; }); return result; }
QString ZoneEntityItem::getCompoundShapeURL() const { QString result; withReadLock([&] { result = _compoundShapeURL; }); return result; }
QString ZoneEntityItem::getFilterURL() const { QString result; withReadLock([&] { result = _filterURL; }); return result; }
EntityItemProperties ZoneEntityItem::getProperties(const EntityPropertyFlags& desiredProperties, bool allowEmptyDesiredProperties) const { EntityItemProperties properties = EntityItem::getProperties(desiredProperties, allowEmptyDesiredProperties); // get the properties from our base class COPY_ENTITY_PROPERTY_TO_PROPERTIES(shapeType, getShapeType); COPY_ENTITY_PROPERTY_TO_PROPERTIES(compoundShapeURL, getCompoundShapeURL); // Contain QString properties, must be synchronized withReadLock([&] { _keyLightProperties.getProperties(properties); _ambientLightProperties.getProperties(properties); _skyboxProperties.getProperties(properties); }); _hazeProperties.getProperties(properties); _bloomProperties.getProperties(properties); COPY_ENTITY_PROPERTY_TO_PROPERTIES(flyingAllowed, getFlyingAllowed); COPY_ENTITY_PROPERTY_TO_PROPERTIES(ghostingAllowed, getGhostingAllowed); COPY_ENTITY_PROPERTY_TO_PROPERTIES(filterURL, getFilterURL); COPY_ENTITY_PROPERTY_TO_PROPERTIES(keyLightMode, getKeyLightMode); COPY_ENTITY_PROPERTY_TO_PROPERTIES(ambientLightMode, getAmbientLightMode); COPY_ENTITY_PROPERTY_TO_PROPERTIES(skyboxMode, getSkyboxMode); COPY_ENTITY_PROPERTY_TO_PROPERTIES(hazeMode, getHazeMode); COPY_ENTITY_PROPERTY_TO_PROPERTIES(bloomMode, getBloomMode); COPY_ENTITY_PROPERTY_TO_PROPERTIES(avatarPriority, getAvatarPriority); return properties; }
QVector<glm::vec3> LineEntityItem::getLinePoints() const { QVector<glm::vec3> result; withReadLock([&] { result = _points; }); return result; }
QByteArray ObjectConstraintSlider::serialize() const { QByteArray serializedConstraintArguments; QDataStream dataStream(&serializedConstraintArguments, QIODevice::WriteOnly); dataStream << DYNAMIC_TYPE_SLIDER; dataStream << getID(); dataStream << ObjectConstraintSlider::constraintVersion; withReadLock([&] { dataStream << localTimeToServerTime(_expires); dataStream << _tag; dataStream << _pointInA; dataStream << _axisInA; dataStream << _otherID; dataStream << _pointInB; dataStream << _axisInB; dataStream << _linearLow; dataStream << _linearHigh; dataStream << _angularLow; dataStream << _angularHigh; }); return serializedConstraintArguments; }
const QByteArray PolyVoxEntityItem::getVoxelData() const { QByteArray voxelDataCopy; withReadLock([&] { voxelDataCopy = _voxelData; }); return voxelDataCopy; }
float LineEntityItem::getLineWidth() const { float result; withReadLock([&] { result = _lineWidth; }); return result; }
QString TextEntityItem::getText() const { QString result; withReadLock([&] { result = _text; }); return result; }
xColor LineEntityItem::getXColor() const { xColor result; withReadLock([&] { result = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; }); return result; }
EntityItemID PolyVoxEntityItem::getZPNeighborID() const { EntityItemID result; withReadLock([&] { result = _zPNeighborID; }); return result; }
QVector<float> PolyLineEntityItem::getStrokeWidths() const { QVector<float> result; withReadLock([&] { result = _strokeWidths; }); return result; }
glm::vec3 PolyVoxEntityItem::getVoxelVolumeSize() const { glm::vec3 voxelVolumeSize; withReadLock([&] { voxelVolumeSize = _voxelVolumeSize; }); return voxelVolumeSize; }
QVector<glm::vec3> PolyLineEntityItem::getNormals() const { QVector<glm::vec3> result; withReadLock([&] { result = _normals; }); return result; }
QVariantMap ObjectActionTravelOriented::getArguments() { QVariantMap arguments = ObjectDynamic::getArguments(); withReadLock([&] { arguments["forward"] = glmToQMap(_forward); arguments["angularTimeScale"] = _angularTimeScale; }); return arguments; }
bool ObjectActionOffset::updateArguments(QVariantMap arguments) { glm::vec3 pointToOffsetFrom; float linearTimeScale; float linearDistance; bool needUpdate = false; bool somethingChanged = ObjectAction::updateArguments(arguments); withReadLock([&] { bool ok = true; pointToOffsetFrom = EntityActionInterface::extractVec3Argument("offset action", arguments, "pointToOffsetFrom", ok, true); if (!ok) { pointToOffsetFrom = _pointToOffsetFrom; } ok = true; linearTimeScale = EntityActionInterface::extractFloatArgument("offset action", arguments, "linearTimeScale", ok, false); if (!ok) { linearTimeScale = _linearTimeScale; } ok = true; linearDistance = EntityActionInterface::extractFloatArgument("offset action", arguments, "linearDistance", ok, false); if (!ok) { linearDistance = _linearDistance; } // only change stuff if something actually changed if (somethingChanged || _pointToOffsetFrom != pointToOffsetFrom || _linearTimeScale != linearTimeScale || _linearDistance != linearDistance) { needUpdate = true; } }); if (needUpdate) { withWriteLock([&] { _pointToOffsetFrom = pointToOffsetFrom; _linearTimeScale = linearTimeScale; _linearDistance = linearDistance; _positionalTargetSet = true; _active = true; auto ownerEntity = _ownerEntity.lock(); if (ownerEntity) { ownerEntity->setActionDataDirty(true); } }); activateBody(); } return true; }
QVariantMap ObjectActionOffset::getArguments() { QVariantMap arguments = ObjectAction::getArguments(); withReadLock([&] { arguments["pointToOffsetFrom"] = glmToQMap(_pointToOffsetFrom); arguments["linearTimeScale"] = _linearTimeScale; arguments["linearDistance"] = _linearDistance; }); return arguments; }
/**jsdoc * The <code>"ball-socket"</code> {@link Entities.ActionType|ActionType} connects two entities with a ball and socket joint. * It has arguments in addition to the common {@link Entities.ActionArguments|ActionArguments}. * * @typedef {object} Entities.ActionArguments-BallSocket * @property {Vec3} pivot=0,0,0 - The local offset of the joint relative to the entity's position. * @property {Uuid} otherEntityID=null - The ID of the other entity that is connected to the joint. * @property {Vec3} otherPivot=0,0,0 - The local offset of the joint relative to the other entity's position. */ QVariantMap ObjectConstraintBallSocket::getArguments() { QVariantMap arguments = ObjectDynamic::getArguments(); withReadLock([&] { arguments["pivot"] = glmToQMap(_pivotInA); arguments["otherEntityID"] = _otherID; arguments["otherPivot"] = glmToQMap(_pivotInB); }); return arguments; }
bool ObjectConstraintBallSocket::updateArguments(QVariantMap arguments) { glm::vec3 pivotInA; QUuid otherEntityID; glm::vec3 pivotInB; bool needUpdate = false; bool somethingChanged = ObjectDynamic::updateArguments(arguments); withReadLock([&]{ bool ok = true; pivotInA = EntityDynamicInterface::extractVec3Argument("ball-socket constraint", arguments, "pivot", ok, false); if (!ok) { pivotInA = _pivotInA; } ok = true; otherEntityID = QUuid(EntityDynamicInterface::extractStringArgument("ball-socket constraint", arguments, "otherEntityID", ok, false)); if (!ok) { otherEntityID = _otherID; } ok = true; pivotInB = EntityDynamicInterface::extractVec3Argument("ball-socket constraint", arguments, "otherPivot", ok, false); if (!ok) { pivotInB = _pivotInB; } if (somethingChanged || pivotInA != _pivotInA || otherEntityID != _otherID || pivotInB != _pivotInB) { // something changed needUpdate = true; } }); if (needUpdate) { withWriteLock([&] { _pivotInA = pivotInA; _otherID = otherEntityID; _pivotInB = pivotInB; _active = true; auto ownerEntity = _ownerEntity.lock(); if (ownerEntity) { ownerEntity->setDynamicDataDirty(true); ownerEntity->setDynamicDataNeedsTransmit(true); } }); updateBallSocket(); } return true; }
QVariantMap AvatarActionHold::getArguments() { QVariantMap arguments = ObjectAction::getArguments(); withReadLock([&]{ arguments["relativePosition"] = glmToQMap(_relativePosition); arguments["relativeRotation"] = glmToQMap(_relativeRotation); arguments["timeScale"] = _linearTimeScale; arguments["hand"] = _hand; }); return arguments; }
void Pointer::update(unsigned int pointerID) { // This only needs to be a read lock because update won't change any of the properties that can be modified from scripts withReadLock([&] { auto pickResult = getPrevPickResult(); // Pointer needs its own PickResult object so it doesn't modify the cached pick result auto visualPickResult = getVisualPickResult(getPickResultCopy(pickResult)); updateVisuals(visualPickResult); generatePointerEvents(pointerID, visualPickResult); }); }