Goal4D:  Java Real-time 3D Engine Ανδρέας Ανδρέου http:// andyhot . di . uoa . gr [email_address]
Features <ul><li>Java 1.1 compatible </li></ul><ul><li>Full screen, windowed, applet mode </li></ul><ul><li>Υποστήριξη πολ...
Screenshots
Screenshots
Screenshots
Screenshots
3D Basics <ul><li>Scene </li></ul><ul><ul><li>Objects </li></ul></ul><ul><ul><ul><li>Vertices </li></ul></ul></ul><ul><ul>...
3D Engine <ul><li>Διαχείριση πόρων ( objects, textures, faces, vertices ) </li></ul><ul><li>Προσδιορισμός Ορατότητας  ( αν...
Rasterization <ul><li>Διαδικασία απεικόνισης πολυγώνου στην οθόνη με χρήση των vertices  που το αποτελούν </li></ul><ul><l...
Goal4D <ul><li>Πρώτη έκδοση (2001) </li></ul><ul><ul><li>1 πακέτο </li></ul></ul><ul><ul><li>7 κλάσεις </li></ul></ul><ul>...
Packages 1/2
Packages 2/2
Sample Code <ul><li>Surface surface = Surface.createSurface(320, 200, this);  </li></ul><ul><li>Scene3D scene = new Scene3...
Sequence Diagram
Pre - Post Process 1/2 <ul><li>Υλοποίηση της διεπαφής  Filter </li></ul><ul><ul><li>void setScreen(Screen3D screen);  </li...
Pre - Post Process 2/2
Rasterizers <ul><li>Υλοποίηση της διεπαφής  Rasterizer </li></ul><ul><ul><li>void setScreen(Screen3D screen);  </li></ul><...
Scripting  1/2 <ul><li>Υλοποίηση της διεπαφής  Scriptable </li></ul><ul><ul><li>String showFolderContents (String extensio...
Scripting  2/2 <ul><li>Εντολές:  </li></ul><ul><ul><li>help clear cls quit history for postprocess preprocess usebsp switc...
Development Process <ul><li>Build tools </li></ul><ul><li>IDE </li></ul><ul><li>CVS </li></ul><ul><li>Test  </li></ul><ul>...
Build Tools <ul><li>Ant </li></ul><ul><ul><li>http://ant.apache.org/ </li></ul></ul><ul><ul><li>Τα κάνει όλα! </li></ul></...
IDE <ul><li>Intellij IDEA </li></ul><ul><ul><li>http://www.jetbrains.com/ </li></ul></ul><ul><ul><li>Refactorings </li></u...
CVS <ul><li>Server </li></ul><ul><ul><li>CvsNt ( http://www.cvsnt.com/cvspro/ ) </li></ul></ul><ul><li>Client </li></ul><u...
Test <ul><li>JUnit ( http://www.junit.org/index. htm ) </li></ul>
Code Coverage <ul><li>Clover ( http://www.cenqua.com/clover/ ) </li></ul><ul><li>Emma ( http://emma.sourceforge.net/ ) </l...
Dependencies <ul><li>JDepend ( http://www.clarkware.com/software/JDepend.html ) </li></ul><ul><ul><li>Number of Classes an...
Obfuscators <ul><li>yguard ( www.yworks.com/en/products_yguard_about.htm ) </li></ul><ul><ul><li><obfuscate mainclass=&quo...
Profiling <ul><li>JProfiler ( http://www.ej-technologies.com/ ) </li></ul><ul><ul><li>Memory Views </li></ul></ul><ul><ul>...
JProfiler 1/4
JProfiler 2/4
JProfiler 3/4
JProfiler 4/4
OpenGL Java Bindings <ul><li>GL4Java ( http://www.jausoft.com/gl4java.html ) </li></ul><ul><li>YAJOGLB ( http://home.earth...
Εφαρμογές <ul><li>Terrain Editor ( http://andyhot.di.uoa.gr:8080/Java/terrain/terrain.html ) </li></ul><ul><li>Chess Viewe...
Upcoming SlideShare
Loading in …5
×

Goal4d

3,144 views

Published on

Presentation on Goal4D - a java 3d engine (java1.1-applet compatible) i used to have fun with some 10 years ago

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,144
On SlideShare
0
From Embeds
0
Number of Embeds
1,940
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Συνήθως εδώ είναι το bottleneck, επειδή καλείται συνεχώς. Αναφορά σε quake και M. Abrash που έκανε ακριβως αυτό το κομματι σε optimized assembly.
  • Goal4d

    1. 1. Goal4D: Java Real-time 3D Engine Ανδρέας Ανδρέου http:// andyhot . di . uoa . gr [email_address]
    2. 2. Features <ul><li>Java 1.1 compatible </li></ul><ul><li>Full screen, windowed, applet mode </li></ul><ul><li>Υποστήριξη πολλών 3 d-format (md2, md3, dff, 3ds, obj, bsp, DM) </li></ul><ul><li>Υποστήριξη προοδευτικών πλεγμάτων ( VIPM ) </li></ul><ul><li>Keyframe και skeletal based animation </li></ul><ul><li>Directional και point lights </li></ul><ul><li>Ambient, diffuse, specular lighting - Χρώμα 24 bit </li></ul><ul><li>Affine, perspective correct texturing </li></ul><ul><li>Wireframe, gouraud, environment mapping, light mapping </li></ul><ul><li>Εξειδικευμένη διαχείριση terrain, bsp, billboard, skybox </li></ul><ul><li>Bounding volumes </li></ul><ul><li>Post και pre processing effects </li></ul><ul><li>Υποσύστημα scripting </li></ul><ul><li>3D Studio Max Exporter </li></ul>
    3. 3. Screenshots
    4. 4. Screenshots
    5. 5. Screenshots
    6. 6. Screenshots
    7. 7. 3D Basics <ul><li>Scene </li></ul><ul><ul><li>Objects </li></ul></ul><ul><ul><ul><li>Vertices </li></ul></ul></ul><ul><ul><ul><li>Faces </li></ul></ul></ul><ul><ul><ul><li>Textures </li></ul></ul></ul><ul><ul><li>Lights </li></ul></ul><ul><ul><li>Cameras </li></ul></ul>
    8. 8. 3D Engine <ul><li>Διαχείριση πόρων ( objects, textures, faces, vertices ) </li></ul><ul><li>Προσδιορισμός Ορατότητας ( ανά object και face) </li></ul><ul><li>Σκιές και άλλα εφέ </li></ul><ul><li>Πολλαπλοί τρόποι απεικόνισης ( texture, bump, normal mapping ) </li></ul><ul><li>Importers/Exporters </li></ul><ul><li>Μετασχηματισμοί </li></ul><ul><ul><li>Model To World </li></ul></ul><ul><ul><li>World To Camera </li></ul></ul><ul><ul><li>Camera To Perspective </li></ul></ul><ul><li>Rasterization </li></ul>
    9. 9. Rasterization <ul><li>Διαδικασία απεικόνισης πολυγώνου στην οθόνη με χρήση των vertices που το αποτελούν </li></ul><ul><li>Γίνεται interpolation των γνωρισμάτων των δεδομένων vertices ( βάθος, φωτισμός, texture, normals, e.t.c.) </li></ul>
    10. 10. Goal4D <ul><li>Πρώτη έκδοση (2001) </li></ul><ul><ul><li>1 πακέτο </li></ul></ul><ul><ul><li>7 κλάσεις </li></ul></ul><ul><li>Τρέχουσα έκδοση </li></ul><ul><ul><li>24 πακέτα !!! </li></ul></ul><ul><ul><li>199 κλάσεις !!! </li></ul></ul><ul><ul><li>10 διεπαφές </li></ul></ul><ul><ul><li>40665 γραμμές κώδικα (35387 SLOC) </li></ul></ul><ul><ul><li>2159 γραμμές javadoc </li></ul></ul>
    11. 11. Packages 1/2
    12. 12. Packages 2/2
    13. 13. Sample Code <ul><li>Surface surface = Surface.createSurface(320, 200, this); </li></ul><ul><li>Scene3D scene = new Scene3D(surface); </li></ul><ul><li>// create simple camera </li></ul><ul><li>Camera3D camera3D = new SimpleCamera(80, 45, 45); </li></ul><ul><li>scene.setCamera(camera3D); </li></ul><ul><li>// add light </li></ul><ul><li>Light3D lightOne = new Light3D(0.5, 0.5, 0.7071); </li></ul><ul><li>scene.addLight(lightOne); </li></ul><ul><li>// add material </li></ul><ul><li>Material3D mat = new Material3D(); </li></ul><ul><li>mat.setTexture(img); </li></ul><ul><li>scene.addMaterial(mat); </li></ul><ul><li>// create a rasterizer for this scene </li></ul><ul><li>Rasterizer rast = new WireframeRenderer(); </li></ul><ul><li>rast.setScreen(scene); </li></ul>// add object with its own rasterizer Object3D obj = PolygonObjectFactory.createPyramid(); obj.initRelatives(); obj.setMaterial(mat); obj.setRenderer(rast); scene.addObject(obj); // init the scene scene.init(); // and for each iteration of your game, // render and draw the scene scene.render(); getGraphics().drawImage(surface.getImage(), 0, 0, null);
    14. 14. Sequence Diagram
    15. 15. Pre - Post Process 1/2 <ul><li>Υλοποίηση της διεπαφής Filter </li></ul><ul><ul><li>void setScreen(Screen3D screen); </li></ul></ul><ul><ul><li>void process(Screen3D screen); </li></ul></ul><ul><li>Χρήση στην μηχανή με: </li></ul><ul><ul><li>scene.setPostProcessor(Filter postProcessor) </li></ul></ul><ul><ul><li>scene.setPreProcessor(Filter preProcessor) </li></ul></ul><ul><li>28 έτοιμα φίλτρα: </li></ul><ul><ul><li>PseudoColorFilter HighPassFilter LowPassFilter StereoFilter EdgeFilter SepiaFilter OilFilter RadialBlurFilter MotionBlurFilter </li></ul></ul>
    16. 16. Pre - Post Process 2/2
    17. 17. Rasterizers <ul><li>Υλοποίηση της διεπαφής Rasterizer </li></ul><ul><ul><li>void setScreen(Screen3D screen); </li></ul></ul><ul><ul><li>void render(Rasterizable object); </li></ul></ul><ul><li>Χρήση στην μηχανή με: </li></ul><ul><ul><li>object3D.setRenderer(Rasterizer renderable) </li></ul></ul><ul><li>2 9 έτοιμοι rasterizers </li></ul><ul><li>Άρχειο template σε Velocity ( http://jakarta.apache.org/velocity/ ) για την συγγραφή νέων </li></ul>
    18. 18. Scripting 1/2 <ul><li>Υλοποίηση της διεπαφής Scriptable </li></ul><ul><ul><li>String showFolderContents (String extension, String folder); </li></ul></ul><ul><ul><li>Image getImage(String name); </li></ul></ul><ul><ul><li>InputStream getStream(String name) throws IOException; </li></ul></ul><ul><ul><li>MediaTracker getMediaTracker(); </li></ul></ul><ul><li>Δημιουργία αντικειμένου ScriptEngine </li></ul><ul><ul><li>ScriptEngine(Scene3D sc, Scriptable parent) </li></ul></ul>
    19. 19. Scripting 2/2 <ul><li>Εντολές: </li></ul><ul><ul><li>help clear cls quit history for postprocess preprocess usebsp switch save camera rotate scale info gouraudmap nprmap dir test load animate render texture environ skydome cube pyramid tree </li></ul></ul><ul><li>Παράδειγμα: </li></ul><ul><ul><li>scriptEngine.parseString(“pyramid”); scriptEngine.parseString(“texture 0 world.jpg”); </li></ul></ul>
    20. 20. Development Process <ul><li>Build tools </li></ul><ul><li>IDE </li></ul><ul><li>CVS </li></ul><ul><li>Test </li></ul><ul><li>Code Coverage </li></ul><ul><li>Dependencies </li></ul><ul><li>Obfuscator </li></ul><ul><li>Profiling </li></ul><ul><li>OpenGL bindings </li></ul><ul><li>Εφαρμογές </li></ul>
    21. 21. Build Tools <ul><li>Ant </li></ul><ul><ul><li>http://ant.apache.org/ </li></ul></ul><ul><ul><li>Τα κάνει όλα! </li></ul></ul><ul><ul><li>compile, copy, backup, javadoc, zip, jar, war, ftp, cvs </li></ul></ul><ul><ul><li>IDE integration </li></ul></ul><ul><ul><li>Tools integration </li></ul></ul>
    22. 22. IDE <ul><li>Intellij IDEA </li></ul><ul><ul><li>http://www.jetbrains.com/ </li></ul></ul><ul><ul><li>Refactorings </li></ul></ul>
    23. 23. CVS <ul><li>Server </li></ul><ul><ul><li>CvsNt ( http://www.cvsnt.com/cvspro/ ) </li></ul></ul><ul><li>Client </li></ul><ul><ul><li>jCVS ( http://www.jcvs.org/ ) </li></ul></ul>
    24. 24. Test <ul><li>JUnit ( http://www.junit.org/index. htm ) </li></ul>
    25. 25. Code Coverage <ul><li>Clover ( http://www.cenqua.com/clover/ ) </li></ul><ul><li>Emma ( http://emma.sourceforge.net/ ) </li></ul><ul><ul><li>java -cp emma.jar emmarun -r html –jar goal4d.jar </li></ul></ul>
    26. 26. Dependencies <ul><li>JDepend ( http://www.clarkware.com/software/JDepend.html ) </li></ul><ul><ul><li>Number of Classes and Interfaces </li></ul></ul><ul><ul><li>Afferent Couplings (Ca) </li></ul></ul><ul><ul><li>Efferent Couplings (Ce) </li></ul></ul><ul><ul><li>Abstractness (A) </li></ul></ul><ul><ul><li>Instability (I) : I = Ce / (Ce + Ca) </li></ul></ul><ul><ul><li>Distance from the Main Sequence (D) : A + I = 1 </li></ul></ul><ul><ul><li>Package Dependency Cycles </li></ul></ul>
    27. 27. Obfuscators <ul><li>yguard ( www.yworks.com/en/products_yguard_about.htm ) </li></ul><ul><ul><li><obfuscate mainclass=&quot;andyhot.chess.pgnview.PgnView&quot; logfile=&quot;${dist.pgnviewer.dest.dir}/obf.log&quot; replaceclassnamestrings=&quot;true&quot;> <inoutpair in=&quot;${dist.dir}/pgnView.jar“ out=&quot;${dist.dir}/pgnViewO.jar&quot;/> <expose> <class> <patternset> <include name=&quot;andyhot.chess.pgnview.PgnView&quot;/> </patternset> </class> </expose> </obfuscate> </li></ul></ul>
    28. 28. Profiling <ul><li>JProfiler ( http://www.ej-technologies.com/ ) </li></ul><ul><ul><li>Memory Views </li></ul></ul><ul><ul><ul><li>Class monitor </li></ul></ul></ul><ul><ul><ul><li>Allocations monitor </li></ul></ul></ul><ul><ul><li>CPU Views </li></ul></ul><ul><ul><ul><li>Invocation tree </li></ul></ul></ul><ul><ul><ul><li>Hot spots </li></ul></ul></ul>
    29. 29. JProfiler 1/4
    30. 30. JProfiler 2/4
    31. 31. JProfiler 3/4
    32. 32. JProfiler 4/4
    33. 33. OpenGL Java Bindings <ul><li>GL4Java ( http://www.jausoft.com/gl4java.html ) </li></ul><ul><li>YAJOGLB ( http://home.earthlink.net/%7erzeh/YAJOGLB/doc/YAJOGLB.html ) </li></ul><ul><li>JOGL ( https://jogl.dev.java.net/ ) </li></ul><ul><li>Άλλα ( http://www.opengl.org/resources/java/ ) </li></ul>
    34. 34. Εφαρμογές <ul><li>Terrain Editor ( http://andyhot.di.uoa.gr:8080/Java/terrain/terrain.html ) </li></ul><ul><li>Chess Viewer ( http://andyhot.di.uoa.gr:8080/Java/pgnViewer3D/index.html ) </li></ul>

    ×