File: TestSDKDynamicLightIntensity.cxx

package info (click to toggle)
f3d 3.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 23,504 kB
  • sloc: cpp: 99,106; python: 758; sh: 342; xml: 223; java: 101; javascript: 95; makefile: 25
file content (47 lines) | stat: -rw-r--r-- 1,431 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <engine.h>
#include <options.h>
#include <scene.h>
#include <window.h>

#include "TestSDKHelpers.h"

int TestSDKDynamicLightIntensity(int argc, char* argv[])
{
  f3d::engine eng = f3d::engine::create(true);
  f3d::scene& Scene = eng.getScene();
  f3d::window& win = eng.getWindow();
  f3d::options& opt = eng.getOptions();
  win.setSize(300, 300);

  Scene.add(std::string(argv[1]) + "/data/cow.vtp");

  win.render();

  // Check render with default light intensity
  if (!TestSDKHelpers::RenderTest(eng.getWindow(), std::string(argv[1]) + "baselines/",
        std::string(argv[2]), "TestSDKDynamicLightIntensity-default"))
  {
    std::cerr << "failed for default light intensity" << std::endl;
    return EXIT_FAILURE;
  }

  // set light intensity to 5x brighter
  opt.render.light.intensity = 5.;
  if (!TestSDKHelpers::RenderTest(eng.getWindow(), std::string(argv[1]) + "baselines/",
        std::string(argv[2]), "TestSDKDynamicLightIntensity-5x-brighter"))
  {
    std::cerr << "failed for light intensity = 5" << std::endl;
    return EXIT_FAILURE;
  }

  // set light intensity to 5x darker
  opt.render.light.intensity = .2;
  if (!TestSDKHelpers::RenderTest(eng.getWindow(), std::string(argv[1]) + "baselines/",
        std::string(argv[2]), "TestSDKDynamicLightIntensity-5x-darker"))
  {
    std::cerr << "failed for light intensity = .2" << std::endl;
    return EXIT_FAILURE;
  }

  return EXIT_SUCCESS;
}