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


C++ Octree::readFromFile方法代码示例

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


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

示例1: masterFunc

void masterFunc() {
	Octree t;
	
	vector3 cam(-0.5,-0.5, -800);
	vector3 camX(1,0,0);
	vector3 camY(0,1,0);
	vector3 camZ(0,0,1);
	
	BITMAP32 render(512,512);
	vector3 p;
	vector3 lightdir(-1,-1,1);
	vector3 lightdir2(0,1,0);
	lightdir.normalize();
	
	int treeSize;
	char * treeBuffer;
	
	//t.loadFromBitmaps("./dicom/IM_0001%03d.bmp", 200);
	//t.writeToFile("octree.dat");
	cout << "Loading octree data" << endl;
	t.readFromFile("octree.dat", treeBuffer, treeSize);
	
	MPI_Bcast (&treeSize, 1, MPI_INT, MASTER, MPI_COMM_WORLD);					//Broadcast header with tree size
	MPI_Bcast (treeBuffer,  treeSize, MPI_BYTE, MASTER, MPI_COMM_WORLD);      	//Broadcast tree
	cout << "Data sent from master node." << endl;
	int frames = 1;
	time_t startTime = time(0);
	for(int i = 0; i < frames; i++) {
		double xcenter = 30, zcenter = -25, radius = 500;
		RaytraceCamera camera(vector3(xcenter+radius*cos(i*2*PI/frames)+1,-9,zcenter+radius*sin(i*2*PI/frames)+1), vector3(xcenter,-10,zcenter));
		cout << "Generating rays..." << endl;
		vector<RayPixel> rays = camera.generateRays(512,512);
		cout << rays.size() << " rays generated." << endl;
		traceRays(rays, t, render);
		cout << "Loop " << i << ": done tracing rays!" << endl;
		time_t seconds = time(0);
		cout << "Frame " << i << " done at " << difftime(seconds, startTime) << endl;
		exportBMP(render,"render" + toString(i) + ".bmp");
	}

}
开发者ID:Jordangc,项目名称:Project,代码行数:41,代码来源:main.cpp


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