示例#1
0
void MainWindow::orientationChanged(const QString& newOrientation)
{
	if (newOrientation == QLatin1String(MCE_ORIENTATION_UNKNOWN))
		return;
	bool bPortrait = newOrientation == QLatin1String(MCE_ORIENTATION_PORTRAIT);
	mShowShortTitle = bPortrait;
	mpViewer->setShowShortTitle(mShowShortTitle);
	if (bPortrait)
		setPortrait();
	else
		setLandscape();
}
示例#2
0
void LightingScene::display() 
{

	// ---- BEGIN Background, camera and axis setup

	// Clear image and depth buffer everytime we update the scene
	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

	// Initialize Model-View matrix as identity (no transformation
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	// Apply transformations corresponding to the camera position relative to the origin
	CGFscene::activeCamera->applyView();


	light0->draw();
	light0->disable();
	if (light0On != 0)
		light0->enable();

	light1->draw();
	light1->disable();
	if (light1On != 0)
		light1->enable();

	light2->draw();
	light2->disable();
	if (light2On != 0)
		light2->enable();

	light3->draw();
	light3->disable();
	if (light3On != 0)
		light3->enable();

	dayLight->draw();
	dayLight->enable();
	if(landscapeSelector==4)
		dayLight->disable();
	
	


	// Draw axis
	axis.draw();

	// ---- END Background, camera and axis setup

	// ---- BEGIN Primitive drawing section

	//First Table
	glPushMatrix();
	glTranslated(5,0,8);
	table->draw(materialA, tableAppearence);
	glPopMatrix();
	/*
	//Second Table
	glPushMatrix();
	glTranslated(12,0,8);
	table->draw(materialA, tableAppearence);
	glPopMatrix();
	*/
	materialA->apply();
	//Floor
	glPushMatrix();
	floorAppearence->apply();
	glTranslated(7.5,0,7.5);
	glScaled(15,0.2,15);
	floor->drawFloor(10, 12);
	glPopMatrix();

	//LeftWall
	glPushMatrix();
	windowAppearence->apply();
	wall->drawWindowedWall();
	/*
	glTranslated(0,4,7.5);
	glRotated(-90.0,0,0,1);
	glScaled(8,0.2,15);
	wall->setHeight(15);
	wall->setWidth(8);
	windowAppearence->apply();
	wall->drawCentered(true);*/
	glPopMatrix();

	//PlaneWall
	glPushMatrix();
	glTranslated(7.5,4,0);
	glRotated(90.0,1,0,0);
	glScaled(15,0.2,8);
	materialA->apply();
	wall->draw();
	glPopMatrix();


	// Board A
	glPushMatrix();
	glTranslated(4,4,0.2);
	glScaled(BOARD_WIDTH,BOARD_HEIGHT,1);
	boardA->setHeight(BOARD_HEIGHT);
	boardA->setWidth(BOARD_WIDTH);
	glRotated(90.0,1,0,0);
	slidesAppearence->apply();
	boardA->drawCentered(false);
	glPopMatrix();

	//PlaneB
	glPushMatrix();
	boardAppearence->apply();
	glTranslated(10.5,4,0.2);
	glScaled(BOARD_WIDTH,BOARD_HEIGHT,1);
	boardB->setHeight(BOARD_HEIGHT);
	boardB->setWidth(BOARD_WIDTH);
	glRotated(90.0,1,0,0);
	boardAppearence->apply();
	boardB->drawCentered(false);
	glPopMatrix();

	//cylinder
	materialA->apply();
	glPushMatrix();
	glScaled(1,8,1);
	glTranslated(1,0,2);
	glRotated(-90, 1,0,0);
	cylinder->draw();
	glPopMatrix();


	glPushMatrix();
	glScaled(1,8,1);
	glTranslated(14,0,2);
	glRotated(-90, 1,0,0);
	cylinder1->draw();
	glPopMatrix();


	//clock
	glPushMatrix();
	clockAppearence->apply();
	glTranslated(7.25,7,0.25);
	
	clock->draw();
	glPopMatrix();

	//robot

	glPushMatrix();
	glTranslated(4,0,4);
	if (wire){
	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
	robot->draw();
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	}
	else{
	setRobotTexture();
	robot->draw();
	}
	glPopMatrix();


	//skybox

	glPushMatrix();
	glTranslated(7,-2.5,7);
	glScaled(12,12,12);
	glRotated(45,0,1,0);
	glRotated(-90,1,0,0);
	setLandscape();
	skybox->drawSky();
	glPopMatrix();
	// ---- END Primitive drawing section


	// We have been drawing in a memory area that is not visible - the back buffer, 
	// while the graphics card is showing the contents of another buffer - the front buffer
	// glutSwapBuffers() will swap pointers so that the back buffer becomes the front buffer and vice-versa
	glutSwapBuffers();
}
示例#3
0
/*!
 * Set all pagesize parameters via const gchar attributes
 */
bool fp_PageSize::Set(const gchar ** attributes)
{
	const gchar * szPageSize=NULL, * szOrientation=NULL, * szWidth=NULL, * szHeight=NULL, * szUnits=NULL, * szPageScale=NULL;
	double width=0.0;
	double height=0.0;
	double scale =1.0;
	UT_Dimension u = DIM_IN;

	for (const gchar ** a = attributes; (*a); a++)
	{
	  UT_DEBUGMSG(("PageSize  -prop %s value %s \n",a[0],a[1]));
		if (strcmp(a[0],"pagetype") == 0)
		        szPageSize = a[1];
		else if (strcmp(a[0], "orientation") == 0)
			szOrientation = a[1];
		else if (strcmp(a[0], "width") == 0)
			szWidth = a[1];
		else if (strcmp(a[0], "height") == 0)
			szHeight = a[1];
		else if (strcmp(a[0], "units") == 0)
			szUnits = a[1];
		else if (strcmp(a[0], "page-scale") == 0)
			szPageScale = a[1];
		a++;
	}
	if(!szPageSize)
		return false;
	if(!szOrientation)
		return false;
	Set(static_cast<const char *>(szPageSize));

	if( szWidth && szHeight && szUnits && szPageScale)
	  {
		if(g_ascii_strcasecmp(szPageSize,"Custom") == 0)
		  {
		    width = UT_convertDimensionless(szWidth);
		    height = UT_convertDimensionless(szHeight);
		    if(strcmp(szUnits,"cm") == 0)
		      u = DIM_CM;
		    else if(strcmp(szUnits,"mm") == 0)
		      u = DIM_MM;
		    else if(strcmp(szUnits,"inch") == 0)
		      u = DIM_IN;
		    Set(width,height,u);
		  }

		scale =  UT_convertDimensionless(szPageScale);
		setScale(scale);
	  }

	// set portrait by default
	setPortrait();
	if( g_ascii_strcasecmp(szOrientation,"landscape") == 0 )
	{
		// Note: setting landscape causes the width and height to be swapped
		if (szWidth && szHeight && szUnits) // just setting a custom width or height should be allowed imo, but I'm lazy - MARCM
		{
			width = UT_convertDimensionless(szWidth);
			height = UT_convertDimensionless(szHeight);
			if(strcmp(szUnits,"cm") == 0)
				u = DIM_CM;
			else if(strcmp(szUnits,"mm") == 0)
				u = DIM_MM;
			else if(strcmp(szUnits,"inch") == 0)
				u = DIM_IN;
			setLandscape();
			Set(height,width,u);
		}
		else  
		{
			Set(m_iHeight, m_iWidth, FUND);
		}
	}
	UT_DEBUGMSG(("PageSize - Height %lf Width %lf \n",m_iHeight,m_iWidth));
	return true;
}