Exemple #1
0
	world::world() {
		tracer_ptr = std::unique_ptr<tracer>(new tracer());
		sampler_ptr = sampler_default_instance;
		fog_ptr = nullptr;
		skybox_ptr = nullptr;
		slhtt_radius = 0;
		set_ambient(color::white / 5);
	}
Exemple #2
0
/* private */ void 
mainwindow::_create_actions()
{
  _action_exit                            = new QAction(tr("Exit"), this);
  _action_loadfile                        = new QAction(tr("Open"), this);
  _action_addfile                         = new QAction(tr("Add"),  this);

  // menu
  connect(_action_exit,                     SIGNAL( triggered()), this,         SLOT( close_window() ));
  connect(_action_loadfile,                 SIGNAL( triggered()), this,         SLOT( openfile() ));
  connect(_action_addfile,                  SIGNAL( triggered()), this,         SLOT( addfile() ));

  connect(_button_recompile,                SIGNAL( released() ), _glwindow,    SLOT( recompile() ));
  connect(_button_set_spheremap,            SIGNAL( released() ), _glwindow,    SLOT( load_spheremap() ));

  connect(_addfile_button, SIGNAL(released()), this, SLOT(addfile()));
  connect(_deletefile_button, SIGNAL(released()), this, SLOT(deletefiles()));

  connect(_checkbox_spheremap,              SIGNAL( stateChanged(int) ), _glwindow,    SLOT( spheremapping(int) ));
  connect(_checkbox_fxaa,                   SIGNAL( stateChanged(int) ), _glwindow,    SLOT( fxaa(int) ));
  
  
  connect(_checkbox_pretessellation,        SIGNAL(stateChanged(int)), _glwindow, SLOT(enable_pretessellation(int)));
  connect(_checkbox_vsync,                  SIGNAL( stateChanged(int) ), _glwindow,    SLOT( vsync(int) ));
  connect(_checkbox_culling,                SIGNAL(stateChanged(int)),   _glwindow,    SLOT( backface_culling(int)));
  connect(_checkbox_counting,               SIGNAL(stateChanged(int)),   _glwindow,    SLOT( enable_counter(int)));
  connect(_checkbox_tritesselation,         SIGNAL(stateChanged(int)), _glwindow, SLOT(enable_triangular_tesselation(int)));
  connect(_checkbox_holefilling,            SIGNAL(stateChanged(int)), _glwindow, SLOT(holefilling(int)));
  connect(_checkbox_conservative_rasterization, SIGNAL(stateChanged(int)), _glwindow, SLOT(conservative_rasterization(int)));
  
  connect(_combobox_antialiasing,           SIGNAL(currentIndexChanged(int)), this, SLOT(antialiasing()));
  connect(_combobox_trimming,               SIGNAL(currentIndexChanged(int)), this, SLOT(trimming()));
  connect(_combobox_rendering,              SIGNAL(currentIndexChanged(int)), this, SLOT(rendering()));
  connect(_combobox_fillmode,               SIGNAL(currentIndexChanged(int)), this, SLOT(fillmode()));
  connect(_combobox_preclassification,      SIGNAL(currentIndexChanged(int)), this, SLOT(preclassification()));
  
  connect(_slider_trim_max_bisections,          SIGNAL(valueChanged(int)),    _glwindow, SLOT(trim_max_bisections(int)));
  connect(_slider_trim_error_tolerance,         SIGNAL(valueChanged(float)),  _glwindow, SLOT(trim_error_tolerance(float)));
  connect(_slider_tesselation_max_pixel_error,  SIGNAL(valueChanged(float)),  _glwindow, SLOT(tesselation_max_pixel_error(float)));
  connect(_slider_tesselation_max_object_error, SIGNAL(valueChanged(float)),  _glwindow, SLOT(tesselation_max_geometric_error(float)));
  connect(_slider_raycasting_max_iterations,    SIGNAL(valueChanged(int)),    _glwindow, SLOT(raycasting_max_iterations(int)));
  connect(_slider_raycasting_error_tolerance,   SIGNAL(valueChanged(float)),  _glwindow, SLOT(raycasting_error_tolerance(float)));

  connect(_current_specular, SIGNAL(released()), this, SLOT(set_specular()));
  connect(_current_diffuse, SIGNAL(released()), this, SLOT(set_diffuse()));
  connect(_current_ambient, SIGNAL(released()), this, SLOT(set_ambient()));
  connect(_current_shininess, SIGNAL(valueChanged(float)), this, SLOT(set_shininess(float)));
  connect(_current_opacity, SIGNAL(valueChanged(float)), this, SLOT(set_opacity(float)));

  connect(_material_apply, SIGNAL(released()), this, SLOT(apply_material()));

  _file_menu->addSeparator();
  _file_menu->addAction   (_action_loadfile);
  _file_menu->addAction   (_action_addfile);
  _file_menu->addAction   (_action_exit);
}
Exemple #3
0
Light::Light(Stage* stage, LightID lid):
    Object(stage),
    generic::Identifiable<LightID>(lid),
    type_(LIGHT_TYPE_POINT),
    range_(100.0) {

    set_ambient(kglt::Colour(0.5f, 0.5f, 0.5f, 1.0f));
    set_diffuse(kglt::Colour(1.0f, 1.0f, 1.0f, 1.0f));
    set_specular(kglt::Colour(0.1f, 0.1f, 0.1f, 1.0f));
    set_attenuation_from_range(100.0);
}
Exemple #4
0
void Emission::set_material(const ObjMaterial* m)
{
  set_ambient(m);
}
Exemple #5
0
Table::Table(double origin_x, double origin_y, double origin_z)
    : Drawable(origin_x, origin_y, origin_z, 3)
    , Hitable()
    , boxes_origin_{
          // TopLeft Leg
          GLVector<XYZW>(-inner_table_length_ / 2 + border_width_ / 2,
                         inner_table_width_ / 2 - border_width_ / 2,
                         inner_table_height_ / 2, 1),
          // BottomLeft Leg
          GLVector<XYZW>(-inner_table_length_ / 2 + border_width_ / 2,
                         -inner_table_width_ / 2 + border_width_ / 2,
                         inner_table_height_ / 2, 1),
          // BottomRight Leg
          GLVector<XYZW>(inner_table_length_ / 2 - border_width_ / 2,
                         -inner_table_width_ / 2 + border_width_ / 2,
                         inner_table_height_ / 2, 1),
          // TopRight Leg
          GLVector<XYZW>(inner_table_length_ / 2 - border_width_ / 2,
                         inner_table_width_ / 2 - border_width_ / 2,
                         inner_table_height_ / 2, 1),
          // Plank
          GLVector<XYZW>(0, 0, inner_table_height_ + plank_height_ / 2, 1),
          // LeftBorder
          GLVector<XYZW>(-inner_table_length_ / 2 - border_width_ / 2, 0,
                         inner_table_height_ + border_height_ / 2, 1),
          // BottomBorder
          GLVector<XYZW>(0, -inner_table_width_ / 2 - border_width_ / 2,
                         inner_table_height_ + border_height_ / 2, 1),
          // RightBorder
          GLVector<XYZW>(inner_table_length_ / 2 + border_width_ / 2, 0,
                         inner_table_height_ + border_height_ / 2, 1),
          // TopBorder
          GLVector<XYZW>(0, +inner_table_width_ / 2 + border_width_ / 2,
                         inner_table_height_ + border_height_ / 2, 1)}
    , boxes_{// TopLeft Leg
             OBB(this, &boxes_origin_[0],
                 GLVector<XYZ>(border_width_ / 2, border_width_ / 2,
                               inner_table_height_ / 2)),
             // BottomLeft Leg
             OBB(this, &boxes_origin_[1],
                 GLVector<XYZ>(border_width_ / 2, border_width_ / 2,
                               inner_table_height_ / 2)),
             // BottomRight Leg
             OBB(this, &boxes_origin_[2],
                 GLVector<XYZ>(border_width_ / 2, border_width_ / 2,
                               inner_table_height_ / 2)),
             // TopRight Leg
             OBB(this, &boxes_origin_[3],
                 GLVector<XYZ>(border_width_ / 2, border_width_ / 2,
                               inner_table_height_ / 2)),
             // Plank
             OBB(this, &boxes_origin_[4],
                 GLVector<XYZ>(inner_table_length_ / 2, inner_table_width_ / 2,
                               plank_height_ / 2)),
             // LeftBorder
             OBB(this, &boxes_origin_[5],
                 GLVector<XYZ>(border_width_ / 2, inner_table_width_ / 2,
                               border_height_ / 2)),
             // BottomBorder
             OBB(this, &boxes_origin_[6],
                 GLVector<XYZ>(inner_table_length_ / 2, border_width_ / 2,
                               border_height_ / 2)),
             // RightBorder
             OBB(this, &boxes_origin_[7],
                 GLVector<XYZ>(border_width_ / 2, inner_table_width_ / 2,
                               border_height_ / 2)),
             // TopBorder
             OBB(this, &boxes_origin_[8],
                 GLVector<XYZ>(inner_table_length_ / 2, border_width_ / 2,
                               border_height_ / 2))} {
  set_color(32, 80, 22, 0);
  set_color(40, 20, 11, 1);
  set_ambient(0.01,0);
  set_spectacular(.1,0);
  set_shininess(100,0);
  set_color(7, 9, 24, 2);

  for(unsigned int i = 0; i < 9; ++i) {
    add_bounding_box(&boxes_[i]);
  }
}