00001 /*===========================================================================*\ 00002 * * 00003 * OpenFlipper * 00004 * Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen * 00005 * www.openflipper.org * 00006 * * 00007 *---------------------------------------------------------------------------* 00008 * This file is part of OpenFlipper. * 00009 * * 00010 * OpenFlipper is free software: you can redistribute it and/or modify * 00011 * it under the terms of the GNU Lesser General Public License as * 00012 * published by the Free Software Foundation, either version 3 of * 00013 * the License, or (at your option) any later version with the * 00014 * following exceptions: * 00015 * * 00016 * If other files instantiate templates or use macros * 00017 * or inline functions from this file, or you compile this file and * 00018 * link it with other files to produce an executable, this file does * 00019 * not by itself cause the resulting executable to be covered by the * 00020 * GNU Lesser General Public License. This exception does not however * 00021 * invalidate any other reasons why the executable file might be * 00022 * covered by the GNU Lesser General Public License. * 00023 * * 00024 * OpenFlipper is distributed in the hope that it will be useful, * 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00027 * GNU Lesser General Public License for more details. * 00028 * * 00029 * You should have received a copy of the GNU LesserGeneral Public * 00030 * License along with OpenFlipper. If not, * 00031 * see <http://www.gnu.org/licenses/>. * 00032 * * 00033 \*===========================================================================*/ 00034 00035 /*===========================================================================*\ 00036 * * 00037 * $Revision: 6743 $ * 00038 * $Author: moebius $ * 00039 * $Date: 2009-08-05 11:03:10 +0200 (Mi, 05. Aug 2009) $ * 00040 * * 00041 \*===========================================================================*/ 00042 00043 00044 00045 00046 //============================================================================= 00047 // 00048 // CLASS PointNode 00049 // 00050 //============================================================================= 00051 00052 #ifdef USE_FTGL 00053 00054 #ifndef ACG_TEXTNODE_HH 00055 #define ACG_TEXTNODE_HH 00056 00057 00058 //== INCLUDES ================================================================= 00059 00060 #include "BaseNode.hh" 00061 #include "DrawModes.hh" 00062 #include <vector> 00063 00064 //== NAMESPACES =============================================================== 00065 00066 namespace ACG { 00067 namespace SceneGraph { 00068 00069 //== CLASS DEFINITION ========================================================= 00070 00071 00072 00079 class ACGDLLEXPORT TextNode : public BaseNode 00080 { 00081 public: 00082 00083 enum TextMode { 00084 SCREEN_ALIGNED, 00085 OBJECT_ALIGNED 00086 }; 00087 00094 TextNode( std::string _fontFile, 00095 BaseNode* _parent=0, 00096 std::string _name="<TextNode>", 00097 TextMode _textMode = SCREEN_ALIGNED) 00098 : BaseNode(_parent, _name), 00099 font_(0), 00100 size_(_textMode == SCREEN_ALIGNED ? 15 : 1), 00101 fontFile_(_fontFile), 00102 textMode_(_textMode) 00103 { 00104 UpdateFont(); 00105 } 00106 00108 ~TextNode(); 00109 00111 ACG_CLASSNAME(TextNode); 00112 00114 unsigned int availableDrawModes() const; 00115 00117 void boundingBox(Vec3f& _bbMin, Vec3f& _bbMax); 00118 00120 void draw(GLState& _state, unsigned int _drawMode); 00121 00125 void setRenderingMode(TextMode _textMode) { textMode_ = _textMode; }; 00126 00127 TextMode renderingMode() { return textMode_; }; 00128 00129 void setText(std::string _text) {text_ = _text;}; 00130 00131 void setSize(unsigned int _size) {size_ = _size; UpdateFont();}; 00132 00133 protected: 00134 void UpdateFont(); 00135 00136 private: 00137 void *font_; 00138 00139 unsigned int size_; 00140 00141 std::string text_; 00142 00143 std::string fontFile_; 00144 00145 TextMode textMode_; 00146 }; 00147 00148 00149 //============================================================================= 00150 } // namespace SceneGraph 00151 } // namespace ACG 00152 //============================================================================= 00153 #endif // ACG_TEXTNODE_HH defined 00154 //============================================================================= 00155 #else // NO USE_FTGL but header included 00156 00157 #ifdef WIN32 00158 #pragma message ( "TextNode requires ftgl but ftgl was not found" ) 00159 #else 00160 #warning TextNode requires ftgl but ftgl was not found 00161 #endif 00162 00163 #endif // USE_FTGL defined 00164 //=============================================================================