Changeset View
Changeset View
Standalone View
Standalone View
source/blender/freestyle/intern/view_map/SphericalGrid.cpp
| Show All 32 Lines | |||||
| // Helper Classes | // Helper Classes | ||||
| // OccluderData | // OccluderData | ||||
| /////////////// | /////////////// | ||||
| // Cell | // Cell | ||||
| ///////// | ///////// | ||||
| SphericalGrid::Cell::Cell() | |||||
| { | |||||
| } | |||||
| SphericalGrid::Cell::~Cell() | |||||
| { | |||||
| } | |||||
| void SphericalGrid::Cell::setDimensions(real x, real y, real sizeX, real sizeY) | void SphericalGrid::Cell::setDimensions(real x, real y, real sizeX, real sizeY) | ||||
| { | { | ||||
| const real epsilon = 1.0e-06; | const real epsilon = 1.0e-06; | ||||
| boundary[0] = x - epsilon; | boundary[0] = x - epsilon; | ||||
| boundary[1] = x + sizeX + epsilon; | boundary[1] = x + sizeX + epsilon; | ||||
| boundary[2] = y - epsilon; | boundary[2] = y - epsilon; | ||||
| boundary[3] = y + sizeY + epsilon; | boundary[3] = y + sizeY + epsilon; | ||||
| } | } | ||||
| Show All 25 Lines | cout << "Searching for occluders of edge centered at " << _target << " in cell [" | ||||
| << _cell->boundary[3] << "] (" << _cell->faces.size() << " occluders)" << endl; | << _cell->boundary[3] << "] (" << _cell->faces.size() << " occluders)" << endl; | ||||
| } | } | ||||
| #endif | #endif | ||||
| // Set iterator | // Set iterator | ||||
| _current = _cell->faces.begin(); | _current = _cell->faces.begin(); | ||||
| } | } | ||||
| SphericalGrid::Iterator::~Iterator() | |||||
| { | |||||
| } | |||||
| // SphericalGrid | // SphericalGrid | ||||
| ///////////////// | ///////////////// | ||||
| SphericalGrid::SphericalGrid(OccluderSource &source, | SphericalGrid::SphericalGrid(OccluderSource &source, | ||||
| GridDensityProvider &density, | GridDensityProvider &density, | ||||
| ViewMap *viewMap, | ViewMap *viewMap, | ||||
| Vec3r &viewpoint, | Vec3r &viewpoint, | ||||
| bool enableQI) | bool enableQI) | ||||
| Show All 14 Lines | SphericalGrid::SphericalGrid(OccluderSource &source, | ||||
| } | } | ||||
| // Reorganize Cells | // Reorganize Cells | ||||
| reorganizeCells(); | reorganizeCells(); | ||||
| if (G.debug & G_DEBUG_FREESTYLE) { | if (G.debug & G_DEBUG_FREESTYLE) { | ||||
| cout << "Ready to use SphericalGrid" << endl; | cout << "Ready to use SphericalGrid" << endl; | ||||
| } | } | ||||
| } | } | ||||
| SphericalGrid::~SphericalGrid() | SphericalGrid::~SphericalGrid() = default; | ||||
| { | |||||
| } | |||||
| void SphericalGrid::assignCells(OccluderSource & /*source*/, | void SphericalGrid::assignCells(OccluderSource & /*source*/, | ||||
| GridDensityProvider &density, | GridDensityProvider &density, | ||||
| ViewMap *viewMap) | ViewMap *viewMap) | ||||
| { | { | ||||
| _cellSize = density.cellSize(); | _cellSize = density.cellSize(); | ||||
| _cellsX = density.cellsX(); | _cellsX = density.cellsX(); | ||||
| _cellsY = density.cellsY(); | _cellsY = density.cellsY(); | ||||
| ▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | const Vec3r &SphericalGrid::viewpoint() const | ||||
| return _viewpoint; | return _viewpoint; | ||||
| } | } | ||||
| bool SphericalGrid::enableQI() const | bool SphericalGrid::enableQI() const | ||||
| { | { | ||||
| return _enableQI; | return _enableQI; | ||||
| } | } | ||||
| SphericalGrid::Transform::Transform() | |||||
| { | |||||
| } | |||||
| Vec3r SphericalGrid::Transform::operator()(const Vec3r &point) const | Vec3r SphericalGrid::Transform::operator()(const Vec3r &point) const | ||||
| { | { | ||||
| return sphericalProjection(point); | return sphericalProjection(point); | ||||
| } | } | ||||
| Vec3r SphericalGrid::Transform::sphericalProjection(const Vec3r &M) | Vec3r SphericalGrid::Transform::sphericalProjection(const Vec3r &M) | ||||
| { | { | ||||
| Vec3r newPoint; | Vec3r newPoint; | ||||
| Show All 9 Lines | |||||