本文整理汇总了C++中CAMptr::data方法的典型用法代码示例。如果您正苦于以下问题:C++ CAMptr::data方法的具体用法?C++ CAMptr::data怎么用?C++ CAMptr::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAMptr
的用法示例。
在下文中一共展示了CAMptr::data方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: data
int
Cam_int::rot(
CEvent &e,
State *&
)
{
if (debug_fsa)
cerr << "Cam_int::rot"
<< endl;
CAMptr cam (e.view()->cam());
CAMdataptr data(cam->data());
DEVice_2d *ptr=(DEVice_2d *)e._d;
cam->set_zoom(1);
cam->set_min(NDCpt(XYpt(-1,-1)));
cam->data()->changed();
XYpt cpt = data->center();
double radsq = sqr(1+fabs(cpt[0])); // squared rad of virtual cylinder
XYpt tp = ptr->old();
XYpt te = ptr->cur();
Wvec op (tp[0], 0, 0); // get start and end X coordinates
Wvec oe (te[0], 0, 0); // of cursor motion
double opsq = op * op, oesq = oe * oe;
double lop = opsq > radsq ? 0 : sqrt(radsq - opsq);
double loe = oesq > radsq ? 0 : sqrt(radsq - oesq);
Wvec nop = Wvec(op[0], 0, lop).normalized();
Wvec noe = Wvec(oe[0], 0, loe).normalized();
double dot = nop * noe;
if (fabs(dot) > 0.0001) {
data->rotate(Wline(data->center(), Wvec::Y()),
-2*Acos(dot) * Sign(te[0]-tp[0]));
double rdist = te[1]-tp[1];
CAMdata dd = CAMdata(*data);
Wline raxe(data->center(),data->right_v());
data->rotate(raxe, rdist);
data->set_up(data->from() + Wvec::Y());
if (data->right_v() * dd.right_v() < 0)
*data = dd;
}
return 0;
}
示例2: curpt
int
Cam_int::zoom2(
CEvent &e,
State *&
)
{
if (debug_fsa)
cerr << "Cam_int::zoom2"
<< endl;
DEVice_2d *ptr = (DEVice_2d *)e._d;
CAMptr cam (e.view()->cam());
PIXEL curpt (ptr->cur());
XYpt startpt(_start_pix);
int w,h; e.view()->get_size(w,h);
double zoom_factor = 1 + Sign(ptr->delta()[0]) *
(PIXEL(ptr->cur())-PIXEL(ptr->old())).length()/(w/4);
cam->set_zoom(cam->zoom() * zoom_factor);
cam->set_min (cam->min() + NDCvec(XYpt(_start_pix) - startpt));
ptr->set_cur(curpt);
cam->data()->changed();
return 0;
}
示例3: data
///////////////////////////////////////////////////
//scale_z: scales the selected model
// based on mouse movement
///////////////////////////////////////////////////
int
Cam_int_edit::scale_z
(CEvent &e,
State *&s)
{
CAMptr cam (e.view()->cam());
CAMdataptr data(cam->data());
DEVice_2d *ptr=(DEVice_2d *)e._d;
if(_model == NULL)
return 0;
XYpt tp = ptr->old();
XYpt te = ptr->cur();
double Scale;
double dist = te[1]-tp[1];
//rotate the Y-axis
if(dist < 0)
Scale = 1-(abs(dist));
else
Scale = 1+(abs(dist));
Wtransf xf = _model->obj_to_world() * Wtransf::scaling(1,1,Scale);
_model->set_xform(xf);
return 0;
}
示例4: ray
int
Cam_int::up(
CEvent &e,
State *&s
)
{
if (debug_fsa)
cerr << "Cam_int::up"
<< endl;
DEVice_buttons *btns=(DEVice_buttons *)e._d;
DEVice_2d *ptr=btns->ptr2d();
VIEWptr view(e.view());
CAMptr cam (view->cam());
set<UPobs*>::iterator i;
for (i = _up_obs.begin(); i != _up_obs.end(); ++i)
(*i)->reset(_do_reset); // reset everyone watching us
if (_camwidg.anchor_displayed()) {
if (ptr->cur().dist(_camwidg.anchor_pos()) < DOT_DIST)
focus(e,s);
reset(1);
} else if (ptr->cur().dist(_down_pt_2d) < DOT_DIST) {
RAYhit ray(view->intersect(ptr->cur()));
if (ray.success()) {
// Create the anchor (blue ball) on the surface:
_camwidg.display_anchor(ray.surf());
// If clicked on a mesh, make it the "focus":
BMESHptr m = gel_to_bmesh(ray.geom());
if (m)
BMESH::set_focus(m, dynamic_cast<Patch*>(ray.appear()));
} else {
Wplane hitp(cam->data()->center(), cam->data()->at_v());
_camwidg.display_anchor(hitp.intersect(ray.screen_point()));
}
}
cam->data()->end_manip();
return 0;
}
示例5: up
int
Cam_int::dragup(
CEvent &e,
State *&s
)
{
if (debug_fsa)
cerr << "Cam_int::dragup"
<< endl;
DEVice_buttons *btns=(DEVice_buttons *)e._d;
DEVice_2d *ptr=btns->ptr2d();
VIEWptr view(e.view());
CAMptr cam (view->cam());
PIXEL curpt(ptr->cur());
double elapsed = the_time() - _dtime;
// Are we close to the cam globe?
if (ptr->cur().dist(_camwidg.anchor_pos()) < DOT_DIST && elapsed < 0.25)
return up(e,s);
reset(1);
set<UPobs*>::iterator i;
for (i = _up_obs.begin(); i != _up_obs.end(); ++i)
(*i)->reset(_do_reset); // reset everyone watching us
if ((curpt - _start_pix).length() > 20 &&
(curpt - _start_pix).normalized() * VEXEL(-1,0).normalized() > 0.5)
return 0;
RAYhit ray(view->intersect(_camwidg.anchor_pos()));
if (!ray.success())
return 0;
CAMdataptr data(cam->data());
double dist = _camwidg.anchor_size() * 2*data->focal()/data->height();
Wvec dirvec((data->from() - ray.surf()).normalized());
Wpt from = ray.surf() + dist * dirvec;
new CamFocus(view,
from, // from
ray.surf(), // at
from + Wvec::Y(), // up
ray.surf(), // center
data->width(), data->height());
return 0;
}
示例6: view
int
Cam_int_edit::up(
CEvent &e,
State *&s
)
{
// DEVice_buttons *btns=(DEVice_buttons *)e._d;
// DEVice_2d *ptr=btns->ptr2d();
VIEWptr view(e.view());
CAMptr cam (view->cam());
_model = NULL;
cam->data()->end_manip();
return 0;
}
示例7: cam
int
Cam_int_edit::pan2(
CEvent &e,
State *&
)
{
DEVice_2d *ptr=(DEVice_2d *)e._d;
CAMptr cam (e.view()->cam());
PIXEL curpt(ptr->cur());
cam->set_min(cam->min() + NDCvec(ptr->delta()));
cam->data()->changed();
ptr->set_cur(curpt);
return 0;
}
示例8: in
int
CameraPath::read_stream ( iostream& is ) {
STDdstream in(&is);
int fnum;
double ftime;
CAMptr cptr = make_shared<CAM>("state");
in >> fnum;
for ( int i=0; i < fnum; i++ ) {
cerr << "frame " << i << endl;
in >> ftime;
CAMdataptr cd = cptr->data(); // XXX - temp variable to avoid warnings
in >> cd; // here
state_list.push_back(new CamState ( ftime, cptr ));
}
return 1;
}
示例9: cam
int
Cam_int::pan2(
CEvent &e,
State *&
)
{
if (debug_fsa)
cerr << "Cam_int::pan2"
<< endl;
DEVice_2d *ptr=(DEVice_2d *)e._d;
CAMptr cam (e.view()->cam());
PIXEL curpt(ptr->cur());
cam->set_min(cam->min() + NDCvec(ptr->delta()));
cam->data()->changed();
ptr->set_cur(curpt);
return 0;
}
示例10: tmp
void
Recorder::pre_draw_CB()
{
//set/get time, cam_pos, etc...
CAM tmp("temp");
if ( !_cur_path )
return;
if ( !_paused ) {
if ( _sync && ( _path_pos > _target_frame ) )
replay();
double ttime = _swatch->elapsed_time();
if ( _play_on ) {
//forward to closest path after current time
if ( _path_pos >= (int)_cur_path->state_list.size() ||
_cur_path->state_list.empty() ) {
cerr << "end of state list reached::camera stop" << endl;
rec_stop() ;
return;
}
if ( _render_on || _play_all_frames ) {
CAMptr mine = (_cur_path->state_list[_path_pos]->cam());
_view->cam()->data()->set_from ( mine->data()->from() );
_view->cam()->data()->set_at ( mine->data()->at() );
_view->cam()->data()->set_up ( mine->data()->up() );
_view->cam()->data()->set_center ( mine->data()->center() );
_view->cam()->data()->set_focal ( mine->data()->focal() );
_view->cam()->data()->set_persp ( mine->data()->persp() );
_view->cam()->data()->set_iod ( mine->data()->iod() );
_view->set_frame_time( _cur_path->state_list[_path_pos]->t());
//update UI to reflect which frame is being shown
_ui->set_frame_num ( _path_pos );
if ( _sync ) {
if ( _path_pos == _target_frame ) {
cerr << "at target frame: pausing:" << endl ;
rec_pause();
} else if ( _path_pos > _target_frame ) {
cerr << "ack, we need to set back"<< endl;
replay();
} else _path_pos++;
} else {
if ( _path_pos >= (int)_cur_path->state_list.size() -1 ) rec_stop();
else if ( _path_pos >= _target_frame ) rec_pause();
else _path_pos++;
}
} else {
while ( _cur_path->state_list[_path_pos]->t() < ttime ) {
_path_pos++;
if ( _path_pos >= (int)_cur_path->state_list.size()) {
rec_stop();
return;
}
}
CAMptr mine = (_cur_path->state_list[_path_pos]->cam());
_view->cam()->data()->set_from ( mine->data()->from() );
_view->cam()->data()->set_at ( mine->data()->at() );
_view->cam()->data()->set_up ( mine->data()->up() );
_view->cam()->data()->set_center ( mine->data()->center() );
_view->cam()->data()->set_focal ( mine->data()->focal() );
_view->cam()->data()->set_persp ( mine->data()->persp() );
_view->cam()->data()->set_iod ( mine->data()->iod() );
_view->set_frame_time( _cur_path->state_list[_path_pos]->t());
_ui->set_frame_num ( _path_pos );
}
//set view camera to stored camera
} else if ( _record_on ) {
while ( ttime >= _next_time ) {
_cur_path->add( _next_time, _view->cam()); //always adds to end of list
_path_pos = _cur_path->state_list.size()-1;
_next_time += 1.0/_fps; //set next time to get data
}
}
} else if ( _paused && _play_on) {
if ( _sync && ( _path_pos > _target_frame ) ) {
replay();
_paused = true;
}
if ( _path_pos < 0 ||
_path_pos >= (int)_cur_path->state_list.size() ||
_cur_path->state_list.empty() ) {
rec_stop();
return;
}
}
_ui->update_checks();
}