Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 576


Ignore:
Timestamp:
Dec 17, 2007, 3:39:17 PM (16 years ago)
Author:
landauf
Message:

added Mesh and Model (doesn't work yet, but i don't want to have merge conflicts all the time :P)

Location:
code/branches/FICN
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/bin/levels/sample.oxw

    r570 r576  
    11<?xml version="1.0"?>
    22<orxonoxworld name="Orxonox sample level" image="textures/menu/moonstation_512x512.jpg">
    3         <description>
    4                 This is an orxonox sample level.
    5         </description>
     3  <description>
     4    This is an orxonox sample level.
     5  </description>
    66
    7         <loading>
    8                 <background color="000000" image="textures/load_screens/ambush.png" />
    9                 <bar top="200" left="50" width="300" height="20" image="textures/load_screens/ambush-loadbar.png" />
    10         </loading>
     7  <loading>
     8    <background color="000000" image="textures/load_screens/ambush.png" />
     9    <bar top="200" left="50" width="300" height="20" image="textures/load_screens/ambush-loadbar.png" />
     10  </loading>
    1111
    12         <audio>
     12  <audio>
     13  </audio>
    1314
    14         </audio>
     15  <!-- Keep a minimum distance of >100 to the object, otherwise the camara thinks it's in the object -->
     16  <!-- the value has to negative, as we want the camara behind the object -->
     17  <world>
     18    <SceneNode name="OgreHeadNode" pos="0,0,0" />
     19    <Camera name="Camera" pos="0,0,-150" lookat="0,0,0" node="OgreHeadNode" />
     20    <Ambient colourvalue="1,1,1" />
     21    <Skybox src="Orxonox/BlueStarSkyBox" />
    1522
    16     <!-- Keep a minimum distance of >100 to the object, otherwise the camara thinks it's in the object -->
    17     <!-- the value has to negative, as we want the camara behind the object -->
    18         <world>
    19 
    20                 <SceneNode name="OgreHeadNode" pos="0,0,0" />
    21 
    22                 <Camera name="Camera" pos="0,0,-150" lookat="0,0,0" node="OgreHeadNode" />
    23 
    24                 <Ambient colourvalue="1,1,1" />
    25 
    26                 <Skybox src="Orxonox/BlueStarSkyBox" />
    27 
    28                 <BaseEntity name="ASSF" src="assf2.mesh" node="OgreHeadNode" />
    29 
     23    <BaseEntity name="ASSF" src="assf2.mesh" node="OgreHeadNode" />
    3024
    3125    <SceneNode name="node1" pos="0,200,0" />
     
    4640    <SceneNode name="node6" pos="0,0,-200" />
    4741    <Entity name="asteroid6" src="ast6.mesh" node="node6" />
    48         </world>
     42  </world>
    4943
    5044<!-- Unused at the moment -->
    51                 <SpaceshipSteeringObject node="OgreHeadNode" forward="500" rotateupdown="200" rotaterightleft="200" looprightleft="200" />
     45  <SpaceshipSteeringObject node="OgreHeadNode" forward="500" rotateupdown="200" rotaterightleft="200" looprightleft="200" />
    5246
    53 
    54 
    55         <scripts>
    56                 <script file="intro.lua" />
    57         </scripts>
     47  <scripts>
     48    <script file="intro.lua" />
     49  </scripts>
    5850</orxonoxworld>
  • code/branches/FICN/src/orxonox/CMakeLists.txt

    r555 r576  
    3535    objects/SpaceshipSteeringObject.cc
    3636    objects/Model.cc
     37    objects/Mesh.cc
     38    objects/BaseEntity.cc
    3739  )
    3840ELSE(WIN32)
     
    4143
    4244IF(WIN32)
    43   ADD_LIBRARY(orxonox ${ORXONOX_SRC_FILES})
     45#  ADD_LIBRARY(orxonox ${ORXONOX_SRC_FILES})
    4446ELSE(WIN32)
    4547  ADD_LIBRARY(orxonox SHARED ${ORXONOX_SRC_FILES})
  • code/branches/FICN/src/orxonox/objects/CMakeLists.txt

    r565 r576  
    1515  SpaceshipSteeringObject.cc
    1616  Model.cc
     17  Mesh.cc
    1718)
    1819
  • code/branches/FICN/src/orxonox/objects/Model.cc

    r556 r576  
     1#include <string>
     2
     3#include "Model.h"
     4#include "../core/CoreIncludes.h"
     5#include "../orxonox.h"
     6#include "../../tinyxml/tinyxml.h"
     7#include "../../misc/Tokenizer.h"
     8#include "../../misc/String2Number.h"
     9
     10namespace orxonox
     11{
     12    CreateFactory(Model);
     13
     14    Model::Model()
     15    {
     16        RegisterObject(Model);
     17    }
     18
     19    Model::~Model()
     20    {
     21    }
     22
     23    void Model::loadParams(TiXmlElement* xmlElem)
     24    {
     25        std::cout << "1\n";
     26        if (xmlElem->Attribute("position"))
     27        {
     28        std::cout << "2\n";
     29                std::vector<std::string> pos = tokenize(xmlElem->Attribute("position"),",");
     30                float x, y, z;
     31                String2Number<float>(x, pos[0]);
     32                String2Number<float>(y, pos[1]);
     33                String2Number<float>(z, pos[2]);
     34                this->setPosition(x, y, z);
     35        }
     36
     37        std::cout << "3\n";
     38        if (xmlElem->Attribute("direction"))
     39        {
     40        std::cout << "4\n";
     41                std::vector<std::string> pos = tokenize(xmlElem->Attribute("direction"),",");
     42                float x, y, z;
     43                String2Number<float>(x, pos[0]);
     44                String2Number<float>(y, pos[1]);
     45                String2Number<float>(z, pos[2]);
     46                this->setDirection(x, y, z);
     47        }
     48
     49        std::cout << "5\n";
     50        if (xmlElem->Attribute("mesh"))
     51        {
     52        std::cout << "6_1\n";
     53                std::string src = xmlElem->Attribute("mesh");
     54        std::cout << "6_2\n";
     55        std::cout << this->mesh_.getEntity() << std::endl;
     56                this->mesh_ = Mesh(src);
     57        std::cout << "6_3\n";
     58        std::cout << this->mesh_.getEntity() << std::endl;
     59                    this->attachObject(this->mesh_.getEntity());
     60        std::cout << "6_4\n";
     61        }
     62
     63        std::cout << "7\n";
     64        if (xmlElem->Attribute("scale"))
     65        {
     66        std::cout << "8\n";
     67                    std::string scaleStr = xmlElem->Attribute("scale");
     68                    float scale;
     69                    String2Number<float>(scale, scaleStr);
     70                    this->setScale(scale);
     71        }
     72        std::cout << "9\n";
     73
     74        COUT(4) << "Loader: Created model" << std::endl;
     75    }
     76}
  • code/branches/FICN/src/orxonox/objects/Model.h

    r556 r576  
     1#ifndef _Model_H__
     2#define _Model_H__
     3
     4#include "WorldEntity.h"
     5#include "Mesh.h"
     6#include "../../tinyxml/tinyxml.h"
     7
     8namespace orxonox
     9{
     10    class Model : public WorldEntity
     11    {
     12        public:
     13            Model();
     14            ~Model();
     15            virtual void loadParams(TiXmlElement* xmlElem);
     16
     17        private:
     18            Mesh mesh_;
     19    };
     20}
     21
     22#endif
  • code/branches/FICN/src/orxonox/objects/WorldEntity.cc

    r567 r576  
    4343        RegisterObject(WorldEntity);
    4444
     45        std::cout << "10_1\n";
    4546        if (Orxonox::getSingleton()->getSceneManager())
    4647        {
     48        std::cout << "10_2\n";
    4749            std::ostringstream name;
    4850            name << (WorldEntity::worldEntityCounter_s++);
    4951            this->setName("WorldEntity" + name.str());
    5052            node_ = Orxonox::getSingleton()->getSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName());
     53            std::cout << "blubbbi: " << this->getName() << " .. " << this->node_ << std::endl;
    5154        }
     55        std::cout << "10_3\n";
    5256
    5357        this->bStatic_ = true;
  • code/branches/FICN/src/orxonox/objects/WorldEntity.h

    r567 r576  
    77#include "OgreSceneManager.h"
    88#include "OgreSceneNode.h"
     9#include "Mesh.h"
    910#include "network/Synchronisable.h"
    1011
     
    4546          { this->node_->roll(angle, relativeTo); }
    4647
     48      inline void rotate(const Vector3 &axis, const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)
     49        { this->node_->rotate(axis, angle, relativeTo); }
     50      inline void setDirection(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
     51        { this->node_->setDirection(x, y, z, relativeTo, localDirectionVector); }
     52      inline void setDirection(const Vector3 &vec, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
     53        { this->node_->setDirection(vec, relativeTo, localDirectionVector); }
     54      inline void setOrientation(const Ogre::Quaternion quat)
     55        { this->node_->setOrientation(quat); }
     56      inline void lookAt(const Vector3 &targetPoint, Ogre::Node::TransformSpace relativeTo, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
     57        { this->node_->lookAt(targetPoint, relativeTo, localDirectionVector); }
    4758
    48       inline void rotate(const Vector3 &axis, const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)
    49           { this->node_->rotate(axis, angle, relativeTo); }
    50       inline void setDirection(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
    51           { this->node_->setDirection(x, y, z, relativeTo, localDirectionVector); }
    52       inline void setDirection(const Vector3 &vec, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
    53           { this->node_->setDirection(vec, relativeTo, localDirectionVector); }
    54       inline void setOrientation(const Ogre::Quaternion quat)
    55           { this->node_->setOrientation(quat); }
    56       inline void lookAt(const Vector3 &targetPoint, Ogre::Node::TransformSpace relativeTo, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
    57           { this->node_->lookAt(targetPoint, relativeTo, localDirectionVector); }
     59      inline void setScale(const Vector3 &scale)
     60        { this->node_->setScale(scale); }
     61      inline void setScale(Real x, Real y, Real z)
     62        { this->node_->setScale(x, y, z); }
     63      inline void setScale(Real scale)
     64        { this->node_->setScale(scale, scale, scale); }
     65      inline const Vector3& getScale(void) const
     66        { return this->node_->getScale(); }
     67      inline void scale(const Vector3 &scale)
     68        { this->node_->scale(scale); }
     69      inline void scale(Real x, Real y, Real z)
     70        { this->node_->scale(x, y, z); }
     71      inline void scale(Real scale)
     72        { this->node_->scale(scale, scale, scale); }
    5873
    5974      inline void attachObject(Ogre::MovableObject *obj)
    60           { this->node_->attachObject(obj); }
     75        { std::cout << "gux_1" << this->node_ << "\n"; this->node_->attachObject(obj); std::cout << "gux_2\n"; }
     76      inline void attachObject(Mesh &mesh)
     77        { std::cout << "gux_3" << this->node_ << "\n"; this->node_->attachObject((Ogre::MovableObject*)(mesh.getEntity())); std::cout << "gux_4\n"; }
    6178      inline void detachObject(Ogre::MovableObject *obj)
    62           { this->node_->detachObject(obj); }
     79        { this->node_->detachObject(obj); }
    6380      inline void detachAllObjects()
    64           { this->node_->detachAllObjects(); }
     81        { this->node_->detachAllObjects(); }
    6582
    6683      inline void setVelocity(const Vector3& velocity)
     
    100117      inline const Ogre::Quaternion& getOrientation()
    101118          { return this->node_->getOrientation(); }
    102      
     119
    103120    protected:
    104121      void registerAllVariables();
    105      
     122
    106123    private:
    107124      Ogre::SceneNode* node_;
  • code/branches/FICN/src/orxonox/orxonox.cc

    r568 r576  
    7070#include "../network/NetworkFrameListener.h"
    7171
     72#ifdef WIN32
     73#include <windows.h>
     74#define usleep(x) Sleep((x)/1000)
     75#else
     76#include <unistd.h>
     77#endif
    7278
    7379namespace orxonox
     
    339345    startRenderLoop();
    340346  }
    341  
     347
    342348  void Orxonox::standalone(){
    343    
    344    
    345    
     349
     350
     351
    346352  }
    347353
Note: See TracChangeset for help on using the changeset viewer.