本文整理汇总了C++中RenderTarget类的典型用法代码示例。如果您正苦于以下问题:C++ RenderTarget类的具体用法?C++ RenderTarget怎么用?C++ RenderTarget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RenderTarget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: atmGetGLDeviceContext
void PassForward_Indicators::draw()
{
//return;
if(!atmGetGame()) { return; }
i3d::DeviceContext *dc = atmGetGLDeviceContext();
VertexArray *va_grid = atmGetVertexArray(VA_FIELD_GRID);
AtomicShader *sh_grid = atmGetShader(SH_FILL3D);
RenderTarget *rt = atmGetBackRenderTarget();
rt->setDepthStencilBuffer(atmGetRenderTarget(RT_GBUFFER)->getDepthStencilBuffer());
dc->setBlendState(atmGetBlendState(BS_BLEND_ALPHA));
dc->setDepthStencilState(atmGetDepthStencilState(DS_DEPTH_ENABLED));
dc->setRenderTarget(rt);
sh_grid->bind();
dc->setVertexArray(va_grid);
dc->draw(I3D_LINES, 0, 6*6*2);
dc->setVertexArray(nullptr);
sh_grid->unbind();
dc->setDepthStencilState(atmGetDepthStencilState(DS_NO_DEPTH_NO_STENCIL));
dc->setBlendState(atmGetBlendState(BS_NO_BLEND));
rt->setDepthStencilBuffer(nullptr);
}
示例2: go
void CCPlus::go(const std::string& path, int fps) {
RenderTarget target;
target.inputPath = path;
target.fps = fps;
go(target);
target.waitFinish();
}
示例3: RenderTarget
void MainWindow::newRenderTarget(SceneController* scene, char* name)
{
char buf[256];
bool ret;
RenderTarget* renderTarget = new RenderTarget();
renderTarget->setScene(scene);
scene->setSceneRect(0, 0, ui->tabWidget->size().width(), ui->tabWidget->size().height());
scene->setBackgroundBrush(QBrush(QColor(0, 0, 0)));
renderTarget->setFixedSize(ui->tabWidget->size().width(), ui->tabWidget->size().height());
renderTarget->setAlignment(Qt::AlignTop);
renderTarget->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
if (m_connectedSender) {
ret = disconnect(m_connectedSender, SIGNAL(statusChanged()), this, SLOT(statusChanged()));
assert(ret == true);
}
ret = connect(scene, SIGNAL(statusChanged()), this, SLOT(statusChanged()), Qt::UniqueConnection);
assert(ret == true);
m_connectedSender = scene;
int idx = ui->tabWidget->addTab(renderTarget, name);
ui->tabWidget->setCurrentIndex(idx);
sprintf(buf, "New surface pool: %s", name);
ui->label->setText(buf);
}
示例4: drawObjects
void ObjectInterface::drawObjects(RenderTarget &target) {
if (cb->mapInterface->getTileMap() == 0 && firstFloorObject == 0 && firstObject == 0) {
// No objects to be drawn
return;
}
target.setAsCurrent();
//al_hold_bitmap_drawing(true); //Little speed up
// All objects are drawn at world coordinates.
target.useWorldCoords(true);
// Draw floor objects, including map back layer
CBObject *currentObject = firstFloorObject;
while (currentObject != 0) {
currentObject->render(target);
currentObject = currentObject->afterObj;
}
// Draw normal objects
currentObject = firstObject;
while (currentObject != 0) {
currentObject->render(target);
currentObject = currentObject->afterObj;
}
// Draw map over layer
if (cb->mapInterface->getTileMap()) {
cb->mapInterface->getTileMap()->drawLayer(1, target);
}
//al_hold_bitmap_drawing(false);
// Reset drawing to screen
target.useWorldCoords(false);
}
示例5: lk
void Graphics::Initialize()
{
WickedSick::Window* window = core_->GetSystem<WickedSick::Window>(ST_Window);
std::lock_guard<std::mutex> lk(window->GetWindowHandleMutex());
graphicsAPI->Initialize(options_, window);
// Setup the projection matrix.
float fieldOfView = (float)PI / 2.0f;//90 degrees
float screenAspect = (float)window->GetWindowSize().x / (float)window->GetWindowSize().y;
// Create the projection matrix for 3D rendering.
projection_matrix_.DoPerspective(90.0 * PI/180.0, 0.1f, 100000.0f, screenAspect);
orthographic_matrix_.DoOrthographic(window->GetWindowSize().x, window->GetWindowSize().y, 0.1f, 100000.0f);
camera_->SetPosition(0.0f, 0.0f, 0.0f);
mat_stack_->Push(projection_matrix_);
RenderTargetDesc desc;
desc.size = window->GetWindowSize();
RenderTarget* reflectionTarget = nullptr;
for(int i = 0; i < ReflectionDirections::Count; ++i)
{
reflectionTarget = graphicsAPI->MakeRenderTarget(desc);
reflectionTarget->Initialize();
render_targets_.push_back(reflectionTarget);
}
}
示例6: delete
DeferredShadingSystem::~DeferredShadingSystem()
{
// Delete mini lights
for(std::set<MLight*>::iterator i=mLights.begin(); i!=mLights.end(); ++i)
{
delete (*i);
}
// Delete the ambient light
delete mAmbientLight;
if (mCurrentMode==DSM_SHOWLIT && mInstance[mCurrentMode]->getEnabled())
{
RenderTarget* renderTarget = mInstance[mCurrentMode]->getRenderTarget("mrt_output");
assert(renderTarget);
LogManager::getSingleton().logMessage("Removing Listener from:");
LogManager::getSingleton().logMessage(renderTarget->getName());
renderTarget->removeListener(this);
}
CompositorChain *chain = CompositorManager::getSingleton().getCompositorChain(mViewport);
for(int i=0; i<DSM_COUNT; ++i)
chain->_removeInstance(mInstance[i]);
delete mLightMaterialGenerator;
}
示例7: if
void CarReflection::Update()
{
// update only if we created
if ( pSet->refl_mode == "single" && iIndex != 0 ) return;
// static: only 1st frame
if ( pSet->refl_mode == "static" && bFirstFrame == false ) return;
// skip frames
if (++iCounter >= pSet->refl_skip || bFirstFrame)
{
iCounter = 0;
// cube faces at once
int fc = bFirstFrame ? 6 : pSet->refl_faces;
for (int i=0; i < fc; ++i)
{
++iCam; if (iCam > 5) iCam = 0; // next
Camera* cam = pCams[iCam];
RenderTarget* rt = pRTs[iCam];
if (cam) cam->setPosition ( camPosition );
//else LogO("upd cam 0");
if (rt) rt->update();
//else LogO("upd rt 0");
}
}
//Image im;
//cubetex->convertToImage(im);
//im.save("cube.dds");
bFirstFrame = false;
}
示例8: main
// All threads start execution here.
int main()
{
void *frameBuffer;
if (get_current_thread_id() != 0)
worker_thread();
// Set up render context
frameBuffer = init_vga(VGA_MODE_640x480);
start_all_threads();
RenderContext *context = new RenderContext();
RenderTarget *renderTarget = new RenderTarget();
Surface *colorBuffer = new Surface(kFbWidth, kFbHeight, Surface::RGBA8888,
frameBuffer);
renderTarget->setColorBuffer(colorBuffer);
context->bindTarget(renderTarget);
context->bindShader(new ColorShader());
const RenderBuffer kVertices(kSquareVertices, 4, 3 * sizeof(float));
const RenderBuffer kIndices(kSquareIndices, 6, sizeof(int));
context->bindVertexAttrs(&kVertices);
context->drawElements(&kIndices);
context->finish();
return 0;
}
示例9: create
void WaterRTT::create()
{
if (!mSceneMgr) return;
mCamera = mSceneMgr->createCamera("PlaneReflectionRefraction");
if (mViewerCamera)
{
mCamera->setFarClipDistance(mViewerCamera->getFarClipDistance());
mCamera->setNearClipDistance(mViewerCamera->getNearClipDistance());
mCamera->setAspectRatio(mViewerCamera->getAspectRatio());
}
for (unsigned int i = 0; i < 2; ++i)
{
if (i==0 && !mReflect) continue;
if (i==1 && !mRefract) continue;
TexturePtr tex = TextureManager::getSingleton().createManual(i == 0 ? "PlaneReflection" : "PlaneRefraction",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_2D, mRTTSize, mRTTSize, 0, PF_R8G8B8, TU_RENDERTARGET);
RenderTarget* rtt = tex->getBuffer()->getRenderTarget();
Viewport* vp = rtt->addViewport(mCamera);
vp->setOverlaysEnabled(false);
vp->setBackgroundColour(ColourValue(0.8f, 0.9f, 1.0f));
vp->setShadowsEnabled(false);
vp->setMaterialScheme ("reflection");
vp->setVisibilityMask( i == 0 ? RV_WaterReflect : RV_WaterRefract);
rtt->addListener(this);
if (i == 0) mReflectionTarget = rtt;
else mRefractionTarget = rtt;
}
sh::Factory::getInstance ().setTextureAlias ("WaterReflection", "PlaneReflection");
sh::Factory::getInstance ().setTextureAlias ("WaterRefraction", "PlaneRefraction");
}
示例10: Commit
void CompositorRenderPass::Commit(CommitContext& context) {
if (context.rsys->GetTicket() != this->renderSystemTicket) {
if (numTextureToResolve == 1) {
TextureUnit tu;
RenderTarget* target = context.GetTargetByName(_rtJustOne.name);
if (target && target->GetRenderTargetType() == RenderTargetType::TEXTURE) {
tu.texture = static_cast<RenderTexture*>(target);
parameters.SetData(&tu, _rtJustOne.offset);
}
} else {
for (uint32 i = 0; i < numTextureToResolve; ++i) {
TextureUnit tu;
RenderTarget* target = context.GetTargetByName(_rtBunchOf[i].name);
if (target && target->GetRenderTargetType() == RenderTargetType::TEXTURE) {
tu.texture = static_cast<RenderTexture*>(target);
parameters.SetData(&tu, _rtBunchOf[i].offset);
}
}
}
this->renderSystemTicket = context.rsys->GetTicket();
}
BeginRender(context);
RenderPrimitive(context, (uint32)(ptrdiff_t)this, &primitive);
EndRender(context);
}
示例11: main
// All threads start execution here.
int main()
{
if (__builtin_nyuzi_read_control_reg(0) != 0)
workerThread();
// Start worker threads
__builtin_nyuzi_write_control_reg(30, 0xffffffff);
RenderContext *context = new RenderContext();
RenderTarget *renderTarget = new RenderTarget();
Surface *colorBuffer = new Surface(kFbWidth, kFbHeight, (void*) 0x200000);
Surface *depthBuffer = new Surface(kFbWidth, kFbHeight);
renderTarget->setColorBuffer(colorBuffer);
renderTarget->setDepthBuffer(depthBuffer);
context->bindTarget(renderTarget);
context->enableDepthBuffer(true);
context->bindShader(new ColorShader());
const RenderBuffer kVertices(kTriangleVertices, 6, 7 * sizeof(float));
const RenderBuffer kIndices(kTriangleIndices, 6, sizeof(int));
context->bindGeometry(&kVertices, &kIndices);
context->submitDrawCommand();
context->finish();
exit(1); // Stop worker threads
return 0;
}
示例12: RenderTarget
bool DXDriver::CreateRenderTarget(const unsigned int _id, const RenderTargetInit& _rti, RenderTarget* _renderTargetPtr)
{
// Id already used
if (m_pRenderTargets[_id] != nullptr)
return false;
RenderTarget* temp = VNEW RenderTarget(std::to_string(_id).c_str());
// Failed to allocate mem
if (!temp)
return false;
// Failed to initialize, delete allocated mem
if (!temp->Init(_rti, m_device))
{
SAFE_DELETE(temp);
return false;
}
// all is good
m_pRenderTargets[_id] = temp;
_renderTargetPtr = temp;
return true;
}
示例13: _renderCamera
void Renderer::_renderCamera(Camera* cam)
{
RenderTarget* rt = cam->GetRenderTarget();
if (!rt)
return;
cameraRendering = cam;
rt->Bind();
_setZWrite(true);
_setZTest(true);
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
std::vector<Renderable*> sorted(renderables.begin(), renderables.end());
std::sort(sorted.begin(), sorted.end(), renderableCompare());
std::vector<Renderable*>::iterator rIt;
for (rIt = sorted.begin(); rIt != sorted.end(); rIt++)
{
(*rIt)->Update();
//_render(cam, (*rIt));
(*rIt)->Render(cam);
}
//Go through post-processes
_renderPostProcess(rt->GetPostProcess());
}
示例14: src_rect
void SimpleSurface::applyFilter (Surface *inSrc, const Rect &inRect, ImagePoint inOffset, Filter *inFilter) {
if (!mBase) return;
FilterList f;
f.push_back (inFilter);
Rect src_rect (inRect.w, inRect.h);
Rect dest = GetFilteredObjectRect (f, src_rect);
inSrc->IncRef ();
Surface *result = FilterBitmap (f, inSrc, src_rect, dest, false, ImagePoint (inRect.x, inRect.y));
dest.Translate (inOffset.x, inOffset.y);
src_rect = Rect (0, 0, result->Width (), result->Height ());
int dx = dest.x;
int dy = dest.y;
dest = dest.Intersect (Rect (0, 0, mWidth, mHeight));
dest.Translate (-dx, -dy);
dest = dest.Intersect (src_rect);
dest.Translate (dx, dy);
int bpp = BytesPP ();
RenderTarget t = BeginRender (dest, false);
//printf("Copy back @ %d,%d %dx%d + (%d,%d)\n", dest.x, dest.y, t.Width(), t.Height(), dx, dy);
for (int y = 0; y < t.Height (); y++)
memcpy ((void *)(t.Row (y + dest.y) + ((dest.x) * bpp)), result->Row (y - dy) - (dx * bpp), dest.w * bpp);
EndRender ();
result->DecRef ();
}
示例15: render
void render(float delta){
float ClearColor[4] = { 0.5f, 0.5f, 0.5f, 1.0f }; // red,green,blue,alpha
float ClearColor2[4] = { 0.1f, 0.2f, 0.3f, 1.0f }; // red,green,blue,alpha
clearTargetColor(m_pRenderTargetView,ClearColor);
clearTargetColor(*backTarget->getTarget(),ClearColor2);
clearTargetDepth(m_depthStencilView,1);
static float t=0;
t+=delta;
m_World = XMMatrixRotationY(t);
ConstantBuffer cb;
cb.mWorld = XMMatrixTranspose( m_World );
cb.mView = XMMatrixTranspose( m_View );
cb.mProjection = XMMatrixTranspose( m_Projection);
people->updateConstantbuffer(m_pImmediateContext,0,&cb);
m_pImmediateContext->OMSetRenderTargets(1,backTarget->getTarget(),m_depthStencilView);
people->draw(m_pImmediateContext);
clearTargetDepth(m_depthStencilView,1);
m_pImmediateContext->OMSetRenderTargets(1,&m_pRenderTargetView,m_depthStencilView);
people->draw(m_pImmediateContext);
view_shader->use(m_pImmediateContext);
m_pImmediateContext->PSSetShaderResources(0,1,backTarget->getShaderResource());
view_shader->setConstantBuffer(m_pImmediateContext,0,&quard->s_Matrix);
//quard->draw(m_pImmediateContext);
controller->visite(m_pImmediateContext);
//MyLuaManager::getInstance()->doFile("lua/lua_script/render.lua");
presentDraw();
}