Report

Eriq Muhammad Adams J. [email protected] Informatics Engineering University of Brawijaya Agenda Hello JMonkeyEngine 3.0 3D Math Scenegraph Hello JMonkeyEngine 3.0 (cont.) You can extends com.jme3.app.SimpleApplication to build JMonkey apps. SimpleApplication provide us default camera input. simpleInitApp() is used for game initialization. to start app you can call start() from your main(). rootNode is top node in JME scenegraph. Lets look the code at jme3test.helloworld.HelloJME http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_simpleapplication Hello JMonkeyEngine 3.0 (cont.) Hello JMonkeyEngine 3.0 (cont.) Extends SimpleApplication Start application Initialization (resources creation ) 3D Math JME uses right-handed coordinated system (as OpenGL does). Coordinate defined as com.jme3.math.Vector3f (x,y,z) Origin coordinate is (0,0,0) Unit measurement is wu (world unit), typically 1 wu is 1 meter. 3D Math (cont.) Transformation : operation that converts points from one coordinate system to another includes rotation, scaling, translation. Local transforms represent the positioning of objects relative to a parent coordinate system. Global transforms represent the positioning of objects in a global coordinate system. JME 3.0 provide us low-level transformation functionality. 3D Math (cont.) Visibility Determination concerns itself with minimizing the amount of data that is sent to the graphics card for rendering. Not all data being sent to graphics card but data which we can see are being sent. Data not sent to is said to be culled. Fustrum Culling is the procedure for visibility determination. The BoundingVolume of an object is tested against the frustum planes to determine if it is contained in the frustum. If at any point the object's bounding is outside of the plane, it is tossed out and no longer processed for rendering. 3D Math (cont.) View Fustrum Culling : the process of removing objects that lie completely outside the viewing frustum from the rendering process (wikipedia) 3D Math (cont.) Fundamental Types in JME 3.0 : ColorRGBA, Matrix (Matrix 3f, Matrix4f), Vector (Vector2f, Vector3f). ColorRGBA defines a color value (red, green, blue, alpha). Matrix typically used as linear transformations (scale, rotate, translate) to map vectors to vectors. Matrix3f is a 3×3 matrix and is the most commonly used (able to handle scaling and rotating), while Matrix4f is a 4×4 matrix that can also handle translation. 3D Math (cont.) Source : New Riders, Beginning Math and Physics for Game Programmers 3D Math (cont.) Vectors are used to represent a multitude of things in jME, points in space, vertices in a triangle mesh, normals, etc. These classes (Vector3f in particular) are probably the most used class in jME. Quaternions define a subset of a hyper complex number system. Quaternions are defined by (i2 = j2 = k2 = i j k = -1). jME makes use of Quaternions because they allow for compact representations of rotations, or correspondingly, orientations, in 3D space. With only four float values, we can represent an object's orientation, where a rotation matrix would require nine. They also require fewer arithmetic operations for concatenation. 3D Math (cont.) For more math tutorials in JME please learn JME math for dummies presentation at http://jmonkeyengine.org/wiki/doku.php/jme3:math_for_dummies Scenegraph Represents your 3D world. Object in JME scenegraph are called spatial. Scenegraph (cont.) Scenegraph (cont.) Scenegraph (cont.) Create Blue Cube Create Red Cube Create Node “Pivot” Attach blue & red cube to pivot node Rotate Pivot Node Scenegraph (cont.) Root Node Pivot Node Red Cube Blue Cube