// Copyright 2009-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 #pragma once #include "accelset.h" namespace embree { /*! User geometry with user defined intersection functions */ struct UserGeometry : public AccelSet { /*! type of this geometry */ static const Geometry::GTypeMask geom_type = Geometry::MTY_USER_GEOMETRY; public: UserGeometry (Device* device, unsigned int items = 0, unsigned int numTimeSteps = 1); virtual void setMask (unsigned mask); virtual void setBoundsFunction (RTCBoundsFunction bounds, void* userPtr); virtual void setIntersectFunctionN (RTCIntersectFunctionN intersect); virtual void setOccludedFunctionN (RTCOccludedFunctionN occluded); virtual void build() {} virtual void addElementsToCount (GeometryCounts & counts) const; }; namespace isa { struct UserGeometryISA : public UserGeometry { UserGeometryISA (Device* device) : UserGeometry(device) {} PrimInfo createPrimRefArray(mvector& prims, const range& r, size_t k, unsigned int geomID) const { PrimInfo pinfo(empty); for (size_t j=r.begin(); j& prims, size_t itime, const range& r, size_t k, unsigned int geomID) const { PrimInfo pinfo(empty); for (size_t j=r.begin(); j& prims, const BBox1f& t0t1, const range& r, size_t k, unsigned int geomID) const { PrimInfoMB pinfo(empty); for (size_t j=r.begin(); jnumTimeSegments(),this->time_range,this->numTimeSegments(),geomID,unsigned(j)); pinfo.add_primref(prim); prims[k++] = prim; } return pinfo; } }; } DECLARE_ISA_FUNCTION(UserGeometry*, createUserGeometry, Device*); }