本文整理汇总了C++中IVideoDriver::setViewport方法的典型用法代码示例。如果您正苦于以下问题:C++ IVideoDriver::setViewport方法的具体用法?C++ IVideoDriver::setViewport怎么用?C++ IVideoDriver::setViewport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVideoDriver
的用法示例。
在下文中一共展示了IVideoDriver::setViewport方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pass
void pass(spNativeTexture srcTexture, const Rect& srcRect, spNativeTexture destTexture, const Rect& destRect, const Color& color)
{
IVideoDriver* driver = IVideoDriver::instance;
const VertexDeclarationGL* decl = static_cast<const VertexDeclarationGL*>(driver->getVertexDeclaration(vertexPCT2::FORMAT));
driver->setRenderTarget(destTexture);
driver->clear(0);
driver->setViewport(destRect);
driver->setTexture(0, srcTexture);
vertexPCT2 v[4];
RectF dst = srcRect.cast<RectF>() / Vector2((float)srcTexture->getWidth(), (float)srcTexture->getHeight());
fillQuadT(v,
dst,
RectF(-1, -1, 2, 2),
AffineTransform::getIdentity(), color.rgba());
driver->draw(IVideoDriver::PT_TRIANGLE_STRIP, decl, v, sizeof(v));
driver->setTexture(0, 0);
}
示例2: render
void Stage::render(const Color* clearColor, const Rect& viewport, const Matrix& view, const Matrix& proj)
{
Material::setCurrent(0);
IVideoDriver* driver = IVideoDriver::instance;
driver->setViewport(viewport);
if (clearColor)
driver->clear(*clearColor);
STDMaterial& mat = *STDMaterial::instance;
mat.apply(0);
Matrix vp = view * proj;
mat.setViewProj(vp);
timeMS t = getTimeMS();
RenderState rs;
rs.material = _material;
Point ds = core::getDisplaySize();
RectF clip(0.0f, 0.0f, (float)ds.x, (float)ds.y);
rs.clip = &clip;
if (_clipOuter)
{
driver->setScissorRect(&_viewport);
clip = _viewport.cast<RectF>();
}
Actor::render(rs);
mat.finish();
}
示例3: update
void PostProcess::update(Actor* actor)
{
_screen = getScreenRect(*actor);
OX_ASSERT(actor->_getStage());
_rt = getRTManager().get(_rt, _screen.getWidth(), _screen.getHeight(), _format);
_transform = actor->computeGlobalTransform().inverted();
IVideoDriver* driver = IVideoDriver::instance;
driver->setRenderTarget(_rt);
Rect vp = _screen;
vp.pos = Point(0, 0);
driver->setViewport(vp);
driver->clear(0);
RenderState rs;
STDMaterial* mat = STDMaterial::instance;
STDRenderer* renderer = mat->getRenderer();
rs.material = mat;
RectF clip = vp.cast<RectF>();
rs.clip = &clip;
renderer->initCoordinateSystem(vp.getWidth(), vp.getHeight(), true);
rs.transform = actor->getParent()->computeGlobalTransform();
if (!(_options._flags & PostProcessOptions::flag_fullscreen))
{
AffineTransform offset;
offset.identity();
offset.translate(-_screen.pos);
rs.transform = rs.transform * offset;
}
mat->Material::render(actor, rs);
mat->finish();
}
示例4: render
void Stage::render(const Color& clearColor, const Rect& viewport)
{
//if (!_active)
// return;
IVideoDriver* driver = IVideoDriver::instance;
driver->setViewport(viewport);
driver->clear(clearColor);
STDRenderer renderer(driver);
renderer.initCoordinateSystem(viewport.getWidth(), viewport.getHeight());
renderer.begin(0);
render(renderer);
renderer.end();
}
示例5: render
void DebugActor::render(RenderState const& parentRS)
{
RenderState rs = parentRS;
parentRS.material->finish();
STDRenderer renderer;
STDMaterial mat(&renderer);
mat.apply(0);
//STDRenderer* renderer = mat.getRenderer();
IVideoDriver* driver = renderer.getDriver();
driver->setDebugStats(false);
Rect vp(Point(0, 0), core::getDisplaySize());
driver->setViewport(vp);
renderer.initCoordinateSystem(vp.getWidth(), vp.getHeight());
renderer.resetSettings();
rs.material = &mat;
Actor::render(rs);
renderer.drawBatch();
driver->setDebugStats(true);
mat.finish();
Material::setCurrent(0);
}
示例6: render
//.........这里部分代码省略.........
primitives += vstats.elements[IVideoDriver::PT_TRIANGLES] / 3;
if (vstats.elements[IVideoDriver::PT_TRIANGLE_STRIP])
primitives += vstats.elements[IVideoDriver::PT_TRIANGLE_STRIP] - 2;
s << "batches=" << aligned(vstats.batches, 3) << " primitives=" << aligned(primitives, 3) << std::endl;
#endif
s << "update=" << aligned(getStage()->_statUpdate, 2) << "ms ";
s << "render=" << aligned(vstats.duration, 2) << "ms ";
s << "textures=" << aligned(NativeTexture::created, 2) << " ";
#ifdef __APPLE__
size_t mem;
iosGetMemoryUsage(mem);
s << "memory=" << mem / 1024 << "kb ";
#endif
#ifdef _WIN32
PROCESS_MEMORY_COUNTERS_EX pmc;
GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*) &pmc, sizeof(pmc));
s << "memory=" << pmc.PrivateUsage / 1024 << "kb ";
#endif
if (!_debugText.empty())
{
s << "\n";
s << _debugText;
}
_debugText = "";
_text->setText(s.str());
setHeight(_text->getTextRect().size.y + _text->getY() + 3);
_bg->setSize(getSize());
Vector2 ds = core::getDisplaySize();
Vector2 pos(0, 0);
switch (_corner)
{
case 1:
pos.x = ds.x;
break;
case 2:
pos = ds;
break;
case 3:
pos.y = ds.y;
break;
}
pos = getStage()->parent2local(pos);
Vector2 realSize = getScaledSize();
switch (_corner)
{
case 1:
pos.x -= realSize.x;
break;
case 2:
pos -= realSize;
break;
case 3:
pos.y -= realSize.y;
break;
}
//setPosition(pos);
setScale(1.0f / getStage()->getScaleX());
RenderState rs = parentRS;
parentRS.material->finish();
STDRenderer renderer;
STDMaterial mat(&renderer);
mat.apply(0);
IVideoDriver* driver = renderer.getDriver();
Rect vp(Point(0, 0), core::getDisplaySize());
driver->setViewport(vp);
renderer.initCoordinateSystem(vp.getWidth(), vp.getHeight());
renderer.resetSettings();
rs.material = &mat;
Actor::render(rs);
renderer.drawBatch();
mat.finish();
Material::setCurrent(0);
timeMS dur = getTimeMS() - tm;
IVideoDriver::_stats.start += dur;
}