- Ivan's patch for saving camera in OsgGraph
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6777 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 6bcac01cfca80d4fbe029a7db6b8d30edd0016e7 Former-commit-id: c9a4d37e4b8bf371362e8f176ebd8067a738e3ec
This commit is contained in:
parent
b9f693d45d
commit
4c9062ed2d
4 changed files with 10 additions and 11 deletions
|
@ -17,6 +17,8 @@
|
|||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <osg/Camera>
|
||||
#include <osg/Matrix>
|
||||
#include <osg/ValueObject>
|
||||
|
@ -51,7 +53,7 @@ static inline tdble calc_relaxation(tdble target, tdble prev, tdble rate, tdble
|
|||
{
|
||||
rate = std::max(tdble(0), std::min(tdble(1), rate));
|
||||
|
||||
return prev + (target - prev)*(1.0 - pow(1.0 - rate, dt));
|
||||
return prev + (target - prev)*(tdble(1.0) - pow(tdble(1.0) - rate, dt));
|
||||
}
|
||||
|
||||
SDCamera::SDCamera(SDView * c, int myid, int mydrawCurrent, int mydrawCkt, int mydrawdrv, int mydrawBackground, int mymirrorAllowed)
|
||||
|
@ -530,7 +532,7 @@ public:
|
|||
dist = mydist;
|
||||
height = myHeight;
|
||||
relax = relaxation;
|
||||
PreA = NAN;
|
||||
PreA = tdble(0.0)/tdble(0.0);
|
||||
up[0] = 0;
|
||||
up[1] = 0;
|
||||
up[2] = 1;
|
||||
|
|
|
@ -110,7 +110,7 @@ void SDScreens::Init(int x,int y, int width, int height, osg::ref_ptr<osg::Node>
|
|||
mirrorCam->setClearMask( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
mirrorCam->setReferenceFrame( osg::Camera::ABSOLUTE_RF );
|
||||
|
||||
SDView * view = new SDView(viewer->getCamera(),0,0, width, height, mirrorCam.get());
|
||||
SDView * view = new SDView((int)Screens.size(), viewer->getCamera(),0,0, width, height, mirrorCam.get());
|
||||
Screens.push_back(view);
|
||||
|
||||
/* Set the scene graph root node for traversal by the viewer */
|
||||
|
|
|
@ -35,10 +35,8 @@ static char buf[1024];
|
|||
static char path[1024];
|
||||
static char path2[1024];
|
||||
|
||||
static int cpt=0;
|
||||
|
||||
SDView::SDView(osg::Camera * c, int x, int y, int width, int height,
|
||||
osg::Camera * mc)
|
||||
SDView::SDView(int id, osg::Camera * c, int x, int y, int width, int height,
|
||||
osg::Camera * mc)
|
||||
{
|
||||
this->x =x;
|
||||
this->y =y;
|
||||
|
@ -68,8 +66,7 @@ SDView::SDView(osg::Camera * c, int x, int y, int width, int height,
|
|||
);
|
||||
// mirror->setProjection();
|
||||
|
||||
id = cpt;
|
||||
cpt++;
|
||||
this->id = id;
|
||||
curCar = NULL;
|
||||
cars = 0;
|
||||
selectNextFlag=false;
|
||||
|
|
|
@ -59,14 +59,14 @@ protected:
|
|||
void loadParams(tSituation *s); // Load from parameters files.
|
||||
|
||||
public:
|
||||
SDView(osg::Camera * c, int x , int y, int width , int height, osg::Camera * mc);
|
||||
SDView(int id, osg::Camera * c, int x , int y, int width , int height, osg::Camera * mc);
|
||||
~SDView();
|
||||
|
||||
void Init(tSituation *s);
|
||||
void update(tSituation *s, const SDFrameInfo* frameInfo);
|
||||
|
||||
void setCurrentCar(tCarElt *newCurCar);
|
||||
|
||||
|
||||
inline int getId(){return id;}
|
||||
inline void selectNextCar(void) { selectNextFlag = true; }
|
||||
inline void selectPrevCar(void) { selectPrevFlag = true; }
|
||||
|
|
Loading…
Reference in a new issue