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


C++ SkyBox::MakeFromSideTextures方法代码示例

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


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

示例1: location

    DemoScene( unsigned int windowWidth,
               unsigned int windowHeight,
               bool         fullscreen,
               unsigned int multisample ) :
        time(0.0f),
        fps(0.0f),
        dt(0.0f),
        drawHelp(true),
        needToTakeScreenshot(false)
    {
        Engine* engine = Engine::Instance();

        // setup graphics
        {
            using namespace slon::scene;
            using namespace slon::animation;

            // setup logging
            {
                log::currentLogManager().redirectOutput("database", "database_log.txt");
                log::currentLogManager().redirectOutput("graphics", "graphics_log.txt");
            }

            GraphicsManager& graphicsManager = engine->getGraphicsManager();
            graphicsManager.setVideoMode(windowWidth, windowHeight, 32, fullscreen, false, multisample);

            // create renderer
            {
                ForwardRendererDesc desc;
                desc.useDepthPass   = true;
                desc.makeDepthMap   = true;
                desc.useDebugRender = true;

                Renderer* renderer = graphicsManager.initRenderer(desc);
                renderer->connectPostRenderCallback( boost::bind(&DemoScene::OnPostRender, this, _1) );
            }
        #ifdef WIN32
            FreeConsole();
        #endif

            // create world
            realm::World*       world = realm::currentWorld();
            realm::location_ptr location(new realm::BVHLocation);
            world->addLocation(location);

            // Create skybox
            SkyBox* skyBox = new SkyBox();
            {
                const std::string SKY_BOX_MAPS[6] =
                {
                    "Data/SkyBox/sunset_west.jpg",
                    "Data/SkyBox/sunset_east.jpg",
                    "Data/SkyBox/sunset_up.jpg",
                    "Data/SkyBox/sunset_down.jpg",
                    "Data/SkyBox/sunset_south.jpg",
                    "Data/SkyBox/sunset_north.jpg"
                };
                skyBox->MakeFromSideTextures(SKY_BOX_MAPS);
            }
            world->addInfiniteNode(skyBox);

            // create scene
            {
                database::library_ptr library = database::loadLibrary("Data/Models/troll.DAE");
                location->add(library->visualScenes.begin()->second.get());

				database::Library::key_animation_map animations = library->animations;
				if ( !animations.empty() )
				{
					StartStopTimer* timer = new StartStopTimer();
					timer->start();
					animations.begin()->second->play(timer);
				}

                // create light
                scene::DirectionalLight* light = new DirectionalLight();
                light->setDirection( normalize( Vector3f(-1.5f, -0.1f, 0.85f) ) );
                light->setColor( Vector4f(0.8f, 0.8f, 0.8f, 1.0f) );
                light->setAmbient(0.3f);
                light->setIntensity(1.5f);
                world->addInfiniteNode(light);
            }

            // Create camera
            {
                sgl::rectangle viewport(0, 0, windowWidth, windowHeight);
                camera.reset( createMainCamera(viewport) );
                graphicsManager.addCamera( camera.get() );
            }

            camera->setPosition( Vector3f(60.0f, 20.0f, 0.0f) );
            camera->setDirection( Vector3f(-1.0f, -1.0f, 1.0f) );
            camera->setUp( Vector3f(0.0f, 1.0f, 0.0f) );

            // create font
            font.reset( currentDevice()->CreateFont() );
            {
                sgl::Image* image = currentDevice()->CreateImage();
                image->LoadFromFile("Data/Fonts/font.png");
	            font->SetTexture( image->CreateTexture2D() );
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:slon,代码行数:101,代码来源:main.cpp


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