Commit 5cf54ea2 authored by michael's avatar michael

permet de superposer de perturbation de couleur

parent 34c1338c
/**
* @brief PertColor : les perturbations de couleur d'une optic.
* @file LrPertColorTwoLayers.cpp
* @date Jeudi 14 Fevrier 2008
* @note
* @author Josselin Francois
* @author Michael Nauge
* @author Axel Richard
* @author Hervé Souchaud
* @author Emeric Verschuur
*
*
* Classe représentant une perturbation de couleur grace
* grace a deux perturbation de couleur
*/
#if defined HAVE_CONFIG_H
#include "config.h"
#endif
#include "LrPertColorTwoLayers.h"
/*---------------------------------------------------------------------------*
* constructors and destructor *
*---------------------------------------------------------------------------*/
LrPertColorTwoLayers::LrPertColorTwoLayers(const LrPertColorTwoLayers &source)
:
LrPertColor(source),
m_pertColorHaute(source.m_pertColorHaute),
m_pertColorBasse(source.m_pertColorBasse),
m_coef(source.m_coef)
{
}
LrPertColorTwoLayers* LrPertColorTwoLayers::clone() const
{
return new LrPertColorTwoLayers(*this);
}
LrPertColorTwoLayers::LrPertColorTwoLayers( LrPertColor *pertColorHaute,
LrPertColor *pertColorBasse,
Real coef)
:
LrPertColor(),
m_pertColorHaute(pertColorHaute),
m_pertColorBasse(pertColorBasse),
m_coef(coef)
{
}
LrPertColorTwoLayers::~LrPertColorTwoLayers()
{
}
/*---------------------------------------------------------------------------*
* assignement operator(s) *
*---------------------------------------------------------------------------*/
LrPertColorTwoLayers& LrPertColorTwoLayers::operator = (const LrPertColorTwoLayers &source)
{
if (this == &source)
return *this;
LrPertColor::operator =(source);
return *this;
}
/*---------------------------------------------------------------------------*
* comparison operator(s) *
*---------------------------------------------------------------------------*/
bool operator == (const LrPertColorTwoLayers &lhs, const LrPertColorTwoLayers &rhs)
{
return
(LrPertColor&)lhs == (LrPertColor&)rhs;
}
bool operator != (const LrPertColorTwoLayers &lhs, const LrPertColorTwoLayers &rhs)
{
return (! (lhs == rhs));
}
/*---------------------------------------------------------------------------*
* accessors *
*---------------------------------------------------------------------------*/
LrColor LrPertColorTwoLayers::getColor(Real u, Real v, LrPoint &pointInter)const
{
//melange les 2 couches de couleurs
LrColor colorRes(m_coef*(m_pertColorHaute->getColor(u,v, pointInter)));
colorRes=colorRes+(m_pertColorBasse->getColor(u,v, pointInter));
/*
LrColor colorRes;
if((v<0.17) )
{
colorRes=LrColor::YELLOW;
}
else if(v>0.83){
colorRes=LrColor::GREEN;
}else{
if((u>0.125&&u<0.375)|| (u>0.625&&u<0.875) )
{
//colorRes=m_pertColorBasse->getColor(u,v, pointInter);
colorRes=LrColor::WHITE;
}
else{
//colorRes=m_pertColorHaute->getColor(u,v, pointInter);
colorRes=LrColor::BLUE;
}
}
*/
return colorRes;
}
/**
* @brief PertColor : les perturbations de couleur d'une optic.
* @file LrPertColorTwoLayers.h
* @date Jeudi 14 Fevrier 2008
* @note
* @author Josselin Francois
* @author Michael Nauge
* @author Axel Richard
* @author Hervé Souchaud
* @author Emeric Verschuur
*
*
* Classe représentant une perturbation de couleur grace
* grace a deux perturbation de couleur
*/
#ifndef LRPERTCOLOR_COMPOSED_TWOLAYERS_H
#define LRPERTCOLOR_COMPOSED_TWOLAYERS_H
#include "LrPertColorComposed.h"
/**
* @brief PertColor : les perturbations de couleur d'une optic.
*
* Classe représentant une perturbation de couleur grace
* grace a deux perturbation de couleur
*/
class LrPertColorTwoLayers : public LrPertColor
{
public:
/**
* @brief LrPertColorTwoLayers copy constructor
* @param source LrPertColorTwoLayers object reference.
*/
LrPertColorTwoLayers(const LrPertColorTwoLayers &source);
/**
* @brief LrPertColorTwoLayers personnal constructor
* @param pertColorHaute LrPertColor object reference.
* @param pertColorBasse LrPertColor object reference.
* @param coef Real le coefficient d'attenuation de la couche haute
*/
LrPertColorTwoLayers( LrPertColor *pertColorHaute, LrPertColor *pertColorBasse,Real coef);
/**
* @brief LrPertColorTwoLayers clone.
* @return LrPertColorTwoLayers pointer object.
*/
LrPertColorTwoLayers * clone() const;
/**
* @brief LrPertColorTwoLayers destructor
*/
virtual ~LrPertColorTwoLayers();
/**
* @brief assignement operator(s)
*/
LrPertColorTwoLayers & operator = (const LrPertColorTwoLayers &source);
/**
* @brief comparison operator(s)
*/
friend bool operator == (const LrPertColorTwoLayers &lhs, const LrPertColorTwoLayers &rhs);
friend bool operator != (const LrPertColorTwoLayers &lhs, const LrPertColorTwoLayers &rhs);
/**
* @brief accessors
*/
virtual LrColor getColor(Real u, Real v, LrPoint &pointInter) const;
private :
LrPertColor* m_pertColorHaute;
LrPertColor* m_pertColorBasse;
Real m_coef;
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment