40bool BoxGrid::Cell::compareOccludersByShallowestPoint(
const BoxGrid::OccluderData *
a,
41 const BoxGrid::OccluderData *
b)
43 return a->shallowest <
b->shallowest;
46void BoxGrid::Cell::indexPolygons()
49 sort(
faces.begin(),
faces.end(), compareOccludersByShallowestPoint);
62 cout <<
"Searching for occluders of edge centered at " << _target <<
" in cell ["
63 << 1_cell->boundary[0] <<
", " << _cell->boundary[1] <<
", " << _cell->boundary[2] <<
", "
64 << _cell->boundary[3] <<
"] (" << _cell->faces.size() <<
" occluders)" << endl;
69 _current = _cell->faces.begin();
84 cout <<
"Generate Cell structure" << endl;
90 cout <<
"Distribute occluders" << endl;
96 cout <<
"Reorganize cells" << endl;
101 cout <<
"Ready to use BoxGrid" << endl;
112 _cellsX = density.
cellsX();
113 _cellsY = density.
cellsY();
117 cout <<
"Using " << _cellsX <<
"x" << _cellsY <<
" cells of size " << _cellSize <<
" square."
119 cout <<
"Cell origin: " << _cellOrigin[0] <<
", " << _cellOrigin[1] << endl;
123 _cells.resize(_cellsX * _cellsY);
124 for (cellContainer::iterator i = _cells.begin(), end = _cells.end(); i != end; ++i) {
130 for (ViewMap::fedges_container::iterator f = fedges.begin(), fend = fedges.end(); f != fend; ++f)
132 if ((*f)->isInImage()) {
135 getCellCoordinates(
point, i, j);
136 if (_cells[i * _cellsY + j] ==
nullptr) {
140 x = _cellOrigin[0] + _cellSize * i;
143 y = _cellOrigin[1] + _cellSize * j;
147 Cell *
b = _cells[i * _cellsY + j] =
new Cell();
148 b->setDimensions(
x,
y, width, height);
157 ulong nKeptFaces = 0;
164 _faces.push_back(occluder);
179 cout <<
"Distributed " << nFaces <<
" occluders. Retained " << nKeptFaces <<
"." << endl;
186 for (vector<Cell *>::iterator i = _cells.begin(), end = _cells.end(); i != end; ++i) {
188 (*i)->indexPolygons();
202 getCellCoordinates(
point,
x,
y);
203 return _cells[
x * _cellsY +
y];
Class to define a cell grid surrounding the projected image of a scene.
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
static DBVT_INLINE btDbvtNode * sort(btDbvtNode *n, btDbvtNode *&r)
Iterator(BoxGrid &grid, Vec3r ¢er, real epsilon=1.0e-06)
void assignCells(OccluderSource &source, GridDensityProvider &density, ViewMap *viewMap)
const Vec3r & viewpoint() const
Cell * findCell(const Vec3r &point)
void distributePolygons(OccluderSource &source)
bool insertOccluder(OccluderSource &source, OccluderData *&occluder)
bool orthographicProjection() const
float cellOrigin(int index)
vector< FEdge * > fedges_container
fedges_container & FEdges()
local_group_size(16, 16) .push_constant(Type b
ccl_device_inline float2 floor(const float2 a)
VecMat::Vec3< real > Vec3r
double epsilon
default precision while comparing with Equal(..,..) functions. Initialized at 0.0000001.