Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 19, 2016, 10:49:57 PM (10 years ago)
Author:
landauf
Message:

fixed numerous issues:

  • fixed memory leaks (delete allocated heap space)
  • use 'new' only when necessary
  • use orxonox_cast instead of static_cast
  • fixed warning in MSVC

also fixed formatting and added certain c++11 features

File:
1 edited

Legend:

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

    r11075 r11078  
    6767          {
    6868              public:
    69                   std::string* material_;//!< Which material should the Lens use, current choices include burst, bursthalo, halo1, halo2, halo3
     69                  std::string material_;//!< Which material should the Lens use, current choices include burst, bursthalo, halo1, halo2, halo3
    7070                  float alpha_;//!< Which base alpha value should the Lens use
    7171                  float scale_;//!< Which base scale should the Lens Flare have
    7272                  float position_;//!< This defines how far along the view direction the flare should be positioned, e.g. 0.5 would position the flare halfway between the viewer and the base burst, 0 at the camera, 1 at the burst
    73                   Lens(std::string* material, float alpha, float scale, float position)
     73                  Lens (const std::string& material, float alpha, float scale, float position)
    7474                  {
    75                       this->material_=material;
    76                       this->alpha_=alpha;
    77                       this->scale_=scale;
    78                       this->position_=position;
     75                      this->material_ = material;
     76                      this->alpha_ = alpha;
     77                      this->scale_ = scale;
     78                      this->position_ = position;
    7979                  }
    8080          };
     
    8585           
    8686            inline void setScale(float scale)
    87                 { this->scale_=scale; }
     87                { this->scale_ = scale; }
    8888            inline float getScale() const
    8989                { return this->scale_; }
     
    9696            */
    9797            inline void setColour(const ColourValue& colour)
    98             {
    99                 this->colour_->r=colour.r;
    100                 this->colour_->g=colour.g;
    101                 this->colour_->b=colour.b;
    102             }
     98                { this->colour_ = colour; }
    10399            /**
    104100            @brief
     
    107103            */
    108104            inline const ColourValue& getColour() const
    109                 { return *(new ColourValue(this->colour_->r,this->colour_->g,this->colour_->b)); }
     105                { return this->colour_; }
    110106               
    111107            /**
     
    121117            */
    122118            inline void setFadeResolution(unsigned int fadeResolution)
    123                 { this->fadeResolution_=fadeResolution>0?fadeResolution:1; }
     119                { this->fadeResolution_ = fadeResolution > 0 ? fadeResolution : 1; }
    124120            /**
    125121            @brief
     
    137133            */
    138134            inline void setFadeExponent(float exponent)
    139                 { this->fadeExponent_=exponent; }
     135                { this->fadeExponent_ = exponent; }
    140136            /**
    141137            @brief
     
    153149            */
    154150            inline void setFadeOnViewBorder(bool fadeOnViewBorder)
    155                 { this->fadeOnViewBorder_=fadeOnViewBorder; }
     151                { this->fadeOnViewBorder_ = fadeOnViewBorder; }
    156152            /**
    157153            @brief
     
    174170            void createBillboards();
    175171           
    176             void updateBillboardStates(Vector3& viewDirection, float dimension, bool isLightVisible);
     172            void updateBillboardStates(const Vector3& viewDirection, float dimension, bool isLightVisible);
    177173           
    178174            void updateBillboardAlphas(float alpha);
     
    180176            unsigned int getPointCount(float dimension) const;
    181177           
    182             std::vector<Lens*>* lensConfiguration_;//!< this stores the lensConfiguration
     178            std::vector<Lens> lensConfiguration_;//!< this stores the lensConfiguration
    183179            Billboard* occlusionBillboard_;//!< this is a transparent billboard used solely for the Hardware Occlusion Query
    184             float cameraDistance_;//!< current distance of the lensflare center from the camera
    185180            float scale_;//!< this factor is used to scale the billboard to the desired size
    186181            bool fadeOnViewBorder_;//!< should the effect fade out on the border of the view?
    187182            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
    188183            float fadeExponent_;//!< this determines how fast the flare fades away as it gets obstructed
    189             ColourValue* colour_;//!< this stores the base colour of the light
     184            ColourValue colour_;//!< this stores the base colour of the light
    190185    };
    191186}
Note: See TracChangeset for help on using the changeset viewer.