[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9.6.5 Several light sample
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Light(true); gr->Light(1,mglPoint(0,1,0),'c'); gr->Light(2,mglPoint(1,0,0),'y'); gr->Light(3,mglPoint(0,-1,0),'m'); gr->Box(); gr->Surf(a,"h");
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 light on light 1 0 1 0 'c' light 2 1 0 0 'y' light 3 0 -1 0 'm' box surf a 'h'
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_add_light_rgb(gr,1,0.,1.,0.,1, 0.,1.,1.,0.5); mgl_add_light_rgb(gr,2,1.,0.,0.,1, 1.,1.,0.,0.5); mgl_add_light_rgb(gr,3,0.,-1.,0.,1, 1.,0.,1.,0.5); mgl_box(gr,1); mgl_surf(gr,a,"h"); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_add_light_rgb(gr,1,0.,1.,0.,1, 0.,1.,1.,0.5) call mgl_add_light_rgb(gr,2,1.,0.,0.,1, 1.,1.,0.,0.5) call mgl_add_light_rgb(gr,3,0.,-1.,0.,1, 1.,0.,1.,0.5) call mgl_box(gr,1) call mgl_surf(gr,a,'h') call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Light(True); gr.AddLight(1,0,1,0,"c"); gr.AddLight(2,1,0,0,"y"); gr.AddLight(3,0,-1,0,"m"); gr.Box(); gr.Surf(a,"h")