Пример #1
0
std::array<EntityItemID, 3> PolyVoxEntityItem::getPNeigborIDs() const {
    std::array<EntityItemID, 3> result;
    withReadLock([&] {
        result = { { _xPNeighborID, _yPNeighborID, _zPNeighborID } };
    });
    return result;
}
Пример #2
0
QString PolyLineEntityItem::getTextures() const { 
    QString result;
    withReadLock([&] {
        result = _textures;
    });
    return result;
}
Пример #3
0
QString PolyVoxEntityItem::getZTextureURL() const { 
    QString result;
    withReadLock([&] {
        result = _zTextureURL;
    });
    return result;
}
Пример #4
0
void ObjectDynamic::removeFromSimulation(EntitySimulationPointer simulation) const {
    QUuid myID;
    withReadLock([&]{
        myID = _id;
    });
    simulation->removeDynamic(myID);
}
Пример #5
0
// 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;
}
Пример #6
0
bool TextEntityItem::getFaceCamera() const { 
    bool result;
    withReadLock([&] {
        result = _faceCamera;
    });
    return result;
}
Пример #7
0
xColor TextEntityItem::getBackgroundColorX() const { 
    xColor result;
    withReadLock([&] {
        result = { _backgroundColor[RED_INDEX], _backgroundColor[GREEN_INDEX], _backgroundColor[BLUE_INDEX] };
    });
    return result;
}
Пример #8
0
float TextEntityItem::getLineHeight() const { 
    float result;
    withReadLock([&] {
        result = _lineHeight;
    });
    return result;
}
Пример #9
0
void ObjectAction::removeFromSimulation(EntitySimulation* simulation) const {
    QUuid myID;
    withReadLock([&]{
        myID = _id;
    });
    simulation->removeAction(myID);
}
Пример #10
0
QVector<glm::vec3> PolyLineEntityItem::getStrokeColors() const {
    QVector<glm::vec3> result;
    withReadLock([&] {
        result = _strokeColors;
    });
    return result;
}
Пример #11
0
QString ZoneEntityItem::getCompoundShapeURL() const { 
    QString result;
    withReadLock([&] {
        result = _compoundShapeURL;
    });
    return result;
}
Пример #12
0
QString ZoneEntityItem::getFilterURL() const { 
    QString result;
    withReadLock([&] {
        result = _filterURL;
    });
    return result;
}
Пример #13
0
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;
}
Пример #14
0
QVector<glm::vec3> LineEntityItem::getLinePoints() const { 
    QVector<glm::vec3> result;
    withReadLock([&] {
        result = _points;
    });
    return result;
}
Пример #15
0
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;
}
Пример #16
0
const QByteArray PolyVoxEntityItem::getVoxelData() const {
    QByteArray voxelDataCopy;
    withReadLock([&] {
        voxelDataCopy = _voxelData;
    });
    return voxelDataCopy;
}
Пример #17
0
float LineEntityItem::getLineWidth() const { 
    float result;
    withReadLock([&] {
        result = _lineWidth;
    });
    return result;
}
Пример #18
0
QString TextEntityItem::getText() const { 
    QString result;
    withReadLock([&] {
        result = _text;
    });
    return result;
}
Пример #19
0
xColor LineEntityItem::getXColor() const { 
    xColor result;
    withReadLock([&] {
        result = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] };
    });
    return result; 
}
Пример #20
0
EntityItemID PolyVoxEntityItem::getZPNeighborID() const { 
    EntityItemID result;
    withReadLock([&] {
        result = _zPNeighborID;
    });
    return result;
}
Пример #21
0
QVector<float> PolyLineEntityItem::getStrokeWidths() const { 
    QVector<float> result;
    withReadLock([&] {
        result = _strokeWidths;
    });
    return result;
}
Пример #22
0
glm::vec3 PolyVoxEntityItem::getVoxelVolumeSize() const {
    glm::vec3 voxelVolumeSize;
    withReadLock([&] {
        voxelVolumeSize = _voxelVolumeSize;
    });
    return voxelVolumeSize;
}
Пример #23
0
QVector<glm::vec3> PolyLineEntityItem::getNormals() const { 
    QVector<glm::vec3> result;
    withReadLock([&] {
        result = _normals;
    });
    return result;
}
Пример #24
0
QVariantMap ObjectActionTravelOriented::getArguments() {
    QVariantMap arguments = ObjectDynamic::getArguments();
    withReadLock([&] {
        arguments["forward"] = glmToQMap(_forward);
        arguments["angularTimeScale"] = _angularTimeScale;
    });
    return arguments;
}
Пример #25
0
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;
}
Пример #26
0
QVariantMap ObjectActionOffset::getArguments() {
    QVariantMap arguments = ObjectAction::getArguments();
    withReadLock([&] {
        arguments["pointToOffsetFrom"] = glmToQMap(_pointToOffsetFrom);
        arguments["linearTimeScale"] = _linearTimeScale;
        arguments["linearDistance"] = _linearDistance;
    });
    return arguments;
}
Пример #27
0
/**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;
}
Пример #28
0
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;
}
Пример #29
0
QVariantMap AvatarActionHold::getArguments() {
    QVariantMap arguments = ObjectAction::getArguments();
    withReadLock([&]{
        arguments["relativePosition"] = glmToQMap(_relativePosition);
        arguments["relativeRotation"] = glmToQMap(_relativeRotation);
        arguments["timeScale"] = _linearTimeScale;
        arguments["hand"] = _hand;
    });
    return arguments;
}
Пример #30
0
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);
    });
}