本文整理汇总了C++中RenderQueue类的典型用法代码示例。如果您正苦于以下问题:C++ RenderQueue类的具体用法?C++ RenderQueue怎么用?C++ RenderQueue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RenderQueue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void Renderer::render(const RenderQueue& queue, const Camera& camera)
{
ProfileNodeCall call("Renderer::render");
m_context.setCurrentSharedProgramState(m_state);
const Recti& viewportArea = m_context.viewportArea();
m_state->setViewportSize(float(viewportArea.size.x),
float(viewportArea.size.y));
m_state->setProjectionMatrix(camera.projectionMatrix());
m_state->setViewMatrix(camera.viewTransform());
if (camera.isPerspective())
{
m_state->setCameraProperties(camera.transform().position,
camera.FOV(),
camera.aspectRatio(),
camera.nearZ(),
camera.farZ());
}
renderOperations(queue.opaqueBucket());
renderOperations(queue.blendedBucket());
m_context.setCurrentSharedProgramState(nullptr);
}
示例2: renderThread_AA
int renderThread_AA(void* v) {
RenderQueue* rq = (RenderQueue*)v;
RenderQueue::Point p;
while (rq->checkPop(p)) {
traceAt_AA(*rq->scene, *rq->screen, p.r, p.c);
}
return 0;
}
示例3: GetTickCount
void RenderWindow::Update()
{
// 设置当前渲染窗口
m_pActiveRenderWindow = this;
// 开始场景
if ( m_pRenderer->BeginScene() )
{
// 更新当前帧
m_dwCurFrame ++;
// 更新渲染对象
RenderTarget::Update();
// 后处理
PostProcessQueue::GetSingleton()->ProcessAll();
// 更新缓存管理器
ResourceManager::GetSingleton()->Update();
// 计算时间
m_fElapsedTime = (float) ( GetTickCount() - m_dwLastTime ) / 1000.0f;
m_dwLastTime = GetTickCount();
m_fSumTime += m_fElapsedTime;
m_iFrameCount ++;
// 渲染FPS
if ( m_fSumTime > 1.0f )
{
m_iFPS = (int) ( m_iFrameCount / m_fSumTime );
m_iFrameCount = 0;
m_fSumTime = 0.0f;
}
wchar_t szText[32];
_itow_s( m_iFPS, szText, 32, 10 );
wstring szFPS = szText;
m_pRenderer->RenderText( 5, 5, Vector4f( 1.0f, 1.0f, 0.0f, 1.0f ), szFPS );
int iY = 25;
RenderQueue * pQueue = m_pRenderer->GetRenderQueue( Renderer::RenderQueue_Visible );
multimap< float, Entity * >::iterator VisibleIt = pQueue->GetEntityList()->begin();
while ( VisibleIt != pQueue->GetEntityList()->end() )
{
Key szKey = (*VisibleIt).second->GetKey();
m_pRenderer->RenderText( 5, iY, Vector4f( 1.0f, 1.0f, 0.0f, 1.0f ), szKey.GetName() );
iY += 20;
VisibleIt++;
}
// 结束场景
m_pRenderer->EndScene();
}
// 缓冲交换
m_pRenderer->Present();
}
示例4: renderToTexture
void renderToTexture(const RenderQueue& renderQueue, FrameBufferObject* target)
{
target->bind();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
for(RenderQueue::const_iterator it = renderQueue.begin(); it != renderQueue.end(); ++it)
(*it)();
target->unbind();
}
示例5:
void D3DRenderContext::Render(D3DMaterial* material, RenderQueue& renderableObjects) {
for (RenderQueue::const_iterator i = renderableObjects.begin(); i != renderableObjects.end(); ++i) {
uint passesCount = material->BeginPasses("RenderScene");
for (uint passNo = 0; passNo < passesCount; ++passNo) {
(*i)->ApplyTransformations();
material->SetMatrices();
material->BeginPass(passNo);
(*i)->Render();
(*i)->IdentityTransformation();
material->EndPass();
}
material->EndPasses();
}
}
示例6: DoRender
void MirrorRenderLoop::DoRender(Camera * cam)
{
RenderSystem * render = RenderSystem::Instance();
RenderQueue * rq = mScheme->GetMirrorRenderQueue();
// --->render terrain
if (Environment::Instance()->GetTerrain())
Environment::Instance()->GetTerrain()->RenderInMirror();
// ---> render sky
if (Environment::Instance()->GetSky2())
Environment::Instance()->GetSky2()->RenderReflection(cam->GetMirrorPlane());
// ---> render sun
/*if (Environment::Instance()->GetSun())
Environment::Instance()->GetSun()->Render();*/
// ---> render moons
if (Environment::Instance()->GetMoon())
Environment::Instance()->GetMoon()->Render();
// ---> render cloud
//if (Environment::Instance()->GetCloud())
//Environment::Instance()->GetCloud()->Render(false);
// render solider
{
RenderSystem * render = RenderSystem::Instance();
const Array<Renderer *> & objs = rq->GetSolidRender();
for (int i = 0; i < objs.Size(); ++i)
{
Renderer * rd = objs[i];
bool skined = (rd->GetBlendMatrix(NULL) > 0);
Technique * tech = rd->GetTechnique(eRenderTechType::RTT_Mirror);
if (!tech)
tech = mScheme->GetMainShaderProvider()->GetTechnique(eRenderTechType::RTT_Mirror, skined);
render->Render(tech, rd);
}
}
RenderEvent::OnMirrorRenderSolid1(cam);
RenderEvent::OnMirrorRenderSolid2(cam);
RenderEvent::OnMirrorRenderSolid3(cam);
}
示例7:
void Label::OnPaint(RenderTarget& target, RenderQueue& queue) const
{
Widget::OnPaint(target, queue);
queue.SetColor(GetTextColor());
target.Draw(mCaption);
}
示例8: addToRenderQueue
void Entity::addToRenderQueue(const Matrix4f &transMatrix, RenderQueue &renderQueue)
{
for(unsigned i=0; i<m_subEntityVec.size(); ++i)
{
renderQueue.addItem(transMatrix, m_subEntityVec[i]);
}
}
示例9: findVisible
void DisplayNode::findVisible( Camera*cam, RenderQueue& display, a_vector<LightNode*>& light )
{
if(!cam->isInFrustrum(m_globalBbox))
return;
display.push_back(this);
SceneNode::findVisible(cam,display,light);
}
示例10: preViewportUpdate
void DepthOfFieldEffect::preViewportUpdate(const Ogre::RenderTargetViewportEvent& evt)
{
float dofParams[4] = {mNearDepth, mFocalDepth, mFarDepth, mFarBlurCutoff};
// Adjust fragment program parameters for depth pass
GpuProgramParametersSharedPtr fragParams =
mDepthTechnique->getPass(0)->getFragmentProgramParameters();
if ((!fragParams.isNull())&&(fragParams->_findNamedConstantDefinition("dofParams")))
fragParams->setNamedConstant("dofParams", dofParams,1,4);
evt.source->setVisibilityMask(~DEPTHMAP_DISABLED);
// Add 'this' as a RenderableListener to replace the technique for all renderables
RenderQueue* queue = evt.source->getCamera()->getSceneManager()->getRenderQueue();
queue->setRenderableListener(this);
}
示例11: CC_CALLBACK_0
void Renderer::makeSingleRenderCommandList(RenderQueue& queue) {
//_renderCommands->reserveElements(7);
CustomCommand* begin = _customCommandPool1->pop();
CustomCommand* end = _customCommandPool1->pop();
begin->func = CC_CALLBACK_0(RenderQueue::saveRenderState, &queue);
_renderCommands->push_back_resize(begin);
std::vector<RenderCommand*> queueEntrys = queue.getSubQueue(RenderQueue::QUEUE_GROUP::GLOBALZ_NEG);
if (queueEntrys.size() > 0) {
_renderCommands->push_back_resize(_beginQueue2dCommand);
_lastWasFlushCommand = true;
makeSingleRenderCommandList(queueEntrys);
}
queueEntrys = queue.getSubQueue(RenderQueue::QUEUE_GROUP::OPAQUE_3D);
if (queueEntrys.size() > 0) {
_renderCommands->push_back_resize(_beginQueueOpaqueCommand);
_lastWasFlushCommand = true;
makeSingleRenderCommandList(queueEntrys);
}
queueEntrys = queue.getSubQueue(RenderQueue::QUEUE_GROUP::TRANSPARENT_3D);
if (queueEntrys.size() > 0) {
_renderCommands->push_back_resize(_beginQueueTransparentCommand);
_lastWasFlushCommand = true;
makeSingleRenderCommandList(queueEntrys);
}
queueEntrys = queue.getSubQueue(RenderQueue::QUEUE_GROUP::GLOBALZ_ZERO);
if (queueEntrys.size() > 0) {
_renderCommands->push_back_resize(_beginQueue2dCommand);
_lastWasFlushCommand = true;
makeSingleRenderCommandList(queueEntrys);
}
queueEntrys = queue.getSubQueue(RenderQueue::QUEUE_GROUP::GLOBALZ_POS);
if (queueEntrys.size() > 0) {
_renderCommands->push_back_resize(_beginQueue2dCommand);
_lastWasFlushCommand = true;
makeSingleRenderCommandList(queueEntrys);
}
end->func = CC_CALLBACK_0(RenderQueue::restoreRenderState, &queue);
_renderCommands->push_back_resize(end);
_customCommandPool2->push(begin);
_customCommandPool2->push(end);
}
示例12: CCASSERT
void Renderer::visitRenderQueue(const RenderQueue& queue)
{
ssize_t size = queue.size();
for (ssize_t index = 0; index < size; ++index)
{
auto command = queue[index];
auto commandType = command->getType();
if(RenderCommand::Type::QUAD_COMMAND == commandType)
{
auto cmd = static_cast<QuadCommand*>(command);
//Batch quads
if(_numQuads + cmd->getQuadCount() > VBO_SIZE)
{
CCASSERT(cmd->getQuadCount()>= 0 && cmd->getQuadCount() < VBO_SIZE, "VBO is not big enough for quad data, please break the quad data down or use customized render command");
//Draw batched quads if VBO is full
drawBatchedQuads();
}
_batchedQuadCommands.push_back(cmd);
memcpy(_quads + _numQuads, cmd->getQuads(), sizeof(V3F_C4B_T2F_Quad) * cmd->getQuadCount());
convertToWorldCoordinates(_quads + _numQuads, cmd->getQuadCount(), cmd->getModelView());
_numQuads += cmd->getQuadCount();
}
else if(RenderCommand::Type::GROUP_COMMAND == commandType)
{
flush();
int renderQueueID = ((GroupCommand*) command)->getRenderQueueID();
visitRenderQueue(_renderGroups[renderQueueID]);
}
else if(RenderCommand::Type::CUSTOM_COMMAND == commandType)
{
flush();
auto cmd = static_cast<CustomCommand*>(command);
cmd->execute();
}
else if(RenderCommand::Type::BATCH_COMMAND == commandType)
{
flush();
auto cmd = static_cast<BatchCommand*>(command);
cmd->execute();
}
else
{
CCLOGERROR("Unknown commands in renderQueue");
}
}
}
示例13: OnPaint
void Widget::Render(RenderTarget& target, RenderQueue& queue) const
{
OnPaint(target, queue);
if (mUseScissor)
{
Area& area = ResourceManager::Get()->WidgetArea;
area.PushArea(GetRect(true));
const FloatRect& top = area.GetTopArea();
target.Flush();
RenderChildren(target, queue);
queue.SetScissor(true, Vector2f(top.Left, target.GetHeight() - top.Bottom), Vector2f(top.GetSize().x, top.GetSize().y));
target.Flush();
area.PopArea();
}
else
{
queue.SetScissor(false);
RenderChildren(target, queue);
}
}
示例14: my
void PlanetAtmosphereNode::findVisible( Camera*cam, RenderQueue& display, a_vector<LightNode*>& light )
{
if(!m_controller->m_use_atmosphere || !cam->isInFrustrum(m_globalBbox))
return;
PlanetModel* model = m_controller->m_model;
m_controller->m_cam_position = cam->getPosition();
vec4 my(0,0,0,1);
my = m_transform->modelMatrix()*my;
m_controller->m_cam_position = m_controller->m_cam_position-vec3(my);
m_controller->m_cam_dist = length(m_controller->m_cam_position);
display.push_back(this,RenderQueue::TRenderType::TYPE_BLEND);
SceneNode::findVisible(cam,display,light);
}
示例15: draw
//----------------------------------------------------------------------------//
void OgreRenderTarget::draw(const RenderQueue& queue)
{
queue.draw();
}