예제 #1
0
void RawVolumeModel::releaseVolumeInfo(const eq::Range& range)
{
    const int32_t key = calcHashKey(range);
    if (_volumeHash.find(key) == _volumeHash.end())
        return;

    _volumeHash.erase(key);
}
예제 #2
0
파일: daemon.c 프로젝트: plepe/mod_tile
void remove_item_idx(struct item * item) {
    int key = calcHashKey(item);
    struct item_idx * nextItem;
    struct item_idx * prevItem;
    struct item * test;
    if (item_hashidx[key].item == NULL) {
        //item not in index;
        return;
    }
    prevItem = &(item_hashidx[key]);
    nextItem = &(item_hashidx[key]);

    while (nextItem != NULL) {
        test = nextItem->item;
        if ((item->mx == test->mx) && (item->my == test->my) && (item->req.z
                == test->req.z) && (!strcmp(item->req.xmlname,
                test->req.xmlname))) {
            /*
             * Found item, removing it from list
             */
            nextItem->item = NULL;
            if (nextItem->next != NULL) {
                if (nextItem == &(item_hashidx[key])) {
                    prevItem = nextItem->next;
                    memcpy(&(item_hashidx[key]), nextItem->next,
                            sizeof(struct item_idx));
                    free(prevItem);
                } else {
                    prevItem->next = nextItem->next;
                }
            } else {
                prevItem->next = NULL;
            }

            if (nextItem != &(item_hashidx[key])) {
                free(nextItem);
            }
            return;
        } else {
            prevItem = nextItem;
            nextItem = nextItem->next;
        }
    }
}
예제 #3
0
bool RawVolumeModel::getVolumeInfo(VolumeInfo& info, const eq::Range& range)
{
    if (!_headerLoaded && !loadHeader(1.0f, 1.0f))
        return false;

    if (_preintName == 0)
    {
        LBLOG(eq::LOG_CUSTOM) << "Creating preint" << std::endl;
        _preintName = createPreintegrationTable(&_TF[0]);
    }

    VolumePart* volumePart = nullptr;
    const int32_t key = calcHashKey(range);

    if (_volumeHash.find(key) == _volumeHash.end())
    {
        // new key
        volumePart = &_volumeHash[key];
        if (!_createVolumeTexture(volumePart->volume, volumePart->TD, range))
            return false;
    }
    else
    { // old key
        volumePart = &_volumeHash[key];
    }

    info.volume = volumePart->volume;
    info.TD = volumePart->TD;
    info.preint = _preintName;
    info.volScaling = _volScaling;
    if (_hasDerivatives)
    {
        info.voxelSize.W = 1.f;
        info.voxelSize.H = 1.f;
        info.voxelSize.D = 1.f;
    }
    else
    {
        info.voxelSize.W = 1.f / _tW;
        info.voxelSize.H = 1.f / _tH;
        info.voxelSize.D = 1.f / _tD;
    }
    return true;
}
예제 #4
0
파일: daemon.c 프로젝트: plepe/mod_tile
void insert_item_idx(struct item *item) {
    struct item_idx * nextItem;
    struct item_idx * prevItem;

    int key = calcHashKey(item);

    if (item_hashidx[key].item == NULL) {
        item_hashidx[key].item = item;
    } else {
        prevItem = &(item_hashidx[key]);
        nextItem = item_hashidx[key].next;
        while(nextItem) {
            prevItem = nextItem;
            nextItem = nextItem->next;
        }
        nextItem = (struct item_idx *)malloc(sizeof(struct item_idx));
        nextItem->item = item;
        nextItem->next = NULL;
        prevItem->next = nextItem;
    }
}
예제 #5
0
static void insert_item_idx(struct request_queue * queue, struct item *item) {
    struct item_idx * nextItem;
    struct item_idx * prevItem;

    int key = calcHashKey(queue, item);

    if (queue->item_hashidx[key].item == NULL) {
        queue->item_hashidx[key].item = item;
    } else {
        prevItem = &(queue->item_hashidx[key]);
        nextItem = queue->item_hashidx[key].next;
        while(nextItem) {
            prevItem = nextItem;
            nextItem = nextItem->next;
        }
        nextItem = (struct item_idx *)malloc(sizeof(struct item_idx));
        nextItem->item = item;
        nextItem->next = NULL;
        prevItem->next = nextItem;
    }
}
예제 #6
0
파일: daemon.c 프로젝트: plepe/mod_tile
struct item * lookup_item_idx(struct item * item) {
    struct item_idx * nextItem;
    struct item * test;

    int key = calcHashKey(item);

    if (item_hashidx[key].item == NULL) {
        return NULL;
    } else {
        nextItem = &(item_hashidx[key]);
        while (nextItem != NULL) {
            test = nextItem->item;
            if ((item->mx == test->mx) && (item->my == test->my)
                    && (item->req.z == test->req.z) && (!strcmp(
                    item->req.xmlname, test->req.xmlname))) {
                return test;
            } else {
                nextItem = nextItem->next;
            }
        }
    }
    return NULL;
}