Applied default Visual Studio formatting to most files. This is a quick fix for the tabs vs spaces issue that messes up the formatting in any editor (esp. Linux) which handles tabs/spaces differently to Visual Studio. Some parts of the formatting look a bit worse but overall it should be better (or at least more consistent).

I didn't apply the changes to a few macro-heavy files as Visual Studio removes all indentation from macros, whereas the indentation can be handy to see nesting.
This commit is contained in:
David Williams
2015-12-26 23:11:27 +00:00
parent b3ca051878
commit e89a55d154
58 changed files with 1117 additions and 1114 deletions

View File

@ -53,20 +53,20 @@ namespace PolyVox
// It should simply read "if (ty <= tz)".
//
// This error was reported by Joey Hammer (PixelActive).
/**
* Cast a ray through a volume by specifying the start and end positions
*
*
* The ray will move from \a v3dStart to \a v3dEnd, calling \a callback for each
* voxel it passes through until \a callback returns \a false. In this case it
* returns a RaycastResults::Interupted. If it passes from start to end
* without \a callback returning \a false, it returns RaycastResults::Completed.
*
*
* \param volData The volume to pass the ray though
* \param v3dStart The start position in the volume
* \param v3dEnd The end position in the volume
* \param callback The callback to call for each voxel
*
*
* \return A RaycastResults designating whether the ray hit anything or not
*/
template<typename VolumeType, typename Callback>
@ -83,7 +83,7 @@ namespace PolyVox
const float x2 = v3dEnd.getX() + 0.5f;
const float y2 = v3dEnd.getY() + 0.5f;
const float z2 = v3dEnd.getZ() + 0.5f;
int i = (int)floorf(x1);
int j = (int)floorf(y1);
int k = (int)floorf(z1);
@ -107,39 +107,41 @@ namespace PolyVox
const float minz = floorf(z1), maxz = minz + 1.0f;
float tz = ((z1 > z2) ? (z1 - minz) : (maxz - z1)) * deltatz;
sampler.setPosition(i,j,k);
sampler.setPosition(i, j, k);
for(;;)
for (;;)
{
if(!callback(sampler))
if (!callback(sampler))
{
return RaycastResults::Interupted;
}
if(tx <= ty && tx <= tz)
if (tx <= ty && tx <= tz)
{
if(i == iend) break;
if (i == iend) break;
tx += deltatx;
i += di;
if(di == 1) sampler.movePositiveX();
if(di == -1) sampler.moveNegativeX();
} else if (ty <= tz)
if (di == 1) sampler.movePositiveX();
if (di == -1) sampler.moveNegativeX();
}
else if (ty <= tz)
{
if(j == jend) break;
if (j == jend) break;
ty += deltaty;
j += dj;
if(dj == 1) sampler.movePositiveY();
if(dj == -1) sampler.moveNegativeY();
} else
if (dj == 1) sampler.movePositiveY();
if (dj == -1) sampler.moveNegativeY();
}
else
{
if(k == kend) break;
if (k == kend) break;
tz += deltatz;
k += dk;
if(dk == 1) sampler.movePositiveZ();
if(dk == -1) sampler.moveNegativeZ();
if (dk == 1) sampler.movePositiveZ();
if (dk == -1) sampler.moveNegativeZ();
}
}
@ -148,13 +150,13 @@ namespace PolyVox
/**
* Cast a ray through a volume by specifying the start and a direction
*
* The ray will move from \a v3dStart along \a v3dDirectionAndLength, calling
* \a callback for each voxel it passes through until \a callback returns
* \a false. In this case it returns a RaycastResults::Interupted. If it
* passes from start to end without \a callback returning \a false, it
*
* The ray will move from \a v3dStart along \a v3dDirectionAndLength, calling
* \a callback for each voxel it passes through until \a callback returns
* \a false. In this case it returns a RaycastResults::Interupted. If it
* passes from start to end without \a callback returning \a false, it
* returns RaycastResults::Completed.
*
*
* \note These has been confusion in the past with people not realising
* that the length of the direction vector is important. Most graphics API can provide
* a camera position and view direction for picking purposes, but the view direction is
@ -162,12 +164,12 @@ namespace PolyVox
* will only iterate over a single voxel and won't find what you are looking for. Instead
* you must scale the direction vector so that it's length represents the maximum distance
* over which you want the ray to be cast.
*
*
* \param volData The volume to pass the ray though
* \param v3dStart The start position in the volume
* \param v3dDirectionAndLength The direction and length of the ray
* \param callback The callback to call for each voxel
*
*
* \return A RaycastResults designating whether the ray hit anything or not
*/
template<typename VolumeType, typename Callback>