Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9718 in orxonox.OLD for branches/new_class_id/src/lib/graphics


Ignore:
Timestamp:
Sep 1, 2006, 11:56:54 PM (18 years ago)
Author:
bensch
Message:

more thoughts on Resources, and soon going to adapt… i think i've got a clue :)

Location:
branches/new_class_id/src/lib/graphics
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/graphics/importer/material.cc

    r9715 r9718  
    324324 * @param textureNumber The Texture-Number from 0 to GL_MAX_TEXTURE_UNITS
    325325 */
    326 void Material::setDiffuseMap(const TextureDataPointer& textureDataPointer, unsigned int textureNumber)
     326void Material::setDiffuseMap(const TextureData::Pointer& textureDataPointer, unsigned int textureNumber)
    327327{
    328328  assert(textureNumber < Material::getMaxTextureUnits());
  • branches/new_class_id/src/lib/graphics/importer/material.h

    r9715 r9718  
    5454  // MAPPING //
    5555  void setDiffuseMap(const Texture& texture, unsigned int textureNumber = 0);
    56   void setDiffuseMap(const TextureDataPointer& texturePointer, unsigned int textureNumber = 0);
     56  void setDiffuseMap(const TextureData::Pointer& texturePointer, unsigned int textureNumber = 0);
    5757  void setDiffuseMap(const std::string& dMap, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
    5858  void setSDLDiffuseMap(SDL_Surface *surface, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
  • branches/new_class_id/src/lib/graphics/importer/texture.cc

    r9715 r9718  
    151151  this->registerObject(this, Texture::_objectList);
    152152
    153   this->data = TextureDataPointer(new TextureData());
     153  this->data = TextureData::Pointer(new TextureData());
    154154
    155155  this->priority = 0.5;
     
    176176}
    177177
    178 Texture& Texture::operator=(const TextureDataPointer& textureDataPointer)
     178Texture& Texture::operator=(const TextureData::Pointer& textureDataPointer)
    179179{
    180180  this->data = textureDataPointer;
  • branches/new_class_id/src/lib/graphics/importer/texture.h

    r9715 r9718  
    2929
    3030  Texture& operator=(const Texture& texture);
    31   Texture& operator=(const TextureDataPointer& textureDataPointer);
     31  Texture& operator=(const TextureData::Pointer& textureDataPointer);
    3232
    3333  virtual ~Texture();
     
    6363
    6464private:
    65   TextureDataPointer            data;               //!< The TextureData
     65  TextureData::Pointer          data;               //!< The TextureData
    6666  GLclampf                      priority;           //!< the priority of the current texture (used for garphics cards with limited mem)
    6767
  • branches/new_class_id/src/lib/graphics/importer/texture_data.h

    r8761 r9718  
    1818class TextureData
    1919{
     20  public:
     21    typedef CountPointer<TextureData> Pointer;
    2022  public:
    2123    TextureData();
     
    4345};
    4446
    45 typedef CountPointer<TextureData> TextureDataPointer;
    46 
    4747#endif /* _TEXTURE_DATA_H */
  • branches/new_class_id/src/lib/graphics/text_engine/font.cc

    r9715 r9718  
    139139}
    140140
    141 FontDataPointer Font::defaultFontData(NULL);
     141FontData::Pointer Font::defaultFontData(NULL);
    142142
    143143/**
     
    147147{
    148148  // temporarily create a Font.
    149   Font::defaultFontData = FontDataPointer(new FontData);
     149  Font::defaultFontData = FontData::Pointer(new FontData);
    150150  // apply the Data.
    151151  Font::defaultFontData = Font(font_xpm).data;
     
    160160bool Font::loadFontFromTTF(const std::string& fontFile, unsigned int renderSize)
    161161{
    162   this->data = FontDataPointer (new FontData());
     162  this->data = FontData::Pointer (new FontData());
    163163  bool retVal = this->data->loadFontFromTTF(fontFile, renderSize);
    164164  if (!retVal)
     
    175175bool Font::loadFontFromSDL_Surface(SDL_Surface* surface)
    176176{
    177   this->data = FontDataPointer (new FontData());
     177  this->data = FontData::Pointer (new FontData());
    178178  bool retVal = this->data->loadFontFromSDL_Surface(surface);
    179179  if (!retVal)
     
    197197
    198198
    199 void Font::setTexture(const TextureDataPointer& texDataPointer)
     199void Font::setTexture(const TextureData::Pointer& texDataPointer)
    200200{
    201201  this->setDiffuseMap(texDataPointer);
  • branches/new_class_id/src/lib/graphics/text_engine/font.h

    r9715 r9718  
    2020{
    2121  ObjectListDeclaration(Font);
    22 
     22public:
     23  typedef FontData::Glyph Glyph;
    2324public:
    2425  Font();
     
    4041
    4142  /** @returns a Pointer to the Array of Glyphs */
    42   inline Glyph** getGlyphArray() const { return this->data->getGlyphArray(); };
     43  inline const Glyph* const * const getGlyphArray() const { return this->data->getGlyphArray(); };
    4344
    4445  inline int getMaxHeight() const { return data->getMaxHeight(); };
     
    5556  static void initDefaultFont();
    5657
    57   void setTexture(const TextureDataPointer& texDataPointer);
     58  void setTexture(const TextureData::Pointer& texDataPointer);
    5859
    5960private:
    60   FontDataPointer           data;                //!< A Data-Pointer to a Font.
     61  FontData::Pointer         data;                //!< A Data-Pointer to a Font.
    6162
    62   static FontDataPointer    defaultFontData;     //!< a default font, that is used, if other fonts were unable to be loaded.
     63  static FontData::Pointer  defaultFontData;     //!< a default font, that is used, if other fonts were unable to be loaded.
    6364};
    6465
  • branches/new_class_id/src/lib/graphics/text_engine/font_data.h

    r8768 r9718  
    2626#define FONT_DEFAULT_RENDER_SIZE     50            //!< At what Resolution to render fonts.
    2727
     28class FontData
     29{
     30
     31
     32public:
     33
    2834//! A struct for handling glyphs
    2935/**
    3036 * a Glyph is one letter of a certain font
    3137 */
    32 struct Glyph
    33 {
     38  struct Glyph
     39  {
    3440  // Glyph-specific (size and so on)
    35   Uint16   character;         //!< The character
    36   float    minX;              //!< The minimum distance from the origin in X
    37   float    maxX;              //!< The maximum distance from the origin in X
    38   float    minY;              //!< The minimum distance from the origin in Y
    39   float    maxY;              //!< The maximum distance from the origin in Y
    40   float    width;             //!< The width of the Glyph
    41   float    height;            //!< The height of the Glyph
    42   float    bearingX;          //!< How much is right of the Origin
    43   float    bearingY;          //!< How much is above the Origin
    44   float    advance;           //!< How big a Glyph would be in monospace-mode
     41    Uint16   character;         //!< The character
     42    float    minX;              //!< The minimum distance from the origin in X
     43    float    maxX;              //!< The maximum distance from the origin in X
     44    float    minY;              //!< The minimum distance from the origin in Y
     45    float    maxY;              //!< The maximum distance from the origin in Y
     46    float    width;             //!< The width of the Glyph
     47    float    height;            //!< The height of the Glyph
     48    float    bearingX;          //!< How much is right of the Origin
     49    float    bearingY;          //!< How much is above the Origin
     50    float    advance;           //!< How big a Glyph would be in monospace-mode
    4551
    46   GLfloat texCoord[4];        //!< Texture coordinates: 0:left, 1:right, 2: top, 3: bottom.
    47 };
     52    GLfloat texCoord[4];        //!< Texture coordinates: 0:left, 1:right, 2: top, 3: bottom.
     53  };
    4854
    49 
    50 class FontData
    51 {
     55  typedef CountPointer<FontData> Pointer;
    5256public:
    5357  FontData();
     
    6165
    6266  /** @returns a Pointer to the Array of Glyphs */
    63   inline Glyph** getGlyphArray() const { return this->glyphArray; };
     67  inline const Glyph* const * const getGlyphArray() const { return this->glyphArray; };
    6468
    6569  int getMaxHeight() const { return maxHeight; };
     
    6872
    6973  /** @returns the Texture-Data of this FontData */
    70   const TextureDataPointer& textureData() const { return texData; };
     74  const TextureData::Pointer& textureData() const { return texData; };
    7175
    7276  bool rebuild() { return texData->rebuild(); };
     
    9195  int           maxDescent;          //!< Max Desent of the Font.
    9296
    93   TextureDataPointer   texData;
     97  TextureData::Pointer   texData;
    9498};
    9599
    96 typedef CountPointer<FontData> FontDataPointer;
    97 
    98100#endif /* _FONT_DATA_H */
  • branches/new_class_id/src/lib/graphics/text_engine/limited_width_text.cc

    r9715 r9718  
    7676  glRotatef(this->getAbsDir2D(), 0, 0, 1);
    7777
    78   Glyph* tmpGlyph;
     78  const Font::Glyph* tmpGlyph;
    7979  float posX = 0.0f;
    8080  glBegin(GL_QUADS);
  • branches/new_class_id/src/lib/graphics/text_engine/multi_line_text.cc

    r9715 r9718  
    8080  glRotatef(this->getAbsDir2D(), 0, 0, 1);
    8181
    82   Glyph* tmpGlyph;
     82  const Font::Glyph* tmpGlyph;
    8383  float posX = 0.0f;
    8484  float posY = 0.0f;
  • branches/new_class_id/src/lib/graphics/text_engine/text.cc

    r9715 r9718  
    235235  glRotatef(this->getAbsDir2D(), 0, 0, 1);
    236236
    237   Glyph* tmpGlyph;
     237  const Font::Glyph* tmpGlyph;
    238238  float posX = 0.0f;
    239239  glBegin(GL_QUADS);
Note: See TracChangeset for help on using the changeset viewer.