23 cached.colors.resize(cached.r.size());
24 for (
Size i = 0; i < cached.r.size(); ++i) {
25 cached.colors[i] = colorizer.
evalColor(i);
28 cached.distention.resize(cached.r.size());
34 spheres.
reserve(cached.r.size());
37 const float initialRadius = cached.r[i][H];
38 float radius = initialRadius;
39 while (radius < MAX_DISTENTION * initialRadius) {
40 tree.findAll(cached.r[i], radius, local);
41 if (local.size() >= MIN_NEIGHS) {
54 bvh.build(std::move(spheres));
56 for (ThreadData& data : threadData) {
57 data.data = RayData{};
60 shouldContinue =
true;
64 return !cached.r.empty();
71 RayData& rayData(data.data);
73 intersections.
clear();
76 std::sort(intersections.
begin(), intersections.
end());
83 const Vector hit = ray.origin() + ray.direction() * is.t;
84 const Vector center = cached.r[i];
86 const float cosPhi =
abs(
dot(toCenter, ray.direction()));
88 const float secant = 2._f *
getLength(center - hit) * cosPhi;
Defines projection transforming 3D particles onto 2D screen.
Object converting quantity values of particles into colors.
uint32_t Size
Integral type used to index arrays (by default).
ReverseAdapter< TContainer > reverse(TContainer &&container)
K-d tree for efficient search of neighbouring particles.
NAMESPACE_SPH_BEGIN constexpr INLINE T min(const T &f1, const T &f2)
Minimum & Maximum value.
constexpr INLINE Float pow< 3 >(const Float v)
INLINE auto abs(const T &f)
@ SKIP_RANK
The rank of particles is not created. 'Dummy' option that can be used to improve readability.
#define NAMESPACE_SPH_END
Helper iterators allowing to save values to containers.
BackInserter< TContainer > backInserter(TContainer &c)
@ POSITION
Positions (velocities, accelerations) of particles, always a vector quantity,.
INLINE void parallelFor(IScheduler &scheduler, const Size from, const Size to, TFunctor &&functor)
Executes a functor concurrently from all available threads.
INLINE Float getLength(const Vector &v)
Returns the length of the vector. Enabled only for vectors of floating-point precision.
INLINE float dot(const BasicVector< float > &v1, const BasicVector< float > &v2)
Make sure the vector is trivially constructible and destructible, needed for fast initialization of a...
INLINE Vector getNormalized(const Vector &v)
const float MAX_DISTENTION
void reserve(const TCounter newMaxSize)
Allocates enough memory to store the given number of elements.
INLINE Iterator< StorageType > end() noexcept
void clear()
Removes all elements from the array, but does NOT release the memory.
INLINE Iterator< StorageType > begin() noexcept
Trait for finding intersections with a sphere.
Size getAllIntersections(const Ray &ray, TOutIter iter) const
Returns all intersections of the ray.
Interface defining a camera or view, used by a renderer.
Interface for objects assigning colors to particles.
virtual Rgba evalColor(const Size idx) const =0
Returns the color of idx-th particle.
Base class for renderers based on raytracing.
Rgba getEnviroColor(const CameraRay &ray) const
SharedPtr< IScheduler > scheduler
void build(IScheduler &scheduler, ArrayView< const Vector > points, Flags< FinderFlag > flags=FinderFlag::MAKE_RANK)
Constructs the struct with an array of vectors.
K-d tree, used for hierarchical clustering of particles and accelerated Kn queries.
Container storing all quantities used within the simulations.
Array< TValue > & getValue(const QuantityId key)
Retrieves a quantity values from the storage, given its key and value type.
Template for storing a copy of a value for every thread in given scheduler.
virtual bool isInitialized() const override
Checks if the renderer has been initialized.
Array< float > distention
Distention factor of each particle.
virtual void initialize(const Storage &storage, const IColorizer &colorizer, const ICamera &camera) override
Prepares the objects for rendering and updates its data.
VolumeRenderer(SharedPtr< IScheduler > scheduler, const GuiSettings &settings)
Size userData
Generic user data, can be used to store additional information to the primitives.
Ray given by origin and target point.
Holds intormation about intersection.
Parameters of the rendered image.
struct RenderParams::@36 volume
Parameters of volumetric renderer.
float absorption
Absorption coefficient [m^-1].
float emission
Emission multiplier.