• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

PolyVoxCore/include/PolyVoxCore/Region.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 Copyright (c) 2005-2009 David Williams
00003 
00004 This software is provided 'as-is', without any express or implied
00005 warranty. In no event will the authors be held liable for any damages
00006 arising from the use of this software.
00007 
00008 Permission is granted to anyone to use this software for any purpose,
00009 including commercial applications, and to alter it and redistribute it
00010 freely, subject to the following restrictions:
00011 
00012     1. The origin of this software must not be misrepresented; you must not
00013     claim that you wrote the original software. If you use this software
00014     in a product, an acknowledgment in the product documentation would be
00015     appreciated but is not required.
00016 
00017     2. Altered source versions must be plainly marked as such, and must not be
00018     misrepresented as being the original software.
00019 
00020     3. This notice may not be removed or altered from any source
00021     distribution.   
00022 *******************************************************************************/
00023 
00024 #ifndef __PolyVox_Region_H__
00025 #define __PolyVox_Region_H__
00026 
00027 #include "PolyVoxImpl/TypeDef.h"
00028 
00029 #include "PolyVoxCore/Vector.h"
00030 
00031 namespace PolyVox
00032 {
00033 #ifdef SWIG
00034     class Region
00035 #else
00036     class POLYVOX_API Region
00037 #endif
00038     {
00039     public:
00040 
00041         static const Region MaxRegion;
00042 
00043         Region();
00044         Region(const Vector3DInt32& v3dLowerCorner, const Vector3DInt32& v3dUpperCorner);
00045         Region(int32_t iLowerX, int32_t iLowerY, int32_t iLowerZ, int32_t iUpperX, int32_t iUpperY, int32_t iUpperZ);
00046 
00048         bool operator==(const Region& rhs) const throw();
00050         bool operator!=(const Region& rhs) const throw();
00051 
00052         const Vector3DInt32& getLowerCorner(void) const;
00053         const Vector3DInt32& getUpperCorner(void) const;
00054 
00055         void setLowerCorner(const Vector3DInt32& v3dLowerCorner);
00056         void setUpperCorner(const Vector3DInt32& v3dUpperCorner);
00057 
00058         bool containsPoint(const Vector3DFloat& pos, float boundary = 0.0f) const;
00059         bool containsPoint(const Vector3DInt32& pos, uint8_t boundary = 0) const;
00060         //FIXME - Don't like these. Make containsPoint take flags indicating which axes to check?
00061         bool containsPointInX(float pos, float boundary = 0.0f) const;
00062         bool containsPointInX(int32_t pos, uint8_t boundary = 0) const;
00063         bool containsPointInY(float pos, float boundary = 0.0f) const;
00064         bool containsPointInY(int32_t pos, uint8_t boundary = 0) const;
00065         bool containsPointInZ(float pos, float boundary = 0.0f) const;
00066         bool containsPointInZ(int32_t pos, uint8_t boundary = 0) const;
00067         void cropTo(const Region& other);
00069         int32_t depth(void) const;
00071         int32_t height(void) const;
00072         void shift(const Vector3DInt32& amount);
00073         void shiftLowerCorner(const Vector3DInt32& amount);
00074         void shiftUpperCorner(const Vector3DInt32& amount);
00076         Vector3DInt32 dimensions(void);
00078         int32_t width(void) const;
00079 
00080     private:
00081         Vector3DInt32 m_v3dLowerCorner;
00082         Vector3DInt32 m_v3dUpperCorner;
00083 
00084         //FIXME - This variable is unused, but without it the OpenGL example crashes in release mode
00085         //when the volume size is 128^3 and the level of detail is 2. Very strange, but consistant.
00086         //Presubablly some kind of alignment issue? It started after this class was changed to use
00087         //int16's rather than int32's. To be investigated.
00088         uint8_t dummy; 
00089     };
00090 }
00091 
00092 #endif

Generated on Sat Nov 19 2011 00:27:30 for PolyVox by  doxygen 1.7.1