//*****************************************************************************************
// Truevision - a 3d modeler for povray
//
// camera.h
//
// Vincent LE PRINCE <vincentleprince@users.sourceforge.net>
// Copyright (C) 2000-2005 Vincent LE PRINCE
// This file is part of the TRUEVISION Package
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
//*******************************************************************************************
#ifndef TV_CAMERA_H
#define TV_CAMERA_H
using namespace std;
#include "object3d.h"
//********************************************************************
// Class camera
//
// Camera object
// only one per scene, no copy constructor
// linked to the camera view object
//********************************************************************
class Camera : public Object3D {
#define SENDER ((Camera*)data)
friend void sign_camera_mode( GtkWidget *wid, gpointer data ) { SENDER->mode_changed(); }
#undef SENDER
private:
// Basic parameters
TvWidget_point *location;
TvWidget_point *look_at;
TvWidget_bool *frustum;
TvWidget_float *roll;
TvWidget_float *angle, *aratio;
TvWidget_option_combo *cam_mode;
// Blur
TvWidget_bool_activator *blur;
TvWidget_int *blur_sample;
TvWidget_point *focal_point;
TvWidget_float *aperture, *confidence, *variance;
TvWidget_float *h_angle, *v_angle;
// Normal
TvWidget_matref *normal;
Rolling_box *blur_box, *ray_box;
public:
Camera( app_objs *appref );
void add_to_tree( GtkWidget *view, GtkTreeStore *store, GtkTreeSelection *sel, GtkTreeIter *parent, GtkTreeIter *sibling, const gchar *pixmap = NULL ) { Object3D::add_to_tree( view, store, sel, parent, sibling, "object_camera.xpm" ); }
void destroy() {}
void display( glview *view, bool set_color = true );
void edit_widget( GtkWidget *wid );
void destroy_editor();
void pref_changed();
void mouse_drag( struct drag_info *drag );
void output_to_povray_pass1( ofstream & file ) {}
void output_to_povray_pass2( ofstream & file );
void save( ofstream & file );
bool load( ifstream & file, char *tag );
float get_angle() { return angle->value(); }
void set_angle( float val ) { angle->set(val); }
float get_aspect() { return aratio->value(); }
void set_aspect( float val ) { aratio->set(val); }
float get_roll() { return roll->value(); }
void set_roll( float val ) { roll->set(val); }
TvWidget_point *get_camera_location() { return location; }
TvWidget_point *get_lookat() { return look_at; }
float *get_location() { return location->get(); }
float *get_look_at() { return look_at->get(); }
float *get_focal_point() { return focal_point->get(); }
void set_location(float *data) { location->set(data[0], data[1], data[2]); location->update_widget();}
void set_look_at(float *data) { look_at->set(data[0], data[1], data[2]);look_at->update_widget();}
void set_focal_point(float *data) { focal_point->set(data[0], data[1], data[2]);focal_point->update_widget();}
float get_aperture() { return aperture->value(); }
void set_aperture( float a ) { aperture->set( a ); }
float get_h_angle() { return h_angle->value(); }
void set_h_angle(float v) { h_angle->set( v ); }
float get_v_angle() { return v_angle->value(); }
void set_v_angle(float v) { v_angle->set( v ); }
float get_confidence() { return confidence->value(); }
void set_confidence(float v) {confidence ->set( v ); }
float get_variance() { return variance->value(); }
void set_variance(float v) { variance->set( v ); }
int get_blur_samples() { return blur_sample->value(); }
void set_blur_samples( int v ) { blur_sample->set( v ); }
bool is_blur() { return blur->value(); }
void set_blur(bool v) { blur->set( v ); }
float* get_sky_vector();
void mode_changed();
};
#endif