Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 3, 2007, 11:06:43 PM (16 years ago)
Author:
rgrieder
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/main_reto_vs05/src/orxonox_scene.cc

    r157 r159  
    2626 */
    2727
     28/**
     29* The orxonox scene includes everything running in the background like terrain,
     30* static figures, dangling lamp, etc.
     31*/
     32
     33
    2834#include "orxonox_scene.h"
    2935
    3036
    31 OrxonoxScene::OrxonoxScene(SceneManager *mSceneMgr) : mSceneMgr(mSceneMgr)
     37/**
     38* Empty Consructor except the initialiser list.
     39* @param sceneMgr The Scene Manager.
     40*/
     41OrxonoxScene::OrxonoxScene(SceneManager *sceneMgr) : sceneMgr_(sceneMgr)
    3242{
    3343}
    3444
    35 
     45/**
     46* Empty Destructor.
     47*/
    3648OrxonoxScene::~OrxonoxScene()
    3749{
    3850}
    3951
    40 
     52/**
     53* Ogre initialisation method.
     54* This function is called by the Run Manager to load the neccessary recources
     55* and to create the scene.
     56* @return False if failed.
     57*/
    4158bool OrxonoxScene::initialise()
    4259{
     
    4461        loadResources();
    4562
    46         distance = 0;
    47         radius = 100;
     63        distance_ = 0;
     64        radius_ = 100;
    4865
    4966        createScene();
     
    5370
    5471
    55 // method where you can perform resource group loading
    56 // Must at least do
    57 // ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
    58 void OrxonoxScene::loadResources(void)
     72/**
     73* Resource loader.
     74* Currently, this method loads everything! TODO: If done this ugly, it should
     75* at least be in the Run Manager.
     76*/
     77void OrxonoxScene::loadResources()
    5978{
    6079        // Initialise, parse scripts etc
     
    6382
    6483
    65 // Currently just a test scene with an ogre head an a surrounding light
    66 void OrxonoxScene::createScene(void)
     84/**
     85* Scene creation.
     86* Currently just a test scene with an ogre head an a surrounding light.
     87*/
     88void OrxonoxScene::createScene()
    6789{
    68         mSceneMgr->setAmbientLight(ColourValue(0.3,0.3,0.3));
     90        sceneMgr_->setAmbientLight(ColourValue(0.3,0.3,0.3));
    6991
    7092        //create first entity
    71         Entity *head = mSceneMgr->createEntity("head", "ogrehead.mesh");
     93        Entity *head = sceneMgr_->createEntity("head", "ogrehead.mesh");
    7294
    7395        //create a scene node to attach the head to
    74         SceneNode *node = mSceneMgr->getRootSceneNode()
     96        SceneNode *node = sceneMgr_->getRootSceneNode()
    7597        ->createChildSceneNode("OgreHeadNode", Vector3(0,0,0));
    7698        //attach the ogre head
     
    78100
    79101        // set up skybox
    80         mSceneMgr->setSkyBox(true, "Examples/SceneSkyBox2");
     102        sceneMgr_->setSkyBox(true, "Examples/SceneSkyBox2");
    81103
    82         // set up one mLight source
    83         mLight = mSceneMgr->createLight("Light1");
    84         mLight->setType(Light::LT_POINT);
    85         mLight->setPosition(Vector3(0, 0, 0));
    86         mLight->setDiffuseColour(1.0, 1.0, 1.0);
    87         mLight->setSpecularColour(1.0, 1.0, 1.0);
     104        // set up one light_ source
     105        light_ = sceneMgr_->createLight("Light1");
     106        light_->setType(Light::LT_POINT);
     107        light_->setPosition(Vector3(0, 0, 0));
     108        light_->setDiffuseColour(1.0, 1.0, 1.0);
     109        light_->setSpecularColour(1.0, 1.0, 1.0);
    88110
    89111        //create billboard
    90         bbs = mSceneMgr->createBillboardSet("bb", 1);
    91         bbs->createBillboard(Vector3::ZERO, ColourValue(1.0, 1.0, 1.0));
    92         bbs->setMaterialName("Examples/Flare");
     112        bbs_ = sceneMgr_->createBillboardSet("bb", 1);
     113        bbs_->createBillboard(Vector3::ZERO, ColourValue(1.0, 1.0, 1.0));
     114        bbs_->setMaterialName("Examples/Flare");
    93115
    94         lightNode = mSceneMgr->getRootSceneNode()
    95         ->createChildSceneNode("LightNode", Vector3(0, 100, 0));
     116        lightNode_ = sceneMgr_->getRootSceneNode()
     117        ->createChildSceneNode("lightNode_", Vector3(0, 100, 0));
    96118
    97         lightNode->attachObject(bbs);
    98         lightNode->attachObject(mLight);
     119        lightNode_->attachObject(bbs_);
     120        lightNode_->attachObject(light_);
    99121}
    100122
    101123
    102 // compute something between frames if neccessary
    103 void OrxonoxScene::tick(unsigned long time, float deltaTime)
     124/**
     125* Compute something between frames if neccessary.
     126* @param time Absolute time.
     127* @param deltaTime Relative time.
     128* @return Return true to continue rendering.
     129*/
     130bool OrxonoxScene::tick(unsigned long time, Real deltaTime)
    104131{
    105         float t = time/1000.0;
     132        Real t = time/1000.0;
    106133
    107         lightNode->setPosition(radius*sin(5*t), radius*cos(5*t), sin(1*t)*distance);
     134        lightNode_->setPosition(radius_*sin(5*t), radius_*cos(5*t), sin(1*t)*distance_);
    108135       
    109         mLight->setDiffuseColour(sin(1*t), sin(1*t + 2.09), sin(1*t + 2.09*2));
    110         mLight->setSpecularColour(sin(1*t), sin(1*t + 2.09), sin(1*t + 2.09*2));
     136        light_->setDiffuseColour(sin(1*t), sin(1*t + 2.09), sin(1*t + 2.09*2));
     137        light_->setSpecularColour(sin(1*t), sin(1*t + 2.09), sin(1*t + 2.09*2));
    111138
    112         bbs->getBillboard(0)->setColour(ColourValue(sin(1*t),
     139        bbs_->getBillboard(0)->setColour(ColourValue(sin(1*t),
    113140        sin(1*t + 2.09), sin(1*t + 2.09*2)));
     141 
     142  return true;
    114143}
Note: See TracChangeset for help on using the changeset viewer.