VedaLibDemo/Object3DFontBitmap.h

00001 #ifndef COM_M4NKIND_Object3DFontBitmap_H
00002 #define COM_M4NKIND_Object3DFontBitmap_H
00003 
00004 #include "Object3DFontVirtual.h"
00005 #include "PackString.h"
00006 #include "PackLong_WithLimits.h"
00007 /*!
00008     \class  Object3DFontBitmap
00009     \ingroup    BaseObjectInherited_VedaLibDemo
00010     \brief  Define a list of characters with 3D objects.
00011             Do a fixed-width Font by subdividing an image 
00012             from the texture. Fonts can be used by 3D Object Text.
00013 */
00014 
00015 class Object3DFontBitmap : public Object3DFontVirtual
00016 {
00017 /*==================================================================
00018                                 PUBLIC
00019 ==================================================================*/
00020 public:
00021     /*!
00022         \brief  Constructor. There should only be members initialisation there.
00023     */
00024     Object3DFontBitmap(void);
00025 
00026     /*!
00027         \brief  Class Inheritance Descriptors. Also forces a destructor. See BASEOBJECT_DECLARE_... in .cpp
00028     */
00029     BASEOBJECT_DEFINE_CLASS(Object3DFontBitmap);
00030     /*!
00031         \brief  Return the 3D shape index of the object that fit one character.
00032                 (then use index with RenderObject() )
00033                 a character is given with a zero-ended string because we can support
00034                 one byte character and more large char formats.
00035                 If the char is not supportd, we return false.
00036                 else,_rShapeIndex can return -1 if the char is space or tab.
00037         \param  _pString    zero ended char.
00038         \param  _rShapeIndex return index
00039         \param  _rCharWidth     the width of the char, to use them in the geometry.
00040         \return true if there is a character, false if no char.
00041     */
00042     virtual bool GetShapeIndexForCharacter( const char *_pString,
00043                                             int &_rShapeIndex,
00044                                             float &_rCharWidth );
00045 
00046 /*==================================================================
00047                                 PROTECTED
00048 ==================================================================*/
00049 protected:
00050     //! number of char by line in the image.
00051     PackLong_WithLimits mSer_NbDivCharX;
00052     //! number of lines
00053     PackLong_WithLimits mSer_NbDivCharY;
00054     //! the corresponding character set:
00055     PackString  mSer_Characters;
00056 
00057     /*!
00058         \brief  Method that really build the object using the serializable parameters.
00059                 Close() should close everything opened by CreateInternal().
00060     */
00061     virtual bool CreateInternal(void);
00062 
00063     //! precalculate a remap table with shape indexes.
00064     unsigned char   m_CharTable[256];
00065 };
00066 
00067 #endif

      /\/\        4         N         k         !         N         D
                      _______  _ __ ___  _____            ___ _ _  ____
     ___________  __//___   /________  |/    / ___________\_______/    \
    /   _   _   \/   _     /    _   /      _/_/____/    _       __     /
   /    /   /       /     /    /    \      \/     /    /    \   \     /
  \\___/___/___/    ¯    _____/_____/       ______\___/_____/\________\\
               \________/_ ___ __ l____\      /elD!  
                 http://www.m4nkind.com \____/