本文整理汇总了C++中VideoPtr::GetZBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoPtr::GetZBuffer方法的具体用法?C++ VideoPtr::GetZBuffer怎么用?C++ VideoPtr::GetZBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoPtr
的用法示例。
在下文中一共展示了VideoPtr::GetZBuffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawCollisionBox
void ETHRenderEntity::DrawCollisionBox(SpritePtr pOutline, const Color& dwColor, const Vector2 &zAxisDirection) const
{
VideoPtr video = m_provider->GetVideo();
const bool collidable = (m_properties.collision);
const Vector3 v3Size = (collidable) ? m_properties.collision->size : Vector3(32,32,32);
const Vector3 v3Pos = (collidable) ? (m_properties.collision->pos + GetPosition()) : GetPosition();
const Vector2 v2Pos = ETHGlobal::ToScreenPos(v3Pos, zAxisDirection)/* + Vector2(0, v3Size.y/2)*/;
pOutline->SetOrigin(Sprite::EO_CENTER);
const Video::ALPHA_MODE alphaMode = video->GetAlphaMode();
video->SetAlphaMode(Video::AM_PIXEL);
const bool zBuffer = video->GetZBuffer();
video->SetZBuffer(false);
const bool zWrite = video->GetZWrite();
video->SetZWrite(false);
ShaderPtr pVS = video->GetVertexShader();
video->SetVertexShader(ShaderPtr());
const Color dwH = ARGB(150,dwColor.r,dwColor.g,dwColor.b);
const float depth = video->GetSpriteDepth();
// base
video->SetSpriteDepth(1.0f);
pOutline->DrawShaped(v2Pos, Vector2(v3Size.x, v3Size.y), dwH, dwH, dwH, dwH, GetAngle());
video->SetZBuffer(zBuffer);
video->SetZBuffer(zWrite);
video->SetAlphaMode(alphaMode);
video->SetVertexShader(pVS);
video->SetSpriteDepth(depth);
}
示例2: DrawCollisionBox
void ETHRenderEntity::DrawCollisionBox(const bool drawBase, SpritePtr pOutline, const GS_COLOR dwColor, const Vector2 &zAxisDirection) const
{
VideoPtr video = m_provider->GetVideo();
const bool collidable = (m_properties.collision);
const Vector3 v3Size = (collidable) ? m_properties.collision->size : Vector3(32,32,32);
const Vector3 v3Pos = (collidable) ? (m_properties.collision->pos + GetPosition()) : GetPosition();
const Vector2 v2Pos = ETHGlobal::ToScreenPos(v3Pos, zAxisDirection) + Vector2(0, v3Size.y/2);
pOutline->SetOrigin(GSEO_CENTER_BOTTOM);
const GS_ALPHA_MODE alphaMode = video->GetAlphaMode();
video->SetAlphaMode(GSAM_PIXEL);
const bool zBuffer = video->GetZBuffer();
video->SetZBuffer(false);
const bool zWrite = video->GetZWrite();
video->SetZWrite(false);
ShaderPtr pVS = video->GetVertexShader();
video->SetVertexShader(ShaderPtr());
const GS_COLOR dwH = ARGB(150,dwColor.r,dwColor.g,dwColor.b);
const float depth = video->GetSpriteDepth();
if (drawBase)
{
// base
video->SetSpriteDepth(1.0f);
pOutline->DrawShaped(v2Pos, Vector2(v3Size.x, v3Size.y), dwH, dwH, dwH, dwH);
}
else
{
video->SetSpriteDepth(0.0f);
const GS_COLOR dwV = ARGB(50,dwColor.r,dwColor.g,dwColor.b);
// front face
pOutline->DrawShaped(v2Pos, Vector2(v3Size.x, v3Size.z), dwV, dwV, dwV, dwV);
// upper face
pOutline->DrawShaped(v2Pos-Vector2(0,v3Size.z), Vector2(v3Size.x, v3Size.y), dwH, dwH, dwH, dwH);
}
video->SetZBuffer(zBuffer);
video->SetZBuffer(zWrite);
video->SetAlphaMode(alphaMode);
video->SetVertexShader(pVS);
video->SetSpriteDepth(depth);
}