1 ## Copyright (C) 2005-2012 Etienne Grossmann <etienne@egdn.net>
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
16 ## s = vrml_DirectionalLight (...) - Vrml DirectionalLight node
18 ## s is a string of the form :
19 ## ------------------------------------------------------------------
21 ## exposedField SFFloat ambientIntensity 0 # [0,1]
22 ## exposedField SFColor color 1 1 1 # [0,1]
23 ## exposedField SFVec3f direction 0 0 -1 # (-,)
24 ## exposedField SFFloat intensity 1 # [0,1]
25 ## exposedField SFBool on TRUE
27 ## ------------------------------------------------------------------
30 ## All the fields of the node
32 ## See also : vrml_PointLight
34 function s = vrml_DirectionalLight (varargin) # pos 2.1.39
39 hash = setfield(hash,varargin{k:k+1});
42 tpl = struct ("ambientIntensity", "%8.3f",\
43 "intensity", "%8.3f",\
44 "direction", "%8.3f",\
46 "color", "%8.3f %8.3f %8.3f");
51 if !(isnumeric(val) && isnan (val)),
53 # Check validity of field
54 if !isfield (tpl, key)
55 error (sprintf ("vrml_PointLight : unknown field '%s'",key));
59 sprintf(" %-20s %s\n",key,
60 sprintf(getfield (tpl,key), val))];
63 s = sprintf ("DirectionalLight { \n%s}\n", body);