Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglTexturedTextSet.hpp

00001 /*****************************************************************************
00002  * SGL: A Scene Graph Library
00003  *
00004  * Copyright (C) 1997-2001  Scott McMillan   All Rights Reserved.
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the Free
00018  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  *****************************************************************************
00020  *     File: sglTexturedTextSet.hpp (was sglTexturedText)
00021  *  Created: 18 June 2001
00022  *  Summary: render text in a 3D location in the scene using a texture font
00023  *****************************************************************************/
00024 
00025 #ifndef __SGL_TEXTUREDTEXTSET_HPP
00026 #define __SGL_TEXTUREDTEXTSET_HPP
00027 
00028 #include <sgl.h>
00029 
00030 #include <sglDrawable.hpp>
00031 #include <sglStatelet.hpp>
00032 #include <sglVector.hpp>
00033 #include <string>
00034 
00035 class sglTextureFont;
00036 
00037 //============================================================================
00038 
00043 class SGL_DLL_API sglTexturedTextSet : public sglDrawable
00044 {
00045 public:
00049    sglTexturedTextSet(sglTextureFont *font);
00050 
00052    virtual ~sglTexturedTextSet();
00053 
00057    void setString(const string &str);
00058 
00062    const string& getString() const {return m_text;}
00063 
00067    void setFont(sglTextureFont *font);
00068 
00072    sglTextureFont* getFont() const { return m_font; }
00073 
00077    void setColor(const sglVec4f &color);
00078 
00085    void setColor(float r, float g, float b, float a);
00086 
00090    void getColor(sglVec4f &color) const;
00091 
00095    void setPosition(const sglVec3f &pos);
00096 
00102    void setPosition(float x, float y, float z);
00103 
00107    const sglVec3f &getPosition() const { return m_position; }
00108 
00112    void setCharHeight(float height);
00113 
00117    float getHeight() const;
00118 
00122    float getWidth() const;
00123 
00127    void setVertical(bool on);
00128 
00132    bool getVertical() const { return m_vertical; }
00133 
00134    // ---------------- Functions required by sglDrawable -----------------
00135    // Add this drawable's stats to the given debug_stats.
00136    virtual void addStats(sglStats &stats) const;
00137 
00138    virtual void drawGeometry(const vector<sglTexCoords> &tex_coords) const;
00139 
00141    virtual sglBound::IntersectResultEnum intersectPrim(sglIntersectf &segset);
00143    virtual sglBound::IntersectResultEnum intersectPrim(sglIntersectd &segset);
00144 
00148    virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00149 
00150 protected:
00151    void updateArrays();
00152 
00153    // ---------------- Functions required by sglDrawable -----------------
00154    virtual bool computeBounds();
00155 
00156 private:  // not implemented
00157    sglTexturedTextSet();
00158    sglTexturedTextSet(const sglTexturedTextSet &);
00159    sglTexturedTextSet& operator=(const sglTexturedTextSet &);
00160 
00161 private:
00162    string                 m_text;
00163    float                  m_height;
00164    bool                   m_vertical;
00165 
00166    sglTextureFont        *m_font;
00167    sglVec3f               m_position;
00168 
00169    unsigned int           m_num_prims;
00170    sglVec3f              *m_coords;
00171    sglVec4f               m_color;
00172    sglVec3f               m_normal;
00173 
00174    sglTransparency        m_transparency_statelet;
00175    vector<sglStatelet*>   m_statelets;
00176 };
00177 
00178 #endif

Generated at Mon Jul 1 18:00:06 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001