void PowerLawWidgetManager::loadFromXml(TiXmlElement *_root) {
    std::vector < PowerLawWidget * > widgets;

    double valFactor, valExponent, valOffset, valMin, valMax;
    for (auto child = _root->FirstChildElement("PowerLawParameters"); child; child = child->NextSiblingElement()) {
        auto r0 = child->QueryDoubleAttribute("factor", &valFactor);
        auto r1 = child->QueryDoubleAttribute("exponent", &valExponent);
        auto r2 = child->QueryDoubleAttribute("offset", &valOffset);
        auto r3 = child->QueryDoubleAttribute("rangeMin", &valMin);
        auto r4 = child->QueryDoubleAttribute("rangeMax", &valMax);

        if (r0 == TIXML_SUCCESS && r1 == TIXML_SUCCESS && r2 == TIXML_SUCCESS && r3 == TIXML_SUCCESS &&
            r4 == TIXML_SUCCESS) {
            auto w = new PowerLawWidget();
            w->setFactor(valFactor);
            w->setExponent(valExponent);
            w->setOffset(valOffset);
            w->setMin(valMin);
            w->setMax(valMax);
            widgets.push_back(w);
        } else {
            QMessageBox::warning(0, "failed to load power laws", "could not load power laws: invalid file structure.");
            return;
        }
    }

    setPowerLawWidgets(widgets);
}
Light::Light(LIGHT_TYPE type)
{
    lights.push_back(this);

    if(availableLights.size() > 0)
    {
        lightNum = availableLights[0];
        availableLights.erase(availableLights.begin());
        Visible(true);
        setLightType(type);
        setPosition(0, 0, 0);
        setCutoff(45);
        setExponent(12);
        setSpotDirection(0, -1, 0);
        setAmbient(0, 0, 0, 1);
        setDiffuse(1, 1, 1, 1);
        setSpecular(1, 1, 1, 1);

        updateLight();
    }

    else
    {
        lightNum = 0;
        Visible(false);
    }
}
Exemple #3
0
int TWarnLight::setAttribute (const string& rktNAME, NAttribute nVALUE, EAttribType eTYPE)
{

  if ( rktNAME == "point_at" )
  {
    if ( eTYPE == FX_VECTOR )
    {
      pointAt (*((TVector*) nVALUE.pvValue));
    }
    else
    {
      return FX_ATTRIB_WRONG_TYPE;
    }
  }
  else if ( rktNAME == "exponent" )
  {
    if ( eTYPE == FX_REAL )
    {
      setExponent (nVALUE.dValue);
    }
    else
    {
      return FX_ATTRIB_WRONG_TYPE;
    }
  }
  else
  {
    return TPointLight::setAttribute (rktNAME, nVALUE, eTYPE);
  }

  return FX_ATTRIB_OK;

}  /* setAttribute() */
Exemple #4
0
Light::Light(int number, Vector pos, Vector dir, float cutoff, float exponent) {
	setNumber(number);
	this->pos = pos;
	this->dir = dir;
	setCutoff(cutoff);
	setExponent(exponent);
	initAttenuation();
}
PowerLawWidgetManager::PowerLawWidgetManager(QWidget *_parent) : m_Parent(_parent) {
    // defaults from paper
    addPowerLaw();
    auto w1 = addPowerLaw();
    w1->setMin(0);
    w1->setFactor(6850);
    w1->setExponent(1.49);
}
Exemple #6
0
SpotLight::SpotLight(GLuint lightId) : DirectionalLight(lightId)
{
    // No attenuation with distance
    setConstantAttenuation(1.0f);
    setLinearAttenuation(0.0f);
    setQuadricAttenuation(0.0f);
    setExponent(2.0f);
}
Exemple #7
0
Light::Light(int number, Vector pos, Vector dir, float* attenuation, float cutoff, float exponent) {
	setNumber(number);
	this->pos = pos;
	this->dir = dir;
	setAttenuation(0, attenuation[0]);
	setAttenuation(1, attenuation[1]);
	setAttenuation(2, attenuation[2]);
	setCutoff(cutoff);
	setExponent(exponent);
}
Exemple #8
0
LightSource::LightSource(GLenum number) {
    _num = number;
    setPosition(0,0,1.0,1.0);
    //setDirection(Vector3(0,0,1));
    setAmbient(0.0, 0.0, 0.0, 1.0);
    setDiffuse(1.0, 1.0, 1.0, 1.0);
    setSpecular(1.0, 1.0, 1.0, 1.0);
    setState(true);
    setExponent(0);
    setCutOff(180);
}
Spotlight::Spotlight(GLenum number, Vector4 position, Vector4 ambientLight, Vector4 DiffuseLight, Vector4 SpecularLight, GLfloat cutoff, GLfloat exponent, Vector3 direction):
	LightSource(number, position, ambientLight, DiffuseLight, SpecularLight)
{
	setCutOff(cutoff);
	setExponent(exponent);
	setDirection(direction);
	glLightf(GL_LIGHT0 + number, GL_SPOT_CUTOFF, _cut_off);
	glLightf(GL_LIGHT0 + number, GL_SPOT_EXPONENT, _exponent);
	glLightfv(GL_LIGHT0 + number, GL_SPOT_DIRECTION, _direction);

	glLightf(GL_LIGHT0 + number, GL_CONSTANT_ATTENUATION, 0.05);
	glLightf(GL_LIGHT0 + number, GL_LINEAR_ATTENUATION, 0.005);
	glLightf(GL_LIGHT0 + number, GL_QUADRATIC_ATTENUATION, 0.005);
}
Exemple #10
0
void PMJuliaFractal::restoreMemento( PMMemento* s )
{
   PMMementoDataIterator it( s );
   PMMementoData* data;

   for( ; it.current( ); ++it )
   {
      data = it.current( );
      if( data->objectType( ) == s_pMetaObject )
      {
         switch( data->valueID( ) )
         {
            case PMJuliaParameterID:
               setJuliaParameter( data->vectorData( ) );
               break;
            case PMAlgebraTypeID:
               setAlgebraType( ( AlgebraType ) data->intData( ) );
               break;
            case PMFunctionTypeID:
               setFunctionType( ( FunctionType ) data->intData( ) );
               break;
            case PMMaxIterationsID:
               setMaximumIterations( data->intData( ) );
               break;
            case PMPrecisionID:
               setPrecision( data->doubleData( ) );
               break;
            case PMSliceNormalID:
               setSliceNormal( data->vectorData( ) );
               break;
            case PMSliceDistanceID:
               setSliceDistance( data->doubleData( ) );
               break;
            case PMExponentID:
               setExponent( data->vectorData( ) );
               break;
            default:
               kdError( PMArea ) << "Wrong ID in PMJuliaFractal::restoreMemento\n";
               break;
         }
      }
   }
   Base::restoreMemento( s );
}
void LayerThicknessVariation::setModel(LayerThicknessVariation::Model model)
{
    if (m_model != model) {
        m_model = model;

        switch (m_model) {
        case Default:
            setCoeff(1.98);
            setInitial(10.86);
            setExponent(-0.89);
            break;
        case Custom:
            break;
        }

        emit modelChanged(m_model);
        emit customEnabledChanged(customEnabled());
        emit wasModified();
    }
}
Exemple #12
0
void Light::modifyExponent(float exponent) {
	setExponent(this->exponent + exponent);
}