Exemplo n.º 1
0
Color Texture4D::getNearest(double dx, double dy, double dz, double dw) const {
    if (dx < 0.0)
        dx = 0.0;
    if (dx > 1.0)
        dx = 1.0;
    if (dy < 0.0)
        dy = 0.0;
    if (dy > 1.0)
        dy = 1.0;
    if (dz < 0.0)
        dz = 0.0;
    if (dz > 1.0)
        dz = 1.0;
    if (dw < 0.0)
        dw = 0.0;
    if (dw > 1.0)
        dw = 1.0;

    int ix = trunc_to_int(dx * to_double(this->xsize - 1));
    int iy = trunc_to_int(dy * to_double(this->ysize - 1));
    int iz = trunc_to_int(dz * to_double(this->zsize - 1));
    int iw = trunc_to_int(dw * to_double(this->wsize - 1));

    assert(ix >= 0 && ix < this->xsize);
    assert(iy >= 0 && iy < this->ysize);
    assert(iz >= 0 && iz < this->zsize);
    assert(iw >= 0 && iw < this->wsize);

    return this
        ->data[iw * this->xsize * this->ysize * this->zsize + iz * this->xsize * this->ysize + iy * this->xsize + ix];
}
Exemplo n.º 2
0
void SoftwareRenderer::setQuality(double quality) {
    terrain_renderer->setQuality(quality);
    clouds_renderer->setQuality(quality);
    godrays->setQuality(quality);

    // TEMP compat with old code
    render_quality = trunc_to_int(quality * 9.0) + 1;
}