pro mggrlightmodel::getProperty
compile_opt strictarr
end
pro mggrlightmodel::setProperty
compile_opt strictarr
end
pro mggrlightmodel::cleanup
compile_opt strictarr
self->idlgrmodel::cleanup
end
function mggrlightmodel::init, _extra=e
compile_opt strictarr
if (~self->IDLgrModel::init(_strict_extra=e)) then return, 0B
ambient = obj_new('IDLgrLight', type=0, name='ambient', intensity=0.2)
self->add, ambient
directional1 = obj_new('IDLgrLight', type=2, location=[-1.0, 1.0, 1.0], $
name='directional1', intensity=0.5)
self->add, directional1
directional2 = obj_new('IDLgrLight', type=2, location=[0.0, 0.0, 1.0], $
name='directional2', intensity=0.3)
self->add, directional2
return, 1B
end
pro mggrlightmodel__define
compile_opt strictarr
define = { MGgrLightModel, inherits IDLgrModel }
end
view = obj_new('IDLgrView', color=[0, 0, 0])
lightmodel = obj_new('MGgrLightModel')
view->add, lightmodel
model = obj_new('IDLgrModel')
view->add, model
surf = obj_new('IDLgrSurface', hanning(20, 20), style=2, $
color=[255, 0, 0], bottom=[100, 0, 0])
model->add, surf
surf->getProperty, xrange=xr, yrange=yr, zrange=zr
xc = mg_linear_function(xr, [-0.6, 0.6])
yc = mg_linear_function(yr, [-0.6, 0.6])
zc = mg_linear_function(zr, [-0.6, 0.6])
surf->setProperty, xcoord_conv=xc, ycoord_conv=yc, zcoord_conv=zc
model->rotate, [1, 0, 0], -90
model->rotate, [0, 1, 0], -45
model->rotate, [1, 0, 0], 35
win = obj_new('IDLgrWindow', dimensions=[400, 400], graphics_tree=view)
win->draw
end