Exemple #1
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 #2
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 #3
0
t_vec3		raytracing_color(t_env *e, t_ray *ray, t_cam *cam, t_obj *obj)
{
	t_lgt	*light;
	t_vec3	color;
	t_vec3	diffuse;
	t_vec3	specular;

	color = (t_vec3) {0, 0, 0};
	light = e->lgt;
	while (light != NULL)
	{
		set_light(ray->hit, obj, light);
		set_color(obj, ray);
		color = vec3_add(color, vec3_fmul(light->color, obj->mat.ambient));
		diffuse = set_diffuse(obj, light);
		specular = set_specular(obj, cam, light);
		color = vec3_add(color, vec3_add(diffuse, specular));
		color = vec3_mul(color, obj->mat.color);
		obj->mat.receive_shadow ? set_shadow(e, &color, *light, obj) : 0;
		light = light->next;
	}
	return (color);
}
void VineLeaf::draw() {
    
    enableTex(true); enableBump(true); enableGloss(true);
    bindTexture(vine->leaf_texture, TEX_UNIT);
    bindTexture(vine->leaf_gloss, GLOSS_UNIT);
    bindTexture(vine->leaf_normal, BUMP_UNIT);
    
    setTextureAlpha(1.0);
    set_colour(1.0, 1.0, 1.0);
    set_specular(vec4(0.3f));
    setBumpScale(0.5f);
    
    mstack.push(mModel);
    
    mModel *= Translate(0, parent->getLength() * length_along_parent, 0)
        * RotateY(angle_roll)
        * Translate(-vine->stem_radius/2, 0, 0)
        * RotateZ(angle_pitch)
        * RotateY(angle_turn)
        * Scale(width, height, width * height);
    vine->getLeafShape()->draw();
    
    mModel = mstack.pop();
}