• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Point3D函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Point3D函数的典型用法代码示例。如果您正苦于以下问题:C++ Point3D函数的具体用法?C++ Point3D怎么用?C++ Point3D使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: Point3D

#include "Draw2D.h"
#include <math.h>

#define PI 3.14

Point3D Draw2D::camera = Point3D(225.000000, 225.000000, 1200.000000);
//Point3D Draw2D::camera = Point3D(0.000000, 0.000000, 0.000000);
Point2D Draw2D::center(640/2,480/2);
float Draw2D::xangle = 0;
float Draw2D::yangle = 0;
float Draw2D::zangle = 0;
float Draw2D::far = -300;
float Draw2D::near = -10.0;
float Draw2D::f = 320;
float Draw2D::dx = 1;
float Draw2D::dy = 1;

float Draw2D::miniLine = 0.9;


void Draw2D::drawSegment(SDL_Surface *screen,int x0, int y0, int x1, int y1, Uint8 r, Uint8 g, Uint8 b)
{
    int dx = abs(x1-x0);
    int dy = abs(y1-y0);
    int sx,sy;

    if (x0 < x1)
    {
        sx = 1 ;
    }else{
        sx = -1;
开发者ID:ice-blaze,项目名称:Three_Di_World,代码行数:31,代码来源:Draw2D.cpp


示例2: Point3D

inline Point3D operator -(const Point3D& a, const Vector3D& b)
{
  return Point3D(a[0]-b[0], a[1]-b[1], a[2]-b[2]);
}
开发者ID:luochenhuan,项目名称:Computer-Graphics,代码行数:4,代码来源:algebra.hpp


示例3: CFlightVisualiser

CFlightVisualiser::CFlightVisualiser(QWidget *parent) :
    CFlightVisualiser(parent, Point3D(100, 100, 100), Point2D(100, 250), Point3D(500, 500, 500),  Vector3D(Grad(0), Grad(0)))
{

}
开发者ID:Andrey-Dubas,项目名称:diploma_algo_code,代码行数:5,代码来源:cflightvisualiser.cpp


示例4: RayCast

void 												
World::build(void) {
	int num_samples = 16;

	vp.set_hres(600);
	vp.set_vres(600);
	vp.set_pixel_size(0.5);
	vp.set_samples(num_samples);  
//	vp.set_gamut_display(true);        // for Figure 14.23(b)
	
	tracer_ptr = new RayCast(this);	
	
	Pinhole* pinhole_ptr = new Pinhole;
	pinhole_ptr->set_eye(0, 0, 10000);
	pinhole_ptr->set_lookat(0.0);   
	pinhole_ptr->set_view_distance(15000);	
	pinhole_ptr->compute_uvw(); 
	set_camera(pinhole_ptr);
	
	Directional* light_ptr = new Directional;
	light_ptr->set_direction(100, 100, 200);
	light_ptr->set_color(1.0, 1.0, 1.0); 	
	light_ptr->scale_radiance(4.5); 	  		
	add_light(light_ptr);
	
	
	// colors

	RGBColor yellow(1, 1, 0);										// yellow
	RGBColor brown(0.71, 0.40, 0.16);								// brown
	RGBColor dark_green(0.0, 0.41, 0.41);							// dark_green
	RGBColor orange(1, 0.75, 0);									// orange
	RGBColor green(0, 0.6, 0.3);									// green
	RGBColor light_green(0.65, 1, 0.30);							// light green
	RGBColor dark_yellow(0.61, 0.61, 0);							// dark yellow
	RGBColor light_purple(0.65, 0.3, 1);							// light purple
	RGBColor dark_purple(0.5, 0, 1);								// dark purple
	
	
	// Matt material reflection coefficients
	
	float ka = 0.25;
	float kd = 0.75;
	
	
	// spheres
	
	Matte* matte_ptr1 = new Matte;
	matte_ptr1->set_ka(ka);	
	matte_ptr1->set_kd(kd);
	matte_ptr1->set_cd(yellow);				
	Sphere*	sphere_ptr1 = new Sphere(Point3D(5, 3, 0), 30); 
	sphere_ptr1->set_material(matte_ptr1);	   							// yellow
	add_object(sphere_ptr1);
	
	Matte* matte_ptr2 = new Matte;
	matte_ptr2->set_ka(ka);	
	matte_ptr2->set_kd(kd);
	matte_ptr2->set_cd(brown);
	Sphere*	sphere_ptr2 = new Sphere(Point3D(45, -7, -60), 20); 
	sphere_ptr2->set_material(matte_ptr2);								// brown
	add_object(sphere_ptr2);
	

	Matte* matte_ptr3 = new Matte;
	matte_ptr3->set_ka(ka);	
	matte_ptr3->set_kd(kd);
	matte_ptr3->set_cd(dark_green);	
	Sphere*	sphere_ptr3 = new Sphere(Point3D(40, 43, -100), 17); 
	sphere_ptr3->set_material(matte_ptr3);								// dark green
	add_object(sphere_ptr3);
	
	Matte* matte_ptr4 = new Matte;
	matte_ptr4->set_ka(ka);	
	matte_ptr4->set_kd(kd);
	matte_ptr4->set_cd(orange);
	Sphere*	sphere_ptr4 = new Sphere(Point3D(-20, 28, -15), 20); 
	sphere_ptr4->set_material(matte_ptr4);								// orange
	add_object(sphere_ptr4);
	
	Matte* matte_ptr5 = new Matte;
	matte_ptr5->set_ka(ka);	
	matte_ptr5->set_kd(kd);
	matte_ptr5->set_cd(green);
	Sphere*	sphere_ptr5 = new Sphere(Point3D(-25, -7, -35), 27); 			
	sphere_ptr5->set_material(matte_ptr5);								// green
	add_object(sphere_ptr5);
	
	Matte* matte_ptr6 = new Matte;
	matte_ptr6->set_ka(ka);	
	matte_ptr6->set_kd(kd);
	matte_ptr6->set_cd(light_green);
	Sphere*	sphere_ptr6 = new Sphere(Point3D(20, -27, -35), 25); 
	sphere_ptr6->set_material(matte_ptr6);								// light green
	add_object(sphere_ptr6);
	
	Matte* matte_ptr7 = new Matte;
	matte_ptr7->set_ka(ka);	
	matte_ptr7->set_kd(kd);
	matte_ptr7->set_cd(green);
//.........这里部分代码省略.........
开发者ID:matthiascy,项目名称:crocus-raytracer,代码行数:101,代码来源:BuildFigure14.23.cpp


示例5: Point3D

Point3D RaySpotLight::transparency(RayIntersectionInfo& iInfo,RayShape* shape,Point3D cLimit){
	return Point3D(1,1,1);
}
开发者ID:oraarthornsombat,项目名称:RayTracer,代码行数:3,代码来源:raySpotLight.todo.cpp


示例6: mNumParticles

ParticleSystem::ParticleSystem() :
	mNumParticles( 0.0 ),
	mOrigin( Point3D() ),
	mBaseVelocity( Vector3D() ),
	mBaseSize( 1.0 )
{}
开发者ID:jmmemmol,项目名称:boat-game,代码行数:6,代码来源:Particle.cpp


示例7: Point3D

Point3D operator +(const Point3D& u, const Vector3D& v){
  return Point3D(u[0]+v[0], u[1]+v[1], u[2]+v[2]);
}
开发者ID:zouzias,项目名称:raytracer,代码行数:3,代码来源:Vector3D.cpp


示例8: AllDirections

Point3D AllDirections()
{
	int a = rand() % 100-50, b = (rand() % 100 - 50) / 200.0, c = rand() % 100-50;
	return Point3D(a*1.0, b*1.0, c*1.0).Normalize();
}
开发者ID:maria-negrea,项目名称:MarioRun,代码行数:5,代码来源:FireBall.cpp


示例9: DefaultTranslation

Point3D DefaultTranslation() {
	return Point3D(0.0, 0.0, 0.0);
}
开发者ID:maria-negrea,项目名称:MarioRun,代码行数:3,代码来源:FireBall.cpp


示例10: Translation

Point3D Translation() {
	return Point3D(rand() % 5, rand() % 5, 0.0);
}
开发者ID:maria-negrea,项目名称:MarioRun,代码行数:3,代码来源:FireBall.cpp


示例11: BoxPosition

Point3D BoxPosition() {
	int a = rand() % 100-50, b = rand() % 100-50, c = rand() % 100 - 50;
	return Point3D(a*1.0, b*1.0, c*1.0).Normalize();
}
开发者ID:maria-negrea,项目名称:MarioRun,代码行数:4,代码来源:FireBall.cpp


示例12: NoDirection

Point3D NoDirection()
{
	return Point3D(0.0, 0.0, 0.0).Normalize();
}
开发者ID:maria-negrea,项目名称:MarioRun,代码行数:4,代码来源:FireBall.cpp


示例13: Planar

Point3D Planar()
{
	int a = rand() % 100-50, b = rand() % 100-50;
	return Point3D(0.0, 0.0, 0.0).Normalize();
}
开发者ID:maria-negrea,项目名称:MarioRun,代码行数:5,代码来源:FireBall.cpp


示例14: main

int main(int argc, char* argv[])
{	
	// Build your scene and setup your camera here, by calling 
	// functions from Raytracer.  The code here sets up an example
	// scene and renders it from two different view points, DO NOT
	// change this if you're just implementing part one of the 
	// assignment.  
	Raytracer raytracer;
	int width = 320; 
	int height = 240; 

	if (argc == 3) {
		width = atoi(argv[1]);
		height = atoi(argv[2]);
	}
    
/***********************************************************Testing ********************************
    // Camera parameters.
    Point3D eye(0, 0, 1);
    Vector3D view(0, 0, -1);
    Vector3D up(0, 1, 0);
    double fov = 60;
    
    // Defines a material for shading.
    Material gold( Colour(0.3, 0.3, 0.3), Colour(0.75164, 0.60648, 0.22648),
                  Colour(0.628281, 0.555802, 0.366065),
                  51.2,0.3,0,NULL );
    Material jade( Colour(0, 0, 0), Colour(0.54, 0.89, 0.63),
                  Colour(0.316228, 0.316228, 0.316228),
                  12.8,0.3,0,NULL);
    
    // Defines a point light source.
    raytracer.addLightSource( new PointLight(Point3D(0.0, 0, 5),
                                             Colour(0.9, 0.9, 0.9) ) );
    
    // Add a unit square into the scene with material mat.
    SceneDagNode* sphere = raytracer.addObject( new UnitSphere(), &gold );
    SceneDagNode* plane = raytracer.addObject( new UnitSquare(), &jade );
    
    // Apply some transformations to the unit square.
    double factor1[3] = { 1.0, 2.0, 1.0 };
    double factor2[3] = { 6.0, 6.0, 6.0 };
    raytracer.translate(sphere, Vector3D(0, 0, -5));
    raytracer.rotate(sphere, 'x', -45);
    raytracer.rotate(sphere, 'z', 45);
    raytracer.scale(sphere, Point3D(0, 0, 0), factor1);
    
    raytracer.translate(plane, Vector3D(0, 0, -7));
    raytracer.rotate(plane, 'z', 45);
    raytracer.scale(plane, Point3D(0, 0, 0), factor2);
    
    
    // Render the scene, feel free to make the image smaller for
    // testing purposes.
    raytracer.render(width, height, eye, view, up, fov, "view4.bmp");
    
    // Render it from a different point of view.
    Point3D eye2(4, 2, 1);
    Vector3D view2(-4, -2, -6);
    raytracer.render(width, height, eye2, view2, up, fov, "view5.bmp");
***********************************************************Testing ********************************/
/***********************************************************Final Scene********************************/
    // Camera parameters.
//	Point3D eye(0, 8, -3);
//	Vector3D view(0, -1,0);
    Point3D eye(0, 0, 1);
    Vector3D view(0, 0, -1);
    
	Vector3D up(0, 1, 0);
	double fov = 60;

	// Defines a material for shading.
	Material gold( Colour(0.3, 0.3, 0.3), Colour(0.75164, 0.60648, 0.22648), 
			Colour(0.628281, 0.555802, 0.366065), 
			51.2,0.2,NULL);
//	Material jade( Colour(0, 0, 0), Colour(0.54, 0.89, 0.63), 
//			Colour(0.316228, 0.316228, 0.316228), 
//			12.8,0.5,NULL);
    Material jade( Colour(0, 0, 0), Colour(0.47, 0.576, 0.859),
                  Colour(0.316228, 0.316228, 0.316228),
                  12.8,0.5,NULL);
    Material red( Colour(0.3, 0.3, 0.3), Colour(1, 0, 0),
                 Colour(0.628281, 0.555802, 0.366065),
                 51.2,0.2,NULL);
    
    Material white( Colour(0.3, 0.3, 0.3), Colour(1, 0.8549, 0.7255),
                 Colour(0.628281, 0.555802, 0.366065),
                 51.2,0.2,NULL);
    Material pink( Colour(0.3, 0.3, 0.3), Colour(0.9412, 0.502, 0.502),
                   Colour(0.628281, 0.555802, 0.366065),
                   51.2,0.2,NULL);
    
    Material mirror( Colour(0.0, 0.0, 0.0), Colour(0.0, 0.0, 0.0),
                 Colour(0.0, 0.0, 0.0),
                 51.2,1,NULL);
    
    Material glass( Colour(0.3, 0.3, 0.3), Colour(1, 1, 1),
                    Colour(0.628281, 0.555802, 0.366065),
                    51.2,0,1,NULL);
    glass.R_index = 1.3;
//.........这里部分代码省略.........
开发者ID:XBOOS,项目名称:raytracing,代码行数:101,代码来源:raytracer.cpp


示例15: Whitted


//.........这里部分代码省略.........
	
	// glass-air interface
	
	float c = 2;
	RGBColor glass_color(0.27*c, 0.49*c, 0.42*c);   
	RGBColor water_color(0.75, 1, 0.75);
	
	Dielectric* glass_ptr = new Dielectric;
	glass_ptr->set_ks(0.5);
	glass_ptr->set_exp(8000.0);  
	glass_ptr->set_eta_in(1.50);			// glass
	glass_ptr->set_eta_out(1.0);			// air
	glass_ptr->set_cf_in(glass_color);
	glass_ptr->set_cf_out(white); 
		
	// water-air interface
	
	Dielectric* water_ptr = new Dielectric;
	water_ptr->set_ks(0.5);
	water_ptr->set_exp(8000);
	water_ptr->set_eta_in(1.33);			// water
	water_ptr->set_eta_out(1.0);			// air
	water_ptr->set_cf_in(water_color);
	water_ptr->set_cf_out(white);

	// water-glass interface

	Dielectric* dielectric_ptr = new Dielectric;
	dielectric_ptr->set_ks(0.5);
	dielectric_ptr->set_exp(8000);
	dielectric_ptr->set_eta_in(1.33); 		// water
	dielectric_ptr->set_eta_out(1.5); 		// glass
	dielectric_ptr->set_cf_in(water_color);
	dielectric_ptr->set_cf_out(glass_color);
	
	// physical bowl parameters (also the defaults)
	
	double inner_radius		= 1.0;
	double glass_thickness	= 0.1;
	double water_depth		= 1.25;
	double meniscus_radius 	= 0.05;
	double opening_angle 	= 90.0;
	
	
	FishBowl* fishbowl_ptr = new FishBowl(	inner_radius,
											glass_thickness,
											water_depth,
											meniscus_radius,
											opening_angle);
	fishbowl_ptr->set_glass_air_material(glass_ptr);
	fishbowl_ptr->set_water_air_material(water_ptr);
	fishbowl_ptr->set_water_glass_material(dielectric_ptr);
	add_object(fishbowl_ptr);
	

	
	// goldfish
	
	Phong* phong_ptr = new Phong;			
	phong_ptr->set_ka(0.4); 
	phong_ptr->set_kd(0.8); 
	phong_ptr->set_cd(1.0, 0.15, 0.0);   	// orange 
	phong_ptr->set_ks(0.5);  
	phong_ptr->set_cs(1.0, 0.35, 0.0);		// orange
	phong_ptr->set_exp(50.0); 
//	phong_ptr->set_shadows(false); 
	
		
//	const char* file_name = "goldfish_low_res.ply";		// for scene design
	char* file_name = "goldfish_high_res.ply";  // for production
	Grid* grid_ptr = new Grid(new Mesh);
//	grid_ptr->read_flat_triangles(file_name);		
	grid_ptr->read_smooth_triangles(file_name);		
	grid_ptr->set_material(phong_ptr);    
	grid_ptr->setup_cells();
	
	Instance* gold_fish_ptr = new Instance(grid_ptr);
	gold_fish_ptr->scale(0.03);
	gold_fish_ptr->translate(0.5, 0.0, 0.0);
	add_object(gold_fish_ptr);
	
	
	// plane
	
	PlaneChecker* checker_ptr = new PlaneChecker;
	checker_ptr->set_size(0.5);		
	checker_ptr->set_outline_width(0.05);
	checker_ptr->set_color1(0.75);
	checker_ptr->set_color2(0.75);  
	checker_ptr->set_outline_color(0.45); 
	
	SV_Matte* sv_matte_ptr = new SV_Matte;		
	sv_matte_ptr->set_ka(0.5);
	sv_matte_ptr->set_kd(0.65);
	sv_matte_ptr->set_cd(checker_ptr);
	
	Plane* plane_ptr = new Plane(Point3D(0, -1.51, 0), Normal(0, 1, 0));
	plane_ptr->set_material(sv_matte_ptr);
	add_object(plane_ptr);
}
开发者ID:matthiascy,项目名称:crocus-raytracer,代码行数:101,代码来源:fish_bowl.cpp


示例16: return

Point3D 
GeometricObject::sample(void) {
	return (Point3D(0.0));
}
开发者ID:qiaocreation,项目名称:RayTracer,代码行数:4,代码来源:GeometricObject.cpp


示例17: AreaLighting

void 												
World::build(void) {
	int num_samples = 100;
	
	vp.set_hres(600);	  		
	vp.set_vres(600);        
	vp.set_samples(num_samples);
	vp.set_max_depth(19);	
	
	tracer_ptr = new AreaLighting(this);
	
	Pinhole* pinhole_ptr = new Pinhole;
	pinhole_ptr->set_eye(7.5, 3, 9.5);
	pinhole_ptr->set_lookat(5, 2.5, 0);
	pinhole_ptr->set_view_distance(800);
	pinhole_ptr->compute_uvw(); 
	set_camera(pinhole_ptr);
				
	
	// four point lights near the ceiling
	// these don't use distance attenuation

	PointLight* light_ptr1 = new PointLight;
	light_ptr1->set_location(10, 10, 0); 
	light_ptr1->scale_radiance(2.0); 
	light_ptr1->set_shadows(true); 
    add_light(light_ptr1);
    
    PointLight* light_ptr2 = new PointLight;
	light_ptr2->set_location(0, 10, 10); 
	light_ptr2->scale_radiance(2.0); 
	light_ptr2->set_shadows(true); 
    add_light(light_ptr2);
    
    PointLight* light_ptr3 = new PointLight;
	light_ptr3->set_location(-10, 10, 0); 
	light_ptr3->scale_radiance(2.0); 
	light_ptr3->set_shadows(true); 
    add_light(light_ptr3);
    
    PointLight* light_ptr4 = new PointLight;
	light_ptr4->set_location(0, 10, -10); 
	light_ptr4->scale_radiance(2.0); 
	light_ptr4->set_shadows(true); 
    add_light(light_ptr4);

		
	// sphere
	// this is the only reflective object with a direct illumination shading component
	
	Reflective* reflective_ptr1 = new Reflective;			
	reflective_ptr1->set_ka(0.1); 
	reflective_ptr1->set_kd(0.4); 
	reflective_ptr1->set_cd(0, 0, 1);   	 // blue
	reflective_ptr1->set_ks(0.25);
	reflective_ptr1->set_exp(100.0);
	reflective_ptr1->set_kr(0.85); 
	reflective_ptr1->set_cr(0.75, 0.75, 1);  // blue 
	
	Sphere*	sphere_ptr1 = new Sphere(Point3D(0, 0.5, 0), 4); 
	sphere_ptr1->set_material(reflective_ptr1);
	add_object(sphere_ptr1);
		
	
	// the walls, the ceiling, and the floor of the room are defined as planes
	// the shape is a cube
	
	double room_size = 11.0;
	
	// floor  (-ve yw)
	
	Matte* matte_ptr1 = new Matte;
	matte_ptr1->set_ka(0.1);   
	matte_ptr1->set_kd(0.50);
	matte_ptr1->set_cd(0.25);     // medium grey
	
	Plane* floor_ptr = new Plane(Point3D(0, -room_size,  0), Normal(0, 1, 0));
	floor_ptr->set_material(matte_ptr1);        
	add_object(floor_ptr);
	
	
	// ceiling  (+ve yw)
	
	Matte* matte_ptr2 = new Matte;   
	matte_ptr2->set_ka(0.35);   
	matte_ptr2->set_kd(0.50);
	matte_ptr2->set_cd(white);
	
	Plane* ceiling_ptr = new Plane(Point3D(0, room_size,  0), Normal(0, -1, 0));
	ceiling_ptr->set_material(matte_ptr2);        
	add_object(ceiling_ptr);
	
	
	// back wall  (-ve zw)
	
	Matte* matte_ptr3 = new Matte;
	matte_ptr3->set_ka(0.15); 
	matte_ptr3->set_kd(0.60);
	matte_ptr3->set_cd(0.5, 0.75, 0.75);     // cyan
	
//.........这里部分代码省略.........
开发者ID:matthiascy,项目名称:crocus-raytracer,代码行数:101,代码来源:BuildFigure25.10(b).cpp


示例18: TPhotonMap

/*
 * Fun flux analysis
 */
void FluxAnalysis::RunFluxAnalysis( QString nodeURL, QString surfaceSide, unsigned long nOfRays, bool increasePhotonMap, int heightDivisions, int widthDivisions )
{
	m_surfaceURL = nodeURL;
	m_surfaceSide = surfaceSide;

	//Delete a photonCounts
	if( m_photonCounts && m_photonCounts != 0 )
	{
		for( int h = 0; h < m_heightDivisions; h++ )
		{
			delete[] m_photonCounts[h];
		}

		delete[] m_photonCounts;
	}
	m_photonCounts = 0;
	m_heightDivisions = heightDivisions;
	m_widthDivisions = widthDivisions;

	//Check if there is a scene
	if ( !m_pCurrentScene )  return;

	//Check if there is a transmissivity defined
	TTransmissivity* transmissivity = 0;
	if ( !m_pCurrentScene->getPart( "transmissivity", false ) )	transmissivity = 0;
	else
		transmissivity = static_cast< TTransmissivity* > ( m_pCurrentScene->getPart( "transmissivity", false ) );

	//Check if there is a rootSeparator InstanceNode
	if( !m_pRootSeparatorInstance ) return;

	InstanceNode* sceneInstance = m_pRootSeparatorInstance->GetParent();
	if ( !sceneInstance )  return;

	//Check if there is a light and is properly configured
	if ( !m_pCurrentScene->getPart( "lightList[0]", false ) )return;
	TLightKit* lightKit = static_cast< TLightKit* >( m_pCurrentScene->getPart( "lightList[0]", false ) );

	InstanceNode* lightInstance = sceneInstance->children[0];
	if ( !lightInstance ) return;

	if( !lightKit->getPart( "tsunshape", false ) ) return;
	TSunShape* sunShape = static_cast< TSunShape * >( lightKit->getPart( "tsunshape", false ) );

	if( !lightKit->getPart( "icon", false ) ) return;
	TLightShape* raycastingSurface = static_cast< TLightShape * >( lightKit->getPart( "icon", false ) );

	if( !lightKit->getPart( "transform" ,false ) ) return;
	SoTransform* lightTransform = static_cast< SoTransform * >( lightKit->getPart( "transform" ,false ) );

	//Check if there is a random generator is defined.
	if( !m_pRandomDeviate || m_pRandomDeviate== 0 )	return;

	//Check if the surface and the surface side defined is suitable
	if( CheckSurface() == false || CheckSurfaceSide() == false ) return;

	//Create the photon map where photons are going to be stored
	if( !m_pPhotonMap  || !increasePhotonMap )
	{
		if( m_pPhotonMap ) 	m_pPhotonMap->EndStore( -1 );
		delete m_pPhotonMap;
		m_pPhotonMap = new TPhotonMap();
		m_pPhotonMap->SetBufferSize( HUGE_VAL );
		m_tracedRays = 0;
		m_wPhoton = 0;
		m_totalPower = 0;
	}

	QVector< InstanceNode* > exportSuraceList;
	QModelIndex nodeIndex = m_pCurrentSceneModel->IndexFromNodeUrl( m_surfaceURL );
	if( !nodeIndex.isValid()  )	return;

	InstanceNode* surfaceNode = m_pCurrentSceneModel->NodeFromIndex( nodeIndex );
	if( !surfaceNode || surfaceNode == 0 )	return;
	exportSuraceList.push_back( surfaceNode );

	//UpdateLightSize();
	TSeparatorKit* concentratorRoot = static_cast< TSeparatorKit* >( m_pCurrentScene->getPart( "childList[0]", false ) );
	if ( !concentratorRoot )	return;

	SoGetBoundingBoxAction* bbAction = new SoGetBoundingBoxAction( SbViewportRegion() ) ;
	concentratorRoot->getBoundingBox( bbAction );

	SbBox3f box = bbAction->getXfBoundingBox().project();
	delete bbAction;
	bbAction = 0;

	BBox sceneBox;
	if( !box.isEmpty() )
	{
		sceneBox.pMin = Point3D( box.getMin()[0], box.getMin()[1], box.getMin()[2] );
		sceneBox.pMax = Point3D( box.getMax()[0], box.getMax()[1], box.getMax()[2] );
		if( lightKit ) lightKit->Update( sceneBox );
	}

	m_pCurrentSceneModel->UpdateSceneModel();

//.........这里部分代码省略.........
开发者ID:iat-cener,项目名称:tonatiuh,代码行数:101,代码来源:FluxAnalysis.cpp


示例19: AreaLighting

void 												
World::build(void) {
	int num_samples = 64;
	
	vp.set_hres(600);
	vp.set_vres(600);
	vp.set_samples(num_samples);
		
	tracer_ptr = new AreaLighting(this);

	background_color = RGBColor(0.5,0.5,0.5);
		
	AmbientOccluder* ambient_occluder_ptr = new AmbientOccluder;
	ambient_occluder_ptr->set_sampler(new MultiJittered(num_samples));
	ambient_occluder_ptr->set_min_amount(0.5);
	set_ambient_light(ambient_occluder_ptr);

			
	Pinhole* pinhole_ptr = new Pinhole;
	pinhole_ptr->set_eye(100, 45, 100);  
	pinhole_ptr->set_lookat(-10, 40, 0);  
	pinhole_ptr->set_view_distance(400);  
	pinhole_ptr->compute_uvw(); 
	set_camera(pinhole_ptr);
	
	
	Directional* light_ptr3 = new Directional;
	light_ptr3->set_direction(150, 50, -50);   
	light_ptr3->scale_radiance(4.0); 
	light_ptr3->set_color(1.0, 0.25, 0.0);  // orange
	light_ptr3->set_shadows(true);
	add_light(light_ptr3);

	
	Emissive* emissive_ptr = new Emissive;
	emissive_ptr->scale_radiance(0.90);
	emissive_ptr->set_ce(1.0, 1.0, 0.5); 	// yellow
		
	//ConcaveSphere* sphere_ptr = new ConcaveSphere;
	//sphere_ptr->set_radius(1000000.0);
	//sphere_ptr->set_material(emissive_ptr);
	//sphere_ptr->set_shadows(false);
	//add_object(sphere_ptr);
	
	EnvironmentLight* environment_light_ptr = new EnvironmentLight;
	environment_light_ptr->set_material(emissive_ptr);
	environment_light_ptr->set_sampler(new MultiJittered(num_samples));
	environment_light_ptr->set_shadows(true);
	add_light(environment_light_ptr);
	
	
	float ka = 0.2;  // commom ambient reflection coefficient
	
	// large sphere
		
	Matte* matte_ptr1 = new Matte;			
	matte_ptr1->set_ka(ka); 
	matte_ptr1->set_kd(0.60);
	matte_ptr1->set_cd(0.75);
	
	Sphere* sphere_ptr1 = new Sphere(Point3D(38, 20, -24), 20);
	sphere_ptr1->set_material(matte_ptr1);
	add_object(sphere_ptr1);
	
	
	// small sphere
	
	Matte* matte_ptr2 = new Matte;			
	matte_ptr2->set_ka(ka); 
	matte_ptr2->set_kd(0.5);
	matte_ptr2->set_cd(0.85);
	
	Sphere* sphere_ptr2 = new Sphere(Point3D(34, 12, 13), 12);
	sphere_ptr2->set_material(matte_ptr2);
	add_object(sphere_ptr2);
	
	
	// medium sphere
	
	Matte* matte_ptr3 = new Matte;			
	matte_ptr3->set_ka(ka); 
	matte_ptr3->set_kd(0.5);
	matte_ptr3->set_cd(0.75);
	
	Sphere* sphere_ptr3 = new Sphere(Point3D(-7, 15, 42), 16);
	sphere_ptr3->set_material(matte_ptr3);
	add_object(sphere_ptr3);
	
	
	// cylinder
	//
	//Matte* matte_ptr4 = new Matte;			
	//matte_ptr4->set_ka(ka); 
	//matte_ptr4->set_kd(0.5);
	//matte_ptr4->set_cd(0.60);
	//
	//float bottom 	= 0.0;
	//float top 		= 85; 
	//float radius	= 22;
	//SolidCylinder* cylinder_ptr = new SolidCylinder(bottom, top, radius);
//.........这里部分代码省略.........
开发者ID:matthiascy,项目名称:crocus-raytracer,代码行数:101,代码来源:build5.cpp


示例20: tan

int step_trace_ray::execute
	( const pair & frame_fragment, ray_tracer & rt ) const {

	int current_frame = frame_fragment.first;
	int current_fragment = frame_fragment.second;

	// Consume
	std::vector<Primitive*> scene;
	std::vector<Primitive*> static_scene = rt.static_scene;
	std::vector<Luminaire*> luminaires = rt.luminaires;
	std::vector<Primitive*> dynamic_scene;
	rt.dynamic_scene.get(current_frame, dynamic_scene);

	scene.insert(scene.end(), static_scene.begin(), static_scene.end());
	scene.insert(scene.end(), dynamic_scene.begin(), dynamic_scene.end());

	std::vector<Point2D*> points;
	rt.pixel_locations.get(pair(current_frame, current_fragment), points);

	// Execute

	double duration;
	std::clock_t start = std::clock();
	std::vector<Pixel*> pixels;

	double invWidth = 1/((double)rt.image_width);
	double invHeight = 1/((double)rt.image_height);
	int smaller = std::min(rt.image_width, rt.image_height);

	double fov = 30;

	double aspectratio = rt.image_width/((double)rt.image_height);
	double angle = tan(3.141592653589793 * 0.5 * fov / 180.0);

	for(int ij = 0; ij < points.size(); ij++) {
		double x = (double)points[ij]->i;
		double y = (double)points[ij]->j;
		double nSamp1D = sqrt(rt.number_pixel_samples);
		double duvSamp = 1.0/nSamp1D;
		Multispectral3D superSample = Multispectral3D();
		for(int i = 0; i < nSamp1D; ++i) {
			for(int j = 0; j < nSamp1D; ++j) {
				double u = x + (i + 0.5 * duvSamp)/smaller;
				double v = y + (j + 0.5 * duvSamp)/smaller;
				double xx = (2 * (u * invWidth) - 1) * angle * aspectratio;
				double yy = (1 - 2 * (v * invHeight)) * angle;
				Vector3D raydir = Vector3D(xx, yy, -1).normalize();
				Ray3D ray = Ray3D(Point3D(), raydir, NULL, 0);
				superSample = superSample + trace(ray, scene, luminaires);
			}
		}
		Multispectral3D rgb = superSample / rt.number_pixel_samples;
		pixels.push_back(new Pixel(points[ij]->i,points[ij]->j,rgb.r,rgb.g,rgb.b));
	}

	duration = ( std::clock() - start ) / (double) CLOCKS_PER_SEC;

	// Produce
	rt.pixels.put(pair(current_frame, current_fragment), pixels);
	rt.execution_time.put(pair(current_frame, current_fragment), duration);



  return CnC::CNC_Success;
};
开发者ID:baskarang,项目名称:icnc,代码行数:65,代码来源:raytracer.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Point3F函数代码示例发布时间:2022-05-30
下一篇:
C++ Point3函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap