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); }
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); }