📄 node.html
字号:
<!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 Thu Nov 27 13:54:35 EET 2003 -->
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>
Node (Mobile 3D Graphics API (M3G))
</TITLE>
<META NAME="keywords" CONTENT="javax.microedition.m3g.Node,Node class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title="Node (Mobile 3D Graphics API (M3G))";
}
</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> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Node.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<EM><B>Nov 19, 2003</B></EM></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../javax/microedition/m3g/MorphingMesh.html"><B>PREV CLASS</B></A>
<A HREF="../../../javax/microedition/m3g/Object3D.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>
<A HREF="Node.html" TARGET="_top"><B>NO FRAMES</B></A>
<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: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
javax.microedition.m3g</FONT>
<BR>
Class Node</H2>
<PRE>
java.lang.Object
|
+--<A HREF="../../../javax/microedition/m3g/Object3D.html">javax.microedition.m3g.Object3D</A>
|
+--<A HREF="../../../javax/microedition/m3g/Transformable.html">javax.microedition.m3g.Transformable</A>
|
+--<B>javax.microedition.m3g.Node</B>
</PRE>
<DL>
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../javax/microedition/m3g/Camera.html">Camera</A>, <A HREF="../../../javax/microedition/m3g/Group.html">Group</A>, <A HREF="../../../javax/microedition/m3g/Light.html">Light</A>, <A HREF="../../../javax/microedition/m3g/Mesh.html">Mesh</A>, <A HREF="../../../javax/microedition/m3g/Sprite3D.html">Sprite3D</A></DD>
</DL>
<HR>
<DL>
<DT>public abstract class <B>Node</B><DT>extends <A HREF="../../../javax/microedition/m3g/Transformable.html">Transformable</A></DL>
<P>
<p>An abstract base class for all scene graph nodes.</p><p>There are five different kinds of nodes:</p><ul><li><A HREF="../../../javax/microedition/m3g/Camera.html"><CODE>Camera</CODE></A> defines the projection from 3D to 2D, as well as the position of the viewer in the scene.</li><li><A HREF="../../../javax/microedition/m3g/Mesh.html"><CODE>Mesh</CODE></A> defines a 3D object, consisting of triangles with associated material properties.</li><li><A HREF="../../../javax/microedition/m3g/Sprite3D.html"><CODE>Sprite3D</CODE></A> defines a screen-aligned 2D image with a position in 3D space.</li><li><A HREF="../../../javax/microedition/m3g/Light.html"><CODE>Light</CODE></A> defines the position, direction, color and other attributes of a light source.</li><li><A HREF="../../../javax/microedition/m3g/Group.html"><CODE>Group</CODE></A> serves as a root for scene graph branches.</li></ul><h3>Node transformation</h3><p>Each node defines a local coordinate system that can be transformedrelative to the coordinate system of the parent node. The transformation<i>from</i> the local coordinate system of a node <i>to</i> the coordinatesystem of its parent is called the <i>node transformation</i>.</p><p>The node transformation consists of four parts: a generic matrix<b>M</b>, a non-uniform scale <b>S</b>, an orientation <b>R</b> and atranslation <b>T</b>. The bottom row of <b>M</b> must be equal to (0 00 1). The methods to manipulate the individual components are definedin the base class, <A HREF="../../../javax/microedition/m3g/Transformable.html">Transformable</A>.</p><p>To transform a point from a node's local coordinates to itsparent's coordinates, the point is multiplied by the transformationcomponents in the order that they are listed above. Formally, ahomogeneous vector <b>p</b> = (x, y, z, 1), representing a 3D point inthe local coordinate system, is transformed into <b>p</b>' = (x', y',z', 1) in the parent coordinate system as follows:</p><blockquote><b>p</b>' = <b>T</b> <b>R</b> <b>S</b> <b>M</b> <b>p</b></blockquote><p>The translation, orientation and scale components of the nodetransformation can be animated independently from each other. Thematrix component is not animatable at all; it can only be changedusing the <code>setTransform</code> method.</p><h3>Node alignment</h3><p>A node may be <i>aligned</i> with respect to a selected <i>referencenode</i> (or nodes). This means that the aligned node is, upon request,automatically oriented so that its coordinate system matches the referencenode's coordinate system in the specified way. A common use case for nodealignment is to create "billboards" that are always facing the camera;another is to make the camera always point at a certain object.</p><p>When a node is aligned, its original orientation component <b>R</b> isoverwritten with an aligned orientation <b>A</b>. (The aligned orientationis computed as specified below, in the Implementation Guidelines section.)The other components of the node transformation are not affected byalignment. The transformation from the local coordinate system of analigned node to its parent node's coordinate system is, therefore,</p><blockquote><b>p</b>' = <b>T</b> <b>A</b> <b>S</b> <b>M</b> <b>p</b></blockquote><p>The application must explicitly call the <code>align</code> method ona node (or any of its ancestors) when it requires the alignments of thatnode and its descendants to be computed. This is typically done once perframe, before rendering. Rendering operations do not resolve any alignments;they simply use whatever orientation each node has at that time. The sameholds true for <code>getTransformTo</code> and any other methods whoseresults depend on the orientation.</p><p>The alignment reference node(s) and the method of alignment are selectedwith <code>setAlignment</code>. This does not yet compute the new alignedorientation, but merely specifies how that is to be done. Optionally, thereference node may be left unspecified (null) until when <code>align</code>is called; the reference node is then supplied as a parameter to<code>align</code>. This is very useful for billboards, because otherwisethe application would have to call <code>setAlignment</code> separately forevery billboard in the scene whenever the camera is changed.</p><h3>Inherited node properties</h3><p>Besides the node transformation, there are three node propertieswhose effective values are in some manner influenced by the ancestorsof each node. These properties are the alpha factor, the rendering enableflag, and the picking enable flag.</p><p>The <i>alpha factor</i> allows (groups of) Mesh objects to be fadedin and out in a convenient way, provided that certain preconditionsrelated to their Appearance are met. The alpha factor is defined foreach Node, and its value is between [0, 1]. The effective alpha factorfor a Mesh is obtained by multiplying its local alpha factor with thealpha factors of its ancestors.</p><p>When rendering a Mesh, its effective alpha factor is multipliedwith the alpha component of the diffuse color in each of the Materialobjects associated with that Mesh. In absence of a Material object,the alpha factor is applied to the VertexBuffer color array (ifpresent) or the default color. This implies, for example, that thealpha factor has no effect on submeshes using the <code>REPLACE</code>texture blending mode. The alpha factor is also ignored for Light,Sprite3D and Camera nodes.</p><p>The <i>enable flags</i> for rendering and picking allow (groups of)mesh and sprite objects to be made "invisible" from the point of viewof rendering and picking, respectively. The effective enable status ofa node is the logical AND of the enable flags on that node and all itsancestors. Therefore, setting the enable flag of a node to <i>true</i>does not guarantee that the node will be rendered or picked. Rather, ifany of its ancestors are disabled, the node will be ignored regardlessof its own enable flag.</p><p>Note that the scope of a Node is <i>not</i> an inherited property;see below for more information.</p><h3><a name="Scoping">Scoping</a></h3><p>The <i>scope</i> of a Node is an integer bitmask that allows scene graphnodes to form conceptual groups independent of the scene graph hierarchy. Inother words, nodes that are in a particular Group are not necessarily in thesame scope. Formally, two nodes A and B are defined to be in the same scopeif the bitwise AND of their scopes is non-zero:</p><blockquote>scope<sub>A</sub> & scope<sub>B</sub> != 0</blockquote><p>Scopes are not hierarchic in any way. In particular, the scope ofa Group or SkinnedMesh node is not propagated to or inherited by itschildren. After all, scopes are intended to be separate from the scenehierarchy.</p><p>Scoping serves three purposes:</p><ul><p><li><b>Visibility culling</b>. Only those objects are renderedthat are in the same scope as the Camera. This gives an additionalmeans to control the set of visible objects, complementary to therendering enable flag.</li></p><p><li><b>Lighting</b>. A light source only has an effect on Meshes that arein the same scope with it. This makes it possible to have a very largenumber of light sources in a scene graph without having all the lightsilluminate all meshes. Besides being impractical, that would also beprohibitively expensive in terms of processing power.</li></p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -