Added modified setVoxel functions to SimpleVolume and LargeVolume.
This commit is contained in:
		| @@ -287,9 +287,9 @@ namespace PolyVox | |||||||
| 		/// Sets the number of blocks which can be in memory before the paging system starts unloading them | 		/// Sets the number of blocks which can be in memory before the paging system starts unloading them | ||||||
| 		void setMaxNumberOfBlocksInMemory(uint32_t uMaxNumberOfBlocksInMemory); | 		void setMaxNumberOfBlocksInMemory(uint32_t uMaxNumberOfBlocksInMemory); | ||||||
| 		/// Sets the voxel at the position given by <tt>x,y,z</tt> coordinates | 		/// Sets the voxel at the position given by <tt>x,y,z</tt> coordinates | ||||||
| 		void setVoxel(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue, BoundsCheck eBoundsCheck = BoundsChecks::Full); | 		void setVoxel(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue, WrapMode eWrapMode = WrapModes::None); | ||||||
| 		/// Sets the voxel at the position given by a 3D vector | 		/// Sets the voxel at the position given by a 3D vector | ||||||
| 		void setVoxel(const Vector3DInt32& v3dPos, VoxelType tValue, BoundsCheck eBoundsCheck = BoundsChecks::Full); | 		void setVoxel(const Vector3DInt32& v3dPos, VoxelType tValue, WrapMode eWrapMode = WrapModes::None); | ||||||
| 		/// Sets the voxel at the position given by <tt>x,y,z</tt> coordinates | 		/// Sets the voxel at the position given by <tt>x,y,z</tt> coordinates | ||||||
| 		bool setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue); | 		bool setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue); | ||||||
| 		/// Sets the voxel at the position given by a 3D vector | 		/// Sets the voxel at the position given by a 3D vector | ||||||
|   | |||||||
| @@ -267,16 +267,19 @@ namespace PolyVox | |||||||
| 	/// \param uYPos the \c y position of the voxel | 	/// \param uYPos the \c y position of the voxel | ||||||
| 	/// \param uZPos the \c z position of the voxel | 	/// \param uZPos the \c z position of the voxel | ||||||
| 	/// \param tValue the value to which the voxel will be set | 	/// \param tValue the value to which the voxel will be set | ||||||
| 	/// \param eBoundsCheck Controls whether bounds checking is performed on voxel access. It's safest to | 	/// \param eWrapMode Specifies the behaviour when the requested position is outside of the volume. | ||||||
| 	/// set this to BoundsChecks::Full (the default), but if you are certain that the voxel you are accessing | 	/// This must be set to 'None' or 'DontCheck'. Other wrap modes cannot be used when writing to volume data. | ||||||
| 	/// is inside the volume's enclosing region then you can skip this check to gain some performance. |  | ||||||
| 	//////////////////////////////////////////////////////////////////////////////// | 	//////////////////////////////////////////////////////////////////////////////// | ||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	void LargeVolume<VoxelType>::setVoxel(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue, BoundsCheck eBoundsCheck) | 	void LargeVolume<VoxelType>::setVoxel(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue, WrapMode eWrapMode) | ||||||
| 	{ | 	{ | ||||||
| 		// If bounds checking is enabled then we validate the | 		if((eWrapMode != None) && (eWrapMode != DontCheck)) | ||||||
| 		// bounds, and throw an exception if they are violated. | 		{ | ||||||
| 		if(eBoundsCheck == BoundsChecks::Full) | 			POLYVOX_THROW(std::invalid_argument, "Invalid wrap mode in call to setVoxel(). It must be 'None' or 'DontCheck'."); | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		// This validation is skipped if the wrap mode is 'DontCheck' | ||||||
|  | 		if(eWrapMode == WrapModes::None) | ||||||
| 		{ | 		{ | ||||||
| 			if(this->m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos)) == false) | 			if(this->m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos)) == false) | ||||||
| 			{ | 			{ | ||||||
| @@ -300,12 +303,11 @@ namespace PolyVox | |||||||
| 	//////////////////////////////////////////////////////////////////////////////// | 	//////////////////////////////////////////////////////////////////////////////// | ||||||
| 	/// \param v3dPos the 3D position of the voxel | 	/// \param v3dPos the 3D position of the voxel | ||||||
| 	/// \param tValue the value to which the voxel will be set | 	/// \param tValue the value to which the voxel will be set | ||||||
| 	/// \param eBoundsCheck Controls whether bounds checking is performed on voxel access. It's safest to | 	/// \param eWrapMode Specifies the behaviour when the requested position is outside of the volume. | ||||||
| 	/// set this to BoundsChecks::Full (the default), but if you are certain that the voxel you are accessing | 	/// This must be set to 'None' or 'DontCheck'. Other wrap modes cannot be used when writing to volume data. | ||||||
| 	/// is inside the volume's enclosing region then you can skip this check to gain some performance. |  | ||||||
| 	//////////////////////////////////////////////////////////////////////////////// | 	//////////////////////////////////////////////////////////////////////////////// | ||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	void LargeVolume<VoxelType>::setVoxel(const Vector3DInt32& v3dPos, VoxelType tValue, BoundsCheck eBoundsCheck) | 	void LargeVolume<VoxelType>::setVoxel(const Vector3DInt32& v3dPos, VoxelType tValue, WrapMode eWrapMode) | ||||||
| 	{ | 	{ | ||||||
| 		setVoxel(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ(), tValue, eBoundsCheck); | 		setVoxel(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ(), tValue, eBoundsCheck); | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -172,9 +172,9 @@ namespace PolyVox | |||||||
| 		VoxelType getVoxelAt(const Vector3DInt32& v3dPos) const; | 		VoxelType getVoxelAt(const Vector3DInt32& v3dPos) const; | ||||||
|  |  | ||||||
| 		/// Sets the voxel at the position given by <tt>x,y,z</tt> coordinates | 		/// Sets the voxel at the position given by <tt>x,y,z</tt> coordinates | ||||||
| 		void setVoxel(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue, BoundsCheck eBoundsCheck = BoundsChecks::Full); | 		void setVoxel(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue, WrapMode eWrapMode = WrapModes::None); | ||||||
| 		/// Sets the voxel at the position given by a 3D vector | 		/// Sets the voxel at the position given by a 3D vector | ||||||
| 		void setVoxel(const Vector3DInt32& v3dPos, VoxelType tValue, BoundsCheck eBoundsCheck = BoundsChecks::Full); | 		void setVoxel(const Vector3DInt32& v3dPos, VoxelType tValue, WrapMode eWrapMode = WrapModes::None); | ||||||
| 		/// Sets the voxel at the position given by <tt>x,y,z</tt> coordinates | 		/// Sets the voxel at the position given by <tt>x,y,z</tt> coordinates | ||||||
| 		bool setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue); | 		bool setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue); | ||||||
| 		/// Sets the voxel at the position given by a 3D vector | 		/// Sets the voxel at the position given by a 3D vector | ||||||
|   | |||||||
| @@ -197,16 +197,19 @@ namespace PolyVox | |||||||
| 	/// \param uYPos the \c y position of the voxel | 	/// \param uYPos the \c y position of the voxel | ||||||
| 	/// \param uZPos the \c z position of the voxel | 	/// \param uZPos the \c z position of the voxel | ||||||
| 	/// \param tValue the value to which the voxel will be set | 	/// \param tValue the value to which the voxel will be set | ||||||
| 	/// \param eBoundsCheck Controls whether bounds checking is performed on voxel access. It's safest to | 	/// \param eWrapMode Specifies the behaviour when the requested position is outside of the volume. | ||||||
| 	/// set this to BoundsChecks::Full (the default), but if you are certain that the voxel you are accessing | 	/// This must be set to 'None' or 'DontCheck'. Other wrap modes cannot be used when writing to volume data. | ||||||
| 	/// is inside the volume's enclosing region then you can skip this check to gain some performance. |  | ||||||
| 	//////////////////////////////////////////////////////////////////////////////// | 	//////////////////////////////////////////////////////////////////////////////// | ||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	void SimpleVolume<VoxelType>::setVoxel(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue, BoundsCheck eBoundsCheck) | 	void SimpleVolume<VoxelType>::setVoxel(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue, WrapMode eWrapMode) | ||||||
| 	{ | 	{ | ||||||
| 		// If bounds checking is enabled then we validate the | 		if((eWrapMode != None) && (eWrapMode != DontCheck)) | ||||||
| 		// bounds, and throw an exception if they are violated. | 		{ | ||||||
| 		if(eBoundsCheck == BoundsChecks::Full) | 			POLYVOX_THROW(std::invalid_argument, "Invalid wrap mode in call to setVoxel(). It must be 'None' or 'DontCheck'."); | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		// This validation is skipped if the wrap mode is 'DontCheck' | ||||||
|  | 		if(eWrapMode == WrapModes::None) | ||||||
| 		{ | 		{ | ||||||
| 			if(this->m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos)) == false) | 			if(this->m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos)) == false) | ||||||
| 			{ | 			{ | ||||||
| @@ -230,12 +233,11 @@ namespace PolyVox | |||||||
| 	//////////////////////////////////////////////////////////////////////////////// | 	//////////////////////////////////////////////////////////////////////////////// | ||||||
| 	/// \param v3dPos the 3D position of the voxel | 	/// \param v3dPos the 3D position of the voxel | ||||||
| 	/// \param tValue the value to which the voxel will be set | 	/// \param tValue the value to which the voxel will be set | ||||||
| 	/// \param eBoundsCheck Controls whether bounds checking is performed on voxel access. It's safest to | 	/// \param eWrapMode Specifies the behaviour when the requested position is outside of the volume. | ||||||
| 	/// set this to BoundsChecks::Full (the default), but if you are certain that the voxel you are accessing | 	/// This must be set to 'None' or 'DontCheck'. Other wrap modes cannot be used when writing to volume data. | ||||||
| 	/// is inside the volume's enclosing region then you can skip this check to gain some performance. |  | ||||||
| 	//////////////////////////////////////////////////////////////////////////////// | 	//////////////////////////////////////////////////////////////////////////////// | ||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	void SimpleVolume<VoxelType>::setVoxel(const Vector3DInt32& v3dPos, VoxelType tValue, BoundsCheck eBoundsCheck) | 	void SimpleVolume<VoxelType>::setVoxel(const Vector3DInt32& v3dPos, VoxelType tValue, WrapMode eWrapMode) | ||||||
| 	{ | 	{ | ||||||
| 		setVoxel(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ(), tValue, eBoundsCheck); | 		setVoxel(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ(), tValue, eBoundsCheck); | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user