Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 20, 2012, 6:46:03 PM (11 years ago)
Author:
davidsa
Message:

Updated orxonox::Billboard so you can disable FrustumCulling. Also improved orxonox::LensFlare and added documentation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/shaders/src/orxonox/graphics/LensFlare.h

    r9448 r9461  
    5858    // if we have multiple strong lights it'll become way more complicated to determine how much of every object is occluded individually
    5959    // there's below a 100 render queue groups, so maybe we should take turns for each object to be tested, so we only have one of the objects rendered at a time
    60     // obviously we shouldn't use too much of these effects anyways, since they use a lot of performance, so not sure whether it's worth implementing a solution that works for multiple lens flares on screen
     60    // obviously we shouldn't use too many of these effects anyways, since they use a lot of processing power, so not sure whether it's worth implementing a solution that works for multiple lens flares on screen
    6161    class _OrxonoxExport LensFlare : public StaticEntity, public Tickable
    6262    {
     
    6767            inline void setScale(float scale)
    6868                { this->scale_=scale; }
    69             inline float getScale()
     69            inline float getScale() const
    7070                { return this->scale_; }
     71               
     72            /**
     73            @brief
     74                This sets the resolution of the out-of-screen-fade-effect
     75               
     76                the higher the resolution, the smoother the transition, but it will also have a greater impact on the performance
     77                this happens with O(n^2) since it's a two dimensional operation.
     78            @param fadeResolution
     79                how many point samples should be used per axis
     80               
     81                note: this will always be an odd number, so the center point is included in the samples
     82            */
     83            inline void setFadeResolution(unsigned int fadeResolution)
     84                { this->fadeResolution_=fadeResolution>0?fadeResolution:1; }
     85            /**
     86            @brief
     87                This returns the resolution of the out-of-screen-fade-effect
     88            @return how many point samples are being used per axis
     89            */
     90            inline unsigned int getFadeResolution() const
     91                { return this->fadeResolution_; }
     92               
     93            /**
     94            @brief
     95                This sets the exponent of the fade-out function
     96            @param exponent
     97                how strong should the fade-out effect be
     98            */
     99            inline void setFadeExponent(float exponent)
     100                { this->fadeExponent_=exponent; }
     101            /**
     102            @brief
     103                This returns the exponent of the fade-out function
     104            @return the exponent of the fade-out function
     105            */
     106            inline float getFadeExponent() const
     107                { return this->fadeExponent_; }
     108               
     109            /**
     110            @brief
     111               Turn the out-of-screen-fade-effect on or off
     112            @param fadeOnViewBorder
     113                true to turn the effect on, false to turn it off
     114            */
     115            inline void setFadeOnViewBorder(bool fadeOnViewBorder)
     116                { this->fadeOnViewBorder_=fadeOnViewBorder; }
     117            /**
     118            @brief
     119               Determine whether the out-of-screen-fade-effect is on or off
     120            @return
     121                true if the effect is on, false if it is off
     122            */
     123            inline bool isFadeOnViewBorder() const
     124                { return this->fadeOnViewBorder_; }
    71125
    72126            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     
    81135            void createBillboards();
    82136           
    83             void updateBillboardPositions();
     137            void updateBillboardStates(unsigned int dimension, bool isLightVisible);
    84138           
    85             Billboard* occlusionBillboard_;
    86             unsigned int cameraDistance_;
    87             float scale_;
     139            void updateBillboardAlphas(float alpha);
     140           
     141            unsigned int getPointCount(unsigned int dimension) const;
     142           
     143            Billboard* occlusionBillboard_;//!< this is a transparent billboard used solely for the Hardware Occlusion Query
     144            unsigned int cameraDistance_;//!< current distance of the lensflare center from the camera
     145            float scale_;//!< this factor is used to scale the billboard to the desired size
     146            bool fadeOnViewBorder_;//!< should the effect fade out on the border of the view?
     147            unsigned int fadeResolution_;//!< how many points should be sampled per axis for the screen border fade. High number => smooth fade, but uses more processing power
     148            float fadeExponent_;//!< this determines how fast the flare fades away as it gets obstructed
    88149    };
    89150}
Note: See TracChangeset for help on using the changeset viewer.