_sys:addPath('res')_dofile('cameracontrol.lua')fog = _Fog.new()fog.near, fog.far, fog.color = 20, 70, _Color.DarkGreen_rd.bgColor = fog.color_rd.camera.eye = _Vector3.new(50, 50, 50)_rd:useLight(_AmbientLight.new())_rd:useLight(_SkyLight.new())pp = _ParticlePlayer.new()pp:play('pfx_env_huoba.pfx', _Matrix3D.new():setTranslation(20, 0, 0))pp:play('pfx_env_huoba.pfx', _Matrix3D.new():setTranslation(-20, 0, 0))pp:play('pfx_env_huoba.pfx', _Matrix3D.new():setTranslation(0, 20, 0))pp:play('pfx_env_huoba.pfx', _Matrix3D.new():setTranslation(0, -20, 0))teapot = _mf:createTeapot()teapot.transform:setScaling(5, 5, 5)mats = {}mats[1] = _Matrix3D.new():setTranslation(20, 20, 0)mats[2] = _Matrix3D.new():setTranslation(-20, 20, 0)mats[3] = _Matrix3D.new():setTranslation(20, -20, 0)mats[4] = _Matrix3D.new():setTranslation(-20, -20, 0)font = _Font.new('Arial', 10)font.textColor = _Color.Yellowdistance = fog.far - fog.nearfunction newfog() fog.far = distance + fog.near _rd:popFog() _rd:useFog(fog)end_app:onKeyDown(function(key) if key == _System.KeyW then if fog.near < 100 then fog.near = fog.near + 2 newfog() end elseif key == _System.KeyS then if fog.near > 0 then fog.near = fog.near - 2 newfog() end elseif key == _System.KeyE then if distance < 100 then distance = distance + 2 newfog() end elseif key == _System.KeyD then if distance > 0 then distance = distance - 2 newfog() end endend)_rd:useFog(fog)_app:onIdle(function(e) font:drawText(0, 0, 'Press WS to adjust fog near') font:drawText(0, 14, 'Press ED to adjust fog far') for i = 1, 4 do _rd:pushMatrix3D(mats[i]) teapot:drawMesh() _rd:popMatrix3D() end _rd:drawAxis(100)end)