Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 212


Ignore:
Timestamp:
Nov 14, 2007, 5:10:12 PM (16 years ago)
Author:
motth
Message:

Headerfile which contains the flocking algorithm

Location:
code/branches/AI
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/AI/bin/resources.cfg

    r135 r212  
    88FileSystem=../Media
    99FileSystem=../Media/fonts
    10 #FileSystem=../Media/materials/programs
    11 #FileSystem=../Media/materials/scripts
    12 #FileSystem=../Media/materials/textures
    13 #FileSystem=../Media/models
     10FileSystem=../Media/materials/programs
     11FileSystem=../Media/materials/scripts
     12FileSystem=../Media/materials/textures
     13FileSystem=../Media/models
    1414#FileSystem=../Media/overlays
    1515#FileSystem=../Media/particle
    1616FileSystem=../Media/gui
    1717#FileSystem=../Media/DeferredShadingMedia
    18 #Zip=../Media/packs/cubemap.zip
     18Zip=../Media/packs/cubemap.zip
    1919#Zip=../Media/packs/cubemapsJS.zip
    2020#Zip=../Media/packs/dragon.zip
  • code/branches/AI/src/CMakeLists.txt

    r164 r212  
    44
    55SET(SRC_FILES orxonox.cc loader/LevelLoader.cc xml/xmlParser.cc)
    6 SET(INC_FILES loader/LevelLoader.h xml/xmlParser.h)
     6SET(INC_FILES loader/LevelLoader.h xml/xmlParser.h Flocking.h)
    77
    88#Creates an executable
  • code/branches/AI/src/orxonox.cc

    r164 r212  
    4141#include "xml/xmlParser.h"
    4242#include "loader/LevelLoader.h"
    43 
     43#include "Flocking.h"
    4444
    4545// some tests to see if enet works without includsion
     
    7676using namespace Ogre;
    7777
     78//my-stuff
     79//globale definition eines Arrays welches alle nodes enthält
     80Vector3 ElementLocationArray[2];
     81Vector3 ElementSpeedArray[2];
     82Vector3 ElementAccelerationArray[2];
     83
     84
     85
    7886class OrxExitListener : public FrameListener
    7987{
    8088  public:
    81     OrxExitListener(OIS::Keyboard *keyboard)
     89    OrxExitListener(OIS::Keyboard *keyboard, Root* root)
    8290  : mKeyboard(keyboard)
    8391    {
     92        root_ = root;
    8493    }
    8594
    8695    bool frameStarted(const FrameEvent& evt)
    8796    {
     97      moving(evt);
    8898      mKeyboard->capture();
    8999      return !mKeyboard->isKeyDown(OIS::KC_ESCAPE);
    90100    }
     101 
     102    //code the movments of the nodes here
     103    void moving(const FrameEvent& evt) {
     104      SceneManager *mgr = root_->getSceneManager("Default SceneManager");
     105      mgr->getSceneNode("HeadNode1")->yaw((Radian)10*evt.timeSinceLastFrame);
     106    }
    91107
    92108  private:
    93109    OIS::Keyboard *mKeyboard;
     110    Root* root_;
    94111};
    95112
     
    199216      SceneManager *mgr = mRoot->createSceneManager(ST_GENERIC, "Default SceneManager");
    200217      Camera *cam = mgr->createCamera("Camera");
     218      cam->setPosition(Vector3(0,0,500));
     219      cam->lookAt(Vector3(0,0,0));
    201220      Viewport *vp = mRoot->getAutoCreatedWindow()->addViewport(cam);
     221      example();  //my stuff
    202222    }
    203223
     
    239259    void createFrameListener()
    240260    {
    241       mListener = new OrxExitListener(mKeyboard);
     261      mListener = new OrxExitListener(mKeyboard, mRoot);
    242262      mRoot->addFrameListener(mListener);
    243263    }
     
    247267      mRoot->startRendering();
    248268    }
     269
     270    //declaration of the 3 Ogreheads
     271    void example() {
     272    SceneManager *mgr = mRoot->getSceneManager("Default SceneManager");
     273    mgr->setAmbientLight(ColourValue(1.0,1.0,1.0));
     274    Entity* ent1 = mgr->createEntity("Head1", "ogrehead.mesh");
     275    Entity* ent2 = mgr->createEntity("Head2", "ogrehead.mesh");
     276    Entity* ent3 = mgr->createEntity("Head3", "ogrehead.mesh");
     277    SceneNode *node1 = mgr->getRootSceneNode()->createChildSceneNode("HeadNode1", Vector3(0,0,0));
     278    SceneNode *node2 = mgr->getRootSceneNode()->createChildSceneNode("HeadNode2", Vector3(100,0,0));
     279    SceneNode *node3 = mgr->getRootSceneNode()->createChildSceneNode("HeadNode3", Vector3(-100,0,0));
     280    node1->attachObject(ent1);
     281    node2->attachObject(ent2);
     282    node3->attachObject(ent3);
     283    ElementLocationArray[0] = node1->getPosition();
     284    ElementLocationArray[1] = node2->getPosition();
     285    ElementLocationArray[2] = node3->getPosition();
     286    ElementSpeedArray[0] = (0,0,0);
     287    ElementSpeedArray[1] = (0,0,0);
     288    ElementSpeedArray[2] = (0,0,0);
     289    ElementAccelerationArray[0] = (0,0,0);
     290    ElementAccelerationArray[1] = (0,0,0);
     291    ElementAccelerationArray[2] = (0,0,0);
     292    for (int i=0; i<3; i++) {
     293      Element* arrayOfElements[i] = new element( ElementLocationArray[i], ElementSpeedArray[i], ElementAccelerationArray[i] );
     294    }
     295    }
    249296};
     297
     298
    250299
    251300#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
Note: See TracChangeset for help on using the changeset viewer.