Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5924 in orxonox.OLD for branches/avi_play/src/lib


Ignore:
Timestamp:
Dec 4, 2005, 11:37:49 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/avi_play: merged the Trunk back into the branche avi_play again

merged with command svn merge ../trunk/ avi_play/ -r5845:HEAD
no conflicts

Location:
branches/avi_play/src/lib
Files:
25 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/avi_play/src/lib/collision_detection/cd_engine.cc

    r5134 r5924  
    2424#include "world_entity.h"
    2525#include "terrain.h"
    26 #include "player.h"
     26// #include "player.h"
    2727
    2828#include "spatial_separation.h"
     
    119119    Quadtree* q = this->terrain->ssp->getQuadtree();
    120120
    121     QuadtreeNode* n = q->getQuadtreeFromPosition(this->player->getAbsCoor());
     121//    QuadtreeNode* n = q->getQuadtreeFromPosition(this->player->getAbsCoor());
    122122  }
    123123  //sTriangleExt* tri = q->getTriangleFromPosition(this->player->getAbsCoor());
  • branches/avi_play/src/lib/collision_detection/cd_engine.h

    r5039 r5924  
    1717class OBBTree;
    1818class Terrain;
    19 class Player;
     19//class Player;
    2020
    2121
     
    5151  inline void setEntityList(tList<WorldEntity>* entityList) { this->entityList = entityList; }
    5252  inline void setTerrain(Terrain* terrain) { this->terrain = terrain; }
    53   inline void setPlayer(Player* player) { this->player = player; } /* only for debug purposes \todo: delete*/
     53  //  inline void setPlayer(Player* player) { this->player = player; } /* only for debug purposes \todo: delete*/
    5454
    5555  void drawBV(int depth, int drawMode) const;
     
    7979
    8080  Terrain*                terrain;                          //!< this it a ref to the terrain, serving as a ground for all WE
    81   Player*                 player;
     81//  Player*                 player;
    8282};
    8383
  • branches/avi_play/src/lib/coord/p_node.cc

    r5819 r5924  
    428428
    429429  this->bias = bias;
     430  this->bRelDirChanged = true;
    430431}
    431432
     
    836837        glEnd();
    837838      }
     839
    838840      /* if we want to draw the children too */
    839841      if (depth == 0) /* -> all of them */
  • branches/avi_play/src/lib/coord/p_node.h

    r5770 r5924  
    7676  inline const Vector& getRelCoor () const { return this->prevRelCoordinate; };
    7777  /** @returns the Relative Coordinate Destination */
    78   inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)?*this->toCoordinate:this->relCoordinate; };
     78  inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)? *this->toCoordinate : this->relCoordinate; };
    7979  void setAbsCoor (const Vector& absCoord);
    8080  void setAbsCoor (float x, float y, float z);
     
    9393  inline const Quaternion& getRelDir () const { return this->prevRelDirection; };
    9494  /** @returns the Relative Directional Destination */
    95   inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)?*this->toDirection:this->relDirection; };
     95  inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)? *this->toDirection : this->relDirection; };
    9696  /** @returns a Vector pointing into the relative Direction */
    9797  inline Vector getRelDirV() const { return this->prevRelDirection.apply(Vector(0,1,0)); };
     
    100100  void setAbsDirSoft(const Quaternion& absDirSoft, float bias = 1.0);
    101101  void setAbsDirSoft(float x, float y, float z, float bias = 1.0);
     102  void shiftDir (const Quaternion& shift);
    102103  /** @returns the absolute Direction */
    103104  inline const Quaternion& getAbsDir () const { return this->absDirection; };
    104105  /** @returns a Vector pointing into the absolute Direction */
    105106  inline Vector getAbsDirV() const { return this->absDirection.apply(Vector(0,1,0)); };
    106   void shiftDir (const Quaternion& shift);
     107  /** @returns A Vector pointing into the forward direction (X) of the Node */
     108  inline Vector getAbsDirX() const { return this->absDirection.apply(Vector(1,0,0)); };
     109  /** @returns A Vector pointing into the upward direction (Y) of the Node */
     110  inline Vector getAbsDirY() const { return this->absDirection.apply(Vector(0,1,0)); };
     111  /** @returns A Vector pointing into the right direction (Z) of the Node */
     112  inline Vector getAbsDirZ() const { return this->absDirection.apply(Vector(0,0,1)); };
    107113
    108114  /** @returns the Speed of the Node */
  • branches/avi_play/src/lib/event/key_mapper.cc

    r5474 r5924  
    2121#include "key_mapper.h"
    2222
     23#include "event_def.h"
     24
    2325#include "globals.h"
    2426#include "ini_parser.h"
    2527#include "key_names.h"
    2628#include "debug.h"
     29
    2730
    2831using namespace std;
     
    191194      {
    192195        if( index[0] == 0)
    193         {
     196        {
    194197          *map[i].pValue = index[1];
    195198          PRINTF(4)("Mapping %s to '%s' (id %i)\n", name, SDLKToKeyname(index[1]), index[1]);
    196199          break;
    197         }
    198         else {
     200        }
     201        else {
    199202          *map[i].pValue = index[1];
    200203          PRINTF(4)("Mapping %s to '%s' (id %i)\n", name, SDLBToButtonname(index[1]), index[1]);
    201204          break;
    202         }
     205        }
    203206      }
    204207    }
  • branches/avi_play/src/lib/event/key_mapper.h

    r5819 r5924  
    1010
    1111#include "base_object.h"
    12 #include "event_def.h"
     12//#include "event_def.h"
    1313
    1414class IniParser;
     
    6666
    6767 private:
    68   Sint32     coord[2];              //!< temp place to save variables in nameToIndex() function
     68  int         coord[2];              //!< temp place to save variables in nameToIndex() function
    6969};
    7070
  • branches/avi_play/src/lib/graphics/graphics_engine.cc

    r5819 r5924  
    3131
    3232#include "globals.h"
     33#include "texture.h"
    3334
    3435#ifdef __WIN32__
    3536 #include "class_list.h"
    36  #include "texture.h"
    3737 #include "list.h"
    3838 #include "model.h"
     
    131131  const char* textures = iniParser->getVar(CONFIG_NAME_TEXTURES, CONFIG_SECTION_VIDEO_ADVANCED, "0");
    132132  if (strchr(textures, '1') || !strcasecmp(textures, "true"))
    133     this->texturesEnabled = true;
     133    Texture::setTextureEnableState( true);
    134134  else
    135     this->texturesEnabled = false;
     135    Texture::setTextureEnableState(false);
    136136
    137137  // searching for a usefull resolution
     
    365365
    366366/**
    367  * if Textures should be enabled
    368 */
    369 bool GraphicsEngine::texturesEnabled = true;
    370 
    371 /**
    372367 *
    373368 * @param show if The mouse-cursor should be visible
  • branches/avi_play/src/lib/graphics/graphics_engine.h

    r5366 r5924  
    8383
    8484  public:
    85     static bool             texturesEnabled;    //!< if textures should be enabled (globally)
    86 
    8785
    8886  private:
  • branches/avi_play/src/lib/graphics/importer/Makefile.am

    r5463 r5924  
    99                           md2Model.cc \
    1010                           material.cc \
    11                            texture.cc
     11                           texture.cc \
     12                           texture_sequence.cc
    1213
    1314
     
    2021                 material.h \
    2122                 texture.h \
     23                 texture_sequence.h \
    2224                 anorms.h \
    2325                 anormtab.h
  • branches/avi_play/src/lib/graphics/importer/material.h

    r5405 r5924  
    5151  static void addTexturePath(const char* pathName);
    5252
    53  private:
    54   int         illumModel;       //!< The IlluminationModel is either flat or smooth.
    55   float       diffuse [4];      //!< The diffuse color of the Material.
    56   float       ambient [4];      //!< The ambient color of the Material.
    57   float       specular [4];     //!< The specular color of the Material.
    58   float       shininess;        //!< The shininess of the Material.
    59   float       transparency;     //!< The transperency of the Material.
     53  private:
     54    int         illumModel;       //!< The IlluminationModel is either flat or smooth.
     55    float       diffuse [4];      //!< The diffuse color of the Material.
     56    float       ambient [4];      //!< The ambient color of the Material.
     57    float       specular [4];     //!< The specular color of the Material.
     58    float       shininess;        //!< The shininess of the Material.
     59    float       transparency;     //!< The transperency of the Material.
    6060  public:
    61   Texture*    diffuseTexture;   //!< The diffuse texture of the Material.
    62   Texture*    ambientTexture;   //!< The ambient texture of the Material.
    63   Texture*    specularTexture;  //!< The specular texture of the Material.
     61    Texture*    diffuseTexture;   //!< The diffuse texture of the Material.
     62    Texture*    ambientTexture;   //!< The ambient texture of the Material.
     63    Texture*    specularTexture;  //!< The specular texture of the Material.
    6464};
    6565#endif
  • branches/avi_play/src/lib/graphics/importer/texture.cc

    r5790 r5924  
    1919
    2020#include "debug.h"
    21 #include "graphics_engine.h"
    22 
     21
     22// INCLUDING SDL_Image
    2323#ifdef HAVE_SDL_IMAGE_H
    2424#include <SDL_image.h>
     
    4545}
    4646
     47
    4748/**
    4849 *  Destructor of a Texture
     
    6566bool Texture::loadImage(const char* imageName)
    6667{
    67   if (GraphicsEngine::texturesEnabled)
     68  if (Texture::texturesEnabled)
    6869    {
    6970      if (this->image != NULL)
     
    8081        {
    8182          SDL_Surface* tmpSurf;
    82           if (this->texture)
     83          if (this->texture != 0 && glIsTexture(this->texture))
    8384            glDeleteTextures(1, &this->texture);
    8485          // load the new Image to memory
     
    8788          {
    8889            PRINTF(4)("loading Image %s\n", imageName);
    89             if (this->prepareSurface(tmpSurf))
    90               loadTexToGL();
     90            bool hasAlpha;
     91            SDL_Surface* newSurf = this->prepareSurface(tmpSurf, hasAlpha);
     92            if (newSurf != NULL)
     93            {
     94              this->setSurface(newSurf);
     95              this->setAlpha(hasAlpha);
     96              this->setTexture(Texture::loadTexToGL(newSurf));
     97            }
     98
    9199            SDL_FreeSurface(tmpSurf);
    92100            return true;
     
    108116}
    109117
     118
     119/**
     120 * rebuilds the texture.
     121 * reloads the Texture from Memory to OpenGL.
     122 */
    110123bool Texture::rebuild()
    111124{
    112125  if (this->texture != 0)
    113126    {
    114       glDeleteTextures(1,&this->texture);
    115       this->texture = 0;
     127      if (glIsTexture(this->texture))
     128        glDeleteTextures(1,&this->texture);
     129      this->setTexture(0);
    116130    }
    117131
     
    119133    {
    120134      PRINTF(3)("Reloading Texture of %s '%s'\n", this->getClassName(), this->getName());
    121       this->loadTexToGL();
     135      this->setTexture(loadTexToGL(this->image));
    122136    }
    123 
    124 }
    125 
     137}
     138
     139
     140/**
     141 * set the surface this Texture handles
     142 * @param newSurface the new Surface to set as the image for this Texture.
     143 *
     144 * This deletes the old version of the stored Texture,
     145 * and sets the newly given Surface as current.
     146 */
     147bool Texture::setSurface(SDL_Surface* newSurface)
     148{
     149  if (this->image != NULL)
     150    SDL_FreeSurface(this->image);
     151
     152  this->image = newSurface;
     153
     154  return (this->image != NULL);
     155}
     156
     157
     158bool Texture::texturesEnabled = true;
     159
     160/**
     161 * enables, disables textures
     162 * @param texturesEnabled true if the textures should be enabled
     163 */
     164void Texture::setTextureEnableState(bool texturesEnabled)
     165{
     166  Texture::texturesEnabled = texturesEnabled;
     167}
     168
     169
     170//////////////////////////////////////
     171// UTILITY FUNCTIONALITY OF TEXTURE //
     172//////////////////////////////////////
    126173/**
    127174 * converts surface to a new SDL_Surface, that is loadable by openGL
    128175 * @param surface the Surface to convert
     176 * @param hasAlpha if the newly created Surface has an alpha channel, true is returned otherwise false.
    129177 * @returns a !!new!! Surface, that is loadable by openGL.
    130178 */
    131 bool Texture::prepareSurface(SDL_Surface* surface)
     179SDL_Surface* Texture::prepareSurface(SDL_Surface* surface, bool& hasAlpha)
    132180{
    133181  PRINTF(4)("Loading texture to OpenGL-Environment.\n");
    134182
    135   SDL_Surface* putSurface;
     183  SDL_Surface* retSurface;
    136184  SDL_Rect area;
    137185  Uint32 saved_flags;
    138186  Uint8  saved_alpha;
    139187
    140   putSurface = SDL_CreateRGBSurface(SDL_SWSURFACE,
    141                                surface->w, surface->h,
    142                                32,
     188  hasAlpha = false;
     189  retSurface = SDL_CreateRGBSurface(SDL_SWSURFACE,
     190                                    surface->w, surface->h,
     191                                    32,
    143192#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
    144193                               0x000000FF,
     
    147196                               0xFF000000
    148197#else
    149                                0xFF000000,
     198                                   0xFF000000,
    150199                               0x00FF0000,
    151200                               0x0000FF00,
    152201                               0x000000FF
    153202#endif
    154                                );
    155   if ( putSurface == NULL )
     203                                   );
     204  if ( retSurface == NULL )
    156205  {
    157     this->setSurface(NULL);
    158     return false;
     206    return NULL;
    159207  }
    160208
     
    171219  area.w = surface->w;
    172220  area.h = surface->h;
    173   SDL_BlitSurface(surface, &area, putSurface, &area);
     221  SDL_BlitSurface(surface, &area, retSurface, &area);
    174222
    175223  /* Restore the alpha blending attributes */
     
    177225  {
    178226    SDL_SetAlpha(surface, saved_flags | SDL_OPENGL, saved_alpha);
    179     this->bAlpha = true;
    180   }
    181 
    182   return (this->setSurface(putSurface));
    183 }
    184 
    185 bool Texture::setSurface(SDL_Surface* newSurface)
    186 {
    187   if (this->image != NULL)
    188     SDL_FreeSurface(this->image);
    189 
    190   this->image = newSurface;
    191 
    192   return (this->image != NULL);
     227    hasAlpha = true;
     228  }
     229
     230  return (retSurface);
    193231}
    194232
     
    199237 * @returns The ID of the texture.
    200238 */
    201 GLuint Texture::loadTexToGL ()
    202 {
    203   if (this->texture != 0 && glIsTexture(this->texture))
    204     glDeleteTextures(1, &this->texture);
    205   this->texture = 0;
    206 
    207   if (this->image == NULL)
     239GLuint Texture::loadTexToGL (const SDL_Surface* surface)
     240{
     241//   if (this->texture != 0 && glIsTexture(this->texture))
     242//     glDeleteTextures(1, &this->texture);
     243//   this->texture = 0;
     244
     245  GLuint texture;
     246
     247  if (surface == NULL)
    208248    return 0;
    209249
    210250  /* Create an OpenGL texture for the image */
    211   glGenTextures(1, &this->texture);
    212   glBindTexture(GL_TEXTURE_2D, this->texture);
     251  glGenTextures(1, &texture);
     252  glBindTexture(GL_TEXTURE_2D, texture);
    213253  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    214254  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     
    217257               0,
    218258               GL_RGBA,
    219                this->image->w, this->image->h,
     259               surface->w, surface->h,
    220260               0,
    221261               GL_RGBA,
    222262               GL_UNSIGNED_BYTE,
    223                this->image->pixels);
     263               surface->pixels);
    224264  // build the MipMaps
    225265  gluBuild2DMipmaps(GL_TEXTURE_2D,
    226266                    GL_RGBA,
    227                     this->image->w,
    228                     this->image->h,
     267                    surface->w,
     268                    surface->h,
    229269                    GL_RGBA,
    230270                    GL_UNSIGNED_BYTE,
    231                     this->image->pixels);
     271                    surface->pixels);
    232272  glBindTexture(GL_TEXTURE_2D, 0);
    233   return this->texture;
    234 }
     273  return texture;
     274}
  • branches/avi_play/src/lib/graphics/importer/texture.h

    r5768 r5924  
    1414struct SDL_Surface;
    1515
    16 //! an enumerator for different procedural texture-types
    17 typedef enum TEXTURE_TYPE { TEXTURE_RADIAL_ALIAS,
    18   TEXTURE_NOISE };
    19 
    2016//! A Class, that reads in Textures from different fileformats.
    2117  class Texture : public BaseObject
     
    2723
    2824      bool loadImage(const char* imageName);
    29       bool rebuild();
     25      virtual bool rebuild();
    3026
    3127      /** @returns The textureID of this texture.  */
     
    3329      /** @returns true if texture has alpha, false otherwise */
    3430      inline bool hasAlpha() const {return bAlpha;}
     31      /** @returns the stored image of this Texture */
     32      const SDL_Surface* const getStoredImage() const { return this->image; };
     33
     34
     35
     36      static void setTextureEnableState(bool texturesEnabled);
     37      /** @returns true if Textures are enabled */
     38      inline static bool getTextureEnableState() { return Texture::texturesEnabled; };
     39
     40      // Utility functionality:
     41      static SDL_Surface* prepareSurface(SDL_Surface* input, bool& hasAlpha);
     42      static GLuint loadTexToGL (const SDL_Surface* surface);
    3543
    3644    protected:
    37       bool prepareSurface(SDL_Surface* input);
     45
    3846      bool setSurface(SDL_Surface* newSurface);
     47      bool setAlpha(bool hasAlpha) { this->bAlpha = hasAlpha; };
     48      bool setTexture(GLuint texture) { this->texture = texture; };
    3949
    40       GLuint loadTexToGL ();
    4150
    4251    private:
    43       GLuint        texture;            //!< The Texture-ID of opengl from this Texture.
    44       bool          bAlpha;             //!< if the texture has an alpha channel.
    45       SDL_Surface*  image;              //!< The SDL_Surfce that stores the Texture on it.
     52      GLuint           texture;            //!< The Texture-ID of opengl from this Texture.
     53      bool             bAlpha;             //!< if the texture has an alpha channel.
     54      SDL_Surface*     image;              //!< The SDL_Surfce that stores the Texture on it.
     55
     56      static bool      texturesEnabled;    //!< If the Textures are enabled.
    4657  };
    4758
  • branches/avi_play/src/lib/graphics/text_engine/font.cc

    r5768 r5924  
    181181    this->fontTTF = NULL;
    182182  }
    183   if (this->prepareSurface(surface))
    184     this->loadTexToGL( );
     183  bool hasAlpha;
     184  SDL_Surface* newSurf = this->prepareSurface(surface, hasAlpha);
     185  if (newSurf != NULL)
     186  {
     187    this->setSurface(newSurf);
     188    this->setAlpha(hasAlpha);
     189    this->setTexture(Texture::loadTexToGL(newSurf));
     190  }
    185191
    186192  // initializing the Glyphs.
     
    491497
    492498  if (this->setSurface(tmpSurf))
    493     loadTexToGL();
     499    (this->setTexture(Texture::loadTexToGL(tmpSurf)));
    494500}
    495501
  • branches/avi_play/src/lib/graphics/text_engine/text_engine.cc

    r5780 r5924  
    6464{
    6565  // first remove all the remaining Texts (if any).
    66   std::list<BaseObject*>* textList = ClassList::getList(CL_TEXT);
     66  const std::list<BaseObject*>* textList = ClassList::getList(CL_TEXT);
    6767  if (textList != NULL)
    6868  {
     
    7171  }
    7272  // delete all remaining fonts (There should not be Anything to do here)
    73   std::list<BaseObject*>* fontList = ClassList::getList(CL_FONT);
     73  const std::list<BaseObject*>* fontList = ClassList::getList(CL_FONT);
    7474  if (fontList != NULL)
    7575  {
     
    124124void TextEngine::debug() const
    125125{
    126   list<BaseObject*>* textList = ClassList::getList(CL_TEXT);
     126  const list<BaseObject*>* textList = ClassList::getList(CL_TEXT);
    127127  if (textList != NULL)
    128128  {
     
    132132    PRINT(0)("Reference: %p; Text Counts: %d\n", this, textList->size());
    133133
    134     list<BaseObject*>::iterator text;
     134    list<BaseObject*>::const_iterator text;
    135135    for ( text = textList->begin(); text != textList->end(); text++)
    136136      dynamic_cast<Text*>(*text)->debug();
  • branches/avi_play/src/lib/lang/base_object.cc

    r5791 r5924  
    112112  else if (classID & CL_MASK_SUBSUPER_CLASS)
    113113  {
    114     if (likely(((this->classID & CL_MASK_SUBSUPER_CLASS_ID) == (this->classID & CL_MASK_SUBSUPER_CLASS_ID)) &&
    115         this->classID & classID & CL_MASK_SUBSUPER_CLASS_ID2))
     114    if (likely(((this->classID & CL_MASK_SUBSUPER_CLASS_IDA) == (this->classID & CL_MASK_SUBSUPER_CLASS_IDA)) &&
     115        this->classID & classID & CL_MASK_SUBSUPER_CLASS_IDB))
    116116      return true;
    117117  }
  • branches/avi_play/src/lib/lang/class_list.cc

    r5822 r5924  
    133133 * @return the List accessed by classID, or NULL if not found
    134134 */
    135 std::list<BaseObject*>* ClassList::getList(ClassID classID)
     135const std::list<BaseObject*>* ClassList::getList(ClassID classID)
    136136{
    137137  ClassList* fl;
     
    156156 * @return the List accessed by classID, or NULL if not found
    157157 */
    158 std::list<BaseObject*>* ClassList::getList(const char* className)
     158const std::list<BaseObject*>* ClassList::getList(const char* className)
    159159{
    160160  ClassList* fl;
  • branches/avi_play/src/lib/lang/class_list.h

    r5821 r5924  
    4040    static void                           removeFromClassList(BaseObject* objectPointer);
    4141
    42     static std::list<BaseObject*>*        getList(ClassID classID = CL_NULL);// { return (ClassList* fl = ClassList::getClassList(classID) != NULL)? &(fl->objectList) : NULL; };
    43     static std::list<BaseObject*>*        getList(const char* className); // { return (ClassList* fl = ClassList::getClassList(className) != NULL)? &(fl->objectList) : NULL;  };
     42    static const std::list<BaseObject*>*  getList(ClassID classID = CL_NULL);// { return (ClassList* fl = ClassList::getClassList(classID) != NULL)? &(fl->objectList) : NULL; };
     43    static const std::list<BaseObject*>*  getList(const char* className); // { return (ClassList* fl = ClassList::getClassList(className) != NULL)? &(fl->objectList) : NULL;  };
    4444    static const std::list<const char*>*  getClassNames();
    4545    static BaseObject*                    getObject(const char* name, ClassID classID = CL_NULL);
    4646    static bool                           exists(const BaseObject* object, ClassID classID = CL_NULL);
     47
     48    void                                  sendBack(std::list<BaseObject*>::const_iterator it);
    4749
    4850    static void                           whatIs(const BaseObject* object);
     
    5153    static long                           StringToID(const char* className);
    5254    static void                           debug(unsigned int debugLevel = 0, long classID = CL_NULL);
    53     static void                           debugS(const char* className = 0x0, unsigned int debugLevel = 0);
     55    static void                           debugS(const char* className = NULL, unsigned int debugLevel = 0);
    5456
    5557    inline bool                           operator==(ClassID classID) { return (this->classID == classID); };
  • branches/avi_play/src/lib/network/network_manager.cc

    r5822 r5924  
    161161  if (this->netStreamList != NULL || (this->netStreamList = ClassList::getList(CL_NETWORK_STREAM)) != NULL)
    162162  {
    163     std::list<BaseObject*>::iterator stream;
     163    std::list<BaseObject*>::const_iterator stream;
    164164    for (stream = this->netStreamList->begin(); stream != this->netStreamList->end(); ++stream)
    165165      static_cast<NetworkStream*>(*stream)->processData();
  • branches/avi_play/src/lib/network/network_manager.h

    r5822 r5924  
    4141
    4242private:
    43   std::list<BaseObject*>*    netStreamList;            // list with refs to all network streams
    44   std::list<BaseObject*>*    syncList;                 // list of synchronizeables
     43  const std::list<BaseObject*>*    netStreamList;            // list with refs to all network streams
     44  const std::list<BaseObject*>*    syncList;                 // list of synchronizeables
    4545
    4646};
  • branches/avi_play/src/lib/shell/shell_command.cc

    r5791 r5924  
    159159  long classID = CL_NULL;                      //< the classID retrieved from the Class.
    160160  ShellCommandClass* commandClass = NULL;      //< the command class this command applies to.
    161   std::list<BaseObject*>* objectList = NULL;   //< the list of Objects stored in classID
     161  const std::list<BaseObject*>* objectList = NULL;   //< the list of Objects stored in classID
    162162  BaseObject* objectPointer = NULL;            //< a pointer to th Object to Execute the command on
    163163  bool emptyComplete = false;                  //< if the completion input is empty string. e.g ""
  • branches/avi_play/src/lib/shell/shell_completion.cc

    r5791 r5924  
    5858
    5959  long classID;                         //< the classID retrieved from the Class.
    60   std::list<BaseObject*>* objectList;   //< the list of Objects stored in classID
     60  const std::list<BaseObject*>* objectList;   //< the list of Objects stored in classID
    6161  bool emptyComplete = false;           //< if the completion input is empty string. e.g ""
    6262  long completeType = SHELLC_NONE;      //< the Type we'd like to complete.
  • branches/avi_play/src/lib/sound/sound_engine.cc

    r5834 r5924  
    137137  if (this->sourceList != NULL)
    138138  {
    139     list<BaseObject*>::iterator source;
     139    list<BaseObject*>::const_iterator source;
    140140    for (source = this->sourceList->begin(); source != this->sourceList->end(); source++)
    141141    {
     
    182182  if (likely(this->sourceList != NULL))
    183183  {
    184     list<BaseObject*>::iterator sourceIT;
     184    list<BaseObject*>::const_iterator sourceIT;
    185185    SoundSource* source;
    186186    for (sourceIT = this->sourceList->begin(); sourceIT != this->sourceList->end(); sourceIT++)
     
    281281
    282282  // INITIALIZING THE DEVICE:
    283   ALchar deviceName[] =
     283#ifndef AL_VERSION_1_1
     284  ALubyte deviceName[] =
     285#else
     286  ALCchar deviceName[] =
     287#endif
    284288#ifdef __WIN32__
    285       "native";
     289      "Direct3D";
    286290#else
    287       "'( ( devices '( native arts null ) ) )";
     291      "'( ( devices '( native null ) ) )";
    288292#endif
    289293  //
     
    301305}
    302306
     307
     308/**
     309 * Allocates openAL sources
     310 * @param count how many sources to allocate
     311 * @returns true on success, false if at least one source could not be allocated
     312 */
     313bool SoundEngine::allocateSources(unsigned int count)
     314{
     315  ALuint* sourceList = new ALuint[count];
     316  ALenum result;
     317
     318  alGenSources(count, sourceList);
     319  if ((result = alGetError()) != AL_NO_ERROR)
     320  {
     321    SoundEngine::PrintALErrorString(result);
     322    return false;
     323  }
     324
     325  /// @TODO check syntax
     326
     327
     328  // Setting default values.
     329  for (int i = 0; i < count; i++)
     330  {
     331    alSourcef (sourceList[i], AL_PITCH,    1.0      );
     332    alSourcef (sourceList[i], AL_GAIN,     this->getEffectsVolume() );
     333    alSourcei (sourceList[i], AL_LOOPING,  AL_FALSE );
     334    this->ALSources.push(sourceList[i]);
     335  }
     336  return true;
     337}
     338
    303339/**
    304340 *  Transforms AL-errors into something readable
  • branches/avi_play/src/lib/sound/sound_engine.h

    r5819 r5924  
    1414
    1515#include <list>
     16#include <stack>
    1617
    1718#define SOUND_DOPPLER_FACTOR       0.001          //!< A factor for the audible doppler effect
     
    2122class PNode;
    2223class IniParser;
     24
    2325
    2426//! A class that handles audio via the openAudioLibrary
     
    5456    void flushAllBuffers();
    5557    void flushAllSources();
     58
     59    bool allocateSources(unsigned int count);
    5660    bool initAudio();
    5761
     
    6670
    6771  private:
    68     static SoundEngine*      singletonRef;             //!< Reference to this class
     72    static SoundEngine*            singletonRef;             //!< Reference to this class
    6973
    70     ALCdevice*               device;                   //!< the used audio-device.
    71     ALCcontext*              context;                  //!< the context, currently in use.
     74    ALCdevice*                     device;                   //!< the used audio-device.
     75    ALCcontext*                    context;                  //!< the context, currently in use.
    7276
    73     float                    musicVolume;              //!< the maximum volume of the music in % (0f,1f]
    74     float                    effectsVolume;            //!< the maximum volume of sound-effects in % (0f,1f]
    75     PNode*                   listener;                 //!< The listener of the Scene
     77    float                          musicVolume;              //!< the maximum volume of the music in % (0f,1f]
     78    float                          effectsVolume;            //!< the maximum volume of sound-effects in % (0f,1f]
     79    PNode*                         listener;                 //!< The listener of the Scene
    7680
    77     std::list<BaseObject*>*  bufferList;               //!< A list of buffers
    78     std::list<BaseObject*>*  sourceList;               //!< A list for all the sources in the scene.
     81    const std::list<BaseObject*>*  bufferList;               //!< A list of buffers
     82    const std::list<BaseObject*>*  sourceList;               //!< A list for all the sources in the scene.
    7983
    80 
     84    unsigned int                   maxSourceCount;           //!< How many Sources is the Maximum
     85    std::stack<ALuint>             ALSources;                //!< A list of real openAL-Sources, the engine allocates, and stores for reuse.
    8186};
    8287
  • branches/avi_play/src/lib/sound/sound_source.cc

    r5386 r5924  
    1818#include "sound_source.h"
    1919#include "sound_engine.h"
     20
    2021#include "alincl.h"
    2122#include "compiler.h"
  • branches/avi_play/src/lib/sound/sound_source.h

    r5386 r5924  
    3939
    4040  private:
     41    bool                   bPlay;                 //!< If the Source is Playing.
    4142    ALuint                 sourceID;              //!< The ID of the Source
    4243    const SoundBuffer*     buffer;                //!< The buffer to play in this source.
Note: See TracChangeset for help on using the changeset viewer.