本文整理汇总了C++中Video::GetVertexShader方法的典型用法代码示例。如果您正苦于以下问题:C++ Video::GetVertexShader方法的具体用法?C++ Video::GetVertexShader怎么用?C++ Video::GetVertexShader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Video
的用法示例。
在下文中一共展示了Video::GetVertexShader方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: floor
bool D3D9Sprite::DrawShapedFast(const Vector2 &v2Pos, const Vector2 &v2Size, const Color& color)
{
if (v2Size == Vector2(0,0))
{
return true;
}
Video* video = m_video.lock().get();
ShaderPtr pCurrentVS = video->GetVertexShader();
// rounds up the final position to avoid alpha distortion
Vector2 v2FinalPos;
if (video->IsRoundingUpPosition())
{
v2FinalPos.x = floor(v2Pos.x);
v2FinalPos.y = floor(v2Pos.y);
}
else
{
v2FinalPos = v2Pos;
}
// subtract 0.5 to align pixel-texel
v2FinalPos -= math::constant::HALF_VECTOR2;
pCurrentVS->SetConstant(L"size", v2Size);
pCurrentVS->SetConstant(L"entityPos", v2FinalPos);
pCurrentVS->SetConstant(L"color0", color);
if (m_rect.size.x == 0 || m_rect.size.y == 0)
{
pCurrentVS->SetConstant(L"rectSize", GetBitmapSizeF());
pCurrentVS->SetConstant(L"rectPos", 0, 0);
}
else
{
pCurrentVS->SetConstant(L"rectSize", m_rect.size);
pCurrentVS->SetConstant(L"rectPos", m_rect.pos);
}
pCurrentVS->SetShader();
// draw the one-pixel-quad applying the vertex shader
m_pVideoInfo->DrawSpriteFast(m_pDevice, m_rectMode);
return true;
}
示例2: GetBitmapSizeF
void D3D9Sprite::BeginFastRendering()
{
Video* video = m_video.lock().get();
video->SetVertexShader(video->GetFontShader());
ShaderPtr pCurrentVS = video->GetVertexShader();
pCurrentVS->SetConstant(L"bitmapSize", GetBitmapSizeF());
// apply textures according to the rendering mode (pixel shaded or not)
ShaderPtr pCurrentPS = video->GetPixelShader();
if (!pCurrentPS)
{
m_pDevice->SetTexture(0, m_pTexture);
//for (unsigned int t=1; t<GS_TEXTURE_CHANNELS; t++)
// pDevice->SetTexture(t, NULL);
}
else
{
pCurrentPS->SetShader();
pCurrentPS->SetTexture(L"diffuse", GetTexture());
}
m_pVideoInfo->BeginFastDraw(m_pDevice, m_rectMode);
}
示例3: flipMul
bool D3D9Sprite::DrawShaped(
const Vector2& v2Pos,
const Vector2& v2Size,
const Color& color0,
const Color& color1,
const Color& color2,
const Color& color3,
const float angle)
{
if (v2Size == Vector2(0,0))
{
return true;
}
// do the flip (parameters that will be send to the VS)
Vector2 flipMul(1,1), flipAdd(0,0);
if (m_flipX)
{
flipMul.x =-1;
flipAdd.x = 1;
}
if (m_flipY)
{
flipMul.y =-1;
flipAdd.y = 1;
}
// centralizes the sprite according to the origin
Vector2 v2Center = m_normalizedOrigin*v2Size;
Video* video = m_video.lock().get();
ShaderPtr pCurrentVS = video->GetVertexShader();
Matrix4x4 mRot;
if (angle != 0.0f)
mRot = RotateZ(DegreeToRadian(angle));
pCurrentVS->SetMatrixConstant(L"rotationMatrix", mRot);
// rounds up the final position to avoid alpha distortion
Vector2 v2FinalPos;
if (video->IsRoundingUpPosition())
{
v2FinalPos.x = floor(v2Pos.x);
v2FinalPos.y = floor(v2Pos.y);
}
else
{
v2FinalPos = v2Pos;
}
// subtract 0.5 to align pixel-texel
v2FinalPos -= math::constant::HALF_VECTOR2;
pCurrentVS->SetConstant(L"size", v2Size);
pCurrentVS->SetConstant(L"entityPos", v2FinalPos);
pCurrentVS->SetConstant(L"center", v2Center);
pCurrentVS->SetConstant(L"flipMul", flipMul);
pCurrentVS->SetConstant(L"flipAdd", flipAdd);
pCurrentVS->SetConstant(L"bitmapSize", GetBitmapSizeF());
pCurrentVS->SetConstant(L"scroll", GetScroll());
pCurrentVS->SetConstant(L"multiply", GetMultiply());
const bool setCameraPos = pCurrentVS->ConstantExist(L"cameraPos");
if (setCameraPos)
pCurrentVS->SetConstant(L"cameraPos", video->GetCameraPos());
if (m_rect.size.x == 0 || m_rect.size.y == 0)
{
pCurrentVS->SetConstant(L"rectSize", GetBitmapSizeF());
pCurrentVS->SetConstant(L"rectPos", 0, 0);
}
else
{
pCurrentVS->SetConstant(L"rectSize", m_rect.size);
pCurrentVS->SetConstant(L"rectPos", m_rect.pos);
}
pCurrentVS->SetConstant(L"color0", color0);
pCurrentVS->SetConstant(L"color1", color1);
pCurrentVS->SetConstant(L"color2", color2);
pCurrentVS->SetConstant(L"color3", color3);
if (pCurrentVS->ConstantExist(L"depth"))
pCurrentVS->SetConstant(L"depth", video->GetSpriteDepth());
pCurrentVS->SetShader();
// apply textures according to the rendering mode (pixel shaded or not)
ShaderPtr pCurrentPS = video->GetPixelShader();
if (!pCurrentPS)
{
m_pDevice->SetTexture(0, m_pTexture);
//for (unsigned int t=1; t<GS_TEXTURE_CHANNELS; t++)
// pDevice->SetTexture(t, NULL);
}
else
{
pCurrentPS->SetShader();
pCurrentPS->SetTexture(L"diffuse", GetTexture());
}
//.........这里部分代码省略.........