Source Code Cross Referenced for DefaultNodeConstructors.java in  » 6.0-JDK-Modules » java-3d » org » jdesktop » j3dedit » scenegrapheditor » nodeeditors » 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.j3dedit.scenegrapheditor.nodeeditors 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  $Header: /cvs/j3dfly/J3dEditor/src/org/jdesktop/j3dedit/scenegrapheditor/nodeeditors/DefaultNodeConstructors.java,v 1.1 2005/04/20 22:20:59 paulby Exp $
003:         *
004:         *                         Sun Public License Notice
005:         *
006:         *  The contents of this file are subject to the Sun Public License Version
007:         *  1.0 (the "License"). You may not use this file except in compliance with
008:         *  the License. A copy of the License is available at http://www.sun.com/
009:         *  
010:         *  The Original Code is the Java 3D(tm) Scene Graph Editor.
011:         *  The Initial Developer of the Original Code is Paul Byrne.
012:         *  Portions created by Paul Byrne are Copyright (C) 2002.
013:         *  All Rights Reserved.
014:         *  
015:         *  Contributor(s): Paul Byrne.
016:         *  
017:         **/
018:        package org.jdesktop.j3dedit.scenegrapheditor.nodeeditors;
019:
020:        import javax.media.j3d.Appearance;
021:        import javax.media.j3d.BoundingSphere;
022:        import javax.vecmath.Point3d;
023:        import javax.vecmath.Point3f;
024:        import javax.vecmath.Quat4f;
025:
026:        import com.sun.j3d.utils.behaviors.mouse.*;
027:        import com.sun.j3d.utils.behaviors.interpolators.RotPosScaleTCBSplinePathInterpolator;
028:        import com.sun.j3d.utils.behaviors.interpolators.TCBKeyFrame;
029:        import com.sun.j3d.utils.behaviors.interpolators.KBRotPosScaleSplinePathInterpolator;
030:        import com.sun.j3d.utils.behaviors.interpolators.KBKeyFrame;
031:
032:        /**
033:         * Provides default constructors for nodes which must have parameters
034:         * during construction
035:         *
036:         * @author Paul Byrne
037:         * @version	1.10, 01/18/02
038:         */
039:        public class DefaultNodeConstructors extends Object {
040:
041:            public static com.sun.j3d.utils.geometry.Box constructBox() {
042:                return new com.sun.j3d.utils.geometry.Box(
043:                        1.0f,
044:                        1.0f,
045:                        1.0f,
046:                        com.sun.j3d.utils.geometry.Primitive.GENERATE_NORMALS
047:                                | com.sun.j3d.utils.geometry.Primitive.GENERATE_TEXTURE_COORDS
048:                                | com.sun.j3d.utils.geometry.Primitive.ENABLE_APPEARANCE_MODIFY,
049:                        new Appearance());
050:            }
051:
052:            public static com.sun.j3d.utils.geometry.Sphere constructSphere() {
053:                return new com.sun.j3d.utils.geometry.Sphere(
054:                        1.0f,
055:                        com.sun.j3d.utils.geometry.Primitive.GENERATE_NORMALS
056:                                | com.sun.j3d.utils.geometry.Primitive.GENERATE_TEXTURE_COORDS
057:                                | com.sun.j3d.utils.geometry.Primitive.ENABLE_APPEARANCE_MODIFY,
058:                        new Appearance());
059:            }
060:
061:            public static com.sun.j3d.utils.geometry.Cylinder constructCylinder() {
062:                return new com.sun.j3d.utils.geometry.Cylinder(
063:                        1.0f,
064:                        1.0f,
065:                        com.sun.j3d.utils.geometry.Primitive.GENERATE_NORMALS
066:                                | com.sun.j3d.utils.geometry.Primitive.GENERATE_TEXTURE_COORDS
067:                                | com.sun.j3d.utils.geometry.Primitive.ENABLE_APPEARANCE_MODIFY,
068:                        new Appearance());
069:            }
070:
071:            public static com.sun.j3d.utils.geometry.Cone constructCone() {
072:                return new com.sun.j3d.utils.geometry.Cone(
073:                        1.0f,
074:                        1.0f,
075:                        com.sun.j3d.utils.geometry.Primitive.GENERATE_NORMALS
076:                                | com.sun.j3d.utils.geometry.Primitive.GENERATE_TEXTURE_COORDS
077:                                | com.sun.j3d.utils.geometry.Primitive.ENABLE_APPEARANCE_MODIFY,
078:                        new Appearance());
079:            }
080:
081:            public static javax.media.j3d.AmbientLight constructAmbientLight() {
082:                javax.media.j3d.AmbientLight light = new javax.media.j3d.AmbientLight();
083:                light.setInfluencingBounds(new BoundingSphere(new Point3d(),
084:                        Double.POSITIVE_INFINITY));
085:                return light;
086:            }
087:
088:            public static javax.media.j3d.SpotLight constructSpotLight() {
089:                javax.media.j3d.SpotLight light = new javax.media.j3d.SpotLight();
090:                light.setInfluencingBounds(new BoundingSphere(new Point3d(),
091:                        Double.POSITIVE_INFINITY));
092:                return light;
093:            }
094:
095:            public static javax.media.j3d.PointLight constructPointLight() {
096:                javax.media.j3d.PointLight light = new javax.media.j3d.PointLight();
097:                light.setInfluencingBounds(new BoundingSphere(new Point3d(),
098:                        Double.POSITIVE_INFINITY));
099:                return light;
100:            }
101:
102:            public static javax.media.j3d.DirectionalLight constructDirectionalLight() {
103:                javax.media.j3d.DirectionalLight light = new javax.media.j3d.DirectionalLight();
104:                light.setInfluencingBounds(new BoundingSphere(new Point3d(),
105:                        Double.POSITIVE_INFINITY));
106:                return light;
107:            }
108:
109:            public static com.sun.j3d.utils.behaviors.mouse.MouseRotate constructMouseRotate() {
110:                MouseRotate rotate = new MouseRotate();
111:                rotate.setSchedulingBounds(new BoundingSphere(new Point3d(),
112:                        Double.POSITIVE_INFINITY));
113:                return rotate;
114:            }
115:
116:            public static com.sun.j3d.utils.behaviors.mouse.MouseZoom constructMouseZoom() {
117:                MouseZoom rotate = new MouseZoom();
118:                rotate.setSchedulingBounds(new BoundingSphere(new Point3d(),
119:                        Double.POSITIVE_INFINITY));
120:                return rotate;
121:            }
122:
123:            public static com.sun.j3d.utils.behaviors.mouse.MouseTranslate constructMouseTranslate() {
124:                MouseTranslate rotate = new MouseTranslate();
125:                rotate.setSchedulingBounds(new BoundingSphere(new Point3d(),
126:                        Double.POSITIVE_INFINITY));
127:                return rotate;
128:            }
129:
130:            public static javax.media.j3d.RotationInterpolator constructRotationInterpolator() {
131:                javax.media.j3d.RotationInterpolator rot = new javax.media.j3d.RotationInterpolator(
132:                        new javax.media.j3d.Alpha(),
133:                        new javax.media.j3d.TransformGroup());
134:                rot.setSchedulingBounds(new BoundingSphere(new Point3d(),
135:                        Double.POSITIVE_INFINITY));
136:                return rot;
137:            }
138:
139:            public static javax.media.j3d.PositionPathInterpolator constructPositionPathInterpolator() {
140:                float[] knots = new float[2];
141:                knots[0] = 0f;
142:                knots[1] = 1.0f;
143:                javax.vecmath.Point3f[] points = new javax.vecmath.Point3f[2];
144:                points[0] = new javax.vecmath.Point3f();
145:                points[1] = new javax.vecmath.Point3f();
146:
147:                javax.media.j3d.PositionPathInterpolator posPath = new javax.media.j3d.PositionPathInterpolator(
148:                        new javax.media.j3d.Alpha(),
149:                        new javax.media.j3d.TransformGroup(),
150:                        new javax.media.j3d.Transform3D(), knots, points);
151:                posPath.setSchedulingBounds(new BoundingSphere(new Point3d(),
152:                        Double.POSITIVE_INFINITY));
153:                return posPath;
154:            }
155:
156:            public static com.sun.j3d.utils.behaviors.interpolators.RotPosScaleTCBSplinePathInterpolator constructRotPosScaleTCBSplinePathInterpolator() {
157:
158:                TCBKeyFrame[] keyFrames = new TCBKeyFrame[2];
159:                keyFrames[0] = new TCBKeyFrame(0f, // Knot
160:                        0, // Linear
161:                        new Point3f(0f, 0f, 0f), // Pos
162:                        new Quat4f(), // Quat
163:                        new Point3f(), // Scale
164:                        0f, // Tension
165:                        0f, // Continuity
166:                        0f); // Bias
167:                keyFrames[1] = new TCBKeyFrame(1f, // Knot
168:                        0, // Linear
169:                        new Point3f(1f, 1f, 1f), // Pos
170:                        new Quat4f(), // Quat
171:                        new Point3f(), // Scale
172:                        0f, // Tension
173:                        0f, // Continuity
174:                        0f); // Bias
175:
176:                RotPosScaleTCBSplinePathInterpolator interp = new RotPosScaleTCBSplinePathInterpolator(
177:                        new javax.media.j3d.Alpha(),
178:                        new javax.media.j3d.TransformGroup(),
179:                        new javax.media.j3d.Transform3D(), keyFrames);
180:                interp.setSchedulingBounds(new BoundingSphere(new Point3d(),
181:                        Double.POSITIVE_INFINITY));
182:                return interp;
183:
184:            }
185:
186:            public static com.sun.j3d.utils.behaviors.interpolators.KBRotPosScaleSplinePathInterpolator constructKBRotPosScaleSplinePathInterpolator() {
187:
188:                KBKeyFrame[] keyFrames = new KBKeyFrame[2];
189:                keyFrames[0] = new KBKeyFrame(0f, // Knot
190:                        0, // Linear
191:                        new Point3f(0f, 0f, 0f), // Pos
192:                        0, // heading
193:                        0, // Pitch
194:                        0, // Bank
195:                        new Point3f(1f, 1f, 1f), // Scale
196:                        0, // tension
197:                        0, // continuity
198:                        0); // bias
199:                keyFrames[1] = new KBKeyFrame(1f, // Knot
200:                        0, // Linear
201:                        new Point3f(1f, 1f, 1f), // Pos
202:                        0, // heading
203:                        0, // Pitch
204:                        0, // Bank
205:                        new Point3f(1f, 1f, 1f), // Scale
206:                        0, // tension
207:                        0, // continuity
208:                        0); // bias
209:
210:                KBRotPosScaleSplinePathInterpolator interp = new KBRotPosScaleSplinePathInterpolator(
211:                        new javax.media.j3d.Alpha(),
212:                        new javax.media.j3d.TransformGroup(),
213:                        new javax.media.j3d.Transform3D(), keyFrames);
214:                interp.setSchedulingBounds(new BoundingSphere(new Point3d(),
215:                        Double.POSITIVE_INFINITY));
216:                return interp;
217:
218:            }
219:
220:            public static javax.media.j3d.PointSound constructPointSound() {
221:                javax.media.j3d.PointSound sound = new javax.media.j3d.PointSound();
222:                sound.setSoundData(new javax.media.j3d.MediaContainer());
223:                sound.setSchedulingBounds(new BoundingSphere(new Point3d(),
224:                        Double.POSITIVE_INFINITY));
225:
226:                return sound;
227:            }
228:
229:            public static javax.media.j3d.BackgroundSound constructBackgroundSound() {
230:                javax.media.j3d.BackgroundSound sound = new javax.media.j3d.BackgroundSound();
231:                sound.setSoundData(new javax.media.j3d.MediaContainer());
232:                sound.setSchedulingBounds(new BoundingSphere(new Point3d(),
233:                        Double.POSITIVE_INFINITY));
234:
235:                return sound;
236:            }
237:
238:            public static javax.media.j3d.LinearFog constructLinearFog() {
239:                // Fog distances are in eye space, which has an approximate scale
240:                // factor of 0.17
241:                javax.media.j3d.LinearFog fog = new javax.media.j3d.LinearFog(
242:                        1f, 1f, 1f, 529, 589);
243:                fog.setInfluencingBounds(new BoundingSphere(new Point3d(),
244:                        Double.POSITIVE_INFINITY));
245:
246:                return fog;
247:            }
248:
249:            public static javax.media.j3d.Background constructBackground() {
250:                // Fog distances are in eye space, which has an approximate scale
251:                // factor of 0.17
252:                javax.media.j3d.Background background = new javax.media.j3d.Background();
253:                background.setApplicationBounds(new BoundingSphere(
254:                        new Point3d(), Double.POSITIVE_INFINITY));
255:
256:                return background;
257:            }
258:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.