Add function to SViewFrustum to get corners of the near plane (patch provided by slavik262)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3440 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2010-11-20 13:18:30 +00:00
parent 43fa6a674f
commit 5db243df93
2 changed files with 56 additions and 2 deletions

View File

@ -1,5 +1,7 @@
Changes in 1.8 (??.0?.2010) Changes in 1.8 (??.0?.2010)
- Add function to SViewFrustum to get corners of the near plane (patch provided by Matt Kline, aka slavik262)
- ParticleFadeOutAffector::setFadeOutTime can no longer be set to invalid values - ParticleFadeOutAffector::setFadeOutTime can no longer be set to invalid values
- ParticleFadeOutAffector uses now throughout u32 for fadeOutTime (found by greenya) - ParticleFadeOutAffector uses now throughout u32 for fadeOutTime (found by greenya)

View File

@ -72,6 +72,18 @@ namespace scene
//! returns the point which is on the far right bottom corner inside the the view frustum. //! returns the point which is on the far right bottom corner inside the the view frustum.
core::vector3df getFarRightDown() const; core::vector3df getFarRightDown() const;
//! returns the point which is on the near left upper corner inside the the view frustum.
core::vector3df getNearLeftUp() const;
//! returns the point which is on the near left bottom corner inside the the view frustum.
core::vector3df getNearLeftDown() const;
//! returns the point which is on the near right top corner inside the the view frustum.
core::vector3df getNearRightUp() const;
//! returns the point which is on the near right bottom corner inside the the view frustum.
core::vector3df getNearRightDown() const;
//! returns a bounding box enclosing the whole view frustum //! returns a bounding box enclosing the whole view frustum
const core::aabbox3d<f32> &getBoundingBox() const; const core::aabbox3d<f32> &getBoundingBox() const;
@ -183,6 +195,46 @@ namespace scene
return p; return p;
} }
inline core::vector3df SViewFrustum::getNearLeftUp() const
{
core::vector3df p;
planes[scene::SViewFrustum::VF_NEAR_PLANE].getIntersectionWithPlanes(
planes[scene::SViewFrustum::VF_TOP_PLANE],
planes[scene::SViewFrustum::VF_LEFT_PLANE], p);
return p;
}
inline core::vector3df SViewFrustum::getNearLeftDown() const
{
core::vector3df p;
planes[scene::SViewFrustum::VF_NEAR_PLANE].getIntersectionWithPlanes(
planes[scene::SViewFrustum::VF_BOTTOM_PLANE],
planes[scene::SViewFrustum::VF_LEFT_PLANE], p);
return p;
}
inline core::vector3df SViewFrustum::getNearRightUp() const
{
core::vector3df p;
planes[scene::SViewFrustum::VF_NEAR_PLANE].getIntersectionWithPlanes(
planes[scene::SViewFrustum::VF_TOP_PLANE],
planes[scene::SViewFrustum::VF_RIGHT_PLANE], p);
return p;
}
inline core::vector3df SViewFrustum::getNearRightDown() const
{
core::vector3df p;
planes[scene::SViewFrustum::VF_NEAR_PLANE].getIntersectionWithPlanes(
planes[scene::SViewFrustum::VF_BOTTOM_PLANE],
planes[scene::SViewFrustum::VF_RIGHT_PLANE], p);
return p;
}
inline const core::aabbox3d<f32> &SViewFrustum::getBoundingBox() const inline const core::aabbox3d<f32> &SViewFrustum::getBoundingBox() const
{ {
return boundingBox; return boundingBox;
@ -296,13 +348,13 @@ namespace scene
{ {
if (planes[i].classifyPointRelation(line.start) == core::ISREL3D_FRONT) if (planes[i].classifyPointRelation(line.start) == core::ISREL3D_FRONT)
{ {
line.start = line.start.getInterpolated(line.end, line.start = line.start.getInterpolated(line.end,
planes[i].getKnownIntersectionWithLine(line.start, line.end)); planes[i].getKnownIntersectionWithLine(line.start, line.end));
wasClipped = true; wasClipped = true;
} }
if (planes[i].classifyPointRelation(line.end) == core::ISREL3D_FRONT) if (planes[i].classifyPointRelation(line.end) == core::ISREL3D_FRONT)
{ {
line.end = line.start.getInterpolated(line.end, line.end = line.start.getInterpolated(line.end,
planes[i].getKnownIntersectionWithLine(line.start, line.end)); planes[i].getKnownIntersectionWithLine(line.start, line.end));
wasClipped = true; wasClipped = true;
} }