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


C++ TriangleMesh::createSingleTriangle方法代码示例

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


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

示例1: Lambert

void
makeBunny1Scene()
{
	g_camera = new Camera;
	g_scene = new Scene;
	g_image = new Image;

	g_image->resize(512, 512);

	// set up the camera
	g_camera->setBGColor(Vector3(0.0f, 0.0f, 0.2f));
	g_camera->setEye(Vector3(0, 5, 15));
	g_camera->setLookAt(Vector3(0, 0, 0));
	g_camera->setUp(Vector3(0, 1, 0));
	g_camera->setFOV(45);

	// create and place a point light source
	PointLight * light = new PointLight;
	light->setPosition(Vector3(10, 20, 10));
	light->setColor(Vector3(1, 1, 1));
	light->setWattage(4.0 * PI * 1000);
	g_scene->addLight(light);

	Material* lambert = new Lambert(Vector3(1.0f));
	Material* mirror = new Mirror(Vector3(0.5f));
	TriangleMesh * bunny = new TriangleMesh;
	bunny->load("bunny.obj");
	addMeshTrianglesToScene(bunny, lambert);
    
	// create the floor triangle
	TriangleMesh * floor = new TriangleMesh;
	floor->createSingleTriangle();
	floor->setV1(Vector3(-100, 0, -100));
	floor->setV2(Vector3(   0, 0,  100));
	floor->setV3(Vector3( 100, 0, -100));
	floor->setN1(Vector3(0, 1, 0));
	floor->setN2(Vector3(0, 1, 0));
	floor->setN3(Vector3(0, 1, 0));
    
	Triangle* t = new Triangle;
	t->setIndex(0);
	t->setMesh(floor);
	t->setMaterial(lambert); 
	g_scene->addObject(t);
    
	// let objects do pre-calculations if needed
	g_scene->preCalc();
}
开发者ID:whirlp00l,项目名称:PhysicalbasedRendering,代码行数:48,代码来源:assignment1.cpp


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