コード例 #1
0
ファイル: ModelTreeElement.cpp プロジェクト: Bazm0/hifi
void ModelTreeElement::getModelsForUpdate(const AABox& box, QVector<ModelItem*>& foundModels) {
    QList<ModelItem>::iterator modelItr = _modelItems->begin();
    QList<ModelItem>::iterator modelEnd = _modelItems->end();
    AABox modelBox;
    while(modelItr != modelEnd) {
        ModelItem* model = &(*modelItr);
        float radius = model->getRadius();
        // NOTE: we actually do box-box collision queries here, which is sloppy but good enough for now
        // TODO: decide whether to replace modelBox-box query with sphere-box (requires a square root
        // but will be slightly more accurate).
        modelBox.setBox(model->getPosition() - glm::vec3(radius), 2.f * radius);
        if (modelBox.touches(_box)) {
            foundModels.push_back(model);
        }
        ++modelItr;
    }
}
コード例 #2
0
ファイル: ModelItem.cpp プロジェクト: Bazm0/hifi
void ModelItemProperties::copyFromModelItem(const ModelItem& modelItem) {
    _position = modelItem.getPosition() * (float) TREE_SCALE;
    _color = modelItem.getXColor();
    _radius = modelItem.getRadius() * (float) TREE_SCALE;
    _shouldDie = modelItem.getShouldDie();
    _modelURL = modelItem.getModelURL();
    _modelRotation = modelItem.getModelRotation();

    _id = modelItem.getID();
    _idSet = true;

    _positionChanged = false;
    _colorChanged = false;
    _radiusChanged = false;

    _shouldDieChanged = false;
    _modelURLChanged = false;
    _modelRotationChanged = false;
    _defaultSettings = false;
}