📄 mgcterrainblock.inl
字号:
// Magic Software, Inc.
// http://www.magic-software.com
// Copyright (c) 2000, All Rights Reserved
//
// Source code from Magic Software is supplied under the terms of a license
// agreement and may not be copied or disclosed except in accordance with the
// terms of that agreement. The various license agreements may be found at
// the Magic Software web site. This file is subject to the license
//
// RESTRICTED USE SOURCE CODE
// http://www.magic-software.com/License/restricted.pdf
#include "MgcRTLib.h"
//----------------------------------------------------------------------------
inline unsigned char MgcTerrainBlock::GetX () const
{
return m_ucX;
}
//----------------------------------------------------------------------------
inline unsigned char MgcTerrainBlock::GetY () const
{
return m_ucY;
}
//----------------------------------------------------------------------------
inline unsigned char MgcTerrainBlock::GetStride () const
{
return m_ucStride;
}
//----------------------------------------------------------------------------
inline void MgcTerrainBlock::SetEven (bool bSet)
{
if ( bSet )
m_ucFlags |= EVEN_PARITY;
else
m_ucFlags &= ~EVEN_PARITY;
}
//----------------------------------------------------------------------------
inline bool MgcTerrainBlock::GetEven () const
{
return (m_ucFlags & EVEN_PARITY) != 0;
}
//----------------------------------------------------------------------------
inline void MgcTerrainBlock::SetProcessed (bool bSet)
{
if ( bSet )
m_ucFlags |= PROCESSED;
else
m_ucFlags &= ~PROCESSED;
}
//----------------------------------------------------------------------------
inline bool MgcTerrainBlock::GetProcessed () const
{
return (m_ucFlags & PROCESSED) != 0;
}
//----------------------------------------------------------------------------
inline void MgcTerrainBlock::SetVisible (bool bSet)
{
if ( bSet )
m_ucFlags |= VISIBLE;
else
m_ucFlags &= ~VISIBLE;
}
//----------------------------------------------------------------------------
inline bool MgcTerrainBlock::GetVisible () const
{
return (m_ucFlags & VISIBLE) != 0;
}
//----------------------------------------------------------------------------
inline void MgcTerrainBlock::SetVisibilityTested (bool bSet)
{
if ( bSet )
m_ucFlags |= VISIBILITY_TESTED;
else
m_ucFlags &= ~VISIBILITY_TESTED;
}
//----------------------------------------------------------------------------
inline bool MgcTerrainBlock::GetVisibilityTested () const
{
return (m_ucFlags & VISIBILITY_TESTED) != 0;
}
//----------------------------------------------------------------------------
inline bool MgcTerrainBlock::BitsSet () const
{
return (m_ucFlags & BITS_MASK) != 0;
}
//----------------------------------------------------------------------------
inline void MgcTerrainBlock::ClearBits ()
{
// retain parity bit, all others zeroed out
m_ucFlags &= EVEN_PARITY;
}
//----------------------------------------------------------------------------
inline MgcReal MgcTerrainBlock::GetDelta (int i) const
{
assert( 0 <= i && i <= 4 );
return m_fDelta[i];
}
//----------------------------------------------------------------------------
inline MgcReal MgcTerrainBlock::GetDeltaMax () const
{
return m_fDeltaMax;
}
//----------------------------------------------------------------------------
inline MgcReal MgcTerrainBlock::GetDeltaL () const
{
return m_fDeltaL;
}
//----------------------------------------------------------------------------
inline MgcReal MgcTerrainBlock::GetDeltaH () const
{
return m_fDeltaH;
}
//----------------------------------------------------------------------------
inline const MgcVector3& MgcTerrainBlock::GetMin () const
{
return m_kMin;
}
//----------------------------------------------------------------------------
inline const MgcVector3& MgcTerrainBlock::GetMax () const
{
return m_kMax;
}
//----------------------------------------------------------------------------
inline unsigned short MgcTerrainBlock::GetParentIndex (unsigned short usChild)
{
// p = (c-1)/4
return (usChild - 1) >> 2;
}
//----------------------------------------------------------------------------
inline unsigned short MgcTerrainBlock::GetChildIndex (unsigned short usParent,
unsigned short usIndex)
{
// c = 4*p+i
return (usParent << 2) + usIndex;
}
//----------------------------------------------------------------------------
inline bool MgcTerrainBlock::IsFirstChild (unsigned short usIndex)
{
return usIndex > 0 && ((usIndex-1) % 4) == 0;
}
//----------------------------------------------------------------------------
inline bool MgcTerrainBlock::IsSibling (unsigned short usIndex,
unsigned short usTest)
{
// assert: usIndex > 0 && usTest > 0
return (usIndex-1) >> 2 == (usTest-1) >> 2;
}
//----------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -