nr-filter-diffuselighting.cpp revision ff01e5e776c82f67e351dd8db3fcf1c00e224bb2
/*
* feDiffuseLighting renderer
*
* Authors:
* Niko Kiirala <niko@kiirala.com>
* Jean-Rene Reinhard <jr@komite.net>
*
* Copyright (C) 2007 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <glib/gmessages.h>
#include "display/nr-3dutils.h"
#include "display/nr-arena-item.h"
#include "display/nr-filter-diffuselighting.h"
#include "display/nr-filter-getalpha.h"
#include "display/nr-filter-slot.h"
#include "display/nr-filter-units.h"
#include "display/nr-filter-utils.h"
#include "display/nr-light.h"
#include "libnr/nr-pixblock.h"
#include "libnr/nr-matrix.h"
#include "libnr/nr-rect-l.h"
#include "color.h"
namespace NR {
{
diffuseConstant = 1;
surfaceScale = 1;
lighting_color = 0xffffffff;
}
return new FilterDiffuseLighting();
}
{}
do {\
}while(0)
if (!in) {
return 1;
}
int i, j;
//As long as FilterRes and kernel unit is not supported we hardcode the
//default value
//surface scale
true);
//No light, nothing to do
switch (light_type) {
case DISTANT_LIGHT:
//the light vector is constant
{
dl->light_vector(L);
//finish the work
for (i = 0, j = 0; i < w*h; i++) {
data_o[j++] = 255;
}
delete dl;
}
break;
case POINT_LIGHT:
{
//TODO we need a reference to the filter to determine primitiveUnits
//if objectBoundingBox is used, use a different matrix for light_vector
// UPDATE: trans is now correct matrix from primitiveUnits to
// pixblock coordinates
//finish the work
for (i = 0, j = 0; i < w*h; i++) {
pl->light_vector(L,
i % w + x0,
i / w + y0,
data_o[j++] = 255;
}
delete pl;
}
break;
case SPOT_LIGHT:
{
//TODO we need a reference to the filter to determine primitiveUnits
//if objectBoundingBox is used, use a different matrix for light_vector
// UPDATE: trans is now correct matrix from primitiveUnits to
// pixblock coordinates
//finish the work
for (i = 0, j = 0; i < w*h; i++) {
sl->light_vector(L,
i % w + x0,
i / w + y0,
data_o[j++] = 255;
}
delete sl;
}
break;
//else unknown light source, doing nothing
case NO_LIGHT:
default:
{
if (light_type != NO_LIGHT)
for (i = 0; i < w*h; i++) {
}
}
}
//finishing
//nr_pixblock_release(in);
//delete in;
return 0;
}
return TRAIT_PARALLER;
}
} /* namespace NR */
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :