48 #include <ACG/Scenegraph/DrawModes.hh> 53 ViewerProperties::ViewerProperties(
int _id):
55 snapshotName_(
"snap"),
56 snapshotFileType_(
"png"),
59 wZoomFactorShift_(0.2),
62 backgroundColor_(0.0f,0.0f,0.0f,1.0f),
64 backFaceCulling_(false),
65 twoSidedLighting_(false),
71 currentViewingDirection_(0),
72 rotationLocked_(false),
76 sceneCenter_(
ACG::
Vec3d( 0.0, 0.0, 0.0 )),
78 trackballCenter_(
ACG::
Vec3d( 0.0, 0.0, 0.0 )),
79 trackballRadius_(1.0),
82 cursorPoint3D_(
ACG::
Vec3d(0.0,0.0,0.0)),
83 cursorPositionValid_(false),
86 settingsSection_ =
"Viewer" + QString::number(_id) +
"/";
89 ViewerProperties::~ViewerProperties() {
96 void ViewerProperties::snapshotBaseFileName(
const QString& _fname) {
97 snapshotName_ = _fname;
101 void ViewerProperties::snapshotFileType(
const QString& _type) {
102 snapshotFileType_ = _type.trimmed();
105 std::string ViewerProperties::pickMode(){
108 emit getPickMode(mode);
112 void ViewerProperties::pickMode(
const std::string& _name){
113 emit setPickMode(_name);
118 emit getActionMode(am);
123 emit setActionMode(_am);
126 int ViewerProperties::currentViewingDirection(){
127 return currentViewingDirection_;
130 void ViewerProperties::currentViewingDirection(
int _dir){
131 currentViewingDirection_ = _dir;
134 bool ViewerProperties::rotationLocked(){
135 return rotationLocked_;
138 void ViewerProperties::rotationLocked(
bool _locked){
139 rotationLocked_ = _locked;
142 int ViewerProperties::viewerId() {
146 void ViewerProperties::viewerId(
int _id) {
148 settingsSection_ =
"Viewer" + QString::number(_id) +
"/";
152 currentDrawMode_ = _mode;
154 emit drawModeChanged(viewerId_);
158 return currentDrawMode_;
161 void ViewerProperties::snapshotCounter(
const int _counter){
162 snapshotCounter_ = _counter;
165 QString ViewerProperties::snapshotFileType() {
166 return snapshotFileType_;
169 QString ViewerProperties::snapshotName() {
170 return snapshotName_;
173 int ViewerProperties::snapshotCounter() {
174 return snapshotCounter_++;
177 double ViewerProperties::wheelZoomFactor() {
181 double ViewerProperties::wheelZoomFactorShift() {
182 return wZoomFactorShift_;
185 void ViewerProperties::wheelZoomFactor(
double _factor) {
186 wZoomFactor_ = _factor;
189 void ViewerProperties::wheelZoomFactorShift(
double _factor) {
190 wZoomFactorShift_ = _factor;
193 bool ViewerProperties::wheelInvert() {
197 void ViewerProperties::wheelInvert(
bool _invert) {
201 bool ViewerProperties::isCCWFront(){
205 void ViewerProperties::ccwFront() {
210 void ViewerProperties::cwFront() {
216 return backgroundColor_;
219 QRgb ViewerProperties::backgroundColorRgb(){
221 c.setRedF( backgroundColor_[0]);
222 c.setGreenF(backgroundColor_[1]);
223 c.setBlueF( backgroundColor_[2]);
224 c.setAlphaF(backgroundColor_[3]);
228 QColor ViewerProperties::backgroundQColor(){
230 c.setRedF( backgroundColor_[0]);
231 c.setGreenF(backgroundColor_[1]);
232 c.setBlueF( backgroundColor_[2]);
233 c.setAlphaF(backgroundColor_[3]);
237 void ViewerProperties::backgroundColor(
ACG::Vec4f _color ) {
238 backgroundColor_ = _color; emit updated();
241 void ViewerProperties::backgroundColor( QRgb _color ) {
243 backgroundColor_[0] = c.redF();
244 backgroundColor_[1] = c.greenF();
245 backgroundColor_[2] = c.blueF();
246 backgroundColor_[3] = c.alphaF();
250 void ViewerProperties::backgroundColor( QColor _color ) {
251 backgroundColor_[0] = _color.redF();
252 backgroundColor_[1] = _color.greenF();
253 backgroundColor_[2] = _color.blueF();
254 backgroundColor_[3] = _color.alphaF();
258 void ViewerProperties::lockUpdate() {
262 void ViewerProperties::unLockUpdate(){
265 std::cerr <<
"More unlocks then locks" << std::endl;
270 bool ViewerProperties::updateLocked() {
271 return (locked_ != 0);
274 bool ViewerProperties::backFaceCulling() {
275 return backFaceCulling_;
278 void ViewerProperties::backFaceCulling(
bool _state ) {
279 backFaceCulling_ = _state;
283 void ViewerProperties::twoSidedLighting(
bool _state ) {
284 twoSidedLighting_ = _state;
288 bool ViewerProperties::twoSidedLighting() {
289 return twoSidedLighting_;
292 void ViewerProperties::multisampling(
bool _state ) {
293 multisampling_ = _state;
297 bool ViewerProperties::multisampling() {
298 return multisampling_;
301 void ViewerProperties::mipmapping(
bool _state ) {
302 glState_->allow_mipmapping(_state); mipmapping_ = _state; emit updated();
305 bool ViewerProperties::mipmapping() {
309 void ViewerProperties::animation(
bool _state ) {
314 bool ViewerProperties::animation() {
331 objectMarker_ = _marker;
336 return objectMarker_;
339 double ViewerProperties::orthoWidth() {
343 void ViewerProperties::orthoWidth(
double _width){
344 orthoWidth_ = _width;
348 double ViewerProperties::nearPlane(){
352 void ViewerProperties::setPlanes(
double _near,
double _far ) {
358 double ViewerProperties::farPlane(){
367 sceneCenter_ = _center;
372 double ViewerProperties::sceneRadius() {
376 void ViewerProperties::sceneRadius(
double _radius ) {
377 sceneRadius_ = _radius;
382 return trackballCenter_;
386 trackballCenter_ = _center;
390 double ViewerProperties::trackballRadius() {
391 return trackballRadius_;
394 void ViewerProperties::trackballRadius(
double _radius ) {
395 trackballRadius_ = _radius; emit updated();
398 void ViewerProperties::stereo(
bool _stereo) {
403 bool ViewerProperties::stereo() {
408 return cursorPainter_;
412 cursorPainter_ = _painter;
416 return cursorPoint3D_;
420 cursorPoint3D_ = _pos;
423 bool ViewerProperties::cursorPositionValid() {
424 return cursorPositionValid_;
427 void ViewerProperties::cursorPositionValid(
bool _valid) {
428 cursorPositionValid_ = _valid;
Namespace providing different geometric functions concerning angles.
ActionMode
Enum listing action modes of the viewers.
VectorT< double, 3 > Vec3d
DrawMode SOLID_FLAT_SHADED
draw flat shaded faces (requires face normals)