123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672 |
- // Copyright 2009-2021 Intel Corporation
- // SPDX-License-Identifier: Apache-2.0
- #pragma once
- #include "default.h"
- #include "device.h"
- #include "buffer.h"
- #include "../common/point_query.h"
- #include "../builders/priminfo.h"
- #include "../builders/priminfo_mb.h"
- namespace embree
- {
- class Scene;
- class Geometry;
- struct GeometryCounts
- {
- __forceinline GeometryCounts()
- : numFilterFunctions(0),
- numTriangles(0), numMBTriangles(0),
- numQuads(0), numMBQuads(0),
- numBezierCurves(0), numMBBezierCurves(0),
- numLineSegments(0), numMBLineSegments(0),
- numSubdivPatches(0), numMBSubdivPatches(0),
- numUserGeometries(0), numMBUserGeometries(0),
- numInstancesCheap(0), numMBInstancesCheap(0),
- numInstancesExpensive(0), numMBInstancesExpensive(0),
- numInstanceArrays(0), numMBInstanceArrays(0),
- numGrids(0), numMBGrids(0),
- numSubGrids(0), numMBSubGrids(0),
- numPoints(0), numMBPoints(0) {}
- __forceinline size_t size() const {
- return numTriangles + numQuads + numBezierCurves + numLineSegments + numSubdivPatches + numUserGeometries + numInstancesCheap + numInstancesExpensive + numInstanceArrays + numGrids + numPoints
- + numMBTriangles + numMBQuads + numMBBezierCurves + numMBLineSegments + numMBSubdivPatches + numMBUserGeometries + numMBInstancesCheap + numMBInstancesExpensive + numMBInstanceArrays + numMBGrids + numMBPoints;
- }
- __forceinline unsigned int enabledGeometryTypesMask() const
- {
- unsigned int mask = 0;
- if (numTriangles) mask |= 1 << 0;
- if (numQuads) mask |= 1 << 1;
- if (numBezierCurves+numLineSegments) mask |= 1 << 2;
- if (numSubdivPatches) mask |= 1 << 3;
- if (numUserGeometries) mask |= 1 << 4;
- if (numInstancesCheap) mask |= 1 << 5;
- if (numInstancesExpensive) mask |= 1 << 6;
- if (numInstanceArrays) mask |= 1 << 7;
- if (numGrids) mask |= 1 << 8;
- if (numPoints) mask |= 1 << 9;
- unsigned int maskMB = 0;
- if (numMBTriangles) maskMB |= 1 << 0;
- if (numMBQuads) maskMB |= 1 << 1;
- if (numMBBezierCurves+numMBLineSegments) maskMB |= 1 << 2;
- if (numMBSubdivPatches) maskMB |= 1 << 3;
- if (numMBUserGeometries) maskMB |= 1 << 4;
- if (numMBInstancesCheap) maskMB |= 1 << 5;
- if (numMBInstancesExpensive) maskMB |= 1 << 6;
- if (numMBInstanceArrays) maskMB |= 1 << 7;
- if (numMBGrids) maskMB |= 1 << 8;
- if (numMBPoints) maskMB |= 1 << 9;
-
- return (mask<<8) + maskMB;
- }
- __forceinline GeometryCounts operator+ (GeometryCounts const & rhs) const
- {
- GeometryCounts ret;
- ret.numFilterFunctions = numFilterFunctions + rhs.numFilterFunctions;
- ret.numTriangles = numTriangles + rhs.numTriangles;
- ret.numMBTriangles = numMBTriangles + rhs.numMBTriangles;
- ret.numQuads = numQuads + rhs.numQuads;
- ret.numMBQuads = numMBQuads + rhs.numMBQuads;
- ret.numBezierCurves = numBezierCurves + rhs.numBezierCurves;
- ret.numMBBezierCurves = numMBBezierCurves + rhs.numMBBezierCurves;
- ret.numLineSegments = numLineSegments + rhs.numLineSegments;
- ret.numMBLineSegments = numMBLineSegments + rhs.numMBLineSegments;
- ret.numSubdivPatches = numSubdivPatches + rhs.numSubdivPatches;
- ret.numMBSubdivPatches = numMBSubdivPatches + rhs.numMBSubdivPatches;
- ret.numUserGeometries = numUserGeometries + rhs.numUserGeometries;
- ret.numMBUserGeometries = numMBUserGeometries + rhs.numMBUserGeometries;
- ret.numInstancesCheap = numInstancesCheap + rhs.numInstancesCheap;
- ret.numMBInstancesCheap = numMBInstancesCheap + rhs.numMBInstancesCheap;
- ret.numInstancesExpensive = numInstancesExpensive + rhs.numInstancesExpensive;
- ret.numMBInstancesExpensive = numMBInstancesExpensive + rhs.numMBInstancesExpensive;
- ret.numInstanceArrays = numInstanceArrays + rhs.numInstanceArrays;
- ret.numMBInstanceArrays = numMBInstanceArrays + rhs.numMBInstanceArrays;
- ret.numGrids = numGrids + rhs.numGrids;
- ret.numMBGrids = numMBGrids + rhs.numMBGrids;
- ret.numSubGrids = numSubGrids + rhs.numSubGrids;
- ret.numMBSubGrids = numMBSubGrids + rhs.numMBSubGrids;
- ret.numPoints = numPoints + rhs.numPoints;
- ret.numMBPoints = numMBPoints + rhs.numMBPoints;
- return ret;
- }
- size_t numFilterFunctions; //!< number of geometries with filter functions enabled
- size_t numTriangles; //!< number of enabled triangles
- size_t numMBTriangles; //!< number of enabled motion blurred triangles
- size_t numQuads; //!< number of enabled quads
- size_t numMBQuads; //!< number of enabled motion blurred quads
- size_t numBezierCurves; //!< number of enabled curves
- size_t numMBBezierCurves; //!< number of enabled motion blurred curves
- size_t numLineSegments; //!< number of enabled line segments
- size_t numMBLineSegments; //!< number of enabled line motion blurred segments
- size_t numSubdivPatches; //!< number of enabled subdivision patches
- size_t numMBSubdivPatches; //!< number of enabled motion blurred subdivision patches
- size_t numUserGeometries; //!< number of enabled user geometries
- size_t numMBUserGeometries; //!< number of enabled motion blurred user geometries
- size_t numInstancesCheap; //!< number of enabled cheap instances
- size_t numMBInstancesCheap; //!< number of enabled motion blurred cheap instances
- size_t numInstancesExpensive; //!< number of enabled expensive instances
- size_t numMBInstancesExpensive; //!< number of enabled motion blurred expensive instances
- size_t numInstanceArrays; //!< number of enabled instance arrays
- size_t numMBInstanceArrays; //!< number of enabled motion blurred instance arrays
- size_t numGrids; //!< number of enabled grid geometries
- size_t numMBGrids; //!< number of enabled motion blurred grid geometries
- size_t numSubGrids; //!< number of enabled grid geometries
- size_t numMBSubGrids; //!< number of enabled motion blurred grid geometries
- size_t numPoints; //!< number of enabled points
- size_t numMBPoints; //!< number of enabled motion blurred points
- };
- /*! Base class all geometries are derived from */
- class __aligned(16) Geometry : public RefCount
- {
- friend class Scene;
- public:
- /*! type of geometry */
- enum GType
- {
- GTY_FLAT_LINEAR_CURVE = 0,
- GTY_ROUND_LINEAR_CURVE = 1,
- GTY_ORIENTED_LINEAR_CURVE = 2,
- GTY_CONE_LINEAR_CURVE = 3,
-
- GTY_FLAT_BEZIER_CURVE = 4,
- GTY_ROUND_BEZIER_CURVE = 5,
- GTY_ORIENTED_BEZIER_CURVE = 6,
-
- GTY_FLAT_BSPLINE_CURVE = 8,
- GTY_ROUND_BSPLINE_CURVE = 9,
- GTY_ORIENTED_BSPLINE_CURVE = 10,
- GTY_FLAT_HERMITE_CURVE = 12,
- GTY_ROUND_HERMITE_CURVE = 13,
- GTY_ORIENTED_HERMITE_CURVE = 14,
-
- GTY_FLAT_CATMULL_ROM_CURVE = 16,
- GTY_ROUND_CATMULL_ROM_CURVE = 17,
- GTY_ORIENTED_CATMULL_ROM_CURVE = 18,
- GTY_TRIANGLE_MESH = 20,
- GTY_QUAD_MESH = 21,
- GTY_GRID_MESH = 22,
- GTY_SUBDIV_MESH = 23,
- GTY_SPHERE_POINT = 25,
- GTY_DISC_POINT = 26,
- GTY_ORIENTED_DISC_POINT = 27,
-
- GTY_USER_GEOMETRY = 29,
- GTY_INSTANCE_CHEAP = 30,
- GTY_INSTANCE_EXPENSIVE = 31,
- GTY_INSTANCE_ARRAY = 24,
- GTY_END = 32,
- GTY_BASIS_LINEAR = 0,
- GTY_BASIS_BEZIER = 4,
- GTY_BASIS_BSPLINE = 8,
- GTY_BASIS_HERMITE = 12,
- GTY_BASIS_CATMULL_ROM = 16,
- GTY_BASIS_MASK = 28,
- GTY_SUBTYPE_FLAT_CURVE = 0,
- GTY_SUBTYPE_ROUND_CURVE = 1,
- GTY_SUBTYPE_ORIENTED_CURVE = 2,
- GTY_SUBTYPE_MASK = 3,
- };
- enum GSubType
- {
- GTY_SUBTYPE_DEFAULT= 0,
- GTY_SUBTYPE_INSTANCE_LINEAR = 0,
- GTY_SUBTYPE_INSTANCE_QUATERNION = 1
- };
- enum GTypeMask
- {
- MTY_FLAT_LINEAR_CURVE = 1ul << GTY_FLAT_LINEAR_CURVE,
- MTY_ROUND_LINEAR_CURVE = 1ul << GTY_ROUND_LINEAR_CURVE,
- MTY_CONE_LINEAR_CURVE = 1ul << GTY_CONE_LINEAR_CURVE,
- MTY_ORIENTED_LINEAR_CURVE = 1ul << GTY_ORIENTED_LINEAR_CURVE,
-
- MTY_FLAT_BEZIER_CURVE = 1ul << GTY_FLAT_BEZIER_CURVE,
- MTY_ROUND_BEZIER_CURVE = 1ul << GTY_ROUND_BEZIER_CURVE,
- MTY_ORIENTED_BEZIER_CURVE = 1ul << GTY_ORIENTED_BEZIER_CURVE,
-
- MTY_FLAT_BSPLINE_CURVE = 1ul << GTY_FLAT_BSPLINE_CURVE,
- MTY_ROUND_BSPLINE_CURVE = 1ul << GTY_ROUND_BSPLINE_CURVE,
- MTY_ORIENTED_BSPLINE_CURVE = 1ul << GTY_ORIENTED_BSPLINE_CURVE,
- MTY_FLAT_HERMITE_CURVE = 1ul << GTY_FLAT_HERMITE_CURVE,
- MTY_ROUND_HERMITE_CURVE = 1ul << GTY_ROUND_HERMITE_CURVE,
- MTY_ORIENTED_HERMITE_CURVE = 1ul << GTY_ORIENTED_HERMITE_CURVE,
- MTY_FLAT_CATMULL_ROM_CURVE = 1ul << GTY_FLAT_CATMULL_ROM_CURVE,
- MTY_ROUND_CATMULL_ROM_CURVE = 1ul << GTY_ROUND_CATMULL_ROM_CURVE,
- MTY_ORIENTED_CATMULL_ROM_CURVE = 1ul << GTY_ORIENTED_CATMULL_ROM_CURVE,
- MTY_CURVE2 = MTY_FLAT_LINEAR_CURVE | MTY_ROUND_LINEAR_CURVE | MTY_CONE_LINEAR_CURVE | MTY_ORIENTED_LINEAR_CURVE,
-
- MTY_CURVE4 = MTY_FLAT_BEZIER_CURVE | MTY_ROUND_BEZIER_CURVE | MTY_ORIENTED_BEZIER_CURVE |
- MTY_FLAT_BSPLINE_CURVE | MTY_ROUND_BSPLINE_CURVE | MTY_ORIENTED_BSPLINE_CURVE |
- MTY_FLAT_HERMITE_CURVE | MTY_ROUND_HERMITE_CURVE | MTY_ORIENTED_HERMITE_CURVE |
- MTY_FLAT_CATMULL_ROM_CURVE | MTY_ROUND_CATMULL_ROM_CURVE | MTY_ORIENTED_CATMULL_ROM_CURVE,
- MTY_SPHERE_POINT = 1ul << GTY_SPHERE_POINT,
- MTY_DISC_POINT = 1ul << GTY_DISC_POINT,
- MTY_ORIENTED_DISC_POINT = 1ul << GTY_ORIENTED_DISC_POINT,
- MTY_POINTS = MTY_SPHERE_POINT | MTY_DISC_POINT | MTY_ORIENTED_DISC_POINT,
- MTY_CURVES = MTY_CURVE2 | MTY_CURVE4 | MTY_POINTS,
- MTY_TRIANGLE_MESH = 1ul << GTY_TRIANGLE_MESH,
- MTY_QUAD_MESH = 1ul << GTY_QUAD_MESH,
- MTY_GRID_MESH = 1ul << GTY_GRID_MESH,
- MTY_SUBDIV_MESH = 1ul << GTY_SUBDIV_MESH,
- MTY_USER_GEOMETRY = 1ul << GTY_USER_GEOMETRY,
- MTY_INSTANCE_CHEAP = 1ul << GTY_INSTANCE_CHEAP,
- MTY_INSTANCE_EXPENSIVE = 1ul << GTY_INSTANCE_EXPENSIVE,
- MTY_INSTANCE = MTY_INSTANCE_CHEAP | MTY_INSTANCE_EXPENSIVE,
- MTY_INSTANCE_ARRAY = 1ul << GTY_INSTANCE_ARRAY,
- MTY_ALL = -1
- };
- static const char* gtype_names[GTY_END];
- enum class State : unsigned {
- MODIFIED = 0,
- COMMITTED = 1,
- };
- public:
-
- /*! Geometry constructor */
- Geometry (Device* device, GType gtype, unsigned int numPrimitives, unsigned int numTimeSteps);
- /*! Geometry destructor */
- virtual ~Geometry();
- public:
- /*! tests if geometry is enabled */
- __forceinline bool isEnabled() const { return enabled; }
- /*! tests if geometry is disabled */
- __forceinline bool isDisabled() const { return !isEnabled(); }
- /* checks if argument version of filter functions are enabled */
- __forceinline bool hasArgumentFilterFunctions() const {
- return argumentFilterEnabled;
- }
-
- /*! tests if that geometry has some filter function set */
- __forceinline bool hasGeometryFilterFunctions () const {
- return (intersectionFilterN != nullptr) || (occlusionFilterN != nullptr);
- }
- /*! returns geometry type */
- __forceinline GType getType() const { return gtype; }
- /*! returns curve type */
- __forceinline GType getCurveType() const { return (GType)(gtype & GTY_SUBTYPE_MASK); }
- /*! returns curve basis */
- __forceinline GType getCurveBasis() const { return (GType)(gtype & GTY_BASIS_MASK); }
- /*! returns geometry type mask */
- __forceinline GTypeMask getTypeMask() const { return (GTypeMask)(1 << gtype); }
- /*! returns true of geometry contains motion blur */
- __forceinline bool hasMotionBlur () const {
- return numTimeSteps > 1;
- }
- /*! returns number of primitives */
- __forceinline size_t size() const { return numPrimitives; }
- /*! sets the number of primitives */
- virtual void setNumPrimitives(unsigned int numPrimitives_in);
- /*! sets number of time steps */
- virtual void setNumTimeSteps (unsigned int numTimeSteps_in);
- /*! sets motion blur time range */
- void setTimeRange (const BBox1f range);
- /*! gets motion blur time range */
- BBox1f getTimeRange () const;
- /*! sets number of vertex attributes */
- virtual void setVertexAttributeCount (unsigned int N) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- /*! sets number of topologies */
- virtual void setTopologyCount (unsigned int N) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- /*! sets the build quality */
- void setBuildQuality(RTCBuildQuality quality_in)
- {
- this->quality = quality_in;
- Geometry::update();
- }
- /* calculate time segment itime and fractional time ftime */
- __forceinline int timeSegment(float time, float& ftime) const {
- return getTimeSegment(time,time_range.lower,time_range.upper,fnumTimeSegments,ftime);
- }
- template<int N>
- __forceinline vint<N> timeSegment(const vfloat<N>& time, vfloat<N>& ftime) const {
- return getTimeSegment<N>(time,vfloat<N>(time_range.lower),vfloat<N>(time_range.upper),vfloat<N>(fnumTimeSegments),ftime);
- }
-
- /* calculate overlapping time segment range */
- __forceinline range<int> timeSegmentRange(const BBox1f& range) const {
- return getTimeSegmentRange(range,time_range,fnumTimeSegments);
- }
- /* returns time that corresponds to time step */
- __forceinline float timeStep(const int i) const {
- assert(i>=0 && i<(int)numTimeSteps);
- return time_range.lower + time_range.size()*float(i)/fnumTimeSegments;
- }
-
- /*! for all geometries */
- public:
- /*! Enable geometry. */
- virtual void enable();
- /*! Update geometry. */
- void update();
-
- /*! commit of geometry */
- virtual void commit();
- /*! Update geometry buffer. */
- virtual void updateBuffer(RTCBufferType type, unsigned int slot) {
- update(); // update everything for geometries not supporting this call
- }
-
- /*! Disable geometry. */
- virtual void disable();
- /*! Verify the geometry */
- virtual bool verify() { return true; }
- /*! called before every build */
- virtual void preCommit();
- /*! called after every build */
- virtual void postCommit();
- virtual void addElementsToCount (GeometryCounts & counts) const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- };
- /*! sets constant tessellation rate for the geometry */
- virtual void setTessellationRate(float N) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- /*! Sets the maximal curve radius scale allowed by min-width feature. */
- virtual void setMaxRadiusScale(float s) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- /*! Set user data pointer. */
- virtual void setUserData(void* ptr);
-
- /*! Get user data pointer. */
- __forceinline void* getUserData() const {
- return userPtr;
- }
- /*! interpolates user data to the specified u/v location */
- virtual void interpolate(const RTCInterpolateArguments* const args) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- /*! interpolates user data to the specified u/v locations */
- virtual void interpolateN(const RTCInterpolateNArguments* const args);
- /* point query api */
- bool pointQuery(PointQuery* query, PointQueryContext* context);
- /*! for subdivision surfaces only */
- public:
- virtual void setSubdivisionMode (unsigned topologyID, RTCSubdivisionMode mode) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- virtual void setVertexAttributeTopology(unsigned int vertexBufferSlot, unsigned int indexBufferSlot) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- /*! Set displacement function. */
- virtual void setDisplacementFunction (RTCDisplacementFunctionN filter) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- virtual unsigned int getFirstHalfEdge(unsigned int faceID) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- virtual unsigned int getFace(unsigned int edgeID) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
-
- virtual unsigned int getNextHalfEdge(unsigned int edgeID) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- virtual unsigned int getPreviousHalfEdge(unsigned int edgeID) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- virtual unsigned int getOppositeHalfEdge(unsigned int topologyID, unsigned int edgeID) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- /*! get fast access to first vertex buffer if applicable */
- virtual float * getCompactVertexArray () const {
- return nullptr;
- }
- /*! Returns the modified counter - how many times the geo has been modified */
- __forceinline unsigned int getModCounter () const {
- return modCounter_;
- }
- /*! for triangle meshes and bezier curves only */
- public:
- /*! Sets ray mask. */
- virtual void setMask(unsigned mask) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
-
- /*! Sets specified buffer. */
- virtual void setBuffer(RTCBufferType type, unsigned int slot, RTCFormat format, const Ref<Buffer>& buffer, size_t offset, size_t stride, unsigned int num) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- /*! Gets specified buffer. */
- virtual void* getBufferData(RTCBufferType type, unsigned int slot, BufferDataPointerType pointerType) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- /*! Set intersection filter function for ray packets of size N. */
- virtual void setIntersectionFilterFunctionN (RTCFilterFunctionN filterN);
- /*! Set occlusion filter function for ray packets of size N. */
- virtual void setOcclusionFilterFunctionN (RTCFilterFunctionN filterN);
- /* Enables argument version of intersection or occlusion filter function. */
- virtual void enableFilterFunctionFromArguments (bool enable) {
- argumentFilterEnabled = enable;
- }
- /*! for instances only */
- public:
- /*! Sets the instanced scene */
- virtual void setInstancedScene(const Ref<Scene>& scene) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- /*! Sets the instanced scenes */
- virtual void setInstancedScenes(const RTCScene* scenes, size_t numScenes) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- /*! Sets transformation of the instance */
- virtual void setTransform(const AffineSpace3fa& transform, unsigned int timeStep) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- /*! Sets transformation of the instance */
- virtual void setQuaternionDecomposition(const AffineSpace3ff& qd, unsigned int timeStep) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- /*! Returns the transformation of the instance */
- virtual AffineSpace3fa getTransform(float time) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- /*! Returns the transformation of the instance */
- virtual AffineSpace3fa getTransform(size_t instance, float time) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- /*! for user geometries only */
- public:
- /*! Set bounds function. */
- virtual void setBoundsFunction (RTCBoundsFunction bounds, void* userPtr) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
- /*! Set intersect function for ray packets of size N. */
- virtual void setIntersectFunctionN (RTCIntersectFunctionN intersect) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
-
- /*! Set occlusion function for ray packets of size N. */
- virtual void setOccludedFunctionN (RTCOccludedFunctionN occluded) {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"operation not supported for this geometry");
- }
-
- /*! Set point query function. */
- void setPointQueryFunction(RTCPointQueryFunction func);
- /*! returns number of time segments */
- __forceinline unsigned numTimeSegments () const {
- return numTimeSteps-1;
- }
- public:
- /*! methods for converting host geometry data to device geometry data */
- virtual size_t getGeometryDataDeviceByteSize() const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"getGeometryDataDeviceByteSize not implemented for this geometry");
- }
- virtual void convertToDeviceRepresentation(size_t offset, char* data_host, char* data_device) const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"convertToDeviceRepresentation not implemented for this geometry");
- }
- public:
- virtual PrimInfo createPrimRefArray(PrimRef* prims, const range<size_t>& r, size_t k, unsigned int geomID) const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"createPrimRefArray not implemented for this geometry");
- }
- PrimInfo createPrimRefArray(mvector<PrimRef>& prims, const range<size_t>& r, size_t k, unsigned int geomID) const {
- return createPrimRefArray(prims.data(),r,k,geomID);
- }
- PrimInfo createPrimRefArray(avector<PrimRef>& prims, const range<size_t>& r, size_t k, unsigned int geomID) const {
- return createPrimRefArray(prims.data(),r,k,geomID);
- }
- virtual PrimInfo createPrimRefArray(mvector<PrimRef>& prims, mvector<SubGridBuildData>& sgrids, const range<size_t>& r, size_t k, unsigned int geomID) const {
- return createPrimRefArray(prims,r,k,geomID);
- }
- virtual PrimInfo createPrimRefArrayMB(mvector<PrimRef>& prims, size_t itime, const range<size_t>& r, size_t k, unsigned int geomID) const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"createPrimRefMBArray not implemented for this geometry");
- }
- /*! Calculates the PrimRef over the complete time interval */
- virtual PrimInfo createPrimRefArrayMB(PrimRef* prims, const BBox1f& t0t1, const range<size_t>& r, size_t k, unsigned int geomID) const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"createPrimRefMBArray not implemented for this geometry");
- }
- PrimInfo createPrimRefArrayMB(mvector<PrimRef>& prims, const BBox1f& t0t1, const range<size_t>& r, size_t k, unsigned int geomID) const {
- return createPrimRefArrayMB(prims.data(),t0t1,r,k,geomID);
- }
- PrimInfo createPrimRefArrayMB(avector<PrimRef>& prims, const BBox1f& t0t1, const range<size_t>& r, size_t k, unsigned int geomID) const {
- return createPrimRefArrayMB(prims.data(),t0t1,r,k,geomID);
- }
-
- virtual PrimInfoMB createPrimRefMBArray(mvector<PrimRefMB>& prims, const BBox1f& t0t1, const range<size_t>& r, size_t k, unsigned int geomID) const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"createPrimRefMBArray not implemented for this geometry");
- }
- virtual PrimInfoMB createPrimRefMBArray(mvector<PrimRefMB>& prims, mvector<SubGridBuildData>& sgrids, const BBox1f& t0t1, const range<size_t>& r, size_t k, unsigned int geomID) const {
- return createPrimRefMBArray(prims,t0t1,r,k,geomID);
- }
- virtual LinearSpace3fa computeAlignedSpace(const size_t primID) const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"computeAlignedSpace not implemented for this geometry");
- }
- virtual LinearSpace3fa computeAlignedSpaceMB(const size_t primID, const BBox1f time_range) const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"computeAlignedSpace not implemented for this geometry");
- }
-
- virtual Vec3fa computeDirection(unsigned int primID) const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"computeDirection not implemented for this geometry");
- }
- virtual Vec3fa computeDirection(unsigned int primID, size_t time) const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"computeDirection not implemented for this geometry");
- }
- virtual BBox3fa vbounds(size_t primID) const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"vbounds not implemented for this geometry");
- }
-
- virtual BBox3fa vbounds(const LinearSpace3fa& space, size_t primID) const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"vbounds not implemented for this geometry");
- }
- virtual BBox3fa vbounds(const Vec3fa& ofs, const float scale, const float r_scale0, const LinearSpace3fa& space, size_t i, size_t itime = 0) const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"vbounds not implemented for this geometry");
- }
- virtual LBBox3fa vlinearBounds(size_t primID, const BBox1f& time_range) const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"vlinearBounds not implemented for this geometry");
- }
- virtual LBBox3fa vlinearBounds(size_t primID, const BBox1f& time_range, const SubGridBuildData * const sgrids) const {
- return vlinearBounds(primID,time_range);
- }
-
- virtual LBBox3fa vlinearBounds(const LinearSpace3fa& space, size_t primID, const BBox1f& time_range) const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"vlinearBounds not implemented for this geometry");
- }
- virtual LBBox3fa vlinearBounds(const Vec3fa& ofs, const float scale, const float r_scale0, const LinearSpace3fa& space, size_t primID, const BBox1f& time_range) const {
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"vlinearBounds not implemented for this geometry");
- }
-
- public:
- __forceinline bool hasIntersectionFilter() const { return intersectionFilterN != nullptr; }
- __forceinline bool hasOcclusionFilter() const { return occlusionFilterN != nullptr; }
- public:
- Device* device; //!< device this geometry belongs to
- void* userPtr; //!< user pointer
- unsigned int numPrimitives; //!< number of primitives of this geometry
-
- unsigned int numTimeSteps; //!< number of time steps
- float fnumTimeSegments; //!< number of time segments (precalculation)
- BBox1f time_range; //!< motion blur time range
-
- unsigned int mask; //!< for masking out geometry
- unsigned int modCounter_ = 1; //!< counter for every modification - used to rebuild scenes when geo is modified
- struct {
- GType gtype : 8; //!< geometry type
- GSubType gsubtype : 8; //!< geometry subtype
- RTCBuildQuality quality : 3; //!< build quality for geometry
- unsigned state : 2;
- bool enabled : 1; //!< true if geometry is enabled
- bool argumentFilterEnabled : 1; //!< true if argument filter functions are enabled for this geometry
- };
-
- RTCFilterFunctionN intersectionFilterN;
- RTCFilterFunctionN occlusionFilterN;
- RTCPointQueryFunction pointQueryFunc;
- };
- }
|