当前位置: 首页>>代码示例>>C++>>正文


C++ Renderable::draw方法代码示例

本文整理汇总了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();
}
开发者ID:MacTop,项目名称:omegalib,代码行数:56,代码来源:UiRenderPass.cpp

示例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());
}
开发者ID:oli-obk,项目名称:lightshifters,代码行数:10,代码来源:space_page.cpp

示例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);
}
开发者ID:oli-obk,项目名称:lightshifters,代码行数:12,代码来源:space_page.cpp

示例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;
	}
}
开发者ID:ChadyG,项目名称:MUGE,代码行数:13,代码来源:RenderManager.cpp

示例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", &params.position.x, -5, 5))
            parabolicPointer = make_parabolic_pointer(worldSurface, params);

        if (ImGui::SliderFloat3("Velocity", &params.velocity.x, -1.f, 1.f))
            parabolicPointer = make_parabolic_pointer(worldSurface, params);

        if (ImGui::SliderFloat("Point Spacing", &params.pointSpacing, 0.5, 2.0))
            parabolicPointer = make_parabolic_pointer(worldSurface, params);

        if (ImGui::SliderFloat("Point Count", &params.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)
            {
//.........这里部分代码省略.........
开发者ID:ddiakopoulos,项目名称:sandbox,代码行数:101,代码来源:geometric_algo_dev.hpp


注:本文中的Renderable::draw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。