本文整理汇总了C++中Renderable::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ Renderable::draw方法的具体用法?C++ Renderable::draw怎么用?C++ Renderable::draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Renderable
的用法示例。
在下文中一共展示了Renderable::draw方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void UiRenderPass::render(Renderer* client, const DrawContext& context)
{
sLock.lock();
myDrawTimeStat->startTiming();
if(context.task == DrawContext::SceneDrawTask)
{
client->getRenderer()->beginDraw3D(context);
glPushAttrib(GL_ALL_ATTRIB_BITS);
// This is a bit of a hack. DIsable depth testing for ui stuff. We will take care of ordering.
// This may lead to depth inconsistencies wrt the background scene when drawing 3d menus, but we want te
// menus to always be visible and unoccluded by geometry.
glDisable(GL_DEPTH_TEST);
ui::Container* ui = myUiRoot;
Renderable* uiRenderable = ui->getRenderable(client);
if(uiRenderable != NULL)
{
uiRenderable->draw(context);
}
glPopAttrib();
client->getRenderer()->endDraw();
}
else if(context.task == DrawContext::OverlayDrawTask)
{
Vector2i displaySize;
// check if the tile is part of a canvas (a multi-tile grid). If it is,
// get the canvas resolution. Otherwise simply use the tile resolution.
if(context.tile->isInGrid)
{
DisplaySystem* ds = SystemManager::instance()->getDisplaySystem();
displaySize = ds->getCanvasSize();
}
else
{
displaySize = context.tile->pixelSize;
}
client->getRenderer()->beginDraw2D(context);
glPushAttrib(GL_ALL_ATTRIB_BITS);
Renderable* uiRenderable = myUiRoot->getRenderable(client);
if(uiRenderable != NULL)
{
uiRenderable->draw(context);
}
glPopAttrib();
client->getRenderer()->endDraw();
}
myDrawTimeStat->stopTiming();
sLock.unlock();
}
示例2: render
void SpacePage::render(const Renderable& r)
{
if (m_PlayerRenderable) {
if (r.getType() == "troll") {
m_Closest.check(r, m_PlayerRenderable->getPosition());
}
}
Gosu::Graphics& g = PageManager::Instance()->graphics();
r.draw(m_matGlobalToLocal, g.width(), g.height());
}
示例3: draw
void ClosestHud::draw(const Matrix& mat, double wdt, double hgt)
{
if (!m_bValid) return;
Renderable rend = Renderable::temporary();
rend.setImageName(L"sphere.png");
rend.setScale(0.1);
rend.setFixedSizeDistance(100);
Gosu::Color col = Gosu::Colors::green;
rend.setColor(col);
rend.setPosition(m_vecPos);
rend.draw(mat, wdt, hgt);
}
示例4: doRender
void RenderManager::doRender() const
{
int camW = m_Camera->Width(), camH = m_Camera->Height();
//m_camX = _x; m_camY = _y,
double camZoom = m_Camera->Zoom(), camRot = m_Camera->Rotation(), camScale = m_Camera->Scale();
Renderable *r = m_rendlist;
while (r != NULL) {
CameraTransform trans = m_Camera->worldToScreen( r->m_posX, r->m_posY, r->m_layer);
r->draw(trans.x, trans.y, trans.zoom, trans.rot);
r = r->m_next;
}
}
示例5: on_draw
void on_draw() override
{
glfwMakeContextCurrent(window);
if (igm) igm->begin_frame();
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
int width, height;
glfwGetWindowSize(window, &width, &height);
glViewport(0, 0, width, height);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(1.0f, 0.1f, 0.0f, 1.0f);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
ImGui::SliderFloat("Projectile Velocity", &turret.velocity, 0.f, 100.f);
if (ImGui::Button("Fire"))
{
turret.projectile = BallisticProjectile();
turret.projectile.p = turret.source.pose;
turret.projectile.lastPos = turret.source.pose.position;
turret.projectile.gravity = 0.0;
/*
float3 firingSolutionLow;
float3 firingSolutionHigh;
auto numSolutions = solve_ballistic_arc(turret.source.pose.position, turret.velocity, turret.target.pose.position, 9.8f, firingSolutionLow, firingSolutionHigh);
*/
float3 fireVelocity;
float gravity;
auto canFire = solve_ballistic_arc_lateral(turret.source.pose.position, turret.velocity, turret.target.pose.position, 10.f, fireVelocity, gravity);
//std::cout << "Num Solutions: " << numSolutions << std::endl;
//std::cout << "Low Solution: " << firingSolutionLow << std::endl;
std::cout << "Fire Velocity: " << fireVelocity << std::endl;
if (canFire)
{
turret.projectile.gravity = gravity;
turret.projectile.add_impulse(fireVelocity);
turret.fired = true;
}
}
ImGui::Spacing();
if (ImGui::SliderInt("M", &ssM, 1, 30)) regeneratePointer = true;
if (ImGui::SliderInt("N1", &ssN1, 1, 30)) regeneratePointer = true;
if (ImGui::SliderInt("N2", &ssN2, 1, 30)) regeneratePointer = true;
if (ImGui::SliderInt("N3", &ssN3, 1, 30)) regeneratePointer = true;
ImGui::Spacing();
ImGui::BeginGroup();
if (ImGui::SliderFloat3("Position", ¶ms.position.x, -5, 5))
parabolicPointer = make_parabolic_pointer(worldSurface, params);
if (ImGui::SliderFloat3("Velocity", ¶ms.velocity.x, -1.f, 1.f))
parabolicPointer = make_parabolic_pointer(worldSurface, params);
if (ImGui::SliderFloat("Point Spacing", ¶ms.pointSpacing, 0.5, 2.0))
parabolicPointer = make_parabolic_pointer(worldSurface, params);
if (ImGui::SliderFloat("Point Count", ¶ms.pointCount, 16, 64))
parabolicPointer = make_parabolic_pointer(worldSurface, params);
ImGui::EndGroup();
const auto proj = camera.get_projection_matrix((float) width / (float) height);
const float4x4 view = camera.get_view_matrix();
const float4x4 viewProj = mul(proj, view);
glViewport(0, 0, width, height);
skydome.render(viewProj, camera.get_eye_point(), camera.farClip);
grid.render(proj, view);
{
simpleShader->bind();
simpleShader->uniform("u_eye", camera.get_eye_point());
simpleShader->uniform("u_viewProj", viewProj);
simpleShader->uniform("u_emissive", float3(0, 0, 0));
simpleShader->uniform("u_diffuse", float3(0.0f, 1.0f, 0.0f));
for (int i = 0; i < 2; i++)
{
simpleShader->uniform("u_lights[" + std::to_string(i) + "].position", lights[i].position);
simpleShader->uniform("u_lights[" + std::to_string(i) + "].color", lights[i].color);
}
for (const auto & model : shadedModels)
{
//.........这里部分代码省略.........