#ifndef _HAIR_VR_VOXEL_PRIMITIVE_base_H_ #define _HAIR_VR_VOXEL_PRIMITIVE_base_H_ // Shave and a Haircut // (c) 2019 Epic Games // US Patent 6720962 /********************************************************************** *< FILE: shaveVrayVoxelPrimBase.h DESCRIPTION: Generic base class for all voxel primitive classes CREATED BY: Vladimir Dubovoy HISTORY: created 12-05-2010 ( as part of 3ds Max + VRay hair shaders) *> **********************************************************************/ #include "utils.h" #include "box.h" #include "rayserver.h" #include "vrayplugins.h" #include "rayserver.h" #include "geometryclasses.h" #include "hairAPIvrayutil.h" #include "assert.h" class shaveVrayVoxelPrimBase { public: shaveVrayVoxelPrimBase(IHairVoxel* vox, VR::VRayCore* vray) { assert(vox); _voxel() = vox; vrayCore = vray; if(vray) { const VR::VRayFrameData& vrfd = vray->getFrameData(); _sceneOffset() = vrfd.sceneOffset; } } virtual ~shaveVrayVoxelPrimBase(){} inline IHairVoxel* GetVoxel() const {return voxel();} protected: VR::VRayCore* vrayCore; //const member access inline const VR::TracePoint& sceneOffset() const {return m_sceneOffset;} inline IHairVoxel* voxel() const {return m_voxel;} //member access inline VR::TracePoint& _sceneOffset() {return m_sceneOffset;} public: inline IHairVoxel*& _voxel(){return m_voxel;} private: IHairVoxel* m_voxel; //got form VRayFrameData::sceneOffset - it should be added to shaded points rc.rayresult.wpoint // //In versions of the V-Ray SDK prior to 1.90.00, wpoint was directly in world space. //In versions 1.90.00 and later, the actual world-space coordinates can be obtained //by adding VRayFrameData::sceneOffset to the wpoint. VR::TracePoint m_sceneOffset ; }; #endif //end of_HAIR_VR_VOXEL_PRIMITIVE_H_