void CloudLayer::_updatePassParameters()
	{
		GetRenderer()->setShader(mSkyX->mCloudShader);
		GetRenderer()->setShaderConstant1f("uScale", mOptions.Scale);
		GetRenderer()->setShaderConstant1f("uHeight", mOptions.Height);

		vec2 WindDirection(mOptions.WindDirection.x, mOptions.WindDirection.y);
		GetRenderer()->setShaderConstant2f("uWindDirection", WindDirection);
		GetRenderer()->setShaderConstant1f("uCloudLayerHeightVolume", mOptions.HeightVolume);
		GetRenderer()->setShaderConstant1f("uCloudLayerVolumetricDisplacement", mOptions.VolumetricDisplacement);
		GetRenderer()->setShaderConstant1f("uDetailAttenuation", mOptions.DetailAttenuation);
		GetRenderer()->setShaderConstant1f("uDistanceAttenuation", mOptions.DistanceAttenuation);	
	}
Esempio n. 2
0
void Splitter::EvalProducts()
  {
  try
    {
    if (1)
      {
      // Examples of retrieving Environment Variables
      double X1=StdP;
      double X2=StdT;
      double X3=AtmosPress();
      double X4=AmbientTemp();
      double X5=BaseElevation();
      double X6=WindSpeed();
      double X7=WindDirection();
      }

    //sum all input streams into a working copy
    MStreamI QI;
    FlwIOs.AddMixtureIn_Id(QI, idFeed);

    //get handles to input and output streams...
    MStream & QO0 = FlwIOs[FlwIOs.First[idProd1]].Stream;
    MStream & QO1 = FlwIOs[FlwIOs.First[idProd2]].Stream;

    // Always initialise the outputs as a copy of the inputs. This ensures all "qualities" are copied.
    QO0 = QI;
    QO1 = QI;

    //make outlet temperature and pressure same as input 
    //(not actualy needed because of stream copy above)
    QO0.SetTP(QI.T, QI.P);
    QO1.SetTP(QI.T, QI.P);

    //force input values to be in meaningful ranges...
    dRqdFracSplit = Range(0.0, dRqdFracSplit, 1.0);
    dRqdSolSplit = Range(0.0, dRqdSolSplit, 1.0);
    dRqdLiqSplit = Range(0.0, dRqdLiqSplit, 1.0);
    dRqdVapSplit = Range(0.0, dRqdVapSplit, 1.0);

    //do the work...
    const int NumSpecies = gs_MVDefn.Count();
    for (int i=0; i<NumSpecies; i++)
      {
      if (bDoPhaseSplit)
        {//split by phase
        if (gs_MVDefn[i].Phase() & MP_Sol)
          QO0.M[i] = QI.M[i] * dRqdSolSplit;
        else if (gs_MVDefn[i].Phase() & MP_Liq)
          QO0.M[i] = QI.M[i] * dRqdLiqSplit;
        else
          QO0.M[i] = QI.M[i] * dRqdVapSplit;
        }
      else
        {
        QO0.M[i] = QI.M[i] * dRqdFracSplit;
        }
      QO1.M[i] = QI.M[i] - QO0.M[i]; //remainder goes to second outlet
      }

    //get display values...
    dFeedQm = QI.MassFlow();
    dProdQm0 = QO0.MassFlow();
    dProdQm1 = QO1.MassFlow();
    }
  catch (MMdlException &e)
    {
    Log.Message(MMsg_Error, e.Description);
    }
  catch (MFPPException &e)
    {
    e.ClearFPP();
    Log.Message(MMsg_Error, e.Description);
    }
  catch (MSysException &e)
    {
    Log.Message(MMsg_Error, e.Description);
    }
  catch (...)
    {
    Log.Message(MMsg_Error, "Some Unknown Exception occured");
    }
  }