Beispiel #1
0
Application::Application ()
{
    mpEngine = Engine::GetInstance ();
		mpSceneManager = new SceneManager ();
    // Set some global variables
    mpSceneManager->mWind.MoveX (1.0f);

    mpSun = new Sun ("media/sun.bmp", "media/blue_flare.bmp", mpEngine, mpEngine->GetTextureManager ());

    mpFont = new Font (mpEngine->GetImageManager ());
		mpTimeOfDay = new TimeOfDay (16, 0, 60, mpFont);
		
    // Build a terrain and a sky
    Terrain* MyTerrain = mpEngine->LoadTerrain ("media/Heightfield5.bmp");
		MyTerrain->LoadTextures ("media/sand.bmp", "media/grass.bmp",
														 "media/mountain.bmp", "media/snow.bmp");
		MyTerrain->Translate (-4.0f, -8.0f, -120.0f);
		mpEngine->LoadProceduralSkybox (mpTimeOfDay);
		mpEngine->GetCamera ()->Move (0.0f, -0.0f, 0.0f);

	// It's foggy today!
    mpFog = new Fog ();
    mpFog->SetStartRange (40.0f);
    mpFog->SetEndRange (90.0f);
    mpFog->SetColor (0.80f, 0.82f, 1.0f);

		// Build a fountain particle system to simulate lava
		// spewing out of an erupting volcano
    gpImage = mpEngine->GetImageManager ()->GetBmp ("media/lava.bmp", true);
    gpImage->SetAlphaColor (0, 0, 0);
    gpImage->SetOpaqueness (192);
		IVector FountainPos = MyTerrain->GetWorldPositionAtCoord (134, 190);
    mpFountain = mpEngine->AddParticleSystem
			(Fountain::NewPartSys (mpEngine->GetTextureManager (), gpImage, 30,
														 		FountainPos));
    mpFountain->SetAllParticlesSize (1.0f, 0.5f);

	// Build a snow particle system
    gpImage = mpEngine->GetImageManager ()->GetBmp
        ("media/snowflake.bmp", true);
    gpImage->SetAlphaColor (240, 240, 240);
    gpImage->SetOpaqueness (128);
	ParticleSystem* pSnow = mpEngine->AddParticleSystem (Snow::NewPartSys
		(mpEngine->GetTextureManager (), gpImage, 4000,
		0.0f, 15.0f, -10.0f));
    pSnow->SetAllParticlesSize (0.1f, 0.05f);

		// Testing NVidia CG shader
    mpShader = Shader::GetInstance ();
    mShaderProfile = mpShader->CreateProfile("src/shader/wave.cg",
        "src/shader/unlit_fragment.cg");
	mWave = mpShader->SetUpCgVertexParameter (mShaderProfile, "IN.wave");

	// CAUSES A CRASH. BUT WHY????
	mSunlitShaderProfile = mpShader->CreateProfile("src/shader/sunlit_vertex.cg",
																								 "src/shader/sunlit_fragment.cg");
	mSunVector = mpShader->SetUpCgVertexParameter (mSunlitShaderProfile, "IN.sun_vector");

	// Load up a couple (very) attractive models, er, boxes
	mpPolyObj0 = mpEngine->LoadMs3dModel ("media/test.ms3d", "media/test_gray.bmp", mSunlitShaderProfile);
    if (mpPolyObj0 == 0)
    {
        ErrorLog::GetInstance ()->Message ("Application::Application()",
            "error opening model file \"test.3ds\"");
    }
    mpPolyObj0->Translate (0.0f, 0.2f,  10.0f);

    mpPolyObj1 = mpEngine->Load3dsModel ("media/test.3ds", "media/test2.bmp", mShaderProfile);
    if (mpPolyObj1 == 0)
    {
        ErrorLog::GetInstance ()->Message ("Application::Application()",
            "error opening model file \"test.3ds\"");
    }
    mpPolyObj1->Translate (0.0f, 0.2f, -180.0f);

	// Draw a 2D image directly to the screen
    mpPixmap = new Pixmap (mpEngine->GetImageManager (),
        "media/grass_test.bmp", false, 0, 0);

	// Build some happy little clouds
    mpCloudManager = new CloudManager (mpEngine, "media/cloud2.bmp",
		mpEngine->GetTextureManager (), true);
    mpCloudManager->AddCloudPuff (50, IVector (0.0f, 0.0f, -4.0f), 1.0f);

    mpCloudManager->AddCloudPuff (20, IVector (2.0f, -0.2f, 0.0f), 0.5f);
    mpCloudManager->Form (50.0f, 6000, 10000);

	// Lighting not fully implemented yet -
	// we need to calculate normals on our models and then, poof!,
	// lighting will work
    mpEngine->GetLightManager ()->UseLighting (true);
    gLightNumber = mpEngine->GetLightManager ()->AddLight (0.0f,
        3.0f, 5.0f, 1.0f, 1.0f, 1.0f);

		mpFpsCounter = new FpsCounter (mpFont);
}
Beispiel #2
0
Data::Data()
{

                                                                               /*

- the number of equations. Must be equal to the number of the defined functions
  above.

                                                                               */
  Dimension_ =  4;

                                                                               /*

- the order of the Taylor models.

                                                                               */
  Order_     =  10;

                                                                               /*

- the way of how to determine the order. Possible are:

      - TOTALDEGREE : sum of the exponents of all variables in a term.

                                                                               */

  Order_Check_ = TOTALDEGREE;

                                                                               /*

- the algorithm for calculating the range enclosures of polynomials. You can 
  choose between:
             
      - LDB   : for the Linear Dominated Bounder;
      - NAIVE : for the naive interval evaluation;
      - MVF   : for the mean value form.

                                                                               */

  Bounder_ = LDB;

                                                                               /*

- the information if you want to use Shrink wrapping (choose 'ON') 
  or if you don't want to use it (choose 'OFF').

                                                                               */

  Shrink_Wrapping_ = ON;


                                                                               /*

- the bound for generating sparsity.

                                                                               */

  Sparsity_ = 1e-15;

                                                                               /*

- the step size control:

     - AUTO  : for automatic step size control depending on the local 
               error but with minimal step size.
     - CONST : for constant step size. You can set one step size or 
               a sequel of step sizes. In the first case the end point 
	       of integration will be taken into account, in the second
	       case the end position will be computet as sum of the 
	       starting point with the all step sizes added.

                                                                               */
  
  Step_cntrl_ = AUTO;

  //
  // In case of automatic step size control set the following parameters.
  //

  h_start_ = 1e-3; 
  h_min_   = 1e-4; 

  //
  // In case of a constant step size give either one step size or a 
  // sequel of step sizes. In the second case separate the step
  // sizes with commas but set no comma behind the last step size.
  //

  /*Step_sizes_ = 1;              
  double local_h_sequel[] = //Only for a simpler setting of step sizes 
    {                       //(e.g. with copy and paste).
      0.1E-3
    };

  h_sequel_ = new double[Step_sizes_];
  for(unsigned int i = 0; i < Step_sizes_; i++) h_sequel_[i] = local_h_sequel[i];*/
  
                                                                               /*

- a bound for the local error in each step size. If you have chosen the 
  automatic step size control and the done error is greater
  than the given bound, then the integration step will be repeated.

                                                                               */

  Local_error_tol_ = 1e-11;

                                                                               /*

- the initial point of the initial value problem.

                                                                               */
  t_0_ = 0;

                                                                               /*

- the points where to calculate the solution enclosure. You can specify
  more than one point, that means that you can add intermediate points at 
  which the result will be calculated and printed.
  If the grid point is not machine representable use the 
  form ' "[a,a]" >> result_t_[i] '! Otherwise you can use 
  ' result_t_[i] = Interval(a,a) '. Set the points in ascending order!

                                                                               */

  Result_points_ = 1;//How many points?
  result_t_ = new Interval[ Result_points_ ]; 
  "[1,1]" >> result_t_[0];



/*

- a letter for the time variable.

                                                                               */

  Time_Identifier_ = "t";

                                                                               /*

- and last but not least letters for and values of the initial values.

                                                                               */
  

  InitVals_Identifier_ = new std::string[ Dimension_ ];
  InitVals_Value_      = IVector(Dimension_);

  InitVals_Identifier_[0]="x0";
  InitVals_Identifier_[1]="x1";
  InitVals_Identifier_[2]="x2";
  InitVals_Identifier_[3]="x3";

  "[2.3561925,2.3561925]">>InitVals_Value_[0];    
  "[-1.7265335380000000,-1.7265335380000000]">>InitVals_Value_[1];   
  "[0.43,0.43]">>InitVals_Value_[2]; 
  "[0.670,0.670]">>InitVals_Value_[3];

                                                                               /*

At the end we must set the pointers to the functions definied above and give 
the problem/data a name for naming the output files. 

                                                                               */

  Func_Ptr_RHS_ = new RHS[ Dimension_ ];
  Func_Ptr_RHS_[0]=&RHS_Equation_No_0;
  Func_Ptr_RHS_[1]=&RHS_Equation_No_1;
  Func_Ptr_RHS_[2]=&RHS_Equation_No_2;
  Func_Ptr_RHS_[3]=&RHS_Equation_No_3;
  

  Title_ = "MDP";

  out_prec_ = 10; //Set the precision of the taylorcoefficients for
                  //output in file 'Title'_03.txt
}