28 #ifndef __Ogre_Volume_OctreeNode_H__
29 #define __Ogre_Volume_OctreeNode_H__
41 class OctreeNodeSplitPolicy;
100 center = (to - from) / (
Real)2.0;
104 height.
x = (
Real)0.0;
106 height.
z = (
Real)0.0;
178 return mChildren != 0;
202 return (mFrom + mTo) / (
Real)2.0;
231 return mFrom.x == root.
mFrom.
x;
242 return mTo.x == root.
mTo.
x;
253 return mFrom.y == root.
mFrom.
y;
264 return mTo.y == root.
mTo.
y;
275 return mFrom.z == root.
mFrom.
z;
286 return mTo.z == root.
mTo.
z;
295 return Vector3(mFrom.x + (mTo.x - mFrom.x) / (
Real)2.0, mFrom.y + (mTo.y - mFrom.y) / (
Real)2.0, mFrom.z);
304 return Vector3(mFrom.x + (mTo.x - mFrom.x) / (
Real)2.0, mFrom.y + (mTo.y - mFrom.y) / (
Real)2.0, mTo.z);
313 return Vector3(mFrom.x, mFrom.y + (mTo.y - mFrom.y) / (
Real)2.0, mFrom.z + (mTo.z - mFrom.z) / (
Real)2.0);
322 return Vector3(mTo.x, mFrom.y + (mTo.y - mFrom.y) / (
Real)2.0, mFrom.z + (mTo.z - mFrom.z) / (
Real)2.0);
331 return Vector3(mFrom.x + (mTo.x - mFrom.x) / (
Real)2.0, mTo.y, mFrom.z + (mTo.z - mFrom.z) / (
Real)2.0);
340 return Vector3(mFrom.x + (mTo.x - mFrom.x) / (
Real)2.0, mFrom.y, mFrom.z + (mTo.z - mFrom.z) / (
Real)2.0);
349 return Vector3(mFrom.x + (mTo.x - mFrom.x) / (
Real)2.0, mTo.y, mFrom.z);
358 return Vector3(mFrom.x + (mTo.x - mFrom.x) / (
Real)2.0, mFrom.y, mFrom.z);
367 return Vector3(mFrom.x + (mTo.x - mFrom.x) / (
Real)2.0, mTo.y, mTo.z);
376 return Vector3(mFrom.x + (mTo.x - mFrom.x) / (
Real)2.0, mFrom.y, mTo.z);
385 return Vector3(mFrom.x, mTo.y, mFrom.z + (mTo.z - mFrom.z) / (
Real)2.0);
394 return Vector3(mFrom.x, mFrom.y, mFrom.z + (mTo.z - mFrom.z) / (
Real)2.0);
403 return Vector3(mTo.x, mTo.y, mFrom.z + (mTo.z - mFrom.z) / (
Real)2.0);
412 return Vector3(mTo.x, mFrom.y, mFrom.z + (mTo.z - mFrom.z) / (
Real)2.0);
421 return Vector3(mFrom.x, mFrom.y + (mTo.y - mFrom.y) / (
Real)2.0, mFrom.z);
430 return Vector3(mFrom.x, mFrom.y + (mTo.y - mFrom.y) / (
Real)2.0, mTo.z);
439 return Vector3(mTo.x, mFrom.y + (mTo.y - mFrom.y) / (
Real)2.0, mFrom.z);
448 return Vector3(mTo.x, mFrom.y + (mTo.y - mFrom.y) / (
Real)2.0, mTo.z);
457 return Vector3(mTo.x, mFrom.y, mFrom.z);
466 return Vector3(mTo.x, mFrom.y, mTo.z);
475 return Vector3(mFrom.x, mFrom.y, mTo.z);
484 return Vector3(mFrom.x, mTo.y, mFrom.z);
493 return Vector3(mTo.x, mTo.y, mFrom.z);
502 return Vector3(mFrom.x, mTo.y, mTo.z);
511 mCenterValue = value;
529 if (mCenterValue.w == (
Real)0.0)
533 return Math::Abs(mCenterValue.w) < (mFrom - mTo).length() * NEAR_FACTOR;
bool isBorderBack(const OctreeNode &root) const
Gets whether this cell is at the back of the given root cell.
const Vector3 getCenterBack(void) const
Gets the center of the corners 0, 1, 4, 5.
bool isSubdivided(void) const
Gets whether this cell has any children.
void setTo(Vector3 to)
Setter for the to-part of this cell.
float Real
Software floating point type.
const Vector3 getCenterRightTop(void) const
Gets the center of the corners 5, 6.
const Vector3 getCenterBackTop(void) const
Gets the center of the corners 4, 5.
const Vector3 getCenterFrontLeft(void) const
Gets the center of the corners 3, 7.
Vector4 mCenterValue
Density and gradient of the center.
const Vector3 getCenterLeftTop(void) const
Gets the center of the corners 4, 7.
Class providing a much simplified interface to generating manual objects with custom geometry...
const Vector3 getCenterRightBottom(void) const
Gets the center of the corners 1, 2.
const Vector3 getCorner5(void) const
Gets the coordinate of corner 5.
const Vector3 getCenterBackRight(void) const
Gets the center of the corners 1, 5.
const Vector3 getCorner3(void) const
Gets the coordinate of corner 3.
Manages the organisation and rendering of a 'scene' i.e.
static const Vector3 ZERO
const Vector3 getCenterLeft(void) const
Gets the center of the corners 0, 3, 4, 6.
bool isBorderTop(const OctreeNode &root) const
Gets whether this cell is at the top of the given root cell.
Vector3 mTo
The front upper right corner of the cell.
const Vector4 getCenterValue(void) const
Gets the center value.
void setCenterValue(Vector4 value)
Raw setter for the center value.
const Vector3 getCenterFrontRight(void) const
Gets the center of the corners 2, 6.
const Vector3 getCenterTop(void) const
Gets the center of the corners 4, 5, 6, 7.
Abstract class defining the density function.
void setFrom(Vector3 from)
Setter for the from-part of this cell.
static void getChildrenDimensions(const Vector3 &from, const Vector3 &to, Vector3 ¢er, Vector3 &width, Vector3 &height, Vector3 &depth)
Gets the center and width / height / depth vector of the children of a node.
static size_t mNodeI
To give the debug manual object an unique name.
bool isIsoSurfaceNear(void) const
Gets whether the isosurface is somewhat near to this node.
const Vector3 getCorner2(void) const
Gets the coordinate of corner 2.
const Vector3 getCenterFront(void) const
Gets the center of the corners 2, 3, 6, 7.
static Real Abs(Real fValue)
Absolute value function.
Vector3 mFrom
The back lower left corner of the cell.
static const size_t OCTREE_CHILDREN_COUNT
Even in an OCtree, the amount of children should not be hardcoded.
const Vector3 & getFrom(void) const
Gets the back lower left corner of the cell.
Defines an instance of a discrete, movable object based on a Mesh.
const Vector3 getCenterFrontBottom(void) const
Gets the center of the corners 2, 3.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
const Vector3 getCenterLeftBottom(void) const
Gets the center of the corners 0, 3.
const Vector3 getCenterFrontTop(void) const
Gets the center of the corners 6, 7.
const Vector3 & getTo(void) const
Gets the front upper right corner of the cell.
const Vector3 getCorner7(void) const
Gets the coordinate of corner 7.
bool isBorderFront(const OctreeNode &root) const
Gets whether this cell is at the front of the given root cell.
const Vector3 getCenter(void) const
Gets the center of this cell.
const Vector3 getCenterBackLeft(void) const
Gets the center of the corners 0, 4.
Standard 3-dimensional vector.
bool isBorderRight(const OctreeNode &root) const
Gets whether this cell is at the right of the given root cell.
static const Real NEAR_FACTOR
Factor to the diagonal of the cell to decide whether this cell is near the isosurface or not...
bool isBorderBottom(const OctreeNode &root) const
Gets whether this cell is at the bottom of the given root cell.
const OctreeNode * getChild(const size_t i) const
Gets an octree child.
A node in the volume octree.
bool isBorderLeft(const OctreeNode &root) const
Gets whether this cell is at the left of the given root cell.
The class deciding on whether to split an octree node or not when building the octree.
const Vector3 getCorner1(void) const
Gets the coordinate of corner 1.
#define _OgreVolumeExport
OctreeNode ** mChildren
The children of this node.
const Vector3 getCenterBackBottom(void) const
Gets the center of the corners 0, 1.
4-dimensional homogeneous vector.
static uint32 mGridPositionCount
To count some indices while creating the debug view and recursing through the instances.
const Vector3 getCorner4(void) const
Gets the coordinate of corner 4.
const Vector3 getCenterBottom(void) const
Gets the center of the corners 0, 1, 2, 3.
const Vector3 getCenterRight(void) const
Gets the center of the corners 1, 2, 5, 6.
Entity * mOctreeGrid
Holds the debug visualization of the octree. Just set in the root.