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