Esempio n. 1
0
static void edit_Click(GL_PageControls_TypeDef* pThis)
{
	Text_Clear(s_currentTextNumber);
	Text_Display(s_currentTextNumber);
	set_kybd_mode(3);
	text_cnt = 0;
}
Esempio n. 2
0
/**
 * Callbacks
 */
static void textButton_Click(GL_PageControls_TypeDef* pThis)
{
	uint16_t id = pThis->ID - ID_TEXT_START;
	//assert(id >= 0 && id <= Text_Items);
	Text_SetSelectedText(id);
	Item_Display(id);
	Text_Wipe();
	Text_Display(id);
}
Esempio n. 3
0
void Print_Details(SUB_MODE s)
{
	/*Array for printing details related to the mode*/
	char Details[100];
	extern int Cur_Text_Flag;
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	//void *font =  GLUT_BITMAP_9_BY_15;
	//void *font =  GLUT_BITMAP_TIMES_ROMAN_24; 
	void *font_type = GLUT_BITMAP_HELVETICA_18;
	int x = 500;
	
	/*For clearing the old selected option ie 'de-highlighting' it*/ 
	glColor3f(0.875,0.875,0.875);
	Right_Boxes = 0;
	//Draw_Info_Bar(x_old1,y_old1,x_old2,y_old2,3,ON);			

	//glColor3f(0.0,0.0,0.0);
	//Draw_Info_Bar(s.vertices[0][0],s.vertices[0][1],s.vertices[1][0],s.vertices[1][1],2,OFF);

	x_old1 = s.vertices[0][0];
	y_old1 = s.vertices[0][1];
	x_old2 = s.vertices[1][0];
	y_old2 = s.vertices[1][1];

	if(s.mode == Cur_Text_Flag)
		return;

    Cur_Text_Flag = s.mode;
	switch(s.mode)
	{
	  case 1:strcpy(Details,"Click and drag the mouse to draw a Line");
			 break;
	  case 2:strcpy(Details,"Click and drag the mouse to draw a Rectangle");
			 break;
	  case 3:strcpy(Details,"Click on two places to draw a Circle");
			 break;
	  case 4:strcpy(Details,"Click and drag the mouse for Free Draw");
			 break;
	  case 5:strcpy(Details,"Click to draw lines.Create a polygon with Middle click");
			 break;
	  case 6:strcpy(Details,"Click and drag the mouse for Erasor");
			 break;
	  case 7:strcpy(Details,"Click and drag the mouse for Spray");
			 break;
	  case 8:strcpy(Details,"Click inside the drawing area and type in your Text");
			 break;
	  case 9:strcpy(Details,"Click on two places for creating Spiral");
		 	 break;
	  case 10:strcpy(Details,"Click and drag for getting Bubbles");
			  break;	
	  case 11:strcpy(Details,"Click inside the drawing for templates");
			 break;
	  case 12:strcpy(Details,"Pick a color from the drawing area");
			 break;  
	  case 13:strcpy(Details,"Draw a shape and press 'R' to rotate the shape");
			 break;
	  case 14:strcpy(Details,"Draw a shape and press 'E' to scale the shape");
			 break;
	  case 15:strcpy(Details,"Click and drag to mix colors");
		 	 break;
	  case 16:strcpy(Details,"Click on two places,copy image and pres 'J' to paste image");
			  break;	
	  case 17:strcpy(Details,"Click inside the drawing area to rotate image");
			 break;
	  case 18:strcpy(Details,"Click to get Points");
			 break;  
	  case 19:strcpy(Details,"Click on two places to get colored rectangles");
			 break;
	  case 20:strcpy(Details,"Click on two places to get an elllipse");
			 break;	
	}
	

	/*Draw the small area where the help info is displayed*/
	{
		extern int Win_Width;
		float colorRed   = 0.4588;
		float colorGreen = 0.6190;
		float colorBlue  = 0.8247;
		int x1 = 0, y1 = 0, x2 = Win_Width, y2 = 25;
		
		//glColor3f(0.3921,0.6313,0.9091);Initally used color -> a blue shade
		
		for(; y1 != y2 ;){
			glColor3f( colorRed += 0.02 ,  colorGreen += 0.02 , colorBlue += 0.02);
			glBegin(GL_LINES);
		  	 glVertex2i(x1,y1);
		   	glVertex2i(x2,y1++);
		  	 glEnd();
			glFlush();
			
		
		}
	}
	/*This above toolbar is generated as a mumber of lines woth different colors*/
	/*For drawing the box around the inormation display*/
	//Draw_Info_Bar(0,0,640,20,2,2);	
	glViewport(0,0,800,600);


	/*NO NEED FOR OLD TEXT.JUST DRAW THE BOX AGAIN*/
	/*For Overwriting with background color(clear) 
	glColor3f(0.7294,0.8,0.9137);
	Text_Display(200,0,old_text);
	glFlush();*/
	
	/*Try Opening a Flashy icon or button so that the user sees the help display*/
	glViewport(150,0,23,23);
	Open_Bitmap(".\\bit\\bulb.bmp");
	glViewport(0,0,800,600);
	
	glColor3f(0.0,0.0,1.0);
	Text_Display(200,5,Details);
	glFlush();
	
	strcpy(old_text,Details);
	
	

}	
Esempio n. 4
0
/*
** RB_IterateStagesGeneric
*/
static void RB_IterateStagesGeneric( shaderCommands_t *input )
{
/*	MODVIEWREM
	int stage;

	for ( stage = 0; stage < MAX_SHADER_STAGES; stage++ )
	{
		shaderStage_t *pStage = tess.xstages[stage];

		if ( !pStage )
		{
			break;
		}

		ComputeColors( pStage );
		ComputeTexCoords( pStage );

		if ( !setArraysOnce )
		{
			qglEnableClientState( GL_COLOR_ARRAY );
			qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, input->svars.colors );
		}

		//
		// do multitexture
		//
		if ( pStage->bundle[1].image[0] != 0 )
		{
			DrawMultitextured( input, stage );
		}
		else
		{

			if ( !setArraysOnce )
			{
				qglTexCoordPointer( 2, GL_FLOAT, 0, input->svars.texcoords[0] );
			}

			//
			// set state
			//
			if ( pStage->bundle[0].vertexLightmap && ( r_vertexLight->integer || glConfig.hardwareType == GLHW_PERMEDIA2 ) && r_lightmap->integer )
			{
				GL_Bind( tr.whiteImage );
			}
			else 
				R_BindAnimatedImage( &pStage->bundle[0] );

			GL_State( pStage->stateBits );

			//
			// draw
			//
			R_DrawElements( input->numIndexes, input->indexes );
		}

		// allow skipping out to show just lightmaps during development
		if ( r_lightmap->integer && ( pStage->bundle[0].isLightmap || pStage->bundle[1].isLightmap || pStage->bundle[0].vertexLightmap ) )
		{
			break;
		}
	}
*/		
	glBindTexture( GL_TEXTURE_2D, input->gluiTextureBind );


		
	
	{// note additional loop I put here for overriding polys to be wireframe - Ste.

		glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT);	// preserves GL_CULL_FACE, GL_CULL_FACE_MODE, GL_POLYGON_MODE
		{
			if (!input->bSurfaceIsG2Tag			// don't draw G2 surface tags
				|| AppVars.bShowTagSurfaces		// ... unless you really want to
				)
			{
				bool bSurfaceIsUnshadowable =	AppVars.bShowUnshadowableSurfaces && (input->numVertexes > (SHADER_MAX_VERTEXES/2));
				bool bSurfaceIsHighlighted =	AppVars.bSurfaceHighlight &&
												input->hModel == AppVars.hModelToHighLight &&
												(
													(AppVars.iSurfaceNumToHighlight == iITEMHIGHLIGHT_ALL)
													||
													(AppVars.iSurfaceNumToHighlight == iITEMHIGHLIGHT_ALL_TAGSURFACES && input->bSurfaceIsG2Tag)
													||
													(AppVars.iSurfaceNumToHighlight == input->iSurfaceNum)
												);				
				bool bSpecialCaseHighlightSoNoYellowNumberClash = (AppVars.bVertIndexes && AppVars.bVertWeighting && AppVars.iSurfaceNumToHighlight < 0);

				if (bSurfaceIsHighlighted && !bSpecialCaseHighlightSoNoYellowNumberClash)
					glLineWidth(2);
				else
					glLineWidth(1);
				bool b2PassForWire = AppVars.bWireFrame || (AppVars.bWireFrame && bSurfaceIsHighlighted);

				if (b2PassForWire)
				{
					if (AppVars.bShowPolysAsDoubleSided && !AppVars.bForceWhite)
					{
						glEnable(GL_CULL_FACE);	
					}
				}
		
		//		for (int iPass=0; iPass<(AppVars.bWireFrame?2:1); iPass++)
				for (int iPass=0; iPass<(b2PassForWire?2:1); iPass++)
				{
					if (b2PassForWire)
					{
						if (!iPass)
						{
							glCullFace(GL_BACK);

							if (bSurfaceIsHighlighted && !bSpecialCaseHighlightSoNoYellowNumberClash)
								glColor3f(0.5,0.5,0.0);	// dim yellow
							else
								glColor3f(0.5,0.5,0.5);	// dim white
						}
						else
						{
							glCullFace(GL_FRONT);
							if (bSurfaceIsHighlighted && !bSpecialCaseHighlightSoNoYellowNumberClash)
								glColor3f( 1,1,0);		// yellow
							else
								glColor3f( 1,1,1);		// white
						}
					}
					
					R_DrawElements( input->numIndexes, input->indexes );	// the standard surface draw code
				}

				if (b2PassForWire)
				{						
					if (AppVars.bShowPolysAsDoubleSided && !AppVars.bForceWhite)
					{
						glDisable(GL_CULL_FACE);
					}
				}


				glLineWidth(1);

				// draw surface-highlights?...  (2 types, so do 2 passes to keep code down)
				//
				if (!AppVars.bWireFrame && bSurfaceIsHighlighted && !bSpecialCaseHighlightSoNoYellowNumberClash)
				{
					// do these 3 in case we're not already in wireframe...
					//
					glDisable(GL_TEXTURE_2D);
					glDisable(GL_BLEND);
					glDisable(GL_LIGHTING);					

					glLineWidth(2);
					glColor3f(1,1,0);	// yellow
					
					if (AppVars.iSurfaceNumToHighlight > 0)
					{					
						SurfaceOnOff_t eOnOff = Model_GLMSurface_GetStatus( input->hModel, input->iSurfaceNum );
						if (eOnOff != SURF_ON)
						{
							// then we must be ON only because of highlighting an OFF surface in the treeview,
							//	so show it dimmer (particualrly if they've just turned it off and wonder why they
							//	can still see it...
							//
							glColor3f(0.5,0.5,0);	// dim yellow
						}
					}

					for (int iVert = 0; iVert<input->numIndexes; iVert+=3)
					{
						glBegin(GL_LINE_LOOP);
						{
							glVertex3fv( input->xyz[input->indexes[iVert+0]] );
							glVertex3fv( input->xyz[input->indexes[iVert+1]] );
							glVertex3fv( input->xyz[input->indexes[iVert+2]] );
						}
						glEnd();
					}
					
					glLineWidth(1);
				}

				// draw unshadowable surfaces...
				//
				if (bSurfaceIsUnshadowable)
				{
					// do these 3 in case we're not already in wireframe...
					//
					glDisable(GL_TEXTURE_2D);
					glDisable(GL_BLEND);
					glDisable(GL_LIGHTING);					

					glLineStipple( 8, 0xAAAA);
					glEnable(GL_LINE_STIPPLE);
					glColor3f(1,0,0);	// red

					if (bSurfaceIsHighlighted)
					{
						glLineWidth(4);	// ... or it won't stand out much over the existing yellow highlights
					}

					for (int iVert = 0; iVert<input->numIndexes; iVert+=3)
					{
						glBegin(GL_LINE_LOOP);
						{
							glVertex3fv( input->xyz[input->indexes[iVert+0]] );
							glVertex3fv( input->xyz[input->indexes[iVert+1]] );
							glVertex3fv( input->xyz[input->indexes[iVert+2]] );
						}
						glEnd();
					}
					
					glDisable(GL_LINE_STIPPLE);

					if (bSurfaceIsHighlighted)
					{
						glLineWidth(1);
					}
				}

				if (AppVars.bCrackHighlight && bSurfaceIsHighlighted)
				{
					extern ModelContainer_t* gpContainerBeingRendered;
					if (gpContainerBeingRendered)	// arrrghhh!!!!
					{
						int iCappedLOD = Model_EnsureGenerated_VertEdgeInfo(gpContainerBeingRendered, AppVars.iLOD);

						SurfaceEdgeVertBools_t &SurfaceEdgeVertBools = gpContainerBeingRendered->SurfaceEdgeInfoPerLOD[iCappedLOD];
						SurfaceEdgeVertBools_t::iterator it = SurfaceEdgeVertBools.find(input->iSurfaceNum);
						if (it != SurfaceEdgeVertBools.end())
						{
							VertIsEdge_t &vrVertIsEdge = (*it).second;

							// highlight the edge verts...
							//
							for (int iIndex=0; iIndex<input->numIndexes; iIndex++)
							{
								int iVert = input->indexes[iIndex];
								if (vrVertIsEdge[iVert])
								{										
									Text_Display("*",input->xyz[iVert],0,255,0);					
								}
							}
						}
					}
				}

/*
				if (1)
				{
					extern int g_iScreenWidth;
					extern int g_iScreenHeight;
					extern int g_iViewAreaMouseX;
					extern int g_iViewAreaMouseY;

					// Header: Declared in Glu.h.
					// Library: Use Glu32.lib.

					GLdouble	modelMatrix[16];
					GLdouble	projMatrix[16];
					GLint		viewPort[4];
					int			iOpenGLMouseX = g_iViewAreaMouseX;
					int			iOpenGLMouseY = (g_iScreenHeight - g_iViewAreaMouseY)-1;

					glGetDoublev	( GL_MODELVIEW_MATRIX,  modelMatrix);
					glGetDoublev	( GL_PROJECTION_MATRIX, projMatrix);
					glGetIntegerv	( GL_VIEWPORT,			viewPort);

					for (int iVert = 0; iVert<input->numIndexes; iVert+=3)
					{						
						GLdouble dX[3],dY[3],dZ[3];

						int iSuccess = 0;
						for (int i=0; i<3; i++)
						{
							iSuccess += gluProject(	input->xyz[input->indexes[iVert+i]][0],	// GLdouble objx,
													input->xyz[input->indexes[iVert+i]][1],	// GLdouble objy,
													input->xyz[input->indexes[iVert+i]][2],	// GLdouble objz,
													modelMatrix,							// const GLdouble modelMatrix[16],
													projMatrix,								// const GLdouble projMatrix[16],
													viewPort,								// const GLint viewport[4],
													&dX[i],&dY[i],&dZ[i]
													);
						}

						if (iSuccess == i)
						{
							// got the 3 vert coords as screen coords, now see if the mouse is within this poly
							//
							if (MouseOverTri(dX[0],dX[1],dX[2],dY[0],dY[1],dY[2], iOpenGLMouseX, iOpenGLMouseY))
							{
								AppVars.iSurfaceNumToHighlight = input->iSurfaceNum;
								OutputDebugString(va("Over surface %d\n",input->iSurfaceNum));
								break;
							}
						}
					}
				}
*/
				// draw normals?...
				//
				if (AppVars.bVertexNormals)
				{
					// do these 3 in case we're doing normals but not wireframe...
					//
					glDisable(GL_TEXTURE_2D);
					glDisable(GL_BLEND);
					glDisable(GL_LIGHTING);

					for (int iNormal = 0; iNormal<input->numVertexes/*numIndexes*/; iNormal++)
					{
						glColor3f(1,0.5,1);	// purple
						glBegin(GL_LINES);
						{
							glVertex3fv(	input->xyz[iNormal] );
							glVertex3f (	input->xyz[iNormal][0] + input->normal[iNormal][0],
											input->xyz[iNormal][1] + input->normal[iNormal][1],
											input->xyz[iNormal][2] + input->normal[iNormal][2]
										);
						}				
						glEnd();				
					}
				}

				// show vertex indexes?...
				//
				if (AppVars.bVertIndexes && bSurfaceIsHighlighted && 
						(
						(AppVars.iSurfaceNumToHighlight != iITEMHIGHLIGHT_ALL || AppVars.bVertWeighting)	// or it drops the framerate through the floor!
						&&
						AppVars.iSurfaceNumToHighlight != iITEMHIGHLIGHT_ALL_TAGSURFACES
						)
					)
				{						
					for (int iVert = 0; iVert<input->numIndexes; iVert++)
					{
						byte r=255,g=0,b=0;	// red

						int iNumWeights = 0;

						if (AppVars.bVertWeighting)
						{
							iNumWeights = input->WeightsUsed[input->indexes[iVert]];						

//							if (gpContainerBeingRendered)
//								gpContainerBeingRendered->iRenderedBoneWeightsThisSurface += iNumWeights;

							GetWeightColour(iNumWeights,r,g,b);

							AppVars.bAtleast1VertWeightDisplayed = true;
						}

						if (AppVars.iSurfaceNumToHighlight != iITEMHIGHLIGHT_ALL
							|| iNumWeights>=3
							)
						{
							Text_Display(va(" %d",input->indexes[iVert]),input->xyz[input->indexes[iVert]],r,g,b);					
						}
					}
				}

				// show triangle indexes?...
				//
				if (AppVars.bTriIndexes && bSurfaceIsHighlighted && 
						(
						(AppVars.iSurfaceNumToHighlight != iITEMHIGHLIGHT_ALL)	// or it drops the framerate through the floor!
						&&
						AppVars.iSurfaceNumToHighlight != iITEMHIGHLIGHT_ALL_TAGSURFACES
						)
					)
				{
					for (int iTri = 0; iTri<input->numIndexes; iTri+=3)	// iTri is effectively like stepval 3 for vert parsing
					{
						byte r=0,g=255,b=255;	// magenta

						vec3_t v3TriCentre;

						v3TriCentre[0] =	(
											input->xyz[input->indexes[iTri+0]][0] +
											input->xyz[input->indexes[iTri+1]][0] +
											input->xyz[input->indexes[iTri+2]][0]
											)/3;

						v3TriCentre[1] =	(
											input->xyz[input->indexes[iTri+0]][1] +
											input->xyz[input->indexes[iTri+1]][1] +
											input->xyz[input->indexes[iTri+2]][1]
											)/3;

						v3TriCentre[2] =	(
											input->xyz[input->indexes[iTri+0]][2] +
											input->xyz[input->indexes[iTri+1]][2] +
											input->xyz[input->indexes[iTri+2]][2]
											)/3;

						Text_Display(va("T:%d",iTri/3), v3TriCentre ,r,g,b);					
					}
				}	

				// show vertexes with omitted bone-weights (threshholding)?...
				//
				if (AppVars.bBoneWeightThreshholdingActive && AppVars.bWireFrame)
				{
//					glDisable(GL_TEXTURE_2D);
//					glDisable(GL_BLEND);
//					glDisable(GL_LIGHTING);

//					glLineWidth(9);
					{
//						glColor3f(0,1,0);	// green

//						glBegin(GL_POINTS);
						{
							for (int iVert=0; iVert<input->numIndexes; iVert++)
							{
								if (input->WeightsOmitted[input->indexes[iVert]])
								{										
									Text_Display("*",input->xyz[input->indexes[iVert]],0,255,0);					
								}
							}
						}
//						glEnd();
					}
//					glLineWidth(1);
				}
			}

			// if this is a G2 tag surface, then work out a matrix from it and store for later use...
			//
			if (input->bSurfaceIsG2Tag)
			{
				// not a clever place to do this, but WTF...
				//
				// Anyway, this is some of Jake's mysterious code to turn a one-triangle tag-surface into a matrix...
				//
				vec3_t			axes[3], sides[3];
				float			pTri[3][3], d;

				memcpy(pTri[0],input->xyz[0],sizeof(vec3_t));
				memcpy(pTri[1],input->xyz[1],sizeof(vec3_t));
				memcpy(pTri[2],input->xyz[2],sizeof(vec3_t));

 				// clear out used arrays
 				memset( axes, 0, sizeof( axes ) );
 				memset( sides, 0, sizeof( sides ) );

 				// work out actual sides of the tag triangle
 				for ( int j = 0; j < 3; j++ )
 				{
 					sides[j][0] = pTri[(j+1)%3][0] - pTri[j][0];
 					sides[j][1] = pTri[(j+1)%3][1] - pTri[j][1];
 					sides[j][2] = pTri[(j+1)%3][2] - pTri[j][2];
 				}

 				// do math trig to work out what the matrix will be from this triangle's translated position
 				VectorNormalize2( sides[iG2_TRISIDE_LONGEST], axes[0] );
 				VectorNormalize2( sides[iG2_TRISIDE_SHORTEST], axes[1] );

 				// project shortest side so that it is exactly 90 degrees to the longer side
 				d = DotProduct( axes[0], axes[1] );
 				VectorMA( axes[0], -d, axes[1], axes[0] );
 				VectorNormalize2( axes[0], axes[0] );

 				CrossProduct( sides[iG2_TRISIDE_LONGEST], sides[iG2_TRISIDE_SHORTEST], axes[2] );
 				VectorNormalize2( axes[2], axes[2] );

				//float Jmatrix[3][4];
				mdxaBone_t Jmatrix;

				#define MDX_TAG_ORIGIN 2

 				// set up location in world space of the origin point in out going matrix
 				Jmatrix.matrix[0][3] = pTri[MDX_TAG_ORIGIN][0];
 				Jmatrix.matrix[1][3] = pTri[MDX_TAG_ORIGIN][1];
 				Jmatrix.matrix[2][3] = pTri[MDX_TAG_ORIGIN][2];

 				// copy axis to matrix - do some magic to orient minus Y to positive X and so on so bolt on stuff is oriented correctly
				Jmatrix.matrix[0][0] = axes[1][0];
				Jmatrix.matrix[0][1] = axes[0][0];
				Jmatrix.matrix[0][2] = -axes[2][0];

				Jmatrix.matrix[1][0] = axes[1][1];
				Jmatrix.matrix[1][1] = axes[0][1];
				Jmatrix.matrix[1][2] = -axes[2][1];

				Jmatrix.matrix[2][0] = axes[1][2];
				Jmatrix.matrix[2][1] = axes[0][2];
				Jmatrix.matrix[2][2] = -axes[2][2];				

				input->pRefEnt->pXFormedG2TagSurfs		[input->iSurfaceNum] = Jmatrix;
				input->pRefEnt->pXFormedG2TagSurfsValid	[input->iSurfaceNum] = true;

	//			OutputDebugString(va("Tag surf %d is valid\n",input->iSurfaceNum));
			}
		}
		glPopAttrib();
		glColor3f( 1,1,1);		
	}
}