本文整理汇总了C++中Transformation::Translate方法的典型用法代码示例。如果您正苦于以下问题:C++ Transformation::Translate方法的具体用法?C++ Transformation::Translate怎么用?C++ Transformation::Translate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transformation
的用法示例。
在下文中一共展示了Transformation::Translate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnIdle
//.........这里部分代码省略.........
for(unsigned int l = 0; l < lights.Size(); l++)
{
Vector3f& p = lights[l]->p;
Vector3f& d = lights[l]->d;
float I = lights[l]->I;
// light is on wrong side of surface
if(Dot(p - lsurf->c, lsurf->N) < 0.1)
continue;
g_renderer->SetLight(0, p.x, p.y, p.z);
g_renderer->SetLightDir(0, d.x, d.y, d.z);
g_renderer->SetLightIntensity(0, I);
g_renderer->SetLightFraction(0, 1.0 / (float)lights.Size());
lsurf->Frame(p);
lsurf->CreateLightMap(p, d, surfaces);
lsurf->AccumulateResidualLight();
lsurf->AccumulateLight();
g_renderer->SetViewMatrix(0);
patches += lsurf->GetNumPatches();
}
r_resid.Set(r_resid.GetBool() ? "1" : "0");
}
}
surf++;
}
if(r_resid.Changed())
{
for(int i = 0; i < surfaces.Size(); i++)
{
Surface* lsurf = surfaces[i];
lsurf->Frame(lsurf->c + lsurf->N*10.0);
if(r_resid.GetBool())
lsurf->CopyResidualToLightMap();
else
lsurf->CopyAccumToLightMap();
}
}
// Render normal view
view.Translate() = Vector3f(cl_camx.GetFloat(),
cl_camy.GetFloat(),
cl_camz.GetFloat());
view = view.Inverse();
g_renderer->SetViewport(0,0, GetWidth(),GetHeight());
g_renderer->SetViewMatrix(view);
g_renderer->SetProjectionMatrix(0);
g_renderer->SetClearColor(0.25f, 0.25f, 0.35f, 1.0f);
g_renderer->BindMaterial(0);
g_renderer->Clear(R_COLOR_BUFFER | R_DEPTH_BUFFER);
g_renderer->SetColor(1,1,1);
int bsurf = 0;
float maxPower = 0.0;
for(unsigned int i = 0; i < surfaces.Size(); i++)
{
float p = surfaces[i]->GetPower();
if(p > maxPower)
{
bsurf = i;
maxPower = p;
}
}
// draw all surfaces normally
for(unsigned int i = 0; i < surfaces.Size(); i++)
{
if(r_showbrightest.GetBool())
{
if(i == bsurf)
g_renderDevice->SetColor(1.0, 1.0, 0.7);
else
g_renderDevice->SetColor(1,1,1);
}
surfaces[i]->Render();
}
g_console->Draw(g_renderer);
g_renderer->DrawTextP(15, 50, 16, r_resid.GetBool() ? "Residual" : "Accumulation");
g_renderer->DrawTextP(15, 30, 16, "Step: %d", pass);
g_renderer->DrawTextP(15, 10, 16, "Patches: %d", patches);
g_materialSystem->BindMaterial(logo);
g_renderer->DrawRect(GetWidth()-200, 0, 200, 50, 0,0,1,1);
g_renderer->Flip();
}