Пример #1
0
FuzzyFuzz::FuzzyFuzz( quint32 id, Brain *brain, Mode mode, InterpolationMode iMode) :
    FuzzyBase(FuzzyBase::FUZZ, brain, id, 0.0, 1.0)
{
    setInterpolationMode(iMode);
    setMode(mode);
}
Пример #2
0
  void MultiGradientSelector::contextMenuEvent(QContextMenuEvent * e)
  {
    QMenu main_menu(this);
    //Default gradient
    QMenu * defaults = main_menu.addMenu("Default gradients");
    defaults->addAction("grey - yellow - red - purple - blue - black");
    defaults->addAction("grey - black");
    defaults->addAction("yellow - red - purple - blue - black");
    defaults->addAction("orange - red - purple - blue - black");
    defaults->addAction("yellow - orange - red");
    defaults->addSeparator();
    defaults->addAction("black");
    defaults->addAction("white");
    defaults->addAction("red");
    defaults->addAction("green");
    defaults->addAction("blue");
    defaults->addAction("magenta");
    defaults->addAction("turquoise");
    defaults->addAction("yellow");

    //Interploate/Stairs
    QMenu * inter = main_menu.addMenu("Interpolation");
    QAction * current = inter->addAction("None");
    if (gradient_.getInterpolationMode() == MultiGradient::IM_STAIRS)
      current->setEnabled(false);
    current = inter->addAction("Linear");
    if (gradient_.getInterpolationMode() == MultiGradient::IM_LINEAR)
      current->setEnabled(false);

    //Execute
    QAction * result;
    if ((result = main_menu.exec(e->globalPos())))
    {
      if (result->text() == "grey - yellow - red - purple - blue - black")
      {
        gradient_ = MultiGradient::getDefaultGradientLinearIntensityMode();
      }
      if (result->text() == "grey - black")
      {
        gradient_ = MultiGradient::getDefaultGradientLogarithmicIntensityMode();
      }
      else if (result->text() == "yellow - red - purple - blue - black")
      {
        gradient_.fromString("Linear|0,#ffea00;6,#ff0000;14,#aa00ff;23,#5500ff;100,#000000");
      }
      else if (result->text() == "orange - red - purple - blue - black")
      {
        gradient_.fromString("Linear|0,#ffaa00;6,#ff0000;14,#aa00ff;23,#5500ff;100,#000000");
      }
      else if (result->text() == "yellow - orange - red")
      {
        gradient_.fromString("Linear|0,#ffea00;6,#ffaa00;100,#ff0000");
      }
      else if (result->text() == "black")
      {
        gradient_.fromString("Linear|0,#000000;100,#000000");
      }
      else if (result->text() == "white")
      {
        gradient_.fromString("Linear|0,#FFFFFF;100,#FFFFFF");
      }
      else if (result->text() == "red")
      {
        gradient_.fromString("Linear|0,#ff0000;100,#ff0000");
      }
      else if (result->text() == "green")
      {
        gradient_.fromString("Linear|0,#00ff00;100,#00ff00");
      }
      else if (result->text() == "blue")
      {
        gradient_.fromString("Linear|0,#0000ff;100,#0000ff");
      }
      else if (result->text() == "magenta")
      {
        gradient_.fromString("Linear|0,#ff00ff;100,#ff00ff");
      }
      else if (result->text() == "turquoise")
      {
        gradient_.fromString("Linear|0,#00ffff;100,#00ffff");
      }
      else if (result->text() == "yellow")
      {
        gradient_.fromString("Linear|0,#ffff00;100,#ffff00");
      }
      else if (result->text() == "None")
      {
        setInterpolationMode(MultiGradient::IM_STAIRS);
      }
      else if (result->text() == "Linear")
      {
        setInterpolationMode(MultiGradient::IM_LINEAR);
      }
    }
  }
Пример #3
0
///==================================================================================================================
void CPSRibbon::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
	NL_PS_FUNC(CPSRibbon_serial)
	// Version 3 : - added brace mode
	//             - added orientation enum
	sint ver = f.serialVersion(3);
	if (ver == 1)
	{
		nlassert(f.isReading());

		/// we had CPSParticle::serial(f), but this is not the base class anymore, so we emulate this...
		/// version 2 : auto-lod saved
		sint ver2 = f.serialVersion(2);

		// here is CPSLocatedBindable::serial(f)
		sint ver3 = f.serialVersion(4);
		f.serialPtr(_Owner);
		if (ver3 > 1) f.serialEnum(_LOD);
		if (ver3 > 2) f.serial(_Name);
		if (ver3 > 3)
		{
			if (f.isReading())
			{
				uint32 id;
				f.serial(id);
				setExternID(id);
			}
			else
			{
				f.serial(_ExternID);
			}
		}

		if (ver2 >= 2)
		{
			bool bDisableAutoLOD;
			f.serial(bDisableAutoLOD);
			disableAutoLOD(bDisableAutoLOD);
		}

		uint32 tailNbSegs;
		bool   colorFading;
		bool   systemBasisEnabled;
		bool   drEnabled; // dying ribbons, not supported in this version

		CPSColoredParticle::serialColorScheme(f);
		CPSSizedParticle::serialSizeScheme(f);

		// we dont use the 2d angle anymore...serial a dummy one
		{
			 CDummy2DAngle _Dummy2DAngle;
			_Dummy2DAngle.serialAngle2DScheme(f);
		}

		f.serial(colorFading, systemBasisEnabled);
		serialMaterial(f);

		f.serial(drEnabled);
		f.serial(tailNbSegs);
		ITexture *tex = NULL;
		f.serialPolyPtr(tex);
		_Tex = tex;
		if (_Tex != NULL)
		{
			f.serial(_UFactor, _VFactor) ;
		}

		// shape serialization
		f.serialCont(_Shape);


		_NbSegs = tailNbSegs >> 1;
		if (_NbSegs < 1) _NbSegs = 2;
		setInterpolationMode(Linear);

		nlassert(_Owner);
		resize(_Owner->getMaxSize());
		initDateVect();
		resetFromOwner();
	}