|
|
The three-dimensional graphics techniques in the system implements OpenGL library. OpenGL supplies a lot of graphics commands, which produce very impressive 3D objects. This project also provides a script language for users to design their simulation models. They can use simple object-definition statements to create objects with polygons, boxes and other elements, then incorporate them with certain behaviors for them to move or act. After loading a script file into the system, users can execute the scenario and watch the system perform an animated simulation. Users can also modify the behaviors of the objects until they serve the purpose of the model.
Since the composition of an object is object-based,
the architecture of the project should be object-oriented. This project
is developed under Microsoft Visual C++ 4.0. It uses Visual C++ and
Microsoft Foundation Class (MFC) to design the major application architecture
and user interface, implements the object classes and functions using C++,
and invokes OpenGL commands and C functions to display three-dimensional
objects and perform animation and interaction.
|
|
|
|
|
|
|
|
Scene begin Object begin ID TestObject Time_Interval 0 Rotate 0.00, 0.00, 0.00 Translate 0.00, 0.00, 0.00 Move 0.00, 0.00, 0.00 Circle 0.00, 0.00, 0.00 Scale 1.00 Box begin Color 1.00, 0.00, 0.00 Rotate 0.00, 0.00, 0.00 Translate 5.00, 0.00, 0.00 Width 2.00 Height 1.00 Depth 1.00 end Polygon begin Color 0.00, 0.00, 1.00 Rotate 0.00, 0.00, 0.00 Translate 5.00, 0.00, 0.00 Vertex -2.00, 5.00, 0.00 Vertex 2.00, 5.00, 0.00 Vertex 2.00, 10.00, 0.00 end ... end end |
|
| Source Codes | Execute |
|
|
|
|
class C3DObject
{
protected:
C3DElementNode *current, *last;
...
public: // Object Properties CString ID; long timeInterval, currentTime; float rX, rY, rZ; // Object Rotation float tX, tY, tZ; // Object Translation float s; // Object Scale float mX, mY, mZ; // Object Movement float cX, cY, cZ; // Object Circling Movement float mX, mY, mZ; // Object Movement float cX, cY, cZ; // Object Circling Movement int nElement; C3DElementNode *theElements; public: ... }; |
class C3DElement
{
...
virtual void Draw () {};
};
class C3DPolygon: public C3DElement
{ ... void Draw (); }; class C3DBox: public C3DElement
// Polymorphism
polygon = * ((C3DPolygon*) element);
|
|
|
|
|
|
|
|
|
|
|
|
|
| Primary Adviosr: | Dr. Ehab Hassanein |
| Secondary Advisor: | Dr. Hubert Kordylewski |
| Student: | Jin-Ghee Lu (Gene) |
| Date: | May 4, 1998 |
|
|
| The Official OpenGL Site | |
| The VRML Consortium Site | |
| Silicon Graphics Inc. | |
| Microsoft's What is DirectX? | |
| The SGI's Open Inventor Site |
|
|