Пример #1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent), scene(new Menu), view (new QGraphicsView)
{
    music = Phonon::createPlayer(Phonon::MusicCategory,
                                 Phonon::MediaSource(":/music/Fly12.mp3"));
    music->play();
    connect(music, SIGNAL(aboutToFinish()), this , SLOT(slotRepeat()));

    connect(scene, SIGNAL(signalGame()), this, SLOT(openGame()));
    connect(scene, SIGNAL(signalEditor()), this, SLOT(openEditor()));
    connect(scene, SIGNAL(signalExit()), this, SLOT(exit()));
    connect(scene, SIGNAL(signalMusic()), this, SLOT(slotMusic()));

    setupView();
}
Пример #2
0
TEST(WebKit2, GeolocationBasicWithHighAccuracy)
{
    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());

    GeolocationBasicWithHighAccuracyStateTracker stateTracker;
    setupGeolocationProvider(context.get(), &stateTracker);

    PlatformWebView webView(context.get());
    setupView(webView);

    WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("geolocationGetCurrentPositionWithHighAccuracy", "html"));
    WKPageLoadURL(webView.page(), url.get());

    Util::run(&stateTracker.finished);
}
Пример #3
0
MainDialog::MainDialog(QWidget *parent)
    : VyborgMainDialog(parent)
{
    setupModel();
    setupView();
    setupMapperDialog();
    setupFilterDialog();
    setupSortDialog();

/*
 * Uncomment if additional button is required
 *
 * QPushButton *chartsButton = addButton(trUtf8("Charts"));
 * connect(chartsButton, SIGNAL(clicked(bool)),
 *         this, SLOT(chartsButtonClicked()));
 */
}
Пример #4
0
void GLQuad::paintGL()
{
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   
  setupView();
  drawAxes();
  drawIntercept();

  glColor3f(0.8,0.5,0.5);
  Quad *quad = Globals::self().simulatedQuad();
  drawQuad(quad->state(), quad->propInput());
  glColor3f(0.5,0.5,0.8);
  drawQuad(Globals::self().imu()->lastState(), Globals::self().propellers()->input());
  glColor3f(0.5,0.5,0.5);
  quad = Globals::self().remoteQuad();
  drawQuad(quad->state(), quad->propInput());
}
Пример #5
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
    db=new DataBase;

    title = new QLabel(this);
    adminBox = new QGroupBox(this);
    clientBox = new QGroupBox(this);
    lineEditAdmin = new QLineEdit(adminBox);
    lineEdit = new QLineEdit(clientBox);
    admin = new QPushButton(adminBox);
    client = new QPushButton(clientBox);

    setupView();

    connect(admin, SIGNAL(clicked()), this, SLOT(on_admin()));
    connect(client,SIGNAL(clicked()),this,SLOT(on_client()));
}
Пример #6
0
bool T2::init(){
	if(!CCLayer::init())
		return false;


	setTouchEnabled(true);


	node_array = CCArray::create();
	node_array->retain();

	initChess(0,15);

	setupView();

	return true;
}
Пример #7
0
KDvoid SdkSample::_setup ( RenderWindow* pWindow )
{
    // assign mRoot here in case Root was initialised after the Sample's constructor ran.
    m_pRoot = Root::getSingletonPtr ( );
    m_pWindow = pWindow;
    
    locateResources ( );
    createSceneManager ( );
    setupView ( );
    
    m_pTrayMgr = new SdkTrayManager ( "SampleControls", pWindow, this );  // create a tray interface
    
    loadResources ( );
    m_bResourcesLoaded = true;
    
    // show stats and logo and hide the cursor
    m_pTrayMgr->showFrameStats ( TL_BOTTOMLEFT );
    m_pTrayMgr->showLogo ( TL_BOTTOMRIGHT );
    m_pTrayMgr->hideCursor ( );
    
    // create a params panel for displaying sample details
    StringVector  aItems;
    aItems.push_back ( "cam.pX" );
    aItems.push_back ( "cam.pY" );
    aItems.push_back ( "cam.pZ" );
    aItems.push_back ( ""       );
    aItems.push_back ( "cam.oW" );
    aItems.push_back ( "cam.oX" );
    aItems.push_back ( "cam.oY" );
    aItems.push_back ( "cam.oZ" );
    aItems.push_back ( ""       );
    aItems.push_back ( "Filtering" );
    aItems.push_back ( "Poly Mode" );
    
    m_pDetailsPanel = m_pTrayMgr->createParamsPanel ( TL_NONE, "DetailsPanel", 200, aItems );
    m_pDetailsPanel->hide ( );
    
    m_pDetailsPanel->setParamValue (  9, "Bilinear" );
    m_pDetailsPanel->setParamValue ( 10, "Solid" );
    
    setupContent ( );
    m_bContentSetup = true;
    
    m_bDone = false;
}
Пример #8
0
	/*-----------------------------------------------------------------------------
	| Extended to setup a default tray interface and camera controller.
	-----------------------------------------------------------------------------*/
	void Framework::_setup(Ogre::RenderWindow* window, OIS::Keyboard* keyboard, OIS::Mouse* mouse, XRENREN::FileSystemLayer* fsLayer)
	{
		// assign mRoot here in case Root was initialised after the Sample's constructor ran.
		mRoot = Ogre::Root::getSingletonPtr();
		mWindow = window;
		mMouse = mouse;
		mFSLayer = fsLayer;

		locateResources();
		createSceneManager();
		setupView();

		mTrayMgr = new SdkTrayManager("SampleControls", window, mouse, this);  // create a tray interface

#ifdef USE_RTSHADER_SYSTEM
		// Initialize shader generator.
		// Must be before resource loading in order to allow parsing extended material attributes.
		bool success = initializeRTShaderSystem(mSceneMgr);
		if (!success) 
		{
			OGRE_EXCEPT(Ogre::Exception::ERR_FILE_NOT_FOUND, 
				"Shader Generator Initialization failed - Core shader libs path not found", 
				"SdkSample::_setup");
		}														
#endif

		loadResources();
		mResourcesLoaded = true;

		// show stats and logo and hide the cursor
		mTrayMgr->showFrameStats(TL_BOTTOMLEFT);
		mTrayMgr->hideLogo();
		mTrayMgr->showCursor();

		setupDetailsPanel();


		setupContent();
		mContentSetup = true;

		mDone = false;
	}
Пример #9
0
Presenter::Presenter(
        const iscore::DocumentContext& context,
        const Curve::Style& style,
        const Model& model,
        View* view,
        QObject* parent):
    QObject{parent},
    m_curveSegments{context.app.components.factory<SegmentList>()},
    m_model{model},
    m_view{view},
    m_commandDispatcher{context.commandStack},
    m_style{style}
{
    // For each segment in the model, create a segment and relevant points in the view.
    // If the segment is linked to another, the point is shared.
    setupView();
    setupSignals();

    connect(m_view, &View::contextMenuRequested,
            this, &Presenter::contextMenuRequested);
}
Пример #10
0
PMShell::PMShell( const KURL& url )
      : PMDockMainWindow( 0, "mainwindow" )
{
   setPluginLoadingMode( DoNotLoadPlugins );
   setInstance( PMFactory::instance( ), false );

   m_pPart = new PMPart( this, "part", this, "part", true, this );
   m_pPart->setReadWrite( ); // read-write mode
   m_viewNumber = 0;
   m_objectsToDelete.setAutoDelete( true );

   if (!initialGeometrySet())
      resize(800,600);

   setupActions( );

   restoreOptions( );

   setupView( );
   setXMLFile( "kpovmodelershell.rc" );
   createGUI( m_pPart );

   //guiFactory( )->addClient( m_pPart );
   m_pStatusBar = statusBar( );
   m_pStatusBar->insertItem( " ", c_statusBarInfo, 1 );
   m_pStatusBar->insertItem( "" , c_statusBarControlPoints );

   KConfig* config = instance( )->config( );
   config->setGroup( "Appearance" );
   applyMainWindowSettings( config );

   if( !url.isEmpty( ) )
      openURL( url );

   setCaption( url.prettyURL( ) );
   connect( m_pPart, SIGNAL( modified( ) ), SLOT( slotModified( ) ) );
   connect( m_pPart, SIGNAL( controlPointMessage( const QString& ) ),
            SLOT( slotControlPointMsg( const QString& ) ) );
}
Пример #11
0
void GLRenderWidget::mouseMoveEvent(QMouseEvent *_event)
{
	if(_event->buttons() & Qt::LeftButton)
	{
		QPoint delta = _event->pos() - mLastMousePos;
		mLastMousePos = _event->pos();

		// one degree is equal to one pixel
		mCam.yAngle += delta.x();
		mCam.xAngle += delta.y();
	}

	if(_event->buttons() & Qt::MidButton)
	{
		QPoint delta = _event->pos() - mLastMousePos;
		mLastMousePos = _event->pos();

		mCam.x += (delta.x() * mCam.stepSizeX * 0.5);
		mCam.y -= (delta.y() * mCam.stepSizeY * 0.5);
	}

	setupView();
	repaint();
}
Пример #12
0
/* OpenGL callbacks */
void redrawScene () {
	pScene sc;
	pTransform view;
	pPersp p;
	pCamera c;

	sc = cv.scene[currentScene()];
	view = sc->view;
	p = sc->persp;
	c = sc->camera;

	if (stereoMode == MONO || !hasStereo) {
		glDrawBuffer(GL_BACK_LEFT);
		glClearColor(sc->par.back[0], sc->par.back[1],
		             sc->par.back[2], sc->par.back[3]);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();
		gluLookAt(0., 0., -p->depth, 0., 0., 0., 0.0, 1.0, 0.0);

		setupView(sc);
		glMultMatrixf(view->matrix);
		glTranslatef(sc->cx, sc->cy, sc->cz);
		drawModel(sc);
		if (sc->type & S_DECO) redrawStatusBar(sc);
	} else {
		double ndfl, ratio, top, bottom;
		double left, right, nnear, ffar;

		nnear = -p->depth - 0.5 * sc->dmax;
		if (nnear < 0.1) nnear = 0.1;

		ffar = -p->depth + 0.5 * sc->dmax;
		ratio = sc->par.xs / (double)sc->par.ys;
		top = nnear * tan(DTOR * 0.5 * p->fovy);
		ndfl = nnear / p->depth;
		if (sc->par.eyesep < 0.0)
			sc->par.eyesep = fabs(p->depth / 20.0);

		/* left view */
		glDrawBuffer(GL_BACK_LEFT);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		left = -ratio * top + 0.5 * sc->par.eyesep * ndfl;
		right = ratio * top + 0.5 * sc->par.eyesep * ndfl;
		bottom = -top;

		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		glFrustum(left, right, top, bottom, nnear, ffar);
		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();
		gluLookAt(-sc->par.eyesep, 0., -p->depth,
		          sc->par.eyesep / 3.0, 0., 0.,
		          0.0, 1.0, 0.0);

		setupView(sc);
		glMultMatrixf(view->matrix);
		glTranslatef(sc->cx, sc->cy, sc->cz);
		drawModel(sc);
		if (sc->type & S_DECO) redrawStatusBar(sc);

		/* right view */
		glDrawBuffer(GL_BACK_RIGHT);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		left = -ratio * top - 0.5 * sc->par.eyesep * ndfl;
		right = ratio * top - 0.5 * sc->par.eyesep * ndfl;

		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		glFrustum(left, right, top, bottom, nnear, ffar);
		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();
		gluLookAt(sc->par.eyesep, 0., -p->depth,
		          sc->par.eyesep / 3.0, 0., 0.,
		          0.0, 1.0, 0.0);

		setupView(sc);
		glMultMatrixf(view->matrix);
		glTranslatef(sc->cx, sc->cy, sc->cz);
		drawModel(sc);
		if (sc->type & S_DECO) redrawStatusBar(sc);
	}

	/* refresh screen */
	if (saveimg && animate)
		glFlush();
	else
		glutSwapBuffers();

	if (ddebug) checkErrors();

	if (saveimg && !(sc->type & S_SCISSOR)) keyFile('H', 0, 0);

	/* redraw linked scene */
	if (!animate && sc->slave > -1) {
		pScene slave;

		slave = cv.scene[sc->slave];
		glutSetWindow(slave->idwin);
		redrawScene();
	}
}
void editRoomCat::setupviewagain()
{
    setupView();
}
Пример #14
0
void GLRenderWidget::resizeGL(int _width, int _height)
{
	glViewport(0, 0, (GLint)_width, (GLint)_height);
	setupView();
}
Пример #15
0
void GLRenderWidget::enableInvertedBackground(bool _state)
{
	mActionInvertBackground->setChecked(_state);
	setupView();
}
Пример #16
0
void GLRenderWidget::enableShowMeta(bool _state)
{
	mActionShowMeta->setChecked(_state);
	setupView();
}
Пример #17
0
void GLRenderWidget::setWireframe(bool _state)
{
	mActionWireframe->setChecked(_state);
	setupView();
}
Пример #18
0
void MainWindow::setupDetailedHostView()
{
    setupView(new DetailedHostView(m_hostInfoManager, this), false);
}
Пример #19
0
void scissorScene() {
  pScene      sc;
  pMesh       mesh;
  pPersp      p;
  pTransform  view;
  int         width,height;

  /* default */
  if ( ddebug ) printf("enable scissoring\n");
  sc   = cv.scene[currentScene()];
  mesh = cv.mesh[sc->idmesh];
  view = sc->view;
  p    = sc->persp; 

  /* subdivide main window */
  glViewport(0,0,sc->par.xs,sc->par.ys);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluOrtho2D(0,sc->par.xs,0,sc->par.ys);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glClearColor(sc->par.back[0],sc->par.back[1],sc->par.back[2],sc->par.back[3]);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  /* split window */
  glDisable(GL_LIGHTING);
  glColor4fv(sc->par.line);
  glBegin(GL_LINES);
  glVertex2i(sc->par.xs/2,0);
  glVertex2i(sc->par.xs/2,sc->par.ys);
  glVertex2i(0,sc->par.ys/2);
  glVertex2i(sc->par.xs,sc->par.ys/2);
  glEnd();
  glEnable(GL_LIGHTING);

  width  = (sc->par.xs + 1)/2;
  height = (sc->par.ys + 1)/2;

  glDisable(GL_LIGHTING);
  glColor4fv(sc->par.line);
  output2(5,sc->par.ys/2+5,"Top");
  output2(5,5,"Front");
  output2(sc->par.xs/2+5,5,"Right");

  glEnable(GL_SCISSOR_TEST);

  /* draw top right : normal */
  glViewport(width,height,width,height);
  glScissor(width,height,width,height);
  farclip(1);

  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  gluLookAt(0.,0.,-p->depth, 0.,0.,0., 0.0,1.0,0.0);
  setupView(sc);
  glMultMatrixf(view->matrix);
  glTranslatef(sc->cx,sc->cy,sc->cz);
  drawModel(sc);
  if ( sc->type & S_DECO )  redrawStatusBar(sc);

  /* draw top left : top view */
  glViewport(0,height,width,height);
  glScissor(0,height,width,height);
  farclip(1);  

  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  gluLookAt(0.,0.,-p->depth, 0.,0.,0., 0.0,1.0,0.0);
  setupView(sc);
  glTranslatef(sc->cx,sc->cy,sc->cz);
  glRotatef(-90,0.0,0.0,1.0);
  glTranslatef(view->opanx,0.,0.);
  drawModel(sc);

  /* draw bottom left : front */
  glViewport(0,0,width,height);
  glScissor(0,0,width,height);
  farclip(1);

  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  gluLookAt(0.,0.,-p->depth, 0.,0.,0., 0.0,1.0,0.0);
  setupView(sc);
  glTranslatef(sc->cx,sc->cy,sc->cz);
  glRotatef(-90.0,1.0,0.0,0.0);
  glTranslatef(view->opanx,0.,0.);
  drawModel(sc);

  /* draw bottom right : right */
  glViewport(width,0,width,height);
  glScissor(width,0,width,height);
  farclip(1);

  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  gluLookAt(0.,0.,-p->depth, 0.,0.,0., 0.0,1.0,0.0);
  setupView(sc);
  glRotatef(-90.0,1.0,0.0,0.0);
  glRotatef(-90.0,0.0,0.0,1.0);
  glTranslatef(0.,view->opany,0.);
  drawModel(sc);

  glutSwapBuffers();
  glDisable(GL_SCISSOR_TEST);
  glViewport(0,0,sc->par.xs,sc->par.ys);
 
  if ( saveimg ) keyFile('H',0,0);
}
Пример #20
0
int main(int argc, char *argv[])
{
  // Main function for the raytracer. Parses input parameters,
  // sets up the initial blank image, and calls the functions
  // that set up the scene and do the raytracing.
  struct image *im; // Will hold the raytraced image
  struct view *cam; // Camera and view for this scene
  int sx;   // Size of the raytraced image
  int antialiasing; // Flag to determine whether antialiaing is enabled or disabled
  char output_name[1024]; // Name of the output file for the raytraced .ppm image
  struct point3D e;   // Camera view parameters 'e', 'g', and 'up'
  struct point3D g;
  struct point3D up;
  double du, dv;      // Increase along u and v directions for pixel coordinates
  struct point3D pc,d;    // Point structures to keep the coordinates of a pixel and
        // the direction or a ray
  struct ray3D *ray;    // Structure to keep the ray from e to a pixel
  // struct colourRGB col;    // Return colour for raytraced pixels
  struct colourRGB background;   // Background colour
  int i,j;      // Counters for pixel coordinates
  unsigned char *rgbIm;

  if (argc<5)
  {
    fprintf(stderr,"RayTracer: Can not parse input parameters\n");
    fprintf(stderr,"USAGE: RayTracer size rec_depth antialias output_name\n");
    fprintf(stderr,"   size = Image size (both along x and y)\n");
    fprintf(stderr,"   rec_depth = Recursion depth\n");
    fprintf(stderr,"   antialias = A single digit, 0 disables antialiasing. Anything else enables antialiasing\n");
    fprintf(stderr,"   output_name = Name of the output file, e.g. MyRender.ppm\n");
    exit(0);
  }
  sx=atoi(argv[1]);
  MAX_DEPTH=atoi(argv[2]);
  if (atoi(argv[3])==0) antialiasing=0; else antialiasing=1;
    strcpy(&output_name[0],argv[4]);

  fprintf(stderr,"Rendering image at %d x %d\n",sx,sx);
  fprintf(stderr,"Recursion depth = %d\n",MAX_DEPTH);
  if (!antialiasing) fprintf(stderr,"Antialising is off\n");
  else  fprintf(stderr,"Antialising is on\n");
  fprintf(stderr,"Output file name: %s\n",output_name);

  object_list=NULL;
  light_list=NULL;
  texture_list=NULL;

  // Allocate memory for the new image
  im=newImage(sx, sx);
  if (!im)
  {
    fprintf(stderr,"Unable to allocate memory for raytraced image\n");
    exit(0);
  }
  else rgbIm=(unsigned char *)im->rgbdata;

  ///////////////////////////////////////////////////
  // TO DO: You will need to implement several of the
  //        functions below. For Assignment 3, you can use
  //        the simple scene already provided. But
  //        for Assignment 4 you need to create your own
  //        *interesting* scene.
  ///////////////////////////////////////////////////
  buildScene();   // Create a scene. This defines all the
      // objects in the world of the raytracer

  //////////////////////////////////////////
  // TO DO: For Assignment 3 you can use the setup
  //        already provided here. For Assignment 4
  //        you may want to move the camera
  //        and change the view parameters
  //        to suit your scene.
  //////////////////////////////////////////

  // Mind the homogeneous coordinate w of all vectors below. DO NOT
  // forget to set it to 1, or you'll get junk out of the
  // geometric transformations later on.

  // Camera center is at (0,0,-1)
  e.px=0;
  e.py=0;
  e.pz=-1;
  e.pw=1;

  // To define the gaze vector, we choose a point 'pc' in the scene that
  // the camera is looking at, and do the vector subtraction pc-e.
  // Here we set up the camera to be looking at the origin.
  g.px=0-e.px;
  g.py=0-e.py;
  g.pz=0-e.pz;
  g.pw=1;
  // In this case, the camera is looking along the world Z axis, so
  // vector w should end up being [0, 0, -1]

  // Define the 'up' vector to be the Y axis
  up.px=0;
  up.py=1;
  up.pz=0;
  up.pw=1;

  // Set up view with given the above vectors, a 4x4 window,
  // and a focal length of -1 (why? where is the image plane?)
  // Note that the top-left corner of the window is at (-2, 2)
  // in camera coordinates.
  cam=setupView(&e, &g, &up, -1, -2, 2, 4);

  if (cam==NULL)
  {
    fprintf(stderr,"Unable to set up the view and camera parameters. Our of memory!\n");
    cleanup(object_list,light_list, texture_list);
    deleteImage(im);
    exit(0);
  }

  // Set up background colour here
  background.R=0;
  background.G=0;
  background.B=0;

  // Do the raytracing
  //////////////////////////////////////////////////////
  // TO DO: You will need code here to do the raytracing
  //        for each pixel in the image. Refer to the
  //        lecture notes, in particular, to the
  //        raytracing pseudocode, for details on what
  //        to do here. Make sure you undersand the
  //        overall procedure of raytracing for a single
  //        pixel.
  //////////////////////////////////////////////////////
  du=cam->wsize/(sx-1);   // du and dv. In the notes in terms of wl and wr, wt and wb,
  dv=-cam->wsize/(sx-1);    // here we use wl, wt, and wsize. du=dv since the image is
        // and dv is negative since y increases downward in pixel
        // coordinates and upward in camera coordinates.
  colourRGB col;
  point3D origin;
  point3D direction;
  ray3D initialRay;
  colourRGB total;
  int offset;
  int aaSamples;
  fprintf(stderr,"View parameters:\n");
  fprintf(stderr,"Left=%f, Top=%f, Width=%f, f=%f\n",cam->wl,cam->wt,cam->wsize,cam->f);
  fprintf(stderr,"Camera to world conversion matrix (make sure it makes sense!):\n");
  printmatrix(cam->C2W);
  fprintf(stderr,"World to camera conversion matrix:\n");
  printmatrix(cam->W2C);
  fprintf(stderr,"\n");
  fprintf(stderr,"Rendering row: ");
  #pragma omp parallel for schedule(dynamic,32) shared(rgbIm, object_list, light_list, texture_list) private(j)
  for (j=0;j<sx;j++)    // For each of the pixels in the image
  // for (j=2;j<3;j++)
  {
    fprintf(stderr,"%d/%d, ",j,sx);
    #pragma omp parallel for private(origin, direction, col, initialRay, i, aaSamples, offset, total)
    for (i=0;i<sx;i++)
    // for (i=2;i<3;i++)
    {
      if (!antialiasing){
        col.R = 0;
        col.G = 0;
        col.B = 0;
        // = newPoint(cam->wl+i*du,cam->wt+j*dv,cam->f);
        origin.px = cam->wl+i*du;
        origin.py = cam->wt+j*dv;
        origin.pz = cam->f;
        origin.pw = 1.0;
        matVecMult(cam->C2W, &origin);
        // Construct direction vector using Pij - e
        // point3D direction;// = newPoint(origin->px,origin->py, origin->pz);
        direction.px = origin.px;
        direction.py = origin.py;
        direction.pz = origin.pz;
        direction.pw = 1.0;
        subVectors(&e, &direction);
        normalize(&direction);
        // Construct ray using both origin and direction.
        // ray3D initialRay;// = newRay(origin, direction);
        initialRay.p0 = origin;
        initialRay.d = direction;
        // Setting up colors.
        // col = (struct colourRGB *)calloc(1,sizeof(struct colourRGB));

        // Tracing ray
        rayTrace(&initialRay, 1, &col, NULL);
        offset = (sx * j * 3) + (i * 3);
        *(rgbIm + offset + 0) = col.R*255;
        *(rgbIm + offset + 1) = col.G*255;
        *(rgbIm + offset + 2) = col.B*255;
        // Tear down col struct.
        // free(col);
      } else {
        total.R = 0;
        total.G = 0;
        total.B = 0;
        for (aaSamples = 0; aaSamples < 20; aaSamples ++){
          col.R = 0;
          col.G = 0;
          col.B = 0;
          // point3D origin;// = newPoint(cam->wl+i*du,cam->wt+j*dv,cam->f);
          origin.px = cam->wl+(i+drand48()-0.5)*du;
          origin.py = cam->wt+(j+drand48()-0.5)*dv;
          origin.pz = cam->f;
          origin.pw = 1.0;
          matVecMult(cam->C2W, &origin);
          // Construct direction vector using Pij - e
          // point3D direction;// = newPoint(origin->px,origin->py, origin->pz);
          direction.px = origin.px;
          direction.py = origin.py;
          direction.pz = origin.pz;
          direction.pw = 1.0;
          subVectors(&e, &direction);
          normalize(&direction);
          // Construct ray using both origin and direction.
          // ray3D initialRay;// = newRay(origin, direction);
          initialRay.p0 = origin;
          initialRay.d = direction;
          // Setting up colors.
          // col = (struct colourRGB *)calloc(1,sizeof(struct colourRGB));
          // Tracing ray
          rayTrace(&initialRay, 1, &col, NULL);
          total.R += col.R;
          total.G += col.G;
          total.B += col.B;
        }
        offset = (sx * j * 3) + (i * 3);
        total.R = total.R / 20 * 255.0;
        total.G = total.G / 20 * 255.0;
        total.B = total.B / 20 * 255.0;
        *(rgbIm + offset + 0) = total.R;
        *(rgbIm + offset + 1) = total.G;
        *(rgbIm + offset + 2) = total.B;
      }
    } // end for i
  } // end for j
  
  fprintf(stderr,"\nDone!\n");

  // Output rendered image
  imageOutput(im,output_name);

  // Exit section. Clean up and return.
  cleanup(object_list,light_list,texture_list);   // Object, light, and texture lists
  deleteImage(im);          // Rendered image
  free(cam);            // camera view
  exit(0);
}
Пример #21
0
void ResetWidget::resetView()
{
    m_tableWidget->clear();
    delete m_tableWidget;
    setupView();
}
Пример #22
0
Geometry::Geometry()
	: mTerrainGroup(0)
	, mTerrainPaging(0)
	, mPageManager(0)
	, mPagedWorld(0)
	, mTerrainPagedWorldSection(0)
	, mTerrainPos(0, 0, 0) {
		
		setupView();
		m_TrayMgr = InputHandler::getSingleton()->getSdkTrayMgr();
		mInfoLabel = m_TrayMgr->createLabel(OgreBites::TL_TOP, "TInfo", "", 350);

		mTerrainGlobals = OGRE_NEW TerrainGlobalOptions();

		//setDragLook(true);

		MaterialManager::getSingleton().setDefaultTextureFiltering(TFO_ANISOTROPIC);
		MaterialManager::getSingleton().setDefaultAnisotropy(7);

		//OgreTrip::getSceneMgr()->setFog(FOG_LINEAR, ColourValue(0.7, 0.7, 0.8), 0, 4000, 10000);

		LogManager::getSingleton().setLogDetail(LL_BOREME);

		Vector3 lightdir(0.55, -0.3, 0.75);
		lightdir.normalise();

		Light * l = OgreTrip::getSceneMgr()->createLight("tstLight");
		l->setType(Light::LT_DIRECTIONAL);
		l->setDirection(lightdir);
		l->setDiffuseColour(ColourValue::White);
		l->setSpecularColour(ColourValue(0.4, 0.4, 0.4));

		OgreTrip::getSceneMgr()->setAmbientLight(ColourValue(0.5f, 0.5f, 0.5f));

		mTerrainGroup = OGRE_NEW TerrainGroup(OgreTrip::getSceneMgr(), Terrain::ALIGN_X_Z, TERRAIN_SIZE, TERRAIN_WORLD_SIZE);
		mTerrainGroup->setFilenameConvention(ENDLESS_TERRAIN_FILE_PREFIX, ENDLESS_TERRAIN_FILE_SUFFIX);
		mTerrainGroup->setOrigin(mTerrainPos);
		mTerrainGroup->setAutoUpdateLod( TerrainAutoUpdateLodFactory::getAutoUpdateLod(BY_DISTANCE) );

		configureTerrainDefaults(l);

		// Paging setup
		mPageManager = OGRE_NEW PageManager();
		// Since we're not loading any pages from .page files, we need a way just
		// to say we've loaded them without them actually being loaded
		mPageManager->setPageProvider( & mDummyPageProvider);
		mPageManager->addCamera(OgreTrip::getCamera());
		mPageManager->setDebugDisplayLevel(0);
		mTerrainPaging = OGRE_NEW TerrainPaging(mPageManager);
		mPagedWorld = mPageManager->createWorld();
		mTerrainPagedWorldSection = mTerrainPaging->createWorldSection(mPagedWorld, mTerrainGroup, 400, 500,
			ENDLESS_PAGE_MIN_X, ENDLESS_PAGE_MIN_Y,
			ENDLESS_PAGE_MAX_X, ENDLESS_PAGE_MAX_Y);

		//      mPerlinNoiseTerrainGenerator = OGRE_NEW PerlinNoiseTerrainGenerator;
		//      mTerrainPagedWorldSection->setDefiner( mPerlinNoiseTerrainGenerator );
		mTerrainPagedWorldSection->setDefiner( OGRE_NEW SimpleTerrainDefiner );
		TerrainGroup::TerrainIterator ti = mTerrainGroup->getTerrainIterator();
		while(ti.hasMoreElements())
		{
			Terrain* t = ti.getNext()->instance;
			initBlendMaps(t);
		}
		mTerrainGroup->freeTemporaryResources();

		OgreTrip::getSceneMgr()->setSkyBox(true, "Examples/CloudyNoonSkyBox");
		


}
Пример #23
0
void MainWindow::setupListView()
{
    setupView(new ListStatusView(m_hostInfoManager, this), true);
}
Пример #24
0
void MainWindow::setupStarView()
{
    setupView(new StarView( m_hostInfoManager, this), false);
}
Пример #25
0
MainWindow::MainWindow( QString myname ) : QMainWindow()
{
  setupUi( this );

  MainTab->setCurrentIndex( 0 );
  RWDXMCenterF = false;
  DXMCenterFile = DXMCENTERFILE0;
  MCACanSaveAllOnMem = false;
  MCAPreAMPGainHasSet = false;
  MaxMCAEnergy = 20;
  MStabOk = false;
  MStabDelegate = "";

#if 0
  AutoShutter->setChecked( false );  // 自動シャッターのボタンはデフォルトでは
  AutoShutter->setEnabled( false );  // 使えなくしておく
#endif

  MCAFSel = scanFSel = monFSel = S2DFileSel
    = SelDFND = SelWBFND = SelRBFND = SelLFND = NULL;

  // Monitor の中で SSD の強度を別ファイルに書き出すときの時間を測るため
  T = new QTime;
  T->start();

  FSTATMsgs[0][0] = tr( "Both the name and the data is old." );
  FSTATMsgs[0][1] = tr( "The name is new, but the data is old." );
  FSTATMsgs[1][0] = tr( "The data is new, but the name is old." );
  FSTATMsgs[1][1] = tr( "The data and the name is new, but not saved." );
  MeasDataStat = MeasNameStat = OLD;
  ScanDataStat = ScanNameStat = OLD;
  MonDataStat = MonNameStat = OLD;
  MCADataStat = MCANameStat = OLD;
  S2DDataStat = S2DNameStat = OLD;

  isQXafsModeAvailable = false;

  XMAPk2p = new KeV2Pix;
  fdbase = new FluoDBase;
  u = new Units;

  MMainTh = NULL;
  MDTh1 = NULL;
  EncMainTh = NULL;
  Enc2 = NULL;
  SLS = NULL;
  SI0 = NULL;
  SI1 = NULL;
  SFluo = NULL;
  MMStab = NULL;

  oldDeg = -100;
  AllInited = MotorsInited = SensorsInited = false;
  EncOrPM = XENC;
  MCAGains.clear();
  MeasA = 0;
  OldDTh1 = 0;

  StatDisp = new Status();
  StatTab->layout()->addWidget( StatDisp );

  XAFSName = myname;
  XAFSKey = myname;
  XAFSTitle = myname;

  starsSV = new StarsSV2;
  conds = new Conditions;
  conds->setVersionInfo( VERSION, __DATE__, __TIME__ );
  alarms = new Alarms;
  connect( alarms, SIGNAL( alarmOn() ),
	   this, SLOT( alarmOn() ), Qt::UniqueConnection );
  connect( alarms, SIGNAL( alarmOff() ),
	   this, SLOT( alarmOff() ), Qt::UniqueConnection );
  
  setupLogArea();     // ログに対する書き出しがある可能性があるので最初にイニシャライズ
  ReadDef( DefFileName );
  remote = new AUnitRemote;
  connect( remote, SIGNAL( setMeasBlockF( bool ) ), MeasBlockB, SLOT( setChecked( bool ) ), Qt:: UniqueConnection );
  
  selmc = new SelMC2( mccd );
  setWindowTitle( XAFSTitle );
  s = new Stars;      // モータ類のイニシャライズの前に Stars の準備はしておく
  s->ReadStarsKeys( XAFSKey, XAFSName ); // Stars とのコネクション確立の準備
  s->SetNewSVAddress( starsSV->SSVAddress() );
  s->SetNewSVPort( starsSV->SSVPort() );
  connect( s, SIGNAL( EvAll( SMsg ) ), this, SLOT( RcvEvAll( SMsg ) ), Qt::UniqueConnection );

  TTable = new TuningTable;
  pmConds = new PMConditions;

  Initialize();
  setupView();
  setupCommonArea();
  setupSetupArea();     // AUnit 関係の Initialize 後でないとだめ
  if ( SFluo != NULL ) {
    setupSetupSSDArea();
  } else {
    MainTab->removeTab( MainTab->indexOf( SSDTab ) );
  }
  setupChangerArea();
  setupQXafsMode();
  setupMeasArea();
  setupReadDataArea();
  setupScan2DArea();
  setupWebView();
  setupAutoSequence();

  //  useFixedDelta = false;
  connect( conds, SIGNAL( SetDXMPMC() ), this, SLOT( SetDXMPMC() ),
	   Qt::UniqueConnection );

  StatDisp->setupStatArea( &AMotors, &ASensors, starsSV, selmc, conds, pmConds );

  connect( StatDisp, SIGNAL( NeedListNodes() ), this, SLOT( SendListNodes() ),
	   Qt::UniqueConnection );
  //  QString msg = "XafsMsg_" + QLocale::system().name();
  //  NewLogMsg( msg );
  NewLogMsg( QString( tr( "Mono: %1 (%2 A)" ) )
	     .arg( mccd[ selmc->MC() ]->getMCName() )
	     .arg( mccd[ selmc->MC() ]->getD() ) );

  connect( s, SIGNAL( AskShowStat( QString, int ) ),
	   this, SLOT( ShowMessageOnSBar( QString, int ) ),
	   Qt::UniqueConnection );
  connect( action_Quit, SIGNAL( triggered() ), qApp, SLOT( closeAllWindows() ),
	   Qt::UniqueConnection );
  //  connect( action_SelMC, SIGNAL( triggered() ), selmc, SLOT( show() ),
  //       Qt::UniqueConnection );
  connect( selmc, SIGNAL( NewLogMsg( QString ) ),
	   this, SLOT( NewLogMsg( QString ) ),
	   Qt::UniqueConnection );
  connect( selmc, SIGNAL( NewLatticeConstant( double ) ),
	   u, SLOT( setD( double ) ),
	   Qt::UniqueConnection );
  //  connect( action_SetSSV, SIGNAL( triggered() ), starsSV, SLOT( show() ),
  //           Qt::UniqueConnection );

  connect( starsSV, SIGNAL( SSVNewAddress( const QString & ) ),
	   s, SLOT( SetNewSVAddress( const QString & ) ),
	   Qt::UniqueConnection );
  connect( starsSV, SIGNAL( SSVNewPort( const QString & ) ),
	   s, SLOT( SetNewSVPort( const QString & ) ),
	   Qt::UniqueConnection );
  connect( s, SIGNAL( RecordSSVHistoryA( const QString & ) ),
	   starsSV, SLOT( RecordSSVHistoryA( const QString & ) ),
	   Qt::UniqueConnection );
  connect( s, SIGNAL( RecordSSVHistoryP( const QString & ) ),
	   starsSV, SLOT( RecordSSVHistoryP( const QString & ) ),
	   Qt::UniqueConnection );
  connect( starsSV, SIGNAL( AskReConnect() ), s, SLOT( ReConnect() ),
	   Qt::UniqueConnection );
  connect( s, SIGNAL( ReConnected() ), this, SLOT( InitializeUnitsAgain() ),
	   Qt::UniqueConnection );
  //  connect( starsSV, SIGNAL( accepted() ), s, SLOT( ReConnect() ),
  //           Qt::UniqueConnection );

  connect( s, SIGNAL( ConnectionIsReady( void ) ), this, SLOT( Initialize( void ) ),
	   Qt::UniqueConnection );
  connect( s, SIGNAL( AnsListNodes( SMsg ) ), this, SLOT( RcvListNodes( SMsg ) ),
	   Qt::UniqueConnection );
  connect( s, SIGNAL( EvConnected( SMsg ) ),
	   this, SLOT( SomeDrvIsConnected( SMsg ) ),
	   Qt::UniqueConnection );
  connect( s, SIGNAL( EvDisconnected( SMsg ) ),
	   this, SLOT( SomeDrvIsDisconnected( SMsg ) ),
	   Qt::UniqueConnection );

  if ( ! isQXafsModeAvailable ) {
    QXafsMode->setChecked( false );
    QXafsMode->setEnabled( false );
  }

  GoTimer = new QTimer;
  MCATimer = new QTimer;
  ScanTimer = new QTimer;
  MonTimer = new QTimer;
  MeasTimer = new QTimer;
  MeasDarkTimer = new QTimer;

  connect( GoTimer, SIGNAL( timeout() ), this, SLOT( MotorMove() ),
	   Qt::UniqueConnection );
  connect( MCATimer, SIGNAL( timeout() ), this, SLOT( MCASequence() ),
	   Qt::UniqueConnection );
  connect( ScanTimer, SIGNAL( timeout() ), this, SLOT( ScanSequence() ),
	   Qt::UniqueConnection );
  connect( MonTimer, SIGNAL( timeout() ), this, SLOT( MonSequence() ),
	   Qt::UniqueConnection );
  connect( MeasTimer, SIGNAL( timeout() ), this, SLOT( MeasSequence() ),
	   Qt::UniqueConnection );
  connect( MeasDarkTimer, SIGNAL( timeout() ), this, SLOT( MeasDarkSequence() ),
	   Qt::UniqueConnection );
  connect( s, SIGNAL( SSisActive( bool ) ), StatDisp, SLOT( SetSSVStat( bool ) ),
	   Qt::UniqueConnection );

  connect( AddNewDTh1TPoint, SIGNAL( clicked() ), this, SLOT( AddNewDTh1TunePoint() ),
	   Qt::UniqueConnection );
  connect( conds, SIGNAL( AskToSaveDTh1TTable() ), TTable, SLOT( SaveTuneTable() ),
	   Qt::UniqueConnection );
  connect( conds, SIGNAL( AskToShowDTh1TTable() ), TTable, SLOT( ShowTuneTable() ),
	   Qt::UniqueConnection );
  connect( conds, SIGNAL( NewDiff1( int ) ), this, SIGNAL( NewDiff1( int ) ),
	   Qt::UniqueConnection );
  connect( conds, SIGNAL( NewDiff2( int ) ), this, SIGNAL( NewDiff2( int ) ),
	   Qt::UniqueConnection );

  connect( Special, SIGNAL( clicked() ), this, SLOT( SpecialMove() ) );
  
  conds->setupDataRoot();      // 他のファイルダイアログが全部 new されていないとダメ !

  s->AskStatus();
  s->MakeConnection();
}