Path: blob/master/thirdparty/embree/kernels/common/geometry.h
9905 views
// Copyright 2009-2021 Intel Corporation1// SPDX-License-Identifier: Apache-2.023#pragma once45#include "default.h"6#include "device.h"7#include "buffer.h"8#include "../common/point_query.h"9#include "../builders/priminfo.h"10#include "../builders/priminfo_mb.h"1112namespace embree13{14class Scene;15class Geometry;1617struct GeometryCounts18{19__forceinline GeometryCounts()20: numFilterFunctions(0),21numTriangles(0), numMBTriangles(0),22numQuads(0), numMBQuads(0),23numBezierCurves(0), numMBBezierCurves(0),24numLineSegments(0), numMBLineSegments(0),25numSubdivPatches(0), numMBSubdivPatches(0),26numUserGeometries(0), numMBUserGeometries(0),27numInstancesCheap(0), numMBInstancesCheap(0),28numInstancesExpensive(0), numMBInstancesExpensive(0),29numInstanceArrays(0), numMBInstanceArrays(0),30numGrids(0), numMBGrids(0),31numSubGrids(0), numMBSubGrids(0),32numPoints(0), numMBPoints(0) {}3334__forceinline size_t size() const {35return numTriangles + numQuads + numBezierCurves + numLineSegments + numSubdivPatches + numUserGeometries + numInstancesCheap + numInstancesExpensive + numInstanceArrays + numGrids + numPoints36+ numMBTriangles + numMBQuads + numMBBezierCurves + numMBLineSegments + numMBSubdivPatches + numMBUserGeometries + numMBInstancesCheap + numMBInstancesExpensive + numMBInstanceArrays + numMBGrids + numMBPoints;37}3839__forceinline unsigned int enabledGeometryTypesMask() const40{41unsigned int mask = 0;42if (numTriangles) mask |= 1 << 0;43if (numQuads) mask |= 1 << 1;44if (numBezierCurves+numLineSegments) mask |= 1 << 2;45if (numSubdivPatches) mask |= 1 << 3;46if (numUserGeometries) mask |= 1 << 4;47if (numInstancesCheap) mask |= 1 << 5;48if (numInstancesExpensive) mask |= 1 << 6;49if (numInstanceArrays) mask |= 1 << 7;50if (numGrids) mask |= 1 << 8;51if (numPoints) mask |= 1 << 9;5253unsigned int maskMB = 0;54if (numMBTriangles) maskMB |= 1 << 0;55if (numMBQuads) maskMB |= 1 << 1;56if (numMBBezierCurves+numMBLineSegments) maskMB |= 1 << 2;57if (numMBSubdivPatches) maskMB |= 1 << 3;58if (numMBUserGeometries) maskMB |= 1 << 4;59if (numMBInstancesCheap) maskMB |= 1 << 5;60if (numMBInstancesExpensive) maskMB |= 1 << 6;61if (numMBInstanceArrays) maskMB |= 1 << 7;62if (numMBGrids) maskMB |= 1 << 8;63if (numMBPoints) maskMB |= 1 << 9;6465return (mask<<8) + maskMB;66}6768__forceinline GeometryCounts operator+ (GeometryCounts const & rhs) const69{70GeometryCounts ret;71ret.numFilterFunctions = numFilterFunctions + rhs.numFilterFunctions;72ret.numTriangles = numTriangles + rhs.numTriangles;73ret.numMBTriangles = numMBTriangles + rhs.numMBTriangles;74ret.numQuads = numQuads + rhs.numQuads;75ret.numMBQuads = numMBQuads + rhs.numMBQuads;76ret.numBezierCurves = numBezierCurves + rhs.numBezierCurves;77ret.numMBBezierCurves = numMBBezierCurves + rhs.numMBBezierCurves;78ret.numLineSegments = numLineSegments + rhs.numLineSegments;79ret.numMBLineSegments = numMBLineSegments + rhs.numMBLineSegments;80ret.numSubdivPatches = numSubdivPatches + rhs.numSubdivPatches;81ret.numMBSubdivPatches = numMBSubdivPatches + rhs.numMBSubdivPatches;82ret.numUserGeometries = numUserGeometries + rhs.numUserGeometries;83ret.numMBUserGeometries = numMBUserGeometries + rhs.numMBUserGeometries;84ret.numInstancesCheap = numInstancesCheap + rhs.numInstancesCheap;85ret.numMBInstancesCheap = numMBInstancesCheap + rhs.numMBInstancesCheap;86ret.numInstancesExpensive = numInstancesExpensive + rhs.numInstancesExpensive;87ret.numMBInstancesExpensive = numMBInstancesExpensive + rhs.numMBInstancesExpensive;88ret.numInstanceArrays = numInstanceArrays + rhs.numInstanceArrays;89ret.numMBInstanceArrays = numMBInstanceArrays + rhs.numMBInstanceArrays;90ret.numGrids = numGrids + rhs.numGrids;91ret.numMBGrids = numMBGrids + rhs.numMBGrids;92ret.numSubGrids = numSubGrids + rhs.numSubGrids;93ret.numMBSubGrids = numMBSubGrids + rhs.numMBSubGrids;94ret.numPoints = numPoints + rhs.numPoints;95ret.numMBPoints = numMBPoints + rhs.numMBPoints;9697return ret;98}99100size_t numFilterFunctions; //!< number of geometries with filter functions enabled101size_t numTriangles; //!< number of enabled triangles102size_t numMBTriangles; //!< number of enabled motion blurred triangles103size_t numQuads; //!< number of enabled quads104size_t numMBQuads; //!< number of enabled motion blurred quads105size_t numBezierCurves; //!< number of enabled curves106size_t numMBBezierCurves; //!< number of enabled motion blurred curves107size_t numLineSegments; //!< number of enabled line segments108size_t numMBLineSegments; //!< number of enabled line motion blurred segments109size_t numSubdivPatches; //!< number of enabled subdivision patches110size_t numMBSubdivPatches; //!< number of enabled motion blurred subdivision patches111size_t numUserGeometries; //!< number of enabled user geometries112size_t numMBUserGeometries; //!< number of enabled motion blurred user geometries113size_t numInstancesCheap; //!< number of enabled cheap instances114size_t numMBInstancesCheap; //!< number of enabled motion blurred cheap instances115size_t numInstancesExpensive; //!< number of enabled expensive instances116size_t numMBInstancesExpensive; //!< number of enabled motion blurred expensive instances117size_t numInstanceArrays; //!< number of enabled instance arrays118size_t numMBInstanceArrays; //!< number of enabled motion blurred instance arrays119size_t numGrids; //!< number of enabled grid geometries120size_t numMBGrids; //!< number of enabled motion blurred grid geometries121size_t numSubGrids; //!< number of enabled grid geometries122size_t numMBSubGrids; //!< number of enabled motion blurred grid geometries123size_t numPoints; //!< number of enabled points124size_t numMBPoints; //!< number of enabled motion blurred points125};126127/*! Base class all geometries are derived from */128class __aligned(16) Geometry : public RefCount129{130friend class Scene;131public:132133/*! type of geometry */134enum GType135{136GTY_FLAT_LINEAR_CURVE = 0,137GTY_ROUND_LINEAR_CURVE = 1,138GTY_ORIENTED_LINEAR_CURVE = 2,139GTY_CONE_LINEAR_CURVE = 3,140141GTY_FLAT_BEZIER_CURVE = 4,142GTY_ROUND_BEZIER_CURVE = 5,143GTY_ORIENTED_BEZIER_CURVE = 6,144145GTY_FLAT_BSPLINE_CURVE = 8,146GTY_ROUND_BSPLINE_CURVE = 9,147GTY_ORIENTED_BSPLINE_CURVE = 10,148149GTY_FLAT_HERMITE_CURVE = 12,150GTY_ROUND_HERMITE_CURVE = 13,151GTY_ORIENTED_HERMITE_CURVE = 14,152153GTY_FLAT_CATMULL_ROM_CURVE = 16,154GTY_ROUND_CATMULL_ROM_CURVE = 17,155GTY_ORIENTED_CATMULL_ROM_CURVE = 18,156157GTY_TRIANGLE_MESH = 20,158GTY_QUAD_MESH = 21,159GTY_GRID_MESH = 22,160GTY_SUBDIV_MESH = 23,161162GTY_SPHERE_POINT = 25,163GTY_DISC_POINT = 26,164GTY_ORIENTED_DISC_POINT = 27,165166GTY_USER_GEOMETRY = 29,167GTY_INSTANCE_CHEAP = 30,168GTY_INSTANCE_EXPENSIVE = 31,169GTY_INSTANCE_ARRAY = 24,170GTY_END = 32,171172GTY_BASIS_LINEAR = 0,173GTY_BASIS_BEZIER = 4,174GTY_BASIS_BSPLINE = 8,175GTY_BASIS_HERMITE = 12,176GTY_BASIS_CATMULL_ROM = 16,177GTY_BASIS_MASK = 28,178179GTY_SUBTYPE_FLAT_CURVE = 0,180GTY_SUBTYPE_ROUND_CURVE = 1,181GTY_SUBTYPE_ORIENTED_CURVE = 2,182GTY_SUBTYPE_MASK = 3,183};184185enum GSubType186{187GTY_SUBTYPE_DEFAULT= 0,188GTY_SUBTYPE_INSTANCE_LINEAR = 0,189GTY_SUBTYPE_INSTANCE_QUATERNION = 1190};191192enum GTypeMask193{194MTY_FLAT_LINEAR_CURVE = 1ul << GTY_FLAT_LINEAR_CURVE,195MTY_ROUND_LINEAR_CURVE = 1ul << GTY_ROUND_LINEAR_CURVE,196MTY_CONE_LINEAR_CURVE = 1ul << GTY_CONE_LINEAR_CURVE,197MTY_ORIENTED_LINEAR_CURVE = 1ul << GTY_ORIENTED_LINEAR_CURVE,198199MTY_FLAT_BEZIER_CURVE = 1ul << GTY_FLAT_BEZIER_CURVE,200MTY_ROUND_BEZIER_CURVE = 1ul << GTY_ROUND_BEZIER_CURVE,201MTY_ORIENTED_BEZIER_CURVE = 1ul << GTY_ORIENTED_BEZIER_CURVE,202203MTY_FLAT_BSPLINE_CURVE = 1ul << GTY_FLAT_BSPLINE_CURVE,204MTY_ROUND_BSPLINE_CURVE = 1ul << GTY_ROUND_BSPLINE_CURVE,205MTY_ORIENTED_BSPLINE_CURVE = 1ul << GTY_ORIENTED_BSPLINE_CURVE,206207MTY_FLAT_HERMITE_CURVE = 1ul << GTY_FLAT_HERMITE_CURVE,208MTY_ROUND_HERMITE_CURVE = 1ul << GTY_ROUND_HERMITE_CURVE,209MTY_ORIENTED_HERMITE_CURVE = 1ul << GTY_ORIENTED_HERMITE_CURVE,210211MTY_FLAT_CATMULL_ROM_CURVE = 1ul << GTY_FLAT_CATMULL_ROM_CURVE,212MTY_ROUND_CATMULL_ROM_CURVE = 1ul << GTY_ROUND_CATMULL_ROM_CURVE,213MTY_ORIENTED_CATMULL_ROM_CURVE = 1ul << GTY_ORIENTED_CATMULL_ROM_CURVE,214215MTY_CURVE2 = MTY_FLAT_LINEAR_CURVE | MTY_ROUND_LINEAR_CURVE | MTY_CONE_LINEAR_CURVE | MTY_ORIENTED_LINEAR_CURVE,216217MTY_CURVE4 = MTY_FLAT_BEZIER_CURVE | MTY_ROUND_BEZIER_CURVE | MTY_ORIENTED_BEZIER_CURVE |218MTY_FLAT_BSPLINE_CURVE | MTY_ROUND_BSPLINE_CURVE | MTY_ORIENTED_BSPLINE_CURVE |219MTY_FLAT_HERMITE_CURVE | MTY_ROUND_HERMITE_CURVE | MTY_ORIENTED_HERMITE_CURVE |220MTY_FLAT_CATMULL_ROM_CURVE | MTY_ROUND_CATMULL_ROM_CURVE | MTY_ORIENTED_CATMULL_ROM_CURVE,221222MTY_SPHERE_POINT = 1ul << GTY_SPHERE_POINT,223MTY_DISC_POINT = 1ul << GTY_DISC_POINT,224MTY_ORIENTED_DISC_POINT = 1ul << GTY_ORIENTED_DISC_POINT,225226MTY_POINTS = MTY_SPHERE_POINT | MTY_DISC_POINT | MTY_ORIENTED_DISC_POINT,227228MTY_CURVES = MTY_CURVE2 | MTY_CURVE4 | MTY_POINTS,229230MTY_TRIANGLE_MESH = 1ul << GTY_TRIANGLE_MESH,231MTY_QUAD_MESH = 1ul << GTY_QUAD_MESH,232MTY_GRID_MESH = 1ul << GTY_GRID_MESH,233MTY_SUBDIV_MESH = 1ul << GTY_SUBDIV_MESH,234MTY_USER_GEOMETRY = 1ul << GTY_USER_GEOMETRY,235236MTY_INSTANCE_CHEAP = 1ul << GTY_INSTANCE_CHEAP,237MTY_INSTANCE_EXPENSIVE = 1ul << GTY_INSTANCE_EXPENSIVE,238MTY_INSTANCE = MTY_INSTANCE_CHEAP | MTY_INSTANCE_EXPENSIVE,239MTY_INSTANCE_ARRAY = 1ul << GTY_INSTANCE_ARRAY,240241MTY_ALL = -1242};243244static const char* gtype_names[GTY_END];245246enum class State : unsigned {247MODIFIED = 0,248COMMITTED = 1,249};250251public:252253/*! Geometry constructor */254Geometry (Device* device, GType gtype, unsigned int numPrimitives, unsigned int numTimeSteps);255256/*! Geometry destructor */257virtual ~Geometry();258259public:260261/*! tests if geometry is enabled */262__forceinline bool isEnabled() const { return enabled; }263264/*! tests if geometry is disabled */265__forceinline bool isDisabled() const { return !isEnabled(); }266267/* checks if argument version of filter functions are enabled */268__forceinline bool hasArgumentFilterFunctions() const {269return argumentFilterEnabled;270}271272/*! tests if that geometry has some filter function set */273__forceinline bool hasGeometryFilterFunctions () const {274return (intersectionFilterN != nullptr) || (occlusionFilterN != nullptr);275}276277/*! returns geometry type */278__forceinline GType getType() const { return gtype; }279280/*! returns curve type */281__forceinline GType getCurveType() const { return (GType)(gtype & GTY_SUBTYPE_MASK); }282283/*! returns curve basis */284__forceinline GType getCurveBasis() const { return (GType)(gtype & GTY_BASIS_MASK); }285286/*! returns geometry type mask */287__forceinline GTypeMask getTypeMask() const { return (GTypeMask)(1 << gtype); }288289/*! returns true of geometry contains motion blur */290__forceinline bool hasMotionBlur () const {291return numTimeSteps > 1;292}293294/*! returns number of primitives */295__forceinline size_t size() const { return numPrimitives; }296297/*! sets the number of primitives */298virtual void setNumPrimitives(unsigned int numPrimitives_in);299300/*! sets number of time steps */301virtual void setNumTimeSteps (unsigned int numTimeSteps_in);302303/*! sets motion blur time range */304void setTimeRange (const BBox1f range);305306/*! gets motion blur time range */307BBox1f getTimeRange () const;308309/*! sets number of vertex attributes */310virtual void setVertexAttributeCount (unsigned int N) {311throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");312}313314/*! sets number of topologies */315virtual void setTopologyCount (unsigned int N) {316throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");317}318319/*! sets the build quality */320void setBuildQuality(RTCBuildQuality quality_in)321{322this->quality = quality_in;323Geometry::update();324}325326/* calculate time segment itime and fractional time ftime */327__forceinline int timeSegment(float time, float& ftime) const {328return getTimeSegment(time,time_range.lower,time_range.upper,fnumTimeSegments,ftime);329}330331template<int N>332__forceinline vint<N> timeSegment(const vfloat<N>& time, vfloat<N>& ftime) const {333return getTimeSegment<N>(time,vfloat<N>(time_range.lower),vfloat<N>(time_range.upper),vfloat<N>(fnumTimeSegments),ftime);334}335336/* calculate overlapping time segment range */337__forceinline range<int> timeSegmentRange(const BBox1f& range) const {338return getTimeSegmentRange(range,time_range,fnumTimeSegments);339}340341/* returns time that corresponds to time step */342__forceinline float timeStep(const int i) const {343assert(i>=0 && i<(int)numTimeSteps);344return time_range.lower + time_range.size()*float(i)/fnumTimeSegments;345}346347/*! for all geometries */348public:349350/*! Enable geometry. */351virtual void enable();352353/*! Update geometry. */354void update();355356/*! commit of geometry */357virtual void commit();358359/*! Update geometry buffer. */360virtual void updateBuffer(RTCBufferType type, unsigned int slot) {361update(); // update everything for geometries not supporting this call362}363364/*! Disable geometry. */365virtual void disable();366367/*! Verify the geometry */368virtual bool verify() { return true; }369370/*! called before every build */371virtual void preCommit();372373/*! called after every build */374virtual void postCommit();375376virtual void addElementsToCount (GeometryCounts & counts) const {377throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");378};379380/*! sets constant tessellation rate for the geometry */381virtual void setTessellationRate(float N) {382throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");383}384385/*! Sets the maximal curve radius scale allowed by min-width feature. */386virtual void setMaxRadiusScale(float s) {387throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");388}389390/*! Set user data pointer. */391virtual void setUserData(void* ptr);392393/*! Get user data pointer. */394__forceinline void* getUserData() const {395return userPtr;396}397398/*! interpolates user data to the specified u/v location */399virtual void interpolate(const RTCInterpolateArguments* const args) {400throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");401}402403/*! interpolates user data to the specified u/v locations */404virtual void interpolateN(const RTCInterpolateNArguments* const args);405406/* point query api */407bool pointQuery(PointQuery* query, PointQueryContext* context);408409/*! for subdivision surfaces only */410public:411virtual void setSubdivisionMode (unsigned topologyID, RTCSubdivisionMode mode) {412throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");413}414415virtual void setVertexAttributeTopology(unsigned int vertexBufferSlot, unsigned int indexBufferSlot) {416throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");417}418419/*! Set displacement function. */420virtual void setDisplacementFunction (RTCDisplacementFunctionN filter) {421throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");422}423424virtual unsigned int getFirstHalfEdge(unsigned int faceID) {425throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");426}427428virtual unsigned int getFace(unsigned int edgeID) {429throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");430}431432virtual unsigned int getNextHalfEdge(unsigned int edgeID) {433throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");434}435436virtual unsigned int getPreviousHalfEdge(unsigned int edgeID) {437throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");438}439440virtual unsigned int getOppositeHalfEdge(unsigned int topologyID, unsigned int edgeID) {441throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");442}443444/*! get fast access to first vertex buffer if applicable */445virtual float * getCompactVertexArray () const {446return nullptr;447}448449/*! Returns the modified counter - how many times the geo has been modified */450__forceinline unsigned int getModCounter () const {451return modCounter_;452}453454/*! for triangle meshes and bezier curves only */455public:456457458/*! Sets ray mask. */459virtual void setMask(unsigned mask) {460throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");461}462463/*! Sets specified buffer. */464virtual void setBuffer(RTCBufferType type, unsigned int slot, RTCFormat format, const Ref<Buffer>& buffer, size_t offset, size_t stride, unsigned int num) {465throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");466}467468/*! Gets specified buffer. */469virtual void* getBufferData(RTCBufferType type, unsigned int slot, BufferDataPointerType pointerType) {470throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");471}472473/*! Set intersection filter function for ray packets of size N. */474virtual void setIntersectionFilterFunctionN (RTCFilterFunctionN filterN);475476/*! Set occlusion filter function for ray packets of size N. */477virtual void setOcclusionFilterFunctionN (RTCFilterFunctionN filterN);478479/* Enables argument version of intersection or occlusion filter function. */480virtual void enableFilterFunctionFromArguments (bool enable) {481argumentFilterEnabled = enable;482}483484/*! for instances only */485public:486487/*! Sets the instanced scene */488virtual void setInstancedScene(const Ref<Scene>& scene) {489throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");490}491492/*! Sets the instanced scenes */493virtual void setInstancedScenes(const RTCScene* scenes, size_t numScenes) {494throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");495}496497/*! Sets transformation of the instance */498virtual void setTransform(const AffineSpace3fa& transform, unsigned int timeStep) {499throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");500}501502/*! Sets transformation of the instance */503virtual void setQuaternionDecomposition(const AffineSpace3ff& qd, unsigned int timeStep) {504throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");505}506507/*! Returns the transformation of the instance */508virtual AffineSpace3fa getTransform(float time) {509throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");510}511512/*! Returns the transformation of the instance */513virtual AffineSpace3fa getTransform(size_t instance, float time) {514throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");515}516517/*! for user geometries only */518public:519520/*! Set bounds function. */521virtual void setBoundsFunction (RTCBoundsFunction bounds, void* userPtr) {522throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");523}524525/*! Set intersect function for ray packets of size N. */526virtual void setIntersectFunctionN (RTCIntersectFunctionN intersect) {527throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");528}529530/*! Set occlusion function for ray packets of size N. */531virtual void setOccludedFunctionN (RTCOccludedFunctionN occluded) {532throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");533}534535/*! Set point query function. */536void setPointQueryFunction(RTCPointQueryFunction func);537538/*! returns number of time segments */539__forceinline unsigned numTimeSegments () const {540return numTimeSteps-1;541}542543public:544545/*! methods for converting host geometry data to device geometry data */546virtual size_t getGeometryDataDeviceByteSize() const {547throw_RTCError(RTC_ERROR_INVALID_OPERATION,"getGeometryDataDeviceByteSize not implemented for this geometry");548}549550virtual void convertToDeviceRepresentation(size_t offset, char* data_host, char* data_device) const {551throw_RTCError(RTC_ERROR_INVALID_OPERATION,"convertToDeviceRepresentation not implemented for this geometry");552}553554public:555556virtual PrimInfo createPrimRefArray(PrimRef* prims, const range<size_t>& r, size_t k, unsigned int geomID) const {557throw_RTCError(RTC_ERROR_INVALID_OPERATION,"createPrimRefArray not implemented for this geometry");558}559560PrimInfo createPrimRefArray(mvector<PrimRef>& prims, const range<size_t>& r, size_t k, unsigned int geomID) const {561return createPrimRefArray(prims.data(),r,k,geomID);562}563564PrimInfo createPrimRefArray(avector<PrimRef>& prims, const range<size_t>& r, size_t k, unsigned int geomID) const {565return createPrimRefArray(prims.data(),r,k,geomID);566}567568virtual PrimInfo createPrimRefArray(mvector<PrimRef>& prims, mvector<SubGridBuildData>& sgrids, const range<size_t>& r, size_t k, unsigned int geomID) const {569return createPrimRefArray(prims,r,k,geomID);570}571572virtual PrimInfo createPrimRefArrayMB(mvector<PrimRef>& prims, size_t itime, const range<size_t>& r, size_t k, unsigned int geomID) const {573throw_RTCError(RTC_ERROR_INVALID_OPERATION,"createPrimRefMBArray not implemented for this geometry");574}575576/*! Calculates the PrimRef over the complete time interval */577virtual PrimInfo createPrimRefArrayMB(PrimRef* prims, const BBox1f& t0t1, const range<size_t>& r, size_t k, unsigned int geomID) const {578throw_RTCError(RTC_ERROR_INVALID_OPERATION,"createPrimRefMBArray not implemented for this geometry");579}580581PrimInfo createPrimRefArrayMB(mvector<PrimRef>& prims, const BBox1f& t0t1, const range<size_t>& r, size_t k, unsigned int geomID) const {582return createPrimRefArrayMB(prims.data(),t0t1,r,k,geomID);583}584585PrimInfo createPrimRefArrayMB(avector<PrimRef>& prims, const BBox1f& t0t1, const range<size_t>& r, size_t k, unsigned int geomID) const {586return createPrimRefArrayMB(prims.data(),t0t1,r,k,geomID);587}588589virtual PrimInfoMB createPrimRefMBArray(mvector<PrimRefMB>& prims, const BBox1f& t0t1, const range<size_t>& r, size_t k, unsigned int geomID) const {590throw_RTCError(RTC_ERROR_INVALID_OPERATION,"createPrimRefMBArray not implemented for this geometry");591}592593virtual PrimInfoMB createPrimRefMBArray(mvector<PrimRefMB>& prims, mvector<SubGridBuildData>& sgrids, const BBox1f& t0t1, const range<size_t>& r, size_t k, unsigned int geomID) const {594return createPrimRefMBArray(prims,t0t1,r,k,geomID);595}596597virtual LinearSpace3fa computeAlignedSpace(const size_t primID) const {598throw_RTCError(RTC_ERROR_INVALID_OPERATION,"computeAlignedSpace not implemented for this geometry");599}600601virtual LinearSpace3fa computeAlignedSpaceMB(const size_t primID, const BBox1f time_range) const {602throw_RTCError(RTC_ERROR_INVALID_OPERATION,"computeAlignedSpace not implemented for this geometry");603}604605virtual Vec3fa computeDirection(unsigned int primID) const {606throw_RTCError(RTC_ERROR_INVALID_OPERATION,"computeDirection not implemented for this geometry");607}608609virtual Vec3fa computeDirection(unsigned int primID, size_t time) const {610throw_RTCError(RTC_ERROR_INVALID_OPERATION,"computeDirection not implemented for this geometry");611}612613virtual BBox3fa vbounds(size_t primID) const {614throw_RTCError(RTC_ERROR_INVALID_OPERATION,"vbounds not implemented for this geometry");615}616617virtual BBox3fa vbounds(const LinearSpace3fa& space, size_t primID) const {618throw_RTCError(RTC_ERROR_INVALID_OPERATION,"vbounds not implemented for this geometry");619}620621virtual BBox3fa vbounds(const Vec3fa& ofs, const float scale, const float r_scale0, const LinearSpace3fa& space, size_t i, size_t itime = 0) const {622throw_RTCError(RTC_ERROR_INVALID_OPERATION,"vbounds not implemented for this geometry");623}624625virtual LBBox3fa vlinearBounds(size_t primID, const BBox1f& time_range) const {626throw_RTCError(RTC_ERROR_INVALID_OPERATION,"vlinearBounds not implemented for this geometry");627}628629virtual LBBox3fa vlinearBounds(size_t primID, const BBox1f& time_range, const SubGridBuildData * const sgrids) const {630return vlinearBounds(primID,time_range);631}632633virtual LBBox3fa vlinearBounds(const LinearSpace3fa& space, size_t primID, const BBox1f& time_range) const {634throw_RTCError(RTC_ERROR_INVALID_OPERATION,"vlinearBounds not implemented for this geometry");635}636637virtual LBBox3fa vlinearBounds(const Vec3fa& ofs, const float scale, const float r_scale0, const LinearSpace3fa& space, size_t primID, const BBox1f& time_range) const {638throw_RTCError(RTC_ERROR_INVALID_OPERATION,"vlinearBounds not implemented for this geometry");639}640641public:642__forceinline bool hasIntersectionFilter() const { return intersectionFilterN != nullptr; }643__forceinline bool hasOcclusionFilter() const { return occlusionFilterN != nullptr; }644645public:646Device* device; //!< device this geometry belongs to647648void* userPtr; //!< user pointer649unsigned int numPrimitives; //!< number of primitives of this geometry650651unsigned int numTimeSteps; //!< number of time steps652float fnumTimeSegments; //!< number of time segments (precalculation)653BBox1f time_range; //!< motion blur time range654655unsigned int mask; //!< for masking out geometry656unsigned int modCounter_ = 1; //!< counter for every modification - used to rebuild scenes when geo is modified657658struct {659GType gtype : 8; //!< geometry type660GSubType gsubtype : 8; //!< geometry subtype661RTCBuildQuality quality : 3; //!< build quality for geometry662unsigned state : 2;663bool enabled : 1; //!< true if geometry is enabled664bool argumentFilterEnabled : 1; //!< true if argument filter functions are enabled for this geometry665};666667RTCFilterFunctionN intersectionFilterN;668RTCFilterFunctionN occlusionFilterN;669RTCPointQueryFunction pointQueryFunc;670};671}672673674