本文整理汇总了C++中ObjectGroup::extend方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectGroup::extend方法的具体用法?C++ ObjectGroup::extend怎么用?C++ ObjectGroup::extend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectGroup
的用法示例。
在下文中一共展示了ObjectGroup::extend方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
Material* ceilingMat = new Lambertian(new ConstantTexture(1.f, 1.f, 1.f));
/* Material* ceilingMat = new Metal(new ConstantTexture(1.f, 1.f, 1.f), 0); */
world->add( new Triangle(A, C, B, ceilingMat));
world->add( new Triangle(C, A, D, ceilingMat));
// left
Material* leftMat = new Lambertian(new ConstantTexture(1.f, 0.f, 0.f));
world->add( new Triangle(A, B, E, leftMat));
world->add( new Triangle(B, F, E, leftMat));
// right
Material* rightMat = new Lambertian(new ConstantTexture(0.f, 1.f, 0.f));
world->add( new Triangle(D, H, C, rightMat));
world->add( new Triangle(C, H, G, rightMat));
// light
float lightIntensity = 10.f;
float lightSize = 0.3f;
Material* lightMat = new Light(new ConstantTexture(lightIntensity, lightIntensity, lightIntensity));
Vector lA = Vector(-lightSize, 0.99f, -lightSize);
Vector lB = Vector(-lightSize, 0.99f, lightSize);
Vector lC = Vector(lightSize, 0.99f, lightSize);
Vector lD = Vector(lightSize, 0.99f, -lightSize);
world->add( new Triangle(lA, lC, lB, lightMat));
world->add( new Triangle(lC, lA, lD, lightMat));
/* world->add( new Sphere(Vector(0, 0, 0), 0.2, new Light(new ConstantTexture(20.f, 20.f, 20.f))) ); */
// stuff inside the box
/* world->add( box(Vector(-0.7, -0.2, 0.2), 0.5, 0.5, 0.5, new Metal(new ConstantTexture(0.9, 0.9, 0.9), 0.01)) ); */
/* for(int i=0 ; i<100 ; i++){ */
world->extend( box(new Lambertian(new ConstantTexture(0.1, 0.2, 0.95)),
Vector(-0.6, -0.1, 0.1),
Vector(0.5, 0.8, 0.5),
Vector(0.f, -20.f, 0.f))->list );
world->extend( box(new Lambertian(new ConstantTexture(1, 1, 1)),
Vector(0., -0.5, -0.7),
Vector(0.5, 0.5, 0.5),
Vector(0.f, 15.f, 0.f))->list );
/* } */
// obj loading tests
// http://www.opengl-tutorial.org/beginners-tutorials/tutorial-7-model-loading/
//
auto checkpoint = std::chrono::high_resolution_clock::now();
Material* objMat = new Lambertian(new ConstantTexture(0.1f, 0.2f, 0.8f));
/* Material* objMat = new Metal(new ConstantTexture(0.6f, 0.6f, 0.2f), 0.1f); */
/* Material* objMat = new Light(new ConstantTexture(0.1f, 0.1f, 0.8f)); */
std::vector<Vector> vertices;
std::vector<Vector> normals;
/* std::vector<Vector> texturecoords; */
std::vector<std::array<long double, 3>> faces; // computed normals indexed by vertices
std::vector<int> nfaces; // number of faces by vertices - to average out the normal
std::vector<std::array<int, 3>> faceLinks; // for each face, link to vertice ids
ObjectGroup *obj = new ObjectGroup();
std::vector<SmoothedTriangle*> tosmooth;
int ignoredObj = 0;