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


C++ Asset::set_mesh方法代码示例

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


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

示例1: main

int main() {
    //Set up debug and info logging
    StreamAppender *appender = new StreamAppender(Logger::DEBUG | Logger::INFO, std::cout);
    Logger::add_appender(appender);
    fps::enable_fps_logging(true);
    
    //Create a window
    WindowManager &window_manager = WindowManager::get_instance();
    EasyWindow *easy_window = create_easy_window(640, 480);
    
    Window *window = easy_window->window;
    window->set_keyboard_callback(key_callback);
    
    //Create an object to add to the world
    Renderer *renderer = new Renderer(FLAT_VERTEX_SHADER,
                                      FLAT_FRAGMENT_SHADER);
    
    Mesh *mesh = new Mesh(2, Mesh::TRIANGLES);
    mesh->set_vertex_attribute(0, 3, 3, g_vertex_buffer_data);
    mesh->set_vertex_attribute(1, 3, 3, cube_colors);
    
    //Create an asset to wrap all of the above
    Asset *asset = new Asset;
    asset->set_mesh(mesh);
    asset->set_renderer(renderer);
    
    //Create a renderable to actually draw on the screen
    Renderable *renderable = new Renderable;
    renderable->asset = asset;
    renderable->set_position(0.0f, 0.0f, 0.3f);
    
    easy_window->world->add_child(renderable);
     
    //Set up the viewpoint
    viewpoint = new Viewpoint;
    viewpoint->set_far(100.0f);
    viewpoint->set_near(1.0f);
    viewpoint->set_position(0.0f, 0.0f, -0.5f);
    easy_window->screen->set_viewpoint(viewpoint);
    
    while(!window->get_should_close()) {
        window->render();
        window_manager.poll();
        fps::fps_tick();
    }
    
    destroy_easy_window(easy_window);
    delete viewpoint;
    
    //Clean up and exit
    Logger::shutdown();
    delete appender;
}
开发者ID:courageousillumination,项目名称:olympus,代码行数:53,代码来源:main.cpp


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