59 #include <ACG/Scenegraph/DrawModes.hh>
64 ViewerProperties::ViewerProperties(
int _id):
66 snapshotName_(
"snap"),
67 snapshotFileType_(
"png"),
70 wZoomFactorShift_(0.2),
73 backgroundColor_(0.0f,0.0f,0.0f,1.0f),
75 backFaceCulling_(false),
76 twoSidedLighting_(false),
82 currentViewingDirection_(0),
83 rotationLocked_(false),
87 sceneCenter_(
ACG::
Vec3d( 0.0, 0.0, 0.0 )),
89 trackballCenter_(
ACG::
Vec3d( 0.0, 0.0, 0.0 )),
90 trackballRadius_(1.0),
93 cursorPoint3D_(
ACG::
Vec3d(0.0,0.0,0.0)),
94 cursorPositionValid_(false),
97 settingsSection_ =
"Viewer" + QString::number(_id) +
"/";
100 ViewerProperties::~ViewerProperties() {
107 void ViewerProperties::snapshotBaseFileName(
const QString& _fname) {
108 snapshotName_ = _fname;
109 snapshotCounter_ = 0;
112 void ViewerProperties::snapshotFileType(
const QString& _type) {
113 snapshotFileType_ = _type.trimmed();
116 std::string ViewerProperties::pickMode(){
119 emit getPickMode(mode);
123 void ViewerProperties::pickMode(
const std::string& _name){
124 emit setPickMode(_name);
127 Viewer::ActionMode ViewerProperties::actionMode(){
128 Viewer::ActionMode am;
129 emit getActionMode(am);
133 void ViewerProperties::actionMode(
const Viewer::ActionMode _am){
134 emit setActionMode(_am);
137 int ViewerProperties::currentViewingDirection(){
138 return currentViewingDirection_;
141 void ViewerProperties::currentViewingDirection(
int _dir){
142 currentViewingDirection_ = _dir;
145 bool ViewerProperties::rotationLocked(){
146 return rotationLocked_;
149 void ViewerProperties::rotationLocked(
bool _locked){
150 rotationLocked_ = _locked;
153 int ViewerProperties::viewerId() {
157 void ViewerProperties::viewerId(
int _id) {
159 settingsSection_ =
"Viewer" + QString::number(_id) +
"/";
163 currentDrawMode_ = _mode;
165 emit drawModeChanged(viewerId_);
169 return currentDrawMode_;
172 void ViewerProperties::snapshotCounter(
const int _counter){
173 snapshotCounter_ = _counter;
176 QString ViewerProperties::snapshotFileType() {
177 return snapshotFileType_;
180 QString ViewerProperties::snapshotName() {
181 return snapshotName_;
184 int ViewerProperties::snapshotCounter() {
185 return snapshotCounter_++;
188 double ViewerProperties::wheelZoomFactor() {
192 double ViewerProperties::wheelZoomFactorShift() {
193 return wZoomFactorShift_;
196 void ViewerProperties::wheelZoomFactor(
double _factor) {
197 wZoomFactor_ = _factor;
200 void ViewerProperties::wheelZoomFactorShift(
double _factor) {
201 wZoomFactorShift_ = _factor;
204 bool ViewerProperties::wheelInvert() {
208 void ViewerProperties::wheelInvert(
bool _invert) {
212 bool ViewerProperties::isCCWFront(){
216 void ViewerProperties::ccwFront() {
221 void ViewerProperties::cwFront() {
227 return backgroundColor_;
230 QRgb ViewerProperties::backgroundColorRgb(){
232 c.setRedF( backgroundColor_[0]);
233 c.setGreenF(backgroundColor_[1]);
234 c.setBlueF( backgroundColor_[2]);
235 c.setAlphaF(backgroundColor_[3]);
239 QColor ViewerProperties::backgroundQColor(){
241 c.setRedF( backgroundColor_[0]);
242 c.setGreenF(backgroundColor_[1]);
243 c.setBlueF( backgroundColor_[2]);
244 c.setAlphaF(backgroundColor_[3]);
248 void ViewerProperties::backgroundColor(
ACG::Vec4f _color ) {
249 backgroundColor_ = _color; emit updated();
252 void ViewerProperties::backgroundColor( QRgb _color ) {
254 backgroundColor_[0] = c.redF();
255 backgroundColor_[1] = c.greenF();
256 backgroundColor_[2] = c.blueF();
257 backgroundColor_[3] = c.alphaF();
261 void ViewerProperties::backgroundColor( QColor _color ) {
262 backgroundColor_[0] = _color.redF();
263 backgroundColor_[1] = _color.greenF();
264 backgroundColor_[2] = _color.blueF();
265 backgroundColor_[3] = _color.alphaF();
269 void ViewerProperties::lockUpdate() {
273 void ViewerProperties::unLockUpdate(){
276 std::cerr <<
"More unlocks then locks" << std::endl;
281 bool ViewerProperties::updateLocked() {
282 return (locked_ != 0);
285 bool ViewerProperties::backFaceCulling() {
286 return backFaceCulling_;
289 void ViewerProperties::backFaceCulling(
bool _state ) {
290 backFaceCulling_ = _state;
294 void ViewerProperties::twoSidedLighting(
bool _state ) {
295 twoSidedLighting_ = _state;
299 bool ViewerProperties::twoSidedLighting() {
300 return twoSidedLighting_;
303 void ViewerProperties::multisampling(
bool _state ) {
304 multisampling_ = _state;
308 bool ViewerProperties::multisampling() {
309 return multisampling_;
312 void ViewerProperties::mipmapping(
bool _state ) {
313 glState_->allow_mipmapping(_state); mipmapping_ = _state; emit updated();
316 bool ViewerProperties::mipmapping() {
320 void ViewerProperties::animation(
bool _state ) {
325 bool ViewerProperties::animation() {
342 objectMarker_ = _marker;
347 return objectMarker_;
350 double ViewerProperties::orthoWidth() {
354 void ViewerProperties::orthoWidth(
double _width){
355 orthoWidth_ = _width;
359 double ViewerProperties::nearPlane(){
363 void ViewerProperties::setPlanes(
double _near,
double _far ) {
369 double ViewerProperties::farPlane(){
378 sceneCenter_ = _center;
383 double ViewerProperties::sceneRadius() {
387 void ViewerProperties::sceneRadius(
double _radius ) {
388 sceneRadius_ = _radius;
393 return trackballCenter_;
397 trackballCenter_ = _center;
401 double ViewerProperties::trackballRadius() {
402 return trackballRadius_;
405 void ViewerProperties::trackballRadius(
double _radius ) {
406 trackballRadius_ = _radius; emit updated();
409 void ViewerProperties::stereo(
bool _stereo) {
414 bool ViewerProperties::stereo() {
419 return cursorPainter_;
423 cursorPainter_ = _painter;
427 return cursorPoint3D_;
431 cursorPoint3D_ = _pos;
434 bool ViewerProperties::cursorPositionValid() {
435 return cursorPositionValid_;
438 void ViewerProperties::cursorPositionValid(
bool _valid) {
439 cursorPositionValid_ = _valid;
Namespace providing different geometric functions concerning angles.
DrawMode SOLID_FLAT_SHADED
draw flat shaded faces (requires face normals)
VectorT< double, 3 > Vec3d