Exemple #1
0
static void renderBlock(const Scene *scene, Sampler *sampler, ImageBlock &block) {
    const Camera *camera = scene->getCamera();
    const Integrator *integrator = scene->getIntegrator();

    Point2i offset = block.getOffset();
    Vector2i size  = block.getSize();

    /* Clear the block contents */
    block.clear();

    /* For each pixel and pixel sample sample */
    for (int y=0; y<size.y(); ++y) {
        for (int x=0; x<size.x(); ++x) {
            for (uint32_t i=0; i<sampler->getSampleCount(); ++i) {
                Point2f pixelSample = Point2f((float) (x + offset.x()), (float) (y + offset.y())) + sampler->next2D();
                Point2f apertureSample = sampler->next2D();

                /* Sample a ray from the camera */
                Ray3f ray;
                Color3f value = camera->sampleRay(ray, pixelSample, apertureSample);

                /* Compute the incident radiance */
                value *= integrator->Li(scene, sampler, ray);

                /* Store in the image block */
                block.put(pixelSample, value);
            }
        }
    }
}
Exemple #2
0
bool Window::isOver(Point2i p) const {
    if (!on) {
        return false;
    }
    /// @todo Shouldn't this be <tt>position.x() + border.size.width()</tt> (and
    /// <tt>position.x() + size.width() - 2 * borderSize.width()</tt>?
    if (p.x() < this->position.x() + this->border.size.width() ||
        p.x() > this->position.x() + 2 * this->border.size.width() + this->size.width()) {
        return false;
    }
    /// @todo Shouldn't this be <tt>position.y() + border.size.height()</tt> (and
    /// <tt>position.y() + size.height() - 2 * borderSize.height()</tt>?
    if (p.y() < this->position.y() + this->border.size.height() ||
        p.y() > this->position.y() + 2 * this->border.size.height() + this->size.height()) {
        return false;
    }
    return true;
}
Exemple #3
0
Point2i::Point2i(const Point2i &_p) 
    : x_(_p.x()), y_(_p.y()) {}