⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 light.html

📁 java 3d帮助文档
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Sun Jun 23 01:50:29 PDT 2002 --><TITLE>Light (Java 3D API)</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"></HEAD><SCRIPT>function asd(){parent.document.title="Light (Java 3D API)";}</SCRIPT><BODY BGCOLOR="white" onload="asd();"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../../javax/media/j3d/Leaf.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../javax/media/j3d/LinearFog.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="Light.html" TARGET="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<SCRIPT>  <!--  if(window==top) {    document.writeln('<A HREF="../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');  }  //--></SCRIPT><NOSCRIPT><A HREF="../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.media.j3d</FONT><BR>Class  Light</H2><PRE>java.lang.Object  |  +--<A HREF="../../../javax/media/j3d/SceneGraphObject.html">javax.media.j3d.SceneGraphObject</A>        |        +--<A HREF="../../../javax/media/j3d/Node.html">javax.media.j3d.Node</A>              |              +--<A HREF="../../../javax/media/j3d/Leaf.html">javax.media.j3d.Leaf</A>                    |                    +--<B>javax.media.j3d.Light</B></PRE><DL><DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../javax/media/j3d/AmbientLight.html">AmbientLight</A>, <A HREF="../../../javax/media/j3d/DirectionalLight.html">DirectionalLight</A>, <A HREF="../../../javax/media/j3d/PointLight.html">PointLight</A></DD></DL><HR><DL><DT>public abstract class <B>Light</B><DT>extends <A HREF="../../../javax/media/j3d/Leaf.html">Leaf</A></DL><P>The Light leaf node is an abstract class that defines a set of  parameters common to all types of light.  These parameters include the light color, an enable flag, and a region of influence in which this Light node is active. A Light node also contains a list of Group nodes that specifies the hierarchical scope of this Light.  If the scope list is empty,  the Light node has universe scope: all nodes within the region of influence are affected by this Light node.  If the scope list is non-empty, only those Leaf nodes under the Group nodes in the scope list are affected by this Light node (subject to the influencing bounds). <p> The light in a scene may come from several light sources that can be individually defined. Some of the light in a scene may come from a specific direction, known as a directional light, from a specific position, known as a point light, or from no particular direction or source as with ambient light. <p> Java 3D supports an arbitrary number of lights. However, the number of lights that can be active within the region of influence is implementation-dependent and cannot be defined here. <p> <b>Light Color</b> <p> The Java 3D lighting model approximates the way light works in the real world. Light is defined in terms of the red, green, and  blue components that combine to create the light color. The three color components represent the amount of light emitted by the source. <p> Each of the three colors is represented by a floating point value that ranges from 0.0 to 1.0. A combination of the three colors such as (1.0, 1.0, 1.0), representing the red, green, and blue color values respectively, creates a white light with maximum brightness. A combination such as (0.0, 0.0, 0.0) creates no light (black). Values between the minimum and maximum values of the range produce corresponding brightness and colors. For example, a combination of (0.5, 0.5, 0.5) produces a 50% grey light. A combination of (1.0, 1.0, 0.0), red and green but no blue, produces a yellow light. <p> If a scene has multiple lights and all lights illuminate an object, the effect of the light on the object is the sum of the  lights. For example, in a scene with two lights, if the first  light emits (R<sub>1</sub>, G<sub>1</sub>, B<sub>1</sub>) and  the second light emits (R<sub>2</sub>, G<sub>2</sub>,  B<sub>2</sub>), the components are added together giving  (R<sub>1</sub>+R<sub>2</sub>, G<sub>1</sub>+G<sub>2</sub>,  B<sub>1</sub>+B<sub>2</sub>). If the sums of any of the color values is greater than 1.0, brighter than the maximum brightness permitted, the color value is clamped to 1.0. <p> <b>Material Colors</b> <p> In the Java 3D lighting model, the light sources have an effect on the scene only when there are object surfaces to absorb or reflect the light. Java 3D approximates an object's color by calculating the percentage of red, green, and blue light the object reflects. An object with a surface color of pure green absorbs all of the red and blue light that strikes it and reflects all of the green light. Viewing the object in a white light, the green color is reflected and you see a green object. However, if the green object is viewed in a red light, all of the red light is absorbed and the object appears black. <p> The surface of each object in the scene has certain material properties that define how light affects its appearance. The object might reflect light in various ways,  depending on the object's surface type. The object might even emit its own light. The Java 3D lighting model specifies  these material properties as five independent components: emitted color, ambient color, diffuse color, specular color, and shininess. All of these properties are computed independently, then added  together to define how the surface of the object appears under light (an exception is Ambient light, which does not contribute  to specular reflection). The material properties are defined  in the Material class. <p> <b>Influencing Bounds</b> <p> Since a scene may be quite large, as large as the universe for example, it is often reasonable to limit the influence of lighting to a region that is within viewing range. There is no reason to waste all that computing power on illuminating objects that are too far away to be viewed. In Java 3D, the influencing bounds is defined by a Bounds object or a BoundingLeaf object. It should be noted that a BoundingLeaf object overrides a Bounds object, should both objects be set. <p> A Bounds object represents a convex, closed volume. Bounds defines three different types of containing  volumes: an axis-aligned-box volume, a spherical volume, and a  bounding polytope. A BoundingLeaf object also specifies a region of influence, but allows an application to specify a bounding  region in one coordinate system (the local coordinate system of  the BoundingLeaf node) other than the local coordinate system of the node that references the bounds (the Light). <p> <b>Limiting the Scope</b> <p> In addition to limiting the lighting calculations to a given region of a scene, lighting can also be limited to groups of nodes, defined by a Group object. This is known as "scoping." All nodes attached to a Group node define a <i>list of scopes</i>. Methods in the Light class permit the setting, addition, insertion,  removal, and enumeration of nodes in the list of scopes. <p> <b>Two-sided Lighting of Polygons</b> <p> Java 3D performs lighting calculations for all polygons, whether they are front-facing or back-facing. Since most polygon objects are constructed with the front face in mind, the back-facing portion may not be correctly illuminated. For example, a sphere with part of the face cut away so you can see its inside. You might want to have the inside surface lit as well as the outside surface and you mught also want to define a different Material description to reduce shininess, specular color, etc. <p> For more information, see the "Face culling" and "Back-facing normal flip" descriptions in the PolygonAttributes class description. <p> <b>Turning on the Lights</b> <p> Lighting needs to be explicitly enabled with the setEnable method or with the lightOn parameter in the constructor before any of the child light sources have any effect on illuminating the scene. The child lights may also be enabled or disabled individually. <p> If lighting is not enabled, the current color of an object in the scene is simply mapped onto the object, and none of the lighting equations regarding Material properties, such as ambient  color, diffuse color, specular color, and shininess, are performed. However, an object's emitted color, if specified and enabled, will still affect that object's appearance. <p> To disable lighting, call setEnable with <code>false</code> as the argument.<P><P><DL><DT><B>See Also:</B><DD><A HREF="../../../javax/media/j3d/Material.html"><CODE>Material</CODE></A>, <A HREF="../../../javax/media/j3d/Bounds.html"><CODE>Bounds</CODE></A>, <A HREF="../../../javax/media/j3d/BoundingLeaf.html"><CODE>BoundingLeaf</CODE></A>, <A HREF="../../../javax/media/j3d/Group.html"><CODE>Group</CODE></A>, <A HREF="../../../javax/media/j3d/PolygonAttributes.html"><CODE>PolygonAttributes</CODE></A></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Light.html#ALLOW_COLOR_READ">ALLOW_COLOR_READ</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Specifies that this Light allows read access to its color information at runtime.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Light.html#ALLOW_COLOR_WRITE">ALLOW_COLOR_WRITE</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Specifies that this Light allows write access to its color information at runtime.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Light.html#ALLOW_INFLUENCING_BOUNDS_READ">ALLOW_INFLUENCING_BOUNDS_READ</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Specifies that this Light allows read access to its influencing bounds and bounds leaf information.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Light.html#ALLOW_INFLUENCING_BOUNDS_WRITE">ALLOW_INFLUENCING_BOUNDS_WRITE</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Specifies that this Light allows write access to its influencing bounds and bounds leaf information.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -