Source Code Cross Referenced for PointLight.java in  » 6.0-JDK-Modules » java-3d » org » jdesktop » j3d » loaders » vrml97 » impl » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » java 3d » org.jdesktop.j3d.loaders.vrml97.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *      @(#)PointLight.java 1.17 98/11/05 20:34:53
003:         *
004:         * Copyright (c) 1996-1998 Sun Microsystems, Inc. All Rights Reserved.
005:         *
006:         * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
007:         * modify and redistribute this software in source and binary code form,
008:         * provided that i) this copyright notice and license appear on all copies of
009:         * the software; and ii) Licensee does not utilize the software in a manner
010:         * which is disparaging to Sun.
011:         *
012:         * This software is provided "AS IS," without a warranty of any kind. ALL
013:         * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
014:         * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
015:         * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
016:         * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
017:         * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
018:         * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
019:         * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
020:         * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
021:         * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
022:         * POSSIBILITY OF SUCH DAMAGES.
023:         *
024:         * This software is not designed or intended for use in on-line control of
025:         * aircraft, air traffic, aircraft navigation or aircraft communications; or in
026:         * the design, construction, operation or maintenance of any nuclear
027:         * facility. Licensee represents and warrants that it will not use or
028:         * redistribute the Software for such purposes.
029:         *
030:         * $Revision: 1.2 $
031:         * $Date: 2005/02/03 23:06:59 $
032:         * $State: Exp $
033:         */
034:        /*
035:         * @Author: Rick Goldberg
036:         * @Author: Doug Gehringer
037:         *
038:         */
039:        package org.jdesktop.j3d.loaders.vrml97.impl;
040:
041:        import javax.media.j3d.AmbientLight;
042:        import javax.media.j3d.BoundingSphere;
043:        import javax.media.j3d.Link;
044:
045:        import javax.media.j3d.SharedGroup;
046:        import javax.vecmath.Color3f;
047:        import javax.vecmath.Point3f;
048:
049:        /**  Description of the Class */
050:        public class PointLight extends Light {
051:
052:            SFFloat ambientIntensity;
053:            SFVec3f attenuation;
054:            SFColor color;
055:            SFFloat intensity;
056:            SFVec3f location;
057:            SFBool on;
058:            SFFloat radius;
059:
060:            Color3f lightColor;
061:            Point3f lightPos;
062:            Point3f lightAtt;
063:            BoundingSphere bounds;
064:            javax.media.j3d.PointLight pntLight;
065:
066:            /**
067:             *Constructor for the PointLight object
068:             *
069:             *@param  loader Description of the Parameter
070:             */
071:            public PointLight(Loader loader) {
072:                super (loader);
073:
074:                ambientIntensity = new SFFloat(0.0f);
075:                attenuation = new SFVec3f(1.0f, 0.0f, 0.0f);
076:                color = new SFColor(1.0f, 1.0f, 1.0f);
077:                intensity = new SFFloat(1.0f);
078:                location = new SFVec3f(0.0f, 0.0f, 0.0f);
079:                on = new SFBool(true);
080:                radius = new SFFloat(100f);
081:
082:                initFields();
083:            }
084:
085:            /**
086:             *Constructor for the PointLight object
087:             *
088:             *@param  loader Description of the Parameter
089:             *@param  ambientIntensity Description of the Parameter
090:             *@param  attenuation Description of the Parameter
091:             *@param  color Description of the Parameter
092:             *@param  intensity Description of the Parameter
093:             *@param  location Description of the Parameter
094:             *@param  on Description of the Parameter
095:             *@param  radius Description of the Parameter
096:             */
097:            PointLight(Loader loader, SFFloat ambientIntensity,
098:                    SFVec3f attenuation, SFColor color, SFFloat intensity,
099:                    SFVec3f location, SFBool on, SFFloat radius) {
100:
101:                super (loader);
102:                this .ambientIntensity = ambientIntensity;
103:                this .attenuation = attenuation;
104:                this .color = color;
105:                this .intensity = intensity;
106:                this .location = location;
107:                this .on = on;
108:                this .radius = radius;
109:
110:                initFields();
111:            }
112:
113:            /**  Description of the Method */
114:            void initImpl() {
115:                lightColor = new Color3f();
116:                lightPos = new Point3f();
117:                lightAtt = new Point3f();
118:                bounds = new BoundingSphere();
119:                bounds.setRadius((double) radius.value);
120:                sharedGroup = new SharedGroup();
121:                lightColor.x = color.color[0] * ambientIntensity.value;
122:                lightColor.y = color.color[1] * ambientIntensity.value;
123:                lightColor.z = color.color[2] * ambientIntensity.value;
124:                ambLight = new AmbientLight(on.value, lightColor);
125:                ambLight.setInfluencingBounds(bounds);
126:                sharedGroup.addChild(ambLight);
127:                lightColor.x = color.color[0] * intensity.value;
128:                lightColor.y = color.color[1] * intensity.value;
129:                lightColor.z = color.color[2] * intensity.value;
130:                lightPos.x = location.value[0];
131:                lightPos.y = location.value[1];
132:                lightPos.z = location.value[2];
133:                lightAtt.x = attenuation.value[0];
134:                lightAtt.y = attenuation.value[1];
135:                lightAtt.z = attenuation.value[2];
136:                light = pntLight = new javax.media.j3d.PointLight(on.value,
137:                        lightColor, lightPos, lightAtt);
138:                pntLight.setInfluencingBounds(bounds);
139:                sharedGroup.addChild(pntLight);
140:                implReady = true;
141:            }
142:
143:            /**
144:             *  Description of the Method
145:             *
146:             *@param  eventInName Description of the Parameter
147:             *@param  time Description of the Parameter
148:             */
149:            public void notifyMethod(String eventInName, double time) {
150:                if (eventInName.equals("AmbientIntensity")) {
151:                    lightColor.x = color.color[0] * ambientIntensity.value;
152:                    lightColor.y = color.color[1] * ambientIntensity.value;
153:                    lightColor.z = color.color[2] * ambientIntensity.value;
154:                    ambLight.setColor(lightColor);
155:                } else if (eventInName.equals("color")
156:                        || eventInName.equals("intensity")) {
157:                    lightColor.x = color.color[0] * ambientIntensity.value;
158:                    lightColor.y = color.color[1] * ambientIntensity.value;
159:                    lightColor.z = color.color[2] * ambientIntensity.value;
160:                    ambLight.setColor(lightColor);
161:                    lightColor.x = color.color[0] * intensity.value;
162:                    lightColor.y = color.color[1] * intensity.value;
163:                    lightColor.z = color.color[2] * intensity.value;
164:                    pntLight.setColor(lightColor);
165:                } else if (eventInName.equals("location")) {
166:                    lightPos.x = location.value[0];
167:                    lightPos.y = location.value[1];
168:                    lightPos.z = location.value[2];
169:                    pntLight.setPosition(lightPos);
170:                } else if (eventInName.equals("attenuation")) {
171:                    lightAtt.x = attenuation.value[0];
172:                    lightAtt.y = attenuation.value[1];
173:                    lightAtt.z = attenuation.value[2];
174:                    pntLight.setAttenuation(lightAtt);
175:                } else if (eventInName.equals("on")) {
176:                    ambLight.setEnable(on.value);
177:                    pntLight.setEnable(on.value);
178:                } else if (eventInName.equals("radius")) {
179:                    bounds.setRadius((double) radius.value);
180:                    ambLight.setInfluencingBounds(bounds);
181:                    pntLight.setInfluencingBounds(bounds);
182:                } else if (eventInName.equals("route_on")) {
183:                    ambLight
184:                            .setCapability(javax.media.j3d.Light.ALLOW_STATE_WRITE);
185:                    pntLight
186:                            .setCapability(javax.media.j3d.Light.ALLOW_STATE_WRITE);
187:                } else if (eventInName.equals("route_location")) {
188:                    pntLight
189:                            .setCapability(javax.media.j3d.PointLight.ALLOW_POSITION_WRITE);
190:                } else if (eventInName.equals("route_attenuation")) {
191:                    pntLight
192:                            .setCapability(javax.media.j3d.PointLight.ALLOW_ATTENUATION_WRITE);
193:                } else if (eventInName.equals("route_color")
194:                        || eventInName.equals("route_intensity")) {
195:                    ambLight
196:                            .setCapability(javax.media.j3d.Light.ALLOW_COLOR_WRITE);
197:                    pntLight
198:                            .setCapability(javax.media.j3d.Light.ALLOW_COLOR_WRITE);
199:                } else if (eventInName.equals("route_ambientIntensity")) {
200:                    ambLight
201:                            .setCapability(javax.media.j3d.Light.ALLOW_COLOR_WRITE);
202:                } else if (eventInName.equals("route_radius")) {
203:                    ambLight
204:                            .setCapability(javax.media.j3d.Light.ALLOW_INFLUENCING_BOUNDS_WRITE);
205:                    pntLight
206:                            .setCapability(javax.media.j3d.Light.ALLOW_INFLUENCING_BOUNDS_WRITE);
207:                }
208:            }
209:
210:            /**
211:             *  Description of the Method
212:             *
213:             *@return  Description of the Return Value
214:             */
215:            public Object clone() {
216:
217:                PointLight l = new PointLight(loader,
218:                        (SFFloat) ambientIntensity.clone(),
219:                        (SFVec3f) attenuation.clone(), (SFColor) color.clone(),
220:                        (SFFloat) intensity.clone(),
221:                        (SFVec3f) location.clone(), (SFBool) on.clone(),
222:                        (SFFloat) radius.clone());
223:                return l;
224:            }
225:
226:            /**
227:             *  Gets the type attribute of the PointLight object
228:             *
229:             *@return  The type value
230:             */
231:            public String getType() {
232:                return "PointLight";
233:            }
234:
235:            /**  Description of the Method */
236:            void initFields() {
237:                ambientIntensity.init(this , FieldSpec, Field.EXPOSED_FIELD,
238:                        "ambientIntensity");
239:                attenuation.init(this , FieldSpec, Field.EXPOSED_FIELD,
240:                        "attenuation");
241:                color.init(this , FieldSpec, Field.EXPOSED_FIELD, "color");
242:                intensity.init(this , FieldSpec, Field.EXPOSED_FIELD,
243:                        "intensity");
244:                location.init(this , FieldSpec, Field.EXPOSED_FIELD, "location");
245:                on.init(this , FieldSpec, Field.EXPOSED_FIELD, "on");
246:                radius.init(this , FieldSpec, Field.EXPOSED_FIELD, "radius");
247:            }
248:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.