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


C++ RenderEngine类代码示例

本文整理汇总了C++中RenderEngine的典型用法代码示例。如果您正苦于以下问题:C++ RenderEngine类的具体用法?C++ RenderEngine怎么用?C++ RenderEngine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RenderEngine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: update_properties

        void ForwardPositonalLightShader::update_properties(
                                                            const Mat4& trans,
                                                            const RenderEngine& engine) const
        {
            //TODO remove global camera.
            //                auto mvp =
            
            set_uniform_matrix4("transformation_mat", trans);
//            set_uniform_matrix4("camera_mat", engine.get_global_camera()->get_camera_mat());
//            set_uniform_matrix4("projection_mat", engine.get_global_camera()->get_projection_mat());
            set_uniform_matrix4("camera_mat", Locator::get_game().get_camera()->get_camera_mat());
            set_uniform_matrix4("projection_mat", Locator::get_game().get_camera()->get_projection_mat());

            set_uniform_matrix3("normal_mat",  trans.get_mat3().inverse().transpose());
            
            
            
            set_light("positional_light.light", engine.get_active_light());
            
            set_pos_light("positional_light",static_cast<const PositionalLight*>(engine.get_active_light()),trans);
            

//            
            //TODO 
            set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos());
            set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos());
            
            set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos());
            set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos());
//            //use the new texture
//            material.get_texture("diffuse").bind_texture(m_program_id, m_uniform_map["texture_sampler"]);
        }
开发者ID:BeiLuoShiMen,项目名称:NicoEngine,代码行数:32,代码来源:FowardPosLightShader.cpp

示例2: assert

void
Gui::onTimelineTimeAboutToChange()
{
    assert( QThread::currentThread() == qApp->thread() );
    const std::list<ViewerTab*>& viewers = getViewersList();
    for (std::list<ViewerTab*>::const_iterator it = viewers.begin(); it != viewers.end(); ++it) {
        RenderEngine* engine = (*it)->getInternalNode()->getRenderEngine();
        engine->abortRendering(true, false);
    }
}
开发者ID:ChristianHeckl,项目名称:Natron,代码行数:10,代码来源:Gui40.cpp

示例3: bindImage

void TextureFX::bindImage(RenderEngine renderengine) 
{
        if(tileImage == 0)
        {
            GL11.glBindTexture(3553 /*GL_TEXTURE_2*/, renderengine.getTexture("/terrain.png"));
        } else
        if(tileImage == 1)
        {
            GL11.glBindTexture(3553 /*GL_TEXTURE_2*/, renderengine.getTexture("/gui/items.png"));
        }
}
开发者ID:mrneo240,项目名称:MineC--,代码行数:11,代码来源:TextureFX.cpp

示例4: operator

	void ImageProcessor::operator()(RenderEngine& render_engine)
	{
		if (initialized_)
		{
			render_engine.draw(*quadrilateral_);
		}
	}
开发者ID:RuiVarela,项目名称:rengine,代码行数:7,代码来源:ImageProcessor.cpp

示例5: handleEvents

	void handleEvents()
	{
		const sf::Input& Input = App->GetInput();
		bool shiftDown = Input.IsKeyDown(sf::Key::LShift) || Input.IsKeyDown(sf::Key::RShift);
		sf::Event Event;
		while (App->GetEvent(Event))
		{
			if (Event.Type == sf::Event::Closed)
				App->Close();
			if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
				App->Close();
			
			// This is for grading your code. DO NOT REMOVE
			if(Event.Type == sf::Event::KeyPressed && Event.Key.Code == sf::Key::Space) {
				firing = 6;
			} 
			if(Event.Type == sf::Event::KeyReleased && Event.Key.Code == sf::Key::Space) {
				firing = 0;
			}

			if(Event.Type == sf::Event::KeyPressed && Event.Key.Code == sf::Key::F12){
				render = RenderEngine();
				render.init();
			}

			
			if (Event.Type == sf::Event::Resized)
			{ glViewport(0, 0, Event.Size.Width, Event.Size.Height); }
		}
	}
开发者ID:timaeudg,项目名称:3DAsteroids,代码行数:30,代码来源:program5.cpp

示例6: UpdateTexture

void AppGUI::UpdateTexture(RenderEngine& engine)
{
    const int selectedTexture = m_cache->TextureSelected.Get();
    if(selectedTexture != m_selectedTexture)
    {
        m_selectedTexture = selectedTexture;
        const int ID = m_data.proceduralTextures[m_selectedTexture];
        m_data.textures[ID]->Write(*m_cache);
        m_data.textures[ID]->Save();
        m_cache->TexturePath.SetUpdated(m_data.textures[ID]->Path());
    }
    else if(m_selectedTexture >= 0 && 
            m_selectedTexture < static_cast<int>(m_data.proceduralTextures.size()))
    {
        const int ID = m_data.proceduralTextures[m_selectedTexture];
        m_data.textures[ID]->Read(*m_cache);
    }

    if (m_cache->ReloadTexture.Get())
    {
        const int ID = m_data.proceduralTextures[m_selectedTexture];
        m_scene.ReloadTexture(ID);
        engine.ReloadTexture(ID);
        m_data.textures[ID]->Save();
        m_cache->TexturePath.SetUpdated(m_data.textures[ID]->Path());
        m_cache->ReloadTexture.Set(false);
    }
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例7: UpdateShader

void AppGUI::UpdateShader(RenderEngine& engine)
{   
    const int selectedShader = m_cache->ShaderSelected.Get();
    bool changedShader = selectedShader != m_selectedShader;
    bool recompiledShader = false;

    const std::string updatedText = m_cache->CompileShader.Get();
    if(!updatedText.empty() && m_selectedShader != NO_INDEX)
    {
        recompiledShader = ReCompileShader(updatedText, engine);
    }

    if(changedShader || recompiledShader)
    {
        m_selectedShader = selectedShader;
        m_cache->ShaderText.SetUpdated(engine.GetShaderText(m_selectedShader));
        m_cache->ShaderAsm.SetUpdated(engine.GetShaderAssembly(m_selectedShader));
    }
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例8: ReCompileShader

bool AppGUI::ReCompileShader(const std::string& text, RenderEngine& engine)
{
    const auto& shader = *m_data.shaders[m_selectedShader];
    m_cache->CompileShader.Clear();
    engine.WriteToShader(shader, text);

    std::string errors = engine.CompileShader(m_selectedShader);
    if(errors.empty())
    {
        Logger::LogInfo(shader.Name() + ": Recompiled successfully");
        return true;
    }
    else
    {
        Logger::LogInfo(shader.Name() + ": Failed Recompilation");
        MessageBox(nullptr, (shader.Name() + ":" + errors).c_str(), "Compilation Errors", MB_OK);
        return false;
    }
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例9: draw

	void HudWriter::draw(RenderEngine& render_engine)
	{
		if (!vertex_buffer_.empty() && ((drawMode() == DynamicDraw) || (drawMode() == StaticDraw) || (drawMode() == StreamDraw)) )
		{
			if (needsDataRefresh())
			{
				prepareDrawing(render_engine);
				needs_data_refresh = false;
			}

			render_engine.drawVertexArrayObject(vertex_vao_, vertex_buffer_);
		}
	}
开发者ID:RuiVarela,项目名称:rengine,代码行数:13,代码来源:HudWriter.cpp

示例10: UpdateScene

void AppGUI::UpdateScene(RenderEngine& engine)
{
    UpdateCamera();

    m_cache->FramesPerSec.Set(m_timer.GetFPS());
    m_cache->DeltaTime.Set(m_timer.GetDeltaTime());
    m_cache->Timer.Set(m_timer.GetTotalTime());

    if (m_cache->ReloadScene.Get())
    {
        m_cache->ReloadScene.Set(false);
        m_scene.Reload();

        const auto maxTextures = m_cache->Textures.Get().size();
        for (unsigned int i = 0; i < maxTextures; ++i)
        {
            engine.ReloadTexture(m_data.proceduralTextures[i]);
        }

        const auto maxTerrain = m_cache->Terrains.Get().size();
        for (unsigned int i = 0; i < maxTerrain; ++i)
        {
            engine.ReloadTerrain(i);
        }
    }

    if (m_cache->ReloadEngine.Get())
    {
        m_reloadEngine();
        m_cache->ReloadEngine.Set(false);
    }

    if (m_cache->ReloadPlacement.Get())
    {
        m_scene.ReloadPlacement();
        m_cache->ReloadPlacement.Set(false);
    }
}
开发者ID:,项目名称:,代码行数:38,代码来源:

示例11: update_properties

        void ForwardDirectionalShader::update_properties(
                                                         const Mat4& trans,
                                                         const RenderEngine& engine) const
        {
            //TOOD use dir
            //TODO remove global camera.
            //                auto mvp =
            
            set_uniform_matrix4("transformation_mat", trans);
//            set_uniform_matrix4("camera_mat", engine.get_global_camera()->get_camera_mat());
//            set_uniform_matrix4("projection_mat", engine.get_global_camera()->get_projection_mat());
            set_uniform_matrix4("camera_mat", Locator::get_game().get_camera()->get_camera_mat());
            set_uniform_matrix4("projection_mat", Locator::get_game().get_camera()->get_projection_mat());

            set_uniform_matrix3("normal_mat", trans.get_mat3().inverse().transpose());
            
            auto dir_light = static_cast<const DirectionalLight*>(engine.get_active_light());
            set_light("directional_light.light", engine.get_active_light());
            set_uniform3f("directional_light.direction", dir_light->get_dir());
            
            
            auto& rim_light = dir_light->get_rim_light();
            if (rim_light) {
                set_uniformi("directional_light.rim_light.enable", rim_light->get_status());
                set_uniform3f("directional_light.rim_light.color", rim_light->get_rim_color());
                set_uniformf("directional_light.rim_light.power", rim_light->get_rim_power());
            }else{
                set_uniformi("directional_light.rim_light.enable", false);
            }
            
            
            //TODO
//            set_uniform3f("camera_pos", engine.get_global_camera()->get_world_pos()    );
            set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos()    );
            
//            //use the new texture
//            material.get_texture("diffuse").bind_texture(m_program_id, m_uniform_map["texture_sampler"]);
        }
开发者ID:BeiLuoShiMen,项目名称:NicoEngine,代码行数:38,代码来源:ForwardDirectionalShader.cpp

示例12: update_properties

        void ForwardAmbientShader::update_properties(
                                                     const Mat4& trans,
                                                     const RenderEngine& engine) const
        {
            set_uniform_matrix4("transformation_mat", trans);
            set_uniform_matrix4("camera_mat", Locator::get_game().get_camera()->get_camera_mat());
            set_uniform_matrix4("projection_mat", Locator::get_game().get_camera()->get_projection_mat());

            
            
            set_uniform3f("ambient", engine.get_ambient_light());
            
//            material.get_texture("diffuse").bind_texture(m_program_id, m_uniform_map["texture_sampler"]);

        }
开发者ID:BeiLuoShiMen,项目名称:NicoEngine,代码行数:15,代码来源:ForwardAmbientShader.cpp

示例13: UpdatePost

void AppGUI::UpdatePost(RenderEngine& engine)
{
    const int selectedMap = m_cache->PostMapSelected.Get();
    if (selectedMap != m_selectedMap)
    {
        m_selectedMap = selectedMap;
        m_scene.SetPostMap(selectedMap);
    }

    m_data.post->Read(*m_cache);

    m_data.caustics->SetSpeed(
        m_cache->Post[POST_CAUSTIC_SPEED].Get());

    if (m_cache->ToggleWireframe.Get())
    {
        engine.ToggleWireframe();
        m_cache->ToggleWireframe.Set(false);
    }
}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例14: UpdateTerrain

void AppGUI::UpdateTerrain(RenderEngine& engine)
{
    const int selectedTerrain = m_cache->TerrainSelected.Get();
    if(selectedTerrain != m_selectedTerrain)
    {
        m_selectedTerrain = selectedTerrain;
        m_data.terrain[m_selectedTerrain]->Write(*m_cache);
    }
    else if(m_selectedTerrain >= 0 && 
            m_selectedTerrain < static_cast<int>(m_scene.Terrains().size()))
    {
        auto& terrain = *m_data.terrain[m_selectedTerrain];
        terrain.Read(*m_cache);
        m_cache->TerrainInstances.SetUpdated(terrain.GetRenderedInstances());
    }

    if (m_cache->ReloadTerrain.Get())
    {
        m_cache->ReloadTerrain.Set(false);
        m_scene.ReloadTerrain(m_selectedTerrain);
        engine.ReloadTerrain(m_selectedTerrain);
    }
}
开发者ID:,项目名称:,代码行数:23,代码来源:

示例15: display

void RenderEngine::display()
{
  if(render_engine.is_done())
  {
    render_engine.set_gl_ortho_proj();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();
    render_engine.draw_texture();
  }
  else
  {
    glEnable(GL_DEPTH_TEST);
    render_engine.set_gl_perspective();
    render_engine.set_gl_clearcolor();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();
	  render_engine.set_gl_camera();
    render_engine.draw();
    glDisable(GL_DEPTH_TEST);
  }
  glutSwapBuffers();  
}
开发者ID:baffo88,项目名称:DTU-RenderingIntroduction-RayTracer,代码行数:22,代码来源:RenderEngine.cpp


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