Add a whole bunch of documentation

This commit is contained in:
Matt Williams 2012-10-27 18:52:50 +01:00
parent 313f7a11ec
commit 856cdca604
8 changed files with 73 additions and 13 deletions

View File

@ -39,6 +39,12 @@ freely, subject to the following restrictions:
namespace PolyVox
{
/**
* \file
*
* Ambient occlusion
*/
template<typename IsVoxelTransparentCallback>
class AmbientOcclusionCalculatorRaycastCallback
{

View File

@ -92,10 +92,18 @@ namespace PolyVox
return *this;
}
/// \return The current density of the voxel
Type getDensity() const throw() { return m_uDensity; }
/**
* Set the density of the voxel
*
* \param uDensity The density to set to
*/
void setDensity(Type uDensity) { m_uDensity = uDensity; }
/// \return The maximum allowed density of the voxel
static Type getMaxDensity() throw() { return (std::numeric_limits<Type>::max)(); }
/// \return The minimum allowed density of the voxel
static Type getMinDensity() throw() { return (std::numeric_limits<Type>::min)(); }
private:

View File

@ -58,7 +58,13 @@ namespace PolyVox
return !(*this == rhs);
}
/// \return The current material value of the voxel
Type getMaterial() const throw() { return m_uMaterial; }
/**
* Set the material value of the voxel
*
* \param uDensity The material to set to
*/
void setMaterial(Type uMaterial) { m_uMaterial = uMaterial; }
private:

View File

@ -30,10 +30,13 @@ namespace PolyVox
{
namespace RaycastResults
{
/**
* The results of a raycast
*/
enum RaycastResult
{
Completed,
Interupted
Completed, ///< If the ray passed through the volume without being interupted
Interupted ///< If the ray was interupted while travelling
};
}
typedef RaycastResults::RaycastResult RaycastResult;

View File

@ -45,6 +45,7 @@ namespace PolyVox
{
public:
#ifndef SWIG
//Could be made private?
class Block
{
public:
@ -82,24 +83,35 @@ namespace PolyVox
#endif
{
public:
/// Construct a new Sampler
Sampler(SimpleVolume<VoxelType>* volume);
~Sampler();
Sampler& operator=(const Sampler& rhs) throw();
VoxelType getSubSampledVoxel(uint8_t uLevel) const;
inline VoxelType getVoxel(void) const;
/// Get the value of the current voxel
inline VoxelType getVoxel(void) const;
/// Set the current voxel position
void setPosition(const Vector3DInt32& v3dNewPos);
/// Set the current voxel position
void setPosition(int32_t xPos, int32_t yPos, int32_t zPos);
/// Set the value of the current voxel
inline bool setVoxel(VoxelType tValue);
/// Increase the \a x position by \a 1
void movePositiveX(void);
/// Increase the \a y position by \a 1
void movePositiveY(void);
/// Increase the \a z position by \a 1
void movePositiveZ(void);
/// Decrease the \a x position by \a 1
void moveNegativeX(void);
/// Decrease the \a y position by \a 1
void moveNegativeY(void);
/// Decrease the \a z position by \a 1
void moveNegativeZ(void);
inline VoxelType peekVoxel1nx1ny1nz(void) const;

View File

@ -50,7 +50,7 @@ namespace PolyVox
}
////////////////////////////////////////////////////////////////////////////////
/// The border value is returned whenever an atempt is made to read a voxel which
/// The border value is returned whenever an attempt is made to read a voxel which
/// is outside the extents of the volume.
/// \return The value used for voxels outside of the volume
////////////////////////////////////////////////////////////////////////////////
@ -230,7 +230,9 @@ namespace PolyVox
}
////////////////////////////////////////////////////////////////////////////////
/// Note: This function needs reviewing for accuracy...
/// \todo This function needs reviewing for accuracy...
///
/// \return The number of bytes used
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
uint32_t SimpleVolume<VoxelType>::calculateSizeInBytes(void)

View File

@ -28,6 +28,9 @@ freely, subject to the following restrictions:
namespace PolyVox
{
/**
* \param volume The SimpleVolume you want to sample
*/
template <typename VoxelType>
SimpleVolume<VoxelType>::Sampler::Sampler(SimpleVolume<VoxelType>* volume)
:BaseVolume<VoxelType>::template Sampler< SimpleVolume<VoxelType> >(volume)
@ -91,19 +94,30 @@ namespace PolyVox
return tValue;
}
}
/**
* \return The current voxel
*/
template <typename VoxelType>
VoxelType SimpleVolume<VoxelType>::Sampler::getVoxel(void) const
{
return *mCurrentVoxel;
}
/**
* \param v3dNewPos The position to set to
*/
template <typename VoxelType>
void SimpleVolume<VoxelType>::Sampler::setPosition(const Vector3DInt32& v3dNewPos)
{
setPosition(v3dNewPos.getX(), v3dNewPos.getY(), v3dNewPos.getZ());
}
/**
* \param xPos The \a x position to set to
* \param yPos The \a y position to set to
* \param zPos The \a z position to set to
*/
template <typename VoxelType>
void SimpleVolume<VoxelType>::Sampler::setPosition(int32_t xPos, int32_t yPos, int32_t zPos)
{
@ -134,7 +148,16 @@ namespace PolyVox
mCurrentVoxel = this->mVolume->m_pUncompressedBorderData + uVoxelIndexInBlock;
}
}
/**
* \details
*
* This function checks that the current voxel position that you're trying
* to set is not outside the volume. If it is, this function returns
* \a false, otherwise it will return \a true.
*
* \param tValue The value to set to voxel to
*/
template <typename VoxelType>
bool SimpleVolume<VoxelType>::Sampler::setVoxel(VoxelType tValue)
{

View File

@ -516,7 +516,7 @@ namespace PolyVox
}
/**
NOTE: This function does not make much sense on integer Vectors.
\note This function does not make much sense on integer Vectors.
\return Length of the Vector.
*/
template <uint32_t Size, typename Type>
@ -543,7 +543,7 @@ namespace PolyVox
This function is commutative, such that a.angleTo(b) == b.angleTo(a). The angle
returned is in radians and varies between 0 and 3.14(pi). It is always positive.
NOTE: This function does not make much sense on integer Vectors.
\note This function does not make much sense on integer Vectors.
\param Vector3D The Vector to find the angle to.
\return The angle between them in radians.
@ -597,7 +597,7 @@ namespace PolyVox
/**
Divides the i, j, and k components by the length to give a Vector of length 1.0.
NOTE: This function does not make much sense on integer Vectors.
\note This function does not make much sense on integer Vectors.
*/
template <uint32_t Size, typename Type>
inline void Vector<Size, Type>::normalise(void) throw()