DocProject/MainPageDoc.h

Go to the documentation of this file.
00001 #ifndef COM_M4NKIND_MAINPAGEDOC_H
00002 #define COM_M4NKIND_MAINPAGEDOC_H
00003 /*!
00004     \file MainPageDoc.h
00005     \brief  This is just some documentation model to manage extra documentations,
00006         it is not used as a classic header.
00007 */
00008 /*!
00009     \mainpage   
00010     <table align="center" width="100%" border="0" cellspacing="0" cellpadding="0"><tr>
00011     <td> \ref BaseContextDocGroup "BaseContext"
00012         \image html avshot1.jpg "Example of tool browsing classes and objects in a context." </td>
00013     <td> \ref BaseObject "BaseObject"
00014         \image html avshot3.jpg "An interface can be built automatically from an object shape." </td>
00015     <td> \ref BaseObjectInherited_VedaLibImage "VedaLibImage"
00016         \image html avshot2.jpg "Fingerprint image built with package VedaLibImage" </td>
00017     <td> \ref BaseObjectInherited_VedaLib3DEngine "VedaLib3DEngine"
00018         \image html avshot4.jpg "A preview of a 3D Object built with package VedaLib3DEngine" </td>
00019     <td> \ref VirtualMedia 
00020         \image html avshot5.jpg "Classes can manage sounds the same way as images or 3D!" </td>
00021     <td> \ref BaseContext::ExportAsCPPTableFile() "Context Export"
00022         \image html avshot6.jpg "Executables can be built from Libs and serialization for any platform!" </td>
00023     </tr></table>
00024     \section    Intro Welcome to the \mainprojectname project documentation !
00025                 \mainprojectname is a set of libraries designed to conduct the development
00026                 of applications. Basically, it is an experimental C++ framework,
00027                 and can be seen as a C++ extension, which adds features that lacks to C++,
00028                 like automatic serialization and other methods seen in java and C#, amongst
00029                 other original features like context management or hardware abstraction. 
00030                 It is thought for system independance, interface experimentations, 
00031                 math experimentations, sound and graphical experimentations, 3D and more.
00032                 It is open enough for portability to both modern and minimal systems, like embedded hardware,
00033                 game consoles, and old hardware.\n
00034                  Extending this base Framework, a set of Libraries offers Math,Image, 3D and sound
00035                  functionnalities, that can be themselves extended:\n
00036                 Use \mainprojectname 's base types for your class members
00037                 and class registration, and your class will get the \mainprojectname features.
00038 
00039                 \n
00040                 \n <b>Before you go further, Note that this documentation is generated
00041                 from the source comments; But Browsing by class inheritage is certainly
00042                 not a good idea. We suggest you to read the paragraphs sorted by Theme Groups,
00043                 as they are in the "Modules" page up there.</b>
00044     \section        ContextManagement   Context Management
00045                 Context management is done by \ref BaseContextDocGroup "class BaseContext", and you can have 
00046                 many context by applications. (Yes, that's what is called multicontext applications.) 
00047                 Contextes are like factories; By example, to have
00048                 a 3D modeler, you should code some 3D object classes, some texture classes,
00049                 some camera classes, and register those classes to a context... And that's all.
00050                 A user interface project will be able to create an application from the context,
00051                 and manage automatically Object creation, Edition and deletion for all the classes,
00052                 and also the serialization of the whole context state with file reading,
00053                 writting... and merging. You can even merge 2 contextes that has
00054                 not exactly the same classes registered: two different applications
00055                 made with \mainprojectname on different subjects can be quickly melt to 
00056                 share their objects.  You can use a first context with a first class set
00057                 for your use, and a second context with a complete different class set,
00058                 for another use, in the same application.
00059                 An undo/redo stack is also automatically managed by each contextes,
00060                 no need for additional code at any level.
00061                  But the most interesting feature must be
00062                 the dynamic pointer management: an object within a context can point
00063                 others objects with \ref PackObjectReference "a special pointer type". It makes possible the last following features:
00064                  - Destroying an object automatically unlink all pointers to it.
00065                  - Object dependance tracing: You can ask if an object
00066                    is dependant or not from another, even indirectly throught many pointers.
00067                  - It makes possible to extract the exact dependant object set for a given object
00068                     used as an entry point, to flush unused objects.
00069                  - It also makes possible what I will call delayed modification: If you modify
00070                    or destroy an object that is used by anothers (even during in a realtime rendering by example),
00071                    all the dependant objects will be locked in the time the modification ends.
00072                 - To finish this list of features, the \mainprojectname context
00073                 objects can be edited on one thread while their methods are used
00074                 by other threads, using a lock mecanism.
00075                 \n
00076     \section    VirtualMachinesec Virtual Machine
00077                 \mainprojectname makes a point to bring
00078                 independance everywhere: that is why the base package provides
00079                 \ref VirtualMachineDocGroup "a pure virtual class" that defines a Machine.
00080                 This class will keep 100% independant from other classes, and provides 
00081                 methods for graphics, sounds, and more. You can choose
00082                 to use the context features with or without the virtual machine, or
00083                 use a virtual machine alone, with or without the context features.  
00084                 The real machine-specific code is managed by each VedaMachine's specific 
00085                 package, included in the releases.
00086                 \n
00087     \section    SoundSection    Sound Management in VirtualMachine 
00088                 the VirtualMachine class used by most \mainprojectname project
00089                 provides \ref MachineSound "an original way to manage sounds". 
00090                 In classic applications,
00091                 Each time you want a sound, music or anything, you have two possibilities:
00092                     - You use a separate library that will play a given format.
00093                         InThat case,these libraries manage their own sound threads,
00094                         but often lack some features, or will
00095                         forbid the application portage because it will lack
00096                         on other platform. You will have problem if you want to 
00097                         throw multiple library inits. If you want to throw
00098                         some other sample of some sort, you will have to recode
00099                         another thread, etc...
00100                     - You code yourself a sound server.
00101                         In that case, you got to manage a system specific sound thread
00102                         yourself, which is quite problematic for portage.
00103                 - \mainprojectname 's VirtualMachine got a better solution: 
00104                     It plays a sound thread with a float buffer, and you can
00105                     register mixing objects that will add their signals
00106                     to it. This way, you are far more free to throw
00107                     music, and experiment with sounds ! Furthermore, you can choose
00108                     to use context-managed class VirtualMedia, which
00109                     allows to use this system transparently, just by extending one method.
00110     \section    CodingRules Coding Rules
00111                 \mainprojectname project targets at least a minimal machine that would
00112                 have a floating point unit and more than 4Mb of memory, according to your application needs.
00113                  In order to assume these features, \ref BaseObjectInheritedDocByLib "The libraries that extends objects"
00114                 from the \mainprojectname base lib should apply to these code rules:
00115                     - Re-entrant code. It means you <b>must not</b> use global variables,
00116                         and be careful with static members: Keep in mind we can have many contextes
00117                         at the same time. If you have to access a table as a resource, declare it
00118                         as <b>'static const'</b>.
00119                     - No assembler or machine-specific code should be used in the extended libraries
00120                         that inherit BaseObject, for portability purposes.
00121                     - You can use assembler or machine-specific optimisations
00122                         \ref VirtualMachineDocGroup "in Libraries that Extend the VirtualMachine".
00123                         They exist for this purpose.
00124                     - If you extend your own Library in order to share it, the totality of
00125                         the code it depends on should belong the \mainprojectname Workspace, in the shape of source.
00126                         It means you shouldn't include standard template library, or anything.
00127                         From now on, the only standard header used by some classes is <math.h>.
00128                         If you want special types,
00129                         use the Base package. You shouldn't use external libraries under
00130                         the form of link libraries, all this could break a portage. Of course,
00131                         you can just choose to not follow this rules for your own use.
00132                     - All Memory access should work in Big or Little Endians:
00133                         Be aware that differents processors doesn't write bytes in the same order.
00134                         ( Intel processors are Little Endian, PowerPC and motorola are Big Endian.)
00135                         If you code a simple way, this should'nt happen.
00136                     - Please, the more possible: align your tables in memory in a way float and int types
00137                         keep aligned on 4 bytes. Try to use less possible int-to-float casts.
00138                         (These optimisation laws doesn't accelerate much an intel, but are
00139                          critics for PowerPC and other processors.)
00140                     - You will not find any C++ operator overriding in \mainprojectname libraries,
00141                         It is a choice: Keeping an understandable code is a need.
00142                         We don't use templates for the same reason. We have short-code
00143                         necessities, and templates inflate the binaries at each use.
00144                     - We follow C++ for everything else: we use virtual methods, and
00145                         const operators a lot.
00146     \section        UnEditable  UnEditable Compilation Mode.
00147                  For some applications, we just need a context with
00148                 objects that take a shape at inition, and then do not change.
00149                 In that case, all the edition, serialization output, and events
00150                 code should not be linked in the application. \mainprojectname 
00151                 use a processor word, _ENGINE_EDITABLE_ that sort out
00152                 all the code that could be useless in such application, and so
00153                 ensure the minimal size for an executable.
00154                  if you want the full features, use word processor _ENGINE_EDITABLE_
00155                 in your compilation project (usually, -D_ENGINE_EDITABLE_).
00156                 <b>Note: this processor word trick may not be continued in further versions,
00157                 as linkers should manage the culling of useless methods.</b>
00158     \section    licensessection licenses
00159                 Each \mainprojectname libraries in the \mainprojectname workspace get a specific license when they're created.
00160                 a 'COPYING' file defines these licenses in each directories under the workspace,
00161                 and this license only applies to the files under this directory. You should read those files.
00162                 VedaLib, the base package, containing the classes to extend, is released under
00163                 the <b>GNU LESSER GENERAL PUBLIC LICENSE Version 2.1</b>( Copyright (C) 1991, 1999 Free Software Foundation, Inc)
00164                 It means, you can link this library into free or non-free programs.
00165                 This license encourages " the widest possible use of this library, so that it becomes
00166                 a de-facto standard". So you may release the sources of it or not in your applications.\n
00167                 VedaLibMath, VedaLibImage, VedaLib3DEngine, the example dir, plus VedaMachineOGL,
00168                 VedaMachineLinux, VedaMachineOGLWinDxSound, and more,
00169                 are also under the same license for the same reasons, but are only presenting
00170                 possible standards, that may evolve: (It could be possible to have more than one
00171                 Image standard in the same context, for example).\n\n
00172                 Other Libraries and applications under the \mainprojectname Workspace directory
00173                 may have a LGPL license <b>or not</b>. In the download section, we will provide
00174                 with each new releases:
00175                     - a free LGPL version of the workspace, which will only feature the directories
00176                        that are under a GNU GENERAL PUBLIC LICENSE or a LESSER GNU GENERAL PUBLIC LICENSE,
00177                        with full sources for these directories.  
00178                     - a full opensource version of the workspace, including the LGPL packages with their sources,
00179                       plus other packages with other license types, GPL or any other opensource license.
00180                     - We provide free binary tools for various platforms (like UVeda) from
00181                          this sourceforge website.
00182                 - The \mainprojectname Workspace library content is decided by the authors of VedaLib, the base package,
00183                     and more contributions may be included with it in the future.\nUpdated on 2007/04/06
00184 */
00185 /*! \page InstallWorkSpacePage Installation, Workspace Architecture.
00186     <table><tr><td>
00187     <table align="left" border="0" ><tr>
00188     <td> \image html workspace.jpg </td>
00189     <td> <b>The Workspace Directory Architecture</b>\n\n
00190         A simple archive extraction is enough to install the whole package,
00191         for all systems.
00192         All sources for \mainprojectname 's base library and the
00193         \ref BaseObjectInheritedDocByLib "Libraries that extends their objects" 
00194         stand at the base of a Workspace directory under a VedaLibXXXX directory, where
00195         XXXX is the specific name of the package.\n
00196         Sources for the \ref VirtualMachineDocGroup "Libraries that extends VirtualMachine" are
00197         in the same directory, under a VedaMachineXXXX name, where XXXX explicits the
00198         target machine or API used to code it.\n
00199          Other Applications can perfectly choose to create a completly \mainprojectname-dependant
00200         project, in the same base directory, with any name.
00201         \n\n<b>Compilation Projects Are relatives to Machines.</b>\n\n
00202          Like a Machine directory exists for each compilable target machine,
00203          the same directory is used to manage each Compilation projects
00204          for this machine, and as base for binary outputs for these projects.
00205          It means, each linux .o, .lib or binaries, will be found under VedaMachineLinux
00206          in subdirectories, the linux target directory. This way, The Library directories are left untouch.\n
00207          To launch the compilation of projects for a given machine, you usually need
00208          to type "make" in your favorite machine directory !\n
00209     </td>
00210     <td></td>
00211     </tr></table>
00212     </td></tr></table>
00213     \n
00214     .
00215     \section iwas_gnu   "Makefile includes."
00216          As each platform will use a different compiler or cross compilers, and different makefiles,
00217          a makefile include, "Makefile.i" should be found in each Library source directory.
00218          This include explicits variables for the .o object list to create in this lib,
00219          for the lib name, and for the dependancies to other neighbour packages.
00220          Then this include file can be used by makefiles in the Machine Directories.
00221          This way,you just got to touch one file to manage each compilation project for each Machines.
00222     \section iwas_notes "Notes about project management."
00223         - The shape or project format of a project into a given machine is totally free!
00224          You can use the tool you want in the context of a machine, but this shall not
00225          affect the other Libs and Machines! And don't forget having a "cleaning" function
00226          is always useful!
00227         - There should be no need for Environment variables in \mainprojectname, all dependances
00228          to neighbour libraries can be done with relative paths. Once the Libraries are compiled,
00229          you may want to use them in an external project. We suggest you should copy your libs
00230          in your lib compiler directory, and refer each projects headers with the -I include directory option.
00231     
00232 */
00233 /*! \page ExamplePage Code Examples
00234         \anchor Example_UsingASimpleSerilizedStruct
00235         You can use the \ref BaseSerializableClass "base types" very easily in order to 
00236         load, save or clone base types. Note this example will write a file on the disk!
00237         \code
00238 #include "PackULong.h"
00239 #include "PackString.h"
00240 #include <stdio.h>
00241 void main()
00242 {
00243     // we got a simple unsigned long:
00244     PackULong   myUnsignedLongWriten,myUnsignedLongRead;
00245 
00246     myUnsignedLongWriten.Set(1337);
00247     myUnsignedLongWriten.WriteFile("my1337File");
00248     
00249     myUnsignedLongRead.ReadFile("my1337File");
00250     unsigned int value = myUnsignedLongRead.Get();
00251     // here it is !!!
00252     printf("%d !!!\n",value);
00253     // note MakeCloneOf() does the same, without saving a file:
00254     myUnsignedLongRead.MakeCloneOf(myUnsignedLongWriten);
00255     // the same goes for all types ! PackString manages strings:
00256     PackString  str1,str2;
00257     str1.Set("My sentence is long.");
00258     str1.AddString("... and It continues on and on !\n");
00259     str2.MakeCloneOf(str1);
00260     printf( str2.Get() );
00261 
00262 }
00263         \endcode
00264         The following example Uses the automatic Serialization of the \mainprojectname \ref BaseSerializableClass "base types" In order
00265         to create and manage a struct, edit it a bit, then save and load it, using 
00266         the PackStruct class, which is a base type done for that !
00267         (note: this example doesn't use the context features.)
00268         \code
00269 #include "PackStruct.h"
00270 #include "PackLong.h"
00271 #include "PackFloat.h"
00272 #include "PackString.h"
00273 #include <stdio.h>
00274 void main()
00275 {
00276     // serialization test
00277     // we just have a local test class.
00278     class myStruct : public PackStruct
00279     { public:
00280         // the constructor got to register the members to know what to serialize,
00281         // the same way as with the more complex BaseObject.
00282         myStruct() : PackStruct()
00283         {
00284             // second parameter 0 means no GUI name. Third is always default value:
00285             REGISTER_MEMBER_PACKSTRING(m_Name,0,"");
00286             REGISTER_MEMBER_PACKLONG(m_LongTestMember,0,0);
00287             REGISTER_MEMBER_PACKFLOAT(m_FloatTestMember,0,0.0f);
00288         };
00289         // declare the members of the class:
00290         PackString  m_Name;
00291         PackLong    m_LongTestMember;
00292         PackFloat   m_FloatTestMember;
00293     };
00294     myStruct    object1,object2;
00295     object1.m_Name.Set("Henry");
00296     object1.m_LongTestMember.Set(4);
00297     object1.m_FloatTestMember.Set(3.14f);
00298 
00299     object1.WriteFile("serializedtest");
00300     object2.ReadFile("serializedtest");
00301     printf("object2 values: name:%s long:%d float:%f\n",
00302         object2.m_Name.Get(),object2.m_LongTestMember.Get(),object2.m_FloatTestMember.Get());
00303 }
00304         \endcode
00305         \n
00306         \anchor Example_MinimalMedia
00307         The next example extends a \ref VirtualMedia "Media Class" that rotates a square
00308         on the default screen and makes sounds, and we create one inside a context.\n
00309         Then we create a main that plays that media with a machine:
00310         (note that example doesn't use the context features.)\n
00311         \code
00312 #include "BaseContext.h"
00313 // the class to extend:
00314 #include "VirtualMedia.h"
00315 // we use some math functions for the sound:
00316 #include <math.h>
00317 // we use time.h for a timer in the main loop. Well, VirtualMachine should manage timers. exact.
00318 #include <time.h>
00319 // we need a machine to play the media:
00320 // note DefaultMachine is a typedef to your platform implementation:
00321 #include "DefaultMachine.h"
00322 // first , we define our media class like in a header file.
00323 // We will not register serializable members,
00324 // but we will extend media methods:
00325 class miniMedia : public VirtualMedia
00326 { public: 
00327     // constructor:
00328     miniMedia() : VirtualMedia() {};
00329     // define context class descriptor and destuctor: 
00330     BASEOBJECT_DEFINE_CLASS(miniMedia);
00331     // extend methods from VirtualMedia to make our media to draw and play things:
00332     virtual void ProcessMedia( double _frameDate,VirtualMachine::InternalViewPort *_pViewPort );
00333     virtual void ProcessSoundInterupt( VirtualMachine::SoundBufferToAddYourSignal &_SoundBufferToAddYourSignal );
00334     // extend creation and close methods from BaseObject, to make our own inits:
00335     virtual bool CreateInternal(void);
00336     virtual void CloseInternal(void);
00337     // now declare some specific members for our routines.
00338     // we could declare serializable members here, na deven dynamic pointers
00339     // to other context objects, but it is  not the point of the example.
00340     // (see examples 01 with PackStruct or any class code).
00341     // state for sound generation:
00342     float   m_sinusPostion1;
00343     float   m_sinusPostion2;
00344     // simple 3D object to be built at init, and then drawn:
00345     //! object created for preview.
00346     VirtualMachine::InternalObject3DBuffer  *m_p3DObject;
00347 };
00348 // ----- Here we have .cpp-like methods for miniMedia -----
00349 // declare class descriptor, its makes possible self-build GUI and context serialization (we will not use in this example):
00350 // "MINI" will be the tag serialized in the .avb binary contextes.
00351 // miniMedia is the C++ name of our class we derivate from VirtualMedia
00352 // "Media Example Class" is a name that can be displayed for this class in some GUI.
00353 // "DefaultName" will be the base name for each new object created with this class.
00354 // the last parameter is a short docuementation of what the class does.
00355 BASEOBJECT_DECLARE_CLASS( "MINI", miniMedia, VirtualMedia,"Media Example Class","DefaultName","This is a class done to show how easy it is to make your own media." );
00356 // CreateInternal must do all inits for a context object, and everything opened
00357 // should be close in CloseInternal().
00358 bool miniMedia::CreateInternal(void)
00359 {
00360     // use superclass member to tell the media time length:
00361     m_MediaTimeLength = 60.0f; // 60 seconds.
00362     // reset state members
00363     m_sinusPostion1 = m_sinusPostion2 = 0.0f;
00364     // ask the machine the creation of a 3D object on pointer m_p3DObject,
00365     // with 4 vertexes, 2 triangles.
00366     GetMachine()->NewObject3DBuffer( &m_p3DObject, 4,2,0);
00367     if(m_p3DObject==0) return false; // pointer null means error !
00368     // give a square shape:
00369     VirtualMachine::InternalVertex *pVert = m_p3DObject->GetFirstVertex();
00370     pVert->m_x = -0.5f;
00371     pVert->m_y = -0.5f;
00372     pVert->m_z = 0.0f;
00373     pVert++;
00374     pVert->m_x = 0.5f;
00375     pVert->m_y = -0.5f;
00376     pVert->m_z = 0.0f;
00377     pVert++;    
00378     pVert->m_x = 0.5f;
00379     pVert->m_y = 0.5f;
00380     pVert->m_z = 0.0f;
00381     pVert++;    
00382     pVert->m_x = -0.5f;
00383     pVert->m_y = 0.5f;
00384     pVert->m_z = 0.0f;
00385 
00386     VirtualMachine::InternalTriangle *pTriangle = m_p3DObject->GetFirstTriangle();
00387     pTriangle->m_p0 = 1;
00388     pTriangle->m_p1 = 2;
00389     pTriangle->m_p2 = 0;
00390     pTriangle++;
00391     pTriangle->m_p0 = 0;
00392     pTriangle->m_p1 = 2;
00393     pTriangle->m_p2 = 3;
00394     m_p3DObject->SetNumberOfActiveTriangle(2);
00395     // as the square shape will not change, 
00396     // this line could optimize rendering:
00397     m_p3DObject->CompileAsStatic();
00398     // not: we use only colors for rendering.
00399     // we could also build a VirtualMachine::InternalTexture
00400     // to render the object.
00401     // The object is succesfully built !
00402     return true;
00403 }
00404 void miniMedia::CloseInternal(void)
00405 {
00406     // delete the object in case it has been created.
00407     //note all machine delete calls do nothing if pointer is null.
00408     // so no need for a test:
00409     GetMachine()->DeleteObject3DBuffer( &m_p3DObject );
00410 
00411 }
00412 // we need our class descriptors, ussually with the methods in a .cpp file:
00413 void miniMedia::ProcessMedia( double _frameDate,VirtualMachine::InternalViewPort *_pViewPort )
00414 {
00415     // ProcessMedia() is useed to manage drawing, frame by frame.
00416     // _frameDate is given in seconds.
00417     // we got to draw on viewport _pViewPort, using the minimal 3D object created in the init.
00418     // we will rotate with the same members used for the sound generation in next method.
00419     // clear:
00420     _pViewPort->Clear(0.1f,0.1f,0.1f);
00421     // set transformation matrix:
00422     _pViewPort->Matrix_LoadID();
00423     _pViewPort->Matrix_Translate(0.0f,0.0f,-1.0f);
00424     // make the rotation do the same thing as the sound vibrato
00425     _pViewPort->Matrix_Rotate(sin(m_sinusPostion1*0.002f),0.0f,0.0f,-1.0f);
00426     // set focale length for viszion:
00427     _pViewPort->SetFOVLength(0.75f);
00428     // set the other vibrato term on the red component of the color object:
00429     float vibratoterm2 =0.5f+ sin(m_sinusPostion2*0.0018f) *0.5f;
00430     m_p3DObject->SetColor(vibratoterm2,0.25f,1.0f);
00431     // render our 3D object
00432     _pViewPort->RenderMesh( m_p3DObject );
00433 
00434 }
00435 void miniMedia::ProcessSoundInterupt( VirtualMachine::SoundBufferToAddYourSignal &_SoundBufferToAddYourSignal )
00436 {
00437     // ProcessSoundInterupt() ask us to add a sound signal on a float buffer.
00438     // Here, we use some sinus functions to make a sound:
00439     const unsigned int  lengthToRender =_SoundBufferToAddYourSignal.m_LengthToRender ;
00440     // here is the buffer to add our signal:
00441     float           *pSoundBuffer = _SoundBufferToAddYourSignal.m_pSoundBuffer ;
00442     // here is the play frequency in float:
00443     const float freq = _SoundBufferToAddYourSignal.m_PlayFrequency ;
00444     float speed1 =  440.0f*4.0f/freq; // this will lead to a chord :-)
00445     float speed2 =  293.3*4.0f/freq;
00446     
00447     unsigned int ii;
00448     float fp1 = m_sinusPostion1;
00449     float fp2 = m_sinusPostion2;
00450     const float leftVolume=0.6f; // of course a factor multiply the volume.
00451     const float rightVolume=0.7f;
00452     // note this nice song suffer from float format precision artifacts !
00453     for(ii=0 ; ii<lengthToRender ; ii++)
00454     {
00455         float vv = sin( fp1 );
00456         *(pSoundBuffer++) += sin( fp1 ) *leftVolume ;   // add left signal
00457         *(pSoundBuffer++) += sin( fp2 ) *rightVolume; // add right signal
00458         fp1 +=(speed1 + sin(fp2*0.0018f)*0.004f); // set a vibrato !
00459         fp2 += speed2+ sin(fp1*0.002f)*0.004f;
00460     }
00461     // keep the states object to ensure continuity of the signal at next call:
00462     m_sinusPostion1 = fp1;
00463     m_sinusPostion2 = fp2;
00464 }
00465 // and then, our main will create and play this media:
00466 int main(void)
00467 {
00468     // we need a context and a machine: note: as we will linik the machine
00469     // to the context, we must assure the context is deleted first at the end,
00470     // and then the machine is deleted. these 2 brackets assures this:
00471     {
00472     DefaultMachine oMachine;
00473     {
00474     BaseContext     oContext;
00475     // init the machine, this should open a screen.
00476     oMachine.InitMachine();
00477     //register our class to the context:
00478     const BaseObject::ClassDescription *classList[]=
00479     {    
00480         & VirtualMedia::m_Description,  // we need to register all parent class after BaseObject.
00481             & miniMedia::m_Description, // class built over VirtualMedia. 
00482         0L // list end.
00483     };
00484     oContext.RegisterClassList(classList);
00485     // tell the context to work with the machine:
00486     oContext.SetMachine(&oMachine);
00487     
00488     // now do a simple edition on the context, just to create our object:
00489     miniMedia *pMiniMedia = (miniMedia *)oContext.NewObject( miniMedia::m_Description );
00490     if( pMiniMedia==0L ) return 1; // error ?
00491 
00492     // any context object should be inited with Create(),
00493     // and its method used if the creation succed.
00494     // note the object init is overriden with BaseObject::CreateInternal()
00495     // and BaseObject::CloseInternal().
00496     int result = pMiniMedia->Create();
00497     // a negative value means a construction error.
00498     // a 0 value mean construction is done, and positive values means
00499     // the object need more Create() calls, which can only happen with Create(false).
00500     // Create(false) can be used for delayed creation.
00501     // true means immediate creation and is a default parameter.
00502     if(result<0) return 1;
00503     // when using context object, you should first ensure that the object
00504     // is well created, before using its methods. Here, a miniMedia could
00505     // fail because the 3D object creation in CreateInternal() could fail,
00506     // because of short memory for example. So now we can use miniMedia.
00507                         
00508     // we do our own loop in the main, manage a timer,
00509     // and ask the media to draw frames whenever we can:
00510     // You could ask yourself why this is not automatized by the Media mechanism.
00511     // The answer is AzurVeda's Context framework must keep independant
00512     // from any shape of application. 
00513     clock_t startclock = clock();
00514     // we use the sound aspect of the media:
00515     pMiniMedia->SetSound(true);
00516     while( !oMachine.GetQuitMessage() )
00517     {   // get new date:
00518         double framedate = ((double)(clock()-startclock))/CLOCKS_PER_SEC ;
00519         // quit if media length ended.
00520         if(framedate>=pMiniMedia->GetTimeLength() ) break; 
00521         pMiniMedia->ProcessMediaOnDefaultViewport( framedate );
00522         // swap the main screen buffer.
00523         oMachine.GetDefaultViewPort()->SwapBuffer();
00524         oMachine.ProcessInterface();
00525     }
00526     // if we continue something after the loop, this should be done:
00527     pMiniMedia->SetSound(false);
00528     // close the 2 brackets, it delete the context, and then the machine, in this order:
00529         }
00530     }
00531     // OK
00532     return 0;
00533 }
00534         \endcode
00535 */
00536 /*! \page currentbuglistandevolution Current Bug List and evolutions.
00537         Bug List:
00538             - No bug ATM in public packages.
00539         - Evolutions that may come, and are discussed:.
00540         (Note some non-released AzurVeda projects are already working,
00541         but packages and licenses are on the work.) Also note that evolutions may
00542         mean simplification.
00543             - the objects graphical preview method BaseObject::ProcessPreview()
00544                 may evolve in such a way that allows member focusing from the
00545                 preview screen.
00546             - more and more context classes on various subjects.
00547             - some extensions done on BaseContext to allow other serialization formats.
00548 */
00549 /*! \page Contribution Contribution
00550             We encourage anyone to contribute to this project,
00551             by extending context classes, machines or build tool that uses \mainprojectname.
00552             If an extending project is free of bug and makes sense in official
00553             releases, we will be happy to include it in the default package. Note the names
00554             of the authors appears in any files of the project. (or should)
00555             This site will constantly delivers informations about the evolution of the project.
00556 */
00557 /*! \page authors Authors
00558         Here are a list of some people involved in this project:
00559             - Victorien Ferry (france)\n
00560                Hello, I'm a computer engineer who lives in toulouse
00561                 At the moment. I've worked in the simulation industry for 5 years,
00562                 dealing with 3D engines and interface architectures, amongst various themes.
00563                 As an artist, I'm also known as krabob, one of the coder from
00564                 the demo group Mankind (www.m4nkind.com), which does art with computers
00565                 since 1995. I actually did most of the code of this project, beginning it
00566                 in june 2005, and I also wrote most of the documentation.
00567                 As a matter of fact, I'm actually searching a job :-).
00568                 Contact me at victorien(REPLACE DOT)ferry(REPLACE AT)free(REPLACE DOT)fr.
00569             - Guillaume Portier\n
00570                 This french computer engineer worked for game companies in japan.
00571                 He started a similar project named makedemo in the early 2000,
00572                 and gave some ideas about the architecture of VedaLib. He is also a coder
00573                 of www.m4nkind.com under the nickname Exel.
00574                 more informations about his work can be found here:
00575                 http://exel.m4nkind.com/
00576             - Johann Nadalutti\n 
00577                 Another french computer engineer, he used to work in the game industry,
00578                 but now works on embedded software in toulouse, if I'm correct.
00579                 He has also a similar project, and studied procedural programming.
00580                 He is also a coder of www.m4nkind.com under the nickname Backlash.
00581             - Gwenaël Dano\n 
00582                 Actually, one of the graphician of www.m4nkind.com, 
00583                 he did the \mainprojectname logo.
00584 */
00585 /*! \page MoreStrangeInformations More Strange Informations...
00586         Did you knew that...
00587             - \mainprojectname 's name was took from the veda indian book,
00588                     which gives a code for life, about various subjects, and teaches
00589                     that "everything is one". Well, actually, It was named
00590                     after gwen, our graphist told us a story about that:
00591                     One day, an english woman came to india to visit a Vedic Sage.
00592                     She asked him if he knew London.  The sage answered:\n
00593                     <b><i>"I am London!"</i></b>\n
00594                     So now you are aware of it, All you just need to do is being London !\n\n
00595             - \mainprojectname 's name may not be definitive... but... nothing is definitive!\n\n
00596             - \mainprojectname can be seen as the continuation of ''karate-fighter'',
00597                 ( http://www.k-fighter.net ) , another language done for the amiga that has some
00598                 common point with \mainprojectname. It has context management,
00599                 many classes, two level of creation by objects and a bit
00600                 of dynamic pointers, but that's all. \mainprojectname 's architecture
00601                 has probably been thought silently by my unconscious left brain
00602                 during the time "karate" was done. Well, it must be that, because I
00603                 don't have other explaination!\n\n
00604 */
00605 
00606 /*! \page page2 Greetings
00607         It is now high time to incriminate some people that asked nothing
00608         in this madness...
00609         Did you know that the following persons must be granted ?
00610             - thanks to (exel+Backlash)^mankind for all the nice ideas about the VM.
00611             - thanks to (bla+gwen+tex+backlash)^mkd for the bug reports last year :-) 
00612             - thanks to farbrausch and moppi for having demonstrated that
00613               a solid architecture was needed to go further.
00614             - thanks to Ken Perlin , because I'm a big fan !
00615             - thanks to SUN RA, for nothing... and in the same time... everything !
00616             - thanks to the guy in carbone that sold me that Dreamcast ;-)\n
00617               <i>(...to make it clear: he was not made from carbone, he was in the town of carbone.
00618                (to make it very clear: the town in question, carbone, is not made from carbone, it's the name of the town!.)
00619                now wait a minute... actually, as any lifeform on earth is made from carbone....arggghh)</i>
00620             - and by the way, hello Dreamcast scene !
00621             - von neuman ! Why not ?
00622             - Fruits. Including apples. (Even after the von neuman affair.)
00623             - Vegetables. Including bananas.
00624         - Did you know it , hu ? Well now you do.
00625 */
00626 
00627 
00628 #endif

      /\/\        4         N         k         !         N         D
                      _______  _ __ ___  _____            ___ _ _  ____
     ___________  __//___   /________  |/    / ___________\_______/    \
    /   _   _   \/   _     /    _   /      _/_/____/    _       __     /
   /    /   /       /     /    /    \      \/     /    /    \   \     /
  \\___/___/___/    ¯    _____/_____/       ______\___/_____/\________\\
               \________/_ ___ __ l____\      /elD!  
                 http://www.m4nkind.com \____/