Show
Ignore:
Timestamp:
03/21/12 18:36:20 (2 years ago)
Author:
robert
Message:

Ran script to remove trailing spaces and tabs

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/include/osgText/Text

    r12068 r13041  
    1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield  
     1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 
    22 * 
    3  * This library is open source and may be redistributed and/or modified under   
    4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or  
     3 * This library is open source and may be redistributed and/or modified under 
     4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 
    55 * (at your option) any later version.  The full license is in LICENSE file 
    66 * included with this distribution, and on the openscenegraph.org website. 
    7  *  
     7 * 
    88 * This library is distributed in the hope that it will be useful, 
    99 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
     10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1111 * OpenSceneGraph Public License for more details. 
    1212*/ 
     
    7474    enum BackdropImplementation 
    7575    { 
    76         /* POLYGON_OFFSET:  
    77          * This uses glPolygonOffset to draw the text multiple times to  
    78          * create the drop-shadow and outline effects. glPolygonOffset  
     76        /* POLYGON_OFFSET: 
     77         * This uses glPolygonOffset to draw the text multiple times to 
     78         * create the drop-shadow and outline effects. glPolygonOffset 
    7979         * is used to prevent z-fighting of the overlapping text. 
    8080         * This probably should have been the best option, but all the ATI 
     
    8383         * which move around depending on the viewing angle. For moving text, 
    8484         * the moving holes give an extremely unpleasant flickering effect. 
    85          * Pumping up the "units" parameter in glPolygonOffset can minimize  
     85         * Pumping up the "units" parameter in glPolygonOffset can minimize 
    8686         * this problem, but two other bad side-effects occur if you do this. 
    8787         * First, high values will cause problems with clipping, particularly 
    8888         * when there are objects behind the text. The drop-shadows or outline 
    89          * may be culled because their computed offset is behind the object or  
     89         * may be culled because their computed offset is behind the object or 
    9090         * z-far plane. Second, there is an additional problem associated with 
    9191         * the Z-slope. High values can make large chunks of the backdrop 
     
    9696         * for the large-section clipping. 
    9797         * Experimentally, we have found units values from 150-512 to be tolerable 
    98          * to acceptable with respect to the 'holes'. A factor of .1 seems to  
     98         * to acceptable with respect to the 'holes'. A factor of .1 seems to 
    9999         * bring down the large clipping problem without creating a new z-fighting 
    100100         * problem. 
    101          * (You can experiment with these numbers by playing with the  
     101         * (You can experiment with these numbers by playing with the 
    102102         * osg:PolygonOffset multipliers which this backend tries to respect.) 
    103103         * 
    104          * If ATI ever fixes their cards/drivers, then this might become the  
     104         * If ATI ever fixes their cards/drivers, then this might become the 
    105105         * best option.*/ 
    106106        POLYGON_OFFSET = 0, 
    107          
     107 
    108108        /* NO_DEPTH_BUFFER 
    109109         * Instead of using glPolygonOffset to prevent z-fighting, this mode 
    110110         * just disables the depth buffer when rendering the text. This allows 
    111          * the text to be rendered without any z-fighting. The downside to this  
    112          * mode is that render order begins to matter and the text will not  
    113          * necessarily correctly appear above or behind other objects in the  
     111         * the text to be rendered without any z-fighting. The downside to this 
     112         * mode is that render order begins to matter and the text will not 
     113         * necessarily correctly appear above or behind other objects in the 
    114114         * scene based on depth values. 
    115          * This mode is best for text that only needs to be ontop and  
     115         * This mode is best for text that only needs to be ontop and 
    116116         * not obscured by any objects.*/ 
    117117        NO_DEPTH_BUFFER, 
     
    121121         * This uses glDepthRange as a substitute for glPolygonOffset. 
    122122         * Strangely, experiments on ATI cards seem to produce cleaner results 
    123          * than when using glPolygonOffset. The trade-off for this is that the  
     123         * than when using glPolygonOffset. The trade-off for this is that the 
    124124         * backdrop still may be placed too far back and might be culled by objects 
    125125         * directly behind the object or by the far z-plane. If ATI ever fixes 
    126          * the glPolygonOffset problem, polygon offset is probably a slightly  
    127          * better solution because you can use smaller offsets. But with the  
     126         * the glPolygonOffset problem, polygon offset is probably a slightly 
     127         * better solution because you can use smaller offsets. But with the 
    128128         * current ATI problem, this option may be preferable.*/ 
    129129        DEPTH_RANGE, 
     
    131131         * (Assuming the backend is written correctly,) the Stencil Buffer is 
    132132         * the most "correct" and reliable way of producing backdrop text. 
    133          * The stencil buffer is a multipass system that allows writing to the  
     133         * The stencil buffer is a multipass system that allows writing to the 
    134134         * same z-values without needing to resort to offsets. This implementation 
    135135         * should not have any of the problems associated with the 3 previous 
    136          * implementations. But the trade-off for this mode is that without  
    137          * hardware acceleration for the stencil buffer, rendering will be  
    138          * extremely slow. (There is also potentially more overhead for this  
    139          * algorithm so it could be slower than the other implementations.  
     136         * implementations. But the trade-off for this mode is that without 
     137         * hardware acceleration for the stencil buffer, rendering will be 
     138         * extremely slow. (There is also potentially more overhead for this 
     139         * algorithm so it could be slower than the other implementations. 
    140140         * Benchmarking would be required to determine if the speed differences 
    141          * are significant on your particular hardware.) This mode is best for  
    142          * when quality is important and stencil buffer hardware acceleration  
     141         * are significant on your particular hardware.) This mode is best for 
     142         * when quality is important and stencil buffer hardware acceleration 
    143143         * is available.*/ 
    144144        STENCIL_BUFFER, 
     
    156156 
    157157    /** 
    158      * BackdropType gives you a background shadow text behind your regular  
    159      * text. This helps give text extra contrast which can be useful when  
    160      * placing text against noisy backgrounds.  
     158     * BackdropType gives you a background shadow text behind your regular 
     159     * text. This helps give text extra contrast which can be useful when 
     160     * placing text against noisy backgrounds. 
    161161     * The color of the background shadow text is specified by setBackdropColor(). 
    162      * DROP_SHADOW_BOTTOM_RIGHT will draw backdrop text to the right and down of  
     162     * DROP_SHADOW_BOTTOM_RIGHT will draw backdrop text to the right and down of 
    163163     * the normal text. Other DROW_SHADOW_* modes do the same for their repective directions. 
    164164     * OUTLINE will draw backdrop text so that it appears the text has an outline 
    165165     * or border around the normal text. This mode is particularly useful against 
    166      * really noisy backgrounds that may put text on top of things that have  
    167      * all types of colors which you don't have control over.  
    168      * Some real world examples of this general technique in use that I know of  
     166     * really noisy backgrounds that may put text on top of things that have 
     167     * all types of colors which you don't have control over. 
     168     * Some real world examples of this general technique in use that I know of 
    169169     * are Google Earth, Sid Meier's Pirates (2004 Remake), and Star Control 2 (PC 1993). 
    170170     * The default is NONE. 
     
    174174    BackdropType getBackdropType() const { return _backdropType; } 
    175175 
    176     /**  
    177      * Sets the amount text is offset to create the backdrop/shadow effect.  
     176    /** 
     177     * Sets the amount text is offset to create the backdrop/shadow effect. 
    178178     * Set the value too high and for example, in OUTLINE mode you will get a "Brady Bunch" 
    179179     * effect where you see duplicates of the text in a 3x3 grid. 
     
    186186     * Note that the text bounding boxes are updated to include backdrop offsets. 
    187187     * However, other metric information such as getCharacterHeight() are unaffected 
    188      * by this. This means that individual glyph spacing (kerning?) are unchanged  
     188     * by this. This means that individual glyph spacing (kerning?) are unchanged 
    189189     * even when this mode is used. 
    190190     * The default is 0.07 (7% offset). 
     
    214214     * so this function is provided to let you 'pick your poison'. Each 
    215215     * implementation has trade-offs. See BackdropImplementation enum 
    216      * docs for details.*/  
     216     * docs for details.*/ 
    217217     void setBackdropImplementation(BackdropImplementation implementation); 
    218218 
     
    230230    /** 
    231231     * This sets different types of text coloring modes. 
    232      * When the coloring mode is not set to SOLID, the  
     232     * When the coloring mode is not set to SOLID, the 
    233233     * colors specified in setColorGradientCorners() determine 
    234234     * the colors for the text. 
     
    237237     * were a single polygon and you had applied colors to each of the four 
    238238     * corners with GL_SMOOTH enabled. In this mode, OpenGL interpolates 
    239      * the colors across the polygon, and this is what OVERALL tries to  
    240      * emulate. This can be used to give nice embellishments on things  
     239     * the colors across the polygon, and this is what OVERALL tries to 
     240     * emulate. This can be used to give nice embellishments on things 
    241241     * like logos and names. 
    242      * PER_CHARACTER is similar to OVERALL except that it applies the  
     242     * PER_CHARACTER is similar to OVERALL except that it applies the 
    243243     * color interpolation to the four corners of each character instead 
    244244     * of across the overall text box. 
     
    251251    /** 
    252252     * Used only for gradient mode, let's you specify the colors of the 4 corners. 
    253      * If ColorGradients are off, these values are ignored (and the value from setColor()  
     253     * If ColorGradients are off, these values are ignored (and the value from setColor() 
    254254     * is the only one that is relevant. 
    255255     */ 
     
    262262 
    263263 
    264      
     264 
    265265    /** Draw the text.*/ 
    266266    virtual void drawImplementation(osg::RenderInfo& renderInfo) const; 
     
    341341    } 
    342342 
    343     const TextureGlyphQuadMap& getTextureGlyphQuadMap() const  
     343    const TextureGlyphQuadMap& getTextureGlyphQuadMap() const 
    344344    { 
    345345        return _textureGlyphQuadMap; 
     
    355355 
    356356    String::iterator computeLastCharacterOnLine(osg::Vec2& cursor, String::iterator first,String::iterator last); 
    357      
     357 
    358358    // members which have public access. 
    359359 
    360360    // iternal map used for rendering. Set up by the computeGlyphRepresentation() method. 
    361361    mutable TextureGlyphQuadMap            _textureGlyphQuadMap; 
    362      
     362 
    363363    void computeGlyphRepresentation(); 
    364364 
    365365    // internal caches of the positioning of the text. 
    366      
     366 
    367367    bool computeAverageGlyphWidthAndHeight(float& avg_width, float& avg_height) const; 
    368      
     368 
    369369    virtual void computePositions(unsigned int contextID) const; 
    370      
     370 
    371371    void computeBackdropPositions(unsigned int contextID) const; 
    372372    void computeBackdropBoundingBox() const; 
     
    386386    void renderWithStencilBuffer(osg::State& state, const osg::Vec4& colorMultiplier) const; 
    387387    void renderWithDelayedDepthWrites(osg::State& state, const osg::Vec4& colorMultiplier) const; 
    388      
     388 
    389389    bool _enableDepthWrites; 
    390390