Ejemplo n.º 1
0
QVariant Line3DOverlay::getProperty(const QString& property) {
    if (property == "start" || property == "startPoint" || property == "p1") {
        return vec3toVariant(_start);
    }
    if (property == "end" || property == "endPoint" || property == "p2") {
        return vec3toVariant(_end);
    }

    return Base3DOverlay::getProperty(property);
}
Ejemplo n.º 2
0
/**jsdoc
 * @typedef
 * @property {Vec3} dimensions - The dimensions of the overlay. Synonyms: <code>scale</code>, <code>size</code>.
 */
QVariant Volume3DOverlay::getProperty(const QString& property) {
    if (property == "dimensions" || property == "scale" || property == "size") {
        return vec3toVariant(getDimensions());
    }

    return Base3DOverlay::getProperty(property);
}
Ejemplo n.º 3
0
QVariant Base3DOverlay::getProperty(const QString& property) {
    if (property == "position" || property == "start" || property == "p1" || property == "point") {
        return vec3toVariant(getPosition());
    }
    if (property == "lineWidth") {
        return _lineWidth;
    }
    if (property == "rotation") {
        return quatToVariant(getRotation());
    }
    if (property == "isSolid" || property == "isFilled" || property == "solid" || property == "filed") {
        return _isSolid;
    }
    if (property == "isWire" || property == "wire") {
        return !_isSolid;
    }
    if (property == "isDashedLine" || property == "dashed") {
        return _isDashedLine;
    }
    if (property == "ignoreRayIntersection") {
        return _ignoreRayIntersection;
    }
    if (property == "drawInFront") {
        return _drawInFront;
    }

    return Overlay::getProperty(property);
}
Ejemplo n.º 4
0
void buildObjectIntersectionsMap(IntersectionType intersectionType, const std::vector<ContactTestResult>& objectIntersections, std::unordered_map<QUuid, QVariantMap>& intersections, std::unordered_map<QUuid, QVariantList>& collisionPointPairs) {
    for (auto& objectIntersection : objectIntersections) {
        auto at = intersections.find(objectIntersection.foundID);
        if (at == intersections.end()) {
            QVariantMap intersectingObject;
            intersectingObject["id"] = objectIntersection.foundID;
            intersectingObject["type"] = intersectionType;
            intersections[objectIntersection.foundID] = intersectingObject;

            collisionPointPairs[objectIntersection.foundID] = QVariantList();
        }

        QVariantMap collisionPointPair;
        collisionPointPair["pointOnPick"] = vec3toVariant(objectIntersection.testCollisionPoint);
        collisionPointPair["pointOnObject"] = vec3toVariant(objectIntersection.foundCollisionPoint);
        collisionPointPair["normalOnPick"] = vec3toVariant(objectIntersection.collisionNormal);

        collisionPointPairs[objectIntersection.foundID].append(collisionPointPair);
    }
}
Ejemplo n.º 5
0
void ParabolaPointer::setVisualPickResultInternal(PickResultPointer pickResult, IntersectionType type, const QUuid& id,
                                               const glm::vec3& intersection, float distance, const glm::vec3& surfaceNormal) {
    auto parabolaPickResult = std::static_pointer_cast<ParabolaPickResult>(pickResult);
    if (parabolaPickResult) {
        parabolaPickResult->type = type;
        parabolaPickResult->objectID = id;
        parabolaPickResult->intersection = intersection;
        parabolaPickResult->distance = distance;
        parabolaPickResult->surfaceNormal = surfaceNormal;
        PickParabola parabola = PickParabola(parabolaPickResult->pickVariant);
        parabolaPickResult->pickVariant["velocity"] = vec3toVariant((intersection - parabola.origin -
            0.5f * parabola.acceleration * parabolaPickResult->parabolicDistance * parabolaPickResult->parabolicDistance) / parabolaPickResult->parabolicDistance);
    }
}
Ejemplo n.º 6
0
QVariant Image3DOverlay::getProperty(const QString& property) {
    if (property == "url") {
        return _url;
    }
    if (property == "subImage") {
        return _fromImage;
    }
    if (property == "offsetPosition") {
        return vec3toVariant(getOffsetPosition());
    }
    if (property == "emissive") {
        return _emissive;
    }

    return Billboard3DOverlay::getProperty(property);
}
Ejemplo n.º 7
0
void Web3DOverlay::loadSourceURL() {
    if (!_webSurface) {
        return;
    }

    QUrl sourceUrl(_url);
    if (sourceUrl.scheme() == "http" || sourceUrl.scheme() == "https" ||
        _url.toLower().endsWith(".htm") || _url.toLower().endsWith(".html")) {

        _webSurface->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));
        _webSurface->load("Web3DOverlay.qml");
        _webSurface->resume();
        _webSurface->getRootItem()->setProperty("url", _url);
        _webSurface->getRootItem()->setProperty("scriptURL", _scriptURL);

    } else {
        _webSurface->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath()));
        _webSurface->load(_url, [&](QQmlContext* context, QObject* obj) {});
        _webSurface->resume();

        _webSurface->getSurfaceContext()->setContextProperty("Users", DependencyManager::get<UsersScriptingInterface>().data());
        _webSurface->getSurfaceContext()->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
        _webSurface->getSurfaceContext()->setContextProperty("UserActivityLogger", DependencyManager::get<UserActivityLoggerScriptingInterface>().data());
        _webSurface->getSurfaceContext()->setContextProperty("Preferences", DependencyManager::get<Preferences>().data());
        _webSurface->getSurfaceContext()->setContextProperty("Vec3", new Vec3());
        _webSurface->getSurfaceContext()->setContextProperty("Quat", new Quat());
        _webSurface->getSurfaceContext()->setContextProperty("MyAvatar", DependencyManager::get<AvatarManager>()->getMyAvatar().get());
        _webSurface->getSurfaceContext()->setContextProperty("Entities", DependencyManager::get<EntityScriptingInterface>().data());
        _webSurface->getSurfaceContext()->setContextProperty("Snapshot", DependencyManager::get<Snapshot>().data());

        if (_webSurface->getRootItem() && _webSurface->getRootItem()->objectName() == "tabletRoot") {
            auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
            auto flags = tabletScriptingInterface->getFlags();

            _webSurface->getSurfaceContext()->setContextProperty("offscreenFlags", flags);
            _webSurface->getSurfaceContext()->setContextProperty("AddressManager", DependencyManager::get<AddressManager>().data());
            _webSurface->getSurfaceContext()->setContextProperty("Account", AccountScriptingInterface::getInstance());
            _webSurface->getSurfaceContext()->setContextProperty("Audio", DependencyManager::get<AudioScriptingInterface>().data());
            _webSurface->getSurfaceContext()->setContextProperty("AudioStats", DependencyManager::get<AudioClient>()->getStats().data());
            _webSurface->getSurfaceContext()->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
            _webSurface->getSurfaceContext()->setContextProperty("fileDialogHelper", new FileDialogHelper());
            _webSurface->getSurfaceContext()->setContextProperty("MyAvatar", DependencyManager::get<AvatarManager>()->getMyAvatar().get());
            _webSurface->getSurfaceContext()->setContextProperty("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());
            _webSurface->getSurfaceContext()->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
            _webSurface->getSurfaceContext()->setContextProperty("Assets", DependencyManager::get<AssetMappingsScriptingInterface>().data());
            _webSurface->getSurfaceContext()->setContextProperty("LODManager", DependencyManager::get<LODManager>().data());
            _webSurface->getSurfaceContext()->setContextProperty("OctreeStats", DependencyManager::get<OctreeStatsProvider>().data());
            _webSurface->getSurfaceContext()->setContextProperty("DCModel", DependencyManager::get<DomainConnectionModel>().data());
            _webSurface->getSurfaceContext()->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
            _webSurface->getSurfaceContext()->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance());
            _webSurface->getSurfaceContext()->setContextProperty("AvatarList", DependencyManager::get<AvatarManager>().data());
            _webSurface->getSurfaceContext()->setContextProperty("DialogsManager", DialogsManagerScriptingInterface::getInstance());
            _webSurface->getSurfaceContext()->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data());
            _webSurface->getSurfaceContext()->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data());

            _webSurface->getSurfaceContext()->setContextProperty("pathToFonts", "../../");

            tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface.data());

            // mark the TabletProxy object as cpp ownership.
            QObject* tablet = tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system");
            _webSurface->getSurfaceContext()->engine()->setObjectOwnership(tablet, QQmlEngine::CppOwnership);

            // Override min fps for tablet UI, for silky smooth scrolling
            setMaxFPS(90);
        }
    }
    _webSurface->getSurfaceContext()->setContextProperty("globalPosition", vec3toVariant(getPosition()));
}
Ejemplo n.º 8
0
void Web3DOverlay::update(float deltatime) {
    if (_webSurface) {
        // update globalPosition
        _webSurface->getSurfaceContext()->setContextProperty("globalPosition", vec3toVariant(getPosition()));
    }
}