Revolving Door for Academic A & B

From CS486wiki
Revision as of 15:08, 28 May 2012 by Core (talk | contribs)
(change visibility) (diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

== Project Development ==


Applications Used:

-Google SketchUp Google SketchUp was used to create 3D model of a revolving door in order to use it in the module. Created model exported as .dae (Collada file extension) file format and added under the ../art directory of the module.

-NetBeans 7.1 NetBeans used as development environment and the module is developed in Java.

Prerequisites (Development)

-Open wonderland source code or libraries to develop open wonderland modules

-NetBeans IDE and Ant-Apache

-Ant-Apache is used to build the module

Prerequisites (To run the module)

-A running open wonderland server

-Scripting-component module on the server

Development Process

Coding

The module is developed in Java using NetBeans 7.1 IDE. The project has 5 packages which 3 of them comes by default when developing an open wonderland module. Remaining 2 package is added for other capabilities of the module. In the following part you can find packages and the source code of the module;

1. Client Package In the client package you will find 3 classes which 2 of them comes by default when developing open wonderland module. For this project the full name of the package is “org.jdesktop.wonderland.modules.RevolvingDoorVirtualBU.client”.

   a.	RevolvingDoorVirtualBUCell.java: This class is used to set and initialize the client side state. In this part of the code, the cell id that will be used in open wonderland world that represents the module is set here. As the scripting component module is used in the 
   project, scripting component instance is created in here and initialization is made in this part. Also the cell renderer for the module is also set and initialized here.
   b.	RevolvingDoorVirtualBUCellFactory.java: This class comes by default when developing open wonderland module. This part of the code initiates the default server and client states. Other properties are set in this part of the code. These are the module name and thumbnail picture 
   that appears in the “Insert->Object” menu on the open wonderland client window.
   c.	RevolvingDoorVirtualBUInit.java: This part of the code is added manually. In this section as 3D model is used in the module the properties of the model is set here. The name of the model, repository that the model will be fetched, default scale of the model, and angles 
   that will the model will be shown to the client is set here.

2. Renderer Package In the renderer package you will find only one class that is added to load and show the repository that the module is held.

   a.	RevolviingDoorVirtualBURenderer.java: In this part of the code, the model is added to cell as a node that is initialized in the “RevolvingDoorVirtualBUCell.java” part of the code. The module is retrieved from the repository in this case from ../Resources directory of the 
   module. After the model is retrieved from resources, the model loader method is called and the model is loaded to client screen. 

3. Common Package

This package comes by default when developing open wonderland module. There are 3 classes which 2 of them comes by default; the other one is created to update client and server states for the module.

   a.	RevolvingDoorVirtualBUCellClientState.java: This class sets the client state of the module.
   b.	RevolvingDoorVirtualBUCellServerState.java: This class sets the server state of the module.
   c.	TypeChangeMessage.java: This class is constructor for the method that loads the module model.

4. Server Package

This package controls the module. Loading and deleting module needs to be controlled and both server and client states must be updated and this is controlled by this part of the code. Necessary notifications to both server and to all client about this module is made in this part. This part of the code comes by default; the only thing that must be done here is to change the name of the methods to the module’s name.

5. Scripting

This part is not a package but it is used in the module. Scripting in Open Wonderland modules enables a user to execute simple scripts on objects. With scripting the revolving door model is rotated with the module. Scripts can be loaded manually after starting a client and adding scripting property to an object or as this module uses, script is embedded into a module. In this module the script that is executed by mouse clicks is used. The script is written into “mouse1.js” file and added to module resources. Every time a mouse click is made, this script is called. Script rotates the module 360 degrees on the clockwise.

     var v = new java.lang.Runnable()
     {
           run: function()
                 { 
                      increment = (Math.PI/2)/90;
                      for(i = 0; i <= 360; i++)
                      {
                            MyClass.rotateObject(0, 1, 0, (increment), 0);
                            MyClass.mySleep(30);
                      }
                  }
     }
    t = new java.lang.Thread(v);
    t.start();


== How to run Module ==


After uploading the RevolvingDoorVirtualBU.jar on the server, it can be loaded by clicking “Insert-> Object” on the client window.



Tugce Ozturk