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


C++ Render::renderTo方法代码示例

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


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

示例1: main

int main(int argc, char* argv[])
{
	bool quit = false;
	SDL_Event e;

	Window window;
	Render render;

	Sphere* sphere0 = new Sphere();
	sphere0->position = glm::vec3(2.0, -0.1, -0.2);
	sphere0->colour = glm::vec3(1.0, 0.2, 0.2);
	sphere0->radius = 0.5;

	sphere0->update();
	render.shapes.push_back(sphere0);

	Sphere* sphere1 = new Sphere();
	sphere1->position = glm::vec3(0.8, -0.4, 0.0);
	sphere1->colour = glm::vec3(1.0, 1.0, 0.2);
	sphere1->reflection = 0.1f;
	sphere1->radius = 0.2;

	sphere1->update();
	render.shapes.push_back(sphere1);

	Sphere* sphere2 = new Sphere();
	sphere2->position = glm::vec3(0.9, 0.4, 0.1);
	sphere2->colour = glm::vec3(0.2, 1.0, 0.2);
	sphere2->reflection = 0.02f;
	sphere2->radius = 0.1;

	sphere2->update();
	render.shapes.push_back(sphere2);

	Sphere* sphere3 = new Sphere();
	sphere3->position = glm::vec3(4.5, -2.3, 0.5);
	sphere3->colour = glm::vec3(1.0, 1.0, 1.0);
	sphere3->reflection = 0.9f;
	sphere3->radius = 0.7;

	sphere3->update();
	render.shapes.push_back(sphere3);

	Floor* floor0 = new Floor();
	floor0->position.z = -0.5;
	floor0->reflection = 0.02f;
	floor0->colour = glm::vec3(2.0, 2.0, 3.0);
	floor0->orientation = glm::quat(glm::vec3(0.0, 0.0, 0.0));

	floor0->update();
	render.shapes.push_back(floor0);

	TorusSquare* torus0 = new TorusSquare();
	torus0->position = glm::vec3(1.1, 0.5, -0.3);
	torus0->colour = glm::vec3(0.2, 0.2, 1.2);
	torus0->properties = glm::vec2(0.13, 0.05);
	torus0->orientation = glm::quat(glm::vec3(0.0, 0.0, -1.0));

	torus0->update();
	render.shapes.push_back(torus0);

	SDL_Init(SDL_INIT_VIDEO);

	window.create();

	clock_t start = clock();

	render.renderTo(&window);

	printf("Rendered in %.2fs.\n", (double)(clock() - start) / CLOCKS_PER_SEC);

	while (!quit)
	{
		//window.blank();

		//Handle events on queue
		while(SDL_PollEvent(&e) != 0)
		{
			//User requests quit
			if(e.type == SDL_QUIT)
			{
				quit = true;
			}
		}

		window.update();

		SDL_Delay(20);
	}

	return 0;
}
开发者ID:zesterer,项目名称:sdf-test,代码行数:92,代码来源:main.cpp


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