Ejemplo n.º 1
0
static void FillAllComboCells(HWND hwnd, int maxLine)
{
   HWND hwndContainer = GetDlgItem (hwnd, IDC_RELOCATE_CONTAINER);
   LPSTORAGEPARAMS  lpstorage = GetDlgProp (hwnd);
   LPCHECKEDOBJECTS ls, lploc = GetLocations ();
   int     i, maxlen = 0;
   char*   item;
   char*   buffer;
   char*   first;

   ls = lploc;
   while (ls)
   {
       item   = (char*) ls->dbname;
       maxlen = maxlen + x_strlen (item) +1;

       ls = ls->pnext;
   }
   if (maxlen > 0)
   {
       buffer = ESL_AllocMem (maxlen +2);
       first  = buffer;

       ls = lploc;
       x_strcpy (buffer, (char*) ls->dbname);
       ls = ls->pnext;

       while (ls)
       {
           item   = (char*)  ls->dbname;
           buffer = buffer + x_strlen (buffer) +1;
           x_strcpy (buffer, item);

           ls = ls->pnext;
       }
       buffer = buffer + x_strlen (buffer) +1;
       x_strcpy (buffer, "");

       //
       // Fill all combos
       //

       for (i=1; i<maxLine; i++)
       {
           ContainerFillComboCell(
               hwndContainer,
               i,
               1,
               0,
               CONT_ALIGN_LEFT,
               first);
       }
       ESL_FreeMem (first);
       first = NULL;
   }
   lploc = FreeCheckedObjects (lploc);
}
Ejemplo n.º 2
0
void GLES2ShaderContext::DrawRect(const Sprite::RECT_MODE mode)
{
	CreateProgram();
	int pos, tex;
	GetLocations(pos, tex);
	if (pos != INVALID_ATTRIB_LOCATION && tex != INVALID_ATTRIB_LOCATION)
	{
		SetUniformParametersFromCurrentProgram(m_currentVS);
		SetUniformParametersFromCurrentProgram(m_currentPS);
		m_rectRenderer.Draw(pos, tex, mode, m_logger);
	}
	else
	{
		m_logger.Log("DrawRect - could not find the current program in the hash", Platform::FileLogger::ERROR);
	}
}
Ejemplo n.º 3
0
DrawLineShader::DrawLineShader() : OpenGLShaderProgram("drawline")
{
    GetLocations();

    glGenBuffers(1, &_vbo);
    glGenVertexArrays(1, &_vao);

    GLuint vertices[] = { 0, 1 };
    glBindBuffer(GL_ARRAY_BUFFER, _vbo);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

    glBindVertexArray(_vao);
    glEnableVertexAttribArray(vIndex);
    glVertexAttribIPointer(vIndex, 1, GL_INT, 0, nullptr);

    Use();
}
Ejemplo n.º 4
0
static void FillAllData (HWND hwnd)
{
   HWND  hwndContainer = GetDlgItem (hwnd, IDC_RELOCATE_CONTAINER);
   LPSTORAGEPARAMS  lpstorage = GetDlgProp (hwnd);
   LPCHECKEDOBJECTS lploc = GetLocations ();
   LPOBJECTLIST lx;
   int   i = 1;
   char* item;

   nLine = ContainerAddCntLine  (hwndContainer);
   ContainerFillTextCell (hwndContainer, 0, 0, CONT_COLTYPE_TITLE, CONT_ALIGN_LEFT, ResourceString ((UINT)IDS_I_OLD_LOCATIONS));
   ContainerFillTextCell (hwndContainer, 0, 1, CONT_COLTYPE_TITLE, CONT_ALIGN_LEFT, ResourceString ((UINT)IDS_I_NEW_LOCATIONS));

   lx    = lpstorage->lpLocations;
   while (lx)
   {
       nLine = ContainerAddCntLine  (hwndContainer);
       lx = lx->lpNext;
   }

   ContainerSetColumnWidth (hwndContainer, 0, 26);
   ContainerSetColumnWidth (hwndContainer, 1, 26);

   lx    = lpstorage->lpLocations;
   while (lx)
   {
       item = (char *)lx->lpObject;
       ContainerFillTextCell(
           hwndContainer,
           i,
           0,
           CONT_COLTYPE_TEXT,
           CONT_ALIGN_LEFT,
           item);

       lx = lx->lpNext;
       i++;
   }

   lploc = FreeCheckedObjects (lploc);
   FillAllComboCells          (hwnd, nLine+1);
   SelectItemInComboCell      (hwnd, nLine);
}
Ejemplo n.º 5
0
FillRectShader::FillRectShader() : OpenGLShaderProgram("fillrect")
{
    GetLocations();

    glGenBuffers(1, &_vbo);
    glGenVertexArrays(1, &_vao);

    GLuint vertices[] = { 0, 1, 2, 2, 1, 3 };
    glBindBuffer(GL_ARRAY_BUFFER, _vbo);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

    glBindVertexArray(_vao);
    glEnableVertexAttribArray(vIndex);
    glVertexAttribIPointer(vIndex, 1, GL_INT, 0, 0);

    Use();
    SetFlags(0);
    glUniform1i(uSourceFramebuffer, 0);
}
Ejemplo n.º 6
0
DrawLineShader::DrawLineShader()
    : OpenGLShaderProgram("drawline")
{
    GetLocations();

    glGenBuffers(1, &_vbo);
    glGenBuffers(1, &_vboInstances);
    glGenVertexArrays(1, &_vao);

    glBindBuffer(GL_ARRAY_BUFFER, _vbo);
    glBufferData(GL_ARRAY_BUFFER, sizeof(VertexData), VertexData, GL_STATIC_DRAW);

    glBindVertexArray(_vao);
    glVertexAttribPointer(vVertMat + 0, 2, GL_FLOAT, GL_FALSE, sizeof(VDStruct), (void*)offsetof(VDStruct, mat[0]));
    glVertexAttribPointer(vVertMat + 1, 2, GL_FLOAT, GL_FALSE, sizeof(VDStruct), (void*)offsetof(VDStruct, mat[1]));
    glVertexAttribPointer(vVertMat + 2, 2, GL_FLOAT, GL_FALSE, sizeof(VDStruct), (void*)offsetof(VDStruct, mat[2]));
    glVertexAttribPointer(vVertMat + 3, 2, GL_FLOAT, GL_FALSE, sizeof(VDStruct), (void*)offsetof(VDStruct, mat[3]));

    glBindBuffer(GL_ARRAY_BUFFER, _vboInstances);
    glVertexAttribIPointer(vClip, 4, GL_INT, sizeof(DrawLineCommand), (void*)offsetof(DrawLineCommand, clip));
    glVertexAttribIPointer(vBounds, 4, GL_INT, sizeof(DrawLineCommand), (void*)offsetof(DrawLineCommand, bounds));
    glVertexAttribIPointer(vColour, 1, GL_UNSIGNED_INT, sizeof(DrawLineCommand), (void*)offsetof(DrawLineCommand, colour));
    glVertexAttribIPointer(vDepth, 1, GL_INT, sizeof(DrawLineCommand), (void*)offsetof(DrawLineCommand, depth));

    glEnableVertexAttribArray(vVertMat + 0);
    glEnableVertexAttribArray(vVertMat + 1);
    glEnableVertexAttribArray(vVertMat + 2);
    glEnableVertexAttribArray(vVertMat + 3);

    glEnableVertexAttribArray(vClip);
    glEnableVertexAttribArray(vBounds);
    glEnableVertexAttribArray(vColour);
    glEnableVertexAttribArray(vDepth);

    glVertexAttribDivisor(vClip, 1);
    glVertexAttribDivisor(vBounds, 1);
    glVertexAttribDivisor(vColour, 1);
    glVertexAttribDivisor(vDepth, 1);

    Use();
}
Ejemplo n.º 7
0
ApplyPaletteShader::ApplyPaletteShader()
    : OpenGLShaderProgram("applypalette")
{
    GetLocations();

    glGenBuffers(1, &_vbo);
    glGenVertexArrays(1, &_vao);

    glBindBuffer(GL_ARRAY_BUFFER, _vbo);
    glBufferData(GL_ARRAY_BUFFER, sizeof(VertexData), VertexData, GL_STATIC_DRAW);

    glBindVertexArray(_vao);
    glVertexAttribPointer(vPosition, 2, GL_FLOAT, GL_FALSE, sizeof(VDStruct), (void*)offsetof(VDStruct, position));
    glVertexAttribPointer(
        vTextureCoordinate, 2, GL_FLOAT, GL_FALSE, sizeof(VDStruct), (void*)offsetof(VDStruct, texturecoordinate));

    glEnableVertexAttribArray(vPosition);
    glEnableVertexAttribArray(vTextureCoordinate);

    Use();
    glUniform1i(uTexture, 0);
}
Ejemplo n.º 8
0
void CustomKernel::Compile()
{
	kernel = new Kernel();
	kernel->shaderProgram.Compile(vCustomKernelSrc, src);
	GetLocations();
}
Ejemplo n.º 9
0
void controller::runGame()
{
	try
	{
		string PutTextString = "";

		while(1)
		{
			Vision.visionMain();

			GetLocations();
			PrepCalcLength(DistancesResults, LOCATIONS_RESULT_NUM, LocationsArray, LOCATIONS_NUM,
							Angles, FixDirection, &DriveForward);

			PrintDistances();
			cout << "Sigma is: " << Angles[0] << endl;
			cout << "Sigma2 is: " << Angles[1] << endl;
			cout << "Robot should turn to: " << FixDirection[0] << endl;
			
			if(!goal)
			{
				if(DriveForward)
					PutTextString = "Drive - ";
				else
					PutTextString = "Stop - ";

				switch(FixDirection[0])
				{
					case -1:
						PutTextString += "Left";
						Command = LEFT;
						break;
					case 0:
						PutTextString += "Keep direction";
						Command = FORWARD;
						break;
					case 1:
						PutTextString += "Right";
						Command = RIGHT;
						break;
					default:
						break;
				}
			
				// Stop - KeepDirection and go for the Goal.
				if(!DriveForward && !FixDirection[0])
				{
					PutTextString = "Attacking!!!";
					switch(FixDirection[1])
					{
						case -1:
						PutTextString += "Left";
						Command = LEFT;
						break;
					case 0:
						PutTextString += "Keep direction";
						Command = FORWARD;
						break;
					case 1:
						PutTextString += "Right";
						Command = RIGHT;
						break;
					default:
						break;
					}
				}
				if(DistancesResults[3] < 30)
				{
					PutTextString = "Goallllll";
					Command = STOP;
					goal = true;
				}
				// Check if reset robot was set.
				if(TrackBars.ResetRobot == 1)
				{
					Command = STOP;
					PutTextString += " - Reset";
				}
			}
			else // goal
			{
				PutTextString = "Goallllll";
				Command = STOP;
				if(TrackBars.ResetRobot == 1)
				{
					PutTextString += " - Reset";
					goal = false;
				}
			}
			Vision.SetRobotCommands(PutTextString);
			try
			{
				PrintToRS232(Command);
			}
			catch(const char *e)
			{
				std::cerr << e;
				cout << "Exception occured: " << e;
				int x;
				cin >> x; 
			}
			waitKey(3);
		}
	}
	catch(const char *e)
	{

		std::cerr << e;
		cout << "Exception occured: " << e;
		int x;
		cin >> x; 
	}
}
Ejemplo n.º 10
0
DrawRectShader::DrawRectShader()
    : OpenGLShaderProgram("drawrect")
{
    GetLocations();

    glGenBuffers(1, &_vbo);
    glGenBuffers(1, &_vboInstances);
    glGenVertexArrays(1, &_vao);

    glBindBuffer(GL_ARRAY_BUFFER, _vbo);
    glBufferData(GL_ARRAY_BUFFER, sizeof(VertexData), VertexData, GL_STATIC_DRAW);

    glBindVertexArray(_vao);

    glVertexAttribPointer(vVertMat + 0, 2, GL_FLOAT, GL_FALSE, sizeof(VDStruct), (void*)offsetof(VDStruct, mat[0]));
    glVertexAttribPointer(vVertMat + 1, 2, GL_FLOAT, GL_FALSE, sizeof(VDStruct), (void*)offsetof(VDStruct, mat[1]));
    glVertexAttribPointer(vVertMat + 2, 2, GL_FLOAT, GL_FALSE, sizeof(VDStruct), (void*)offsetof(VDStruct, mat[2]));
    glVertexAttribPointer(vVertMat + 3, 2, GL_FLOAT, GL_FALSE, sizeof(VDStruct), (void*)offsetof(VDStruct, mat[3]));
    glVertexAttribPointer(vVertVec, 2, GL_FLOAT, GL_FALSE, sizeof(VDStruct), (void*)offsetof(VDStruct, vec));

    glBindBuffer(GL_ARRAY_BUFFER, _vboInstances);
    glVertexAttribIPointer(vClip, 4, GL_INT, sizeof(DrawRectCommand), (void*)offsetof(DrawRectCommand, clip));
    glVertexAttribIPointer(
        vTexColourAtlas, 1, GL_INT, sizeof(DrawRectCommand), (void*)offsetof(DrawRectCommand, texColourAtlas));
    glVertexAttribPointer(
        vTexColourBounds, 4, GL_FLOAT, GL_FALSE, sizeof(DrawRectCommand), (void*)offsetof(DrawRectCommand, texColourBounds));
    glVertexAttribIPointer(vTexMaskAtlas, 1, GL_INT, sizeof(DrawRectCommand), (void*)offsetof(DrawRectCommand, texMaskAtlas));
    glVertexAttribPointer(
        vTexMaskBounds, 4, GL_FLOAT, GL_FALSE, sizeof(DrawRectCommand), (void*)offsetof(DrawRectCommand, texMaskBounds));
    glVertexAttribIPointer(vPalettes, 3, GL_INT, sizeof(DrawRectCommand), (void*)offsetof(DrawRectCommand, palettes));
    glVertexAttribIPointer(vFlags, 1, GL_INT, sizeof(DrawRectCommand), (void*)offsetof(DrawRectCommand, flags));
    glVertexAttribIPointer(vColour, 1, GL_UNSIGNED_INT, sizeof(DrawRectCommand), (void*)offsetof(DrawRectCommand, colour));
    glVertexAttribIPointer(vBounds, 4, GL_INT, sizeof(DrawRectCommand), (void*)offsetof(DrawRectCommand, bounds));
    glVertexAttribIPointer(vDepth, 1, GL_INT, sizeof(DrawRectCommand), (void*)offsetof(DrawRectCommand, depth));

    glEnableVertexAttribArray(vVertMat + 0);
    glEnableVertexAttribArray(vVertMat + 1);
    glEnableVertexAttribArray(vVertMat + 2);
    glEnableVertexAttribArray(vVertMat + 3);
    glEnableVertexAttribArray(vVertVec);

    glEnableVertexAttribArray(vClip);
    glEnableVertexAttribArray(vTexColourAtlas);
    glEnableVertexAttribArray(vTexColourBounds);
    glEnableVertexAttribArray(vTexMaskAtlas);
    glEnableVertexAttribArray(vTexMaskBounds);
    glEnableVertexAttribArray(vPalettes);
    glEnableVertexAttribArray(vFlags);
    glEnableVertexAttribArray(vColour);
    glEnableVertexAttribArray(vBounds);
    glEnableVertexAttribArray(vDepth);

    glVertexAttribDivisor(vClip, 1);
    glVertexAttribDivisor(vTexColourAtlas, 1);
    glVertexAttribDivisor(vTexColourBounds, 1);
    glVertexAttribDivisor(vTexMaskAtlas, 1);
    glVertexAttribDivisor(vTexMaskBounds, 1);
    glVertexAttribDivisor(vPalettes, 1);
    glVertexAttribDivisor(vFlags, 1);
    glVertexAttribDivisor(vColour, 1);
    glVertexAttribDivisor(vBounds, 1);
    glVertexAttribDivisor(vDepth, 1);

    Use();
    glUniform1i(uTexture, 0);
    glUniform1i(uPaletteTex, 1);

    glUniform1i(uPeelingTex, 2);
    glUniform1i(uPeeling, 0);
}