本文整理汇总了C++中Shader::GetParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ Shader::GetParameter方法的具体用法?C++ Shader::GetParameter怎么用?C++ Shader::GetParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shader
的用法示例。
在下文中一共展示了Shader::GetParameter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void Render(const Vect2 &pos, const Vect2 &size)
{
Texture *texture = bitmapImage.GetTexture();
if(texture)
{
if(bUseColorKey)
{
Shader *lastPixelShader = GetCurrentPixelShader();
DWORD alpha = ((opacity*255/100)&0xFF);
DWORD outputColor = (alpha << 24) | color&0xFFFFFF;
LoadPixelShader(colorKeyShader);
float fSimilarity = float(keySimilarity)*0.01f;
float fBlend = float(keyBlend)*0.01f;
colorKeyShader->SetColor(colorKeyShader->GetParameter(2), keyColor);
colorKeyShader->SetFloat(colorKeyShader->GetParameter(3), fSimilarity);
colorKeyShader->SetFloat(colorKeyShader->GetParameter(4), fBlend);
DrawSprite(texture, outputColor, pos.x, pos.y, pos.x+size.x, pos.y+size.y);
LoadPixelShader(lastPixelShader);
}
else
{
DWORD alpha = ((opacity*255/100)&0xFF);
DWORD outputColor = (alpha << 24) | color&0xFFFFFF;
DrawSprite(texture, outputColor, pos.x, pos.y, pos.x+size.x, pos.y+size.y);
}
}
}
示例2: RenderWireframe
void MeshEntity::RenderWireframe()
{
traceInFast(MeshEntity::RenderWireframe);
Shader *shader = GetCurrentVertexShader();
if(shader)
shader->SetColor(shader->GetParameter(1), wireframeColor | 0xFF000000);
MatrixPush();
MatrixMultiply(invTransform);
LoadVertexBuffer(VertBuffer);
LoadIndexBuffer(mesh->WireframeBuffer);
GS->DrawBare(GS_LINES);
MatrixPop();
traceOutFast;
}
示例3: RenderScaled
void RotationManipulator::RenderScaled(const Vect &cameraDir, float scale)
{
traceInFast(RotationManipulator::RenderScaled);
DWORD i;
Shader *rotManipShader = GetVertexShader(TEXT("Editor:RotationManipulator.vShader"));
LoadVertexShader(rotManipShader);
LoadPixelShader(GetPixelShader(TEXT("Base:SolidColor.pShader")));
rotManipShader->SetVector(rotManipShader->GetParameter(2), cameraDir);
MatrixPush();
MatrixTranslate(GetWorldPos());
MatrixScale(scale, scale, scale);
for(i=0; i<3; i++)
{
Vect axisColor(0.0f, 0.0f, 0.0f);
axisColor.ptr[i] = 1.0f;
if(i == activeAxis)
axisColor.Set(1.0f, 1.0f, 0.0f);
else
axisColor.ptr[i] = 1.0f;
rotManipShader->SetVector(rotManipShader->GetParameter(1), axisColor);
LoadVertexBuffer(axisBuffers[i]);
LoadIndexBuffer(NULL);
Draw(GS_LINESTRIP);
}
LoadVertexBuffer(NULL);
//----------------------------------------------------
Shader *solidShader = GetVertexShader(TEXT("Base:SolidColor.vShader"));
LoadVertexShader(solidShader);
MatrixPush();
MatrixRotate(Quat().SetLookDirection(cameraDir));
LoadVertexBuffer(axisBuffers[2]);
LoadIndexBuffer(NULL);
solidShader->SetColor(solidShader->GetParameter(1), 0.5, 0.5, 0.5, 0.5);
Draw(GS_LINESTRIP);
MatrixScale(1.25f, 1.25f, 1.25f);
//---------------
if(activeAxis == 4)
solidShader->SetColor(solidShader->GetParameter(1), 1.0f, 1.0f, 0.0, 1.0f);
else
solidShader->SetColor(solidShader->GetParameter(1), 0.8, 0.8, 0.8, 0.8);
Draw(GS_LINESTRIP);
MatrixPop();
MatrixPop();
LoadVertexShader(NULL);
LoadPixelShader(NULL);
traceOutFast;
}