Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - LimeFruut

Pages: [1]
1
Graphics / Re: 1024 x 1024 tile map
« on: June 23, 2017, 05:40:43 pm »
So I've added this method to the loop which creates 4 vertecies in a
vector<vector<sf::Vertex>> vertices;

this is the way I'm currently assigning them

void CGameMap::CreateRenderingVertecies(int row,int col)
{
   int temp = col * 4;
   sf::Vertex* tStrip = &vertices[row][temp];
   tStrip[0].position = sf::Vector2f(temp / 4 * multiplier row * multiplier);
   tStrip[1].position = sf::Vector2f(temp / 4 * multiplier, (row + 1) * multiplier);
   tStrip[2].position = sf::Vector2f((temp / 4 + 1)*multiplier, row * multiplier);
   tStrip[3].position = sf::Vector2f((temp / 4 + 1)*multiplier, (row + 1) * multiplier);

   tStrip[0].texCoords = sf::Vector2f(0, 0);
   tStrip[1].texCoords = sf::Vector2f(0, 16);
   tStrip[2].texCoords = sf::Vector2f(16, 0);
   tStrip[3].texCoords = sf::Vector2f(16, 16);
}

I am not sure, how to attach the texture and/or states in order to use it in my draw method where im passing a reference of the window.

2
Graphics / Re: 1024 x 1024 tile map
« on: June 23, 2017, 11:05:56 am »
So what I want to do is create the vertecies while im filling up the array. So every 1024 columns would be 1 triangle strip. Also I am aware that i have to select the texture/color of the maptile as I am giving them vector2f value. This way I would reduce my draw calls from 1024*1024 to only 1024

3
Graphics / 1024 x 1024 tile map
« on: June 23, 2017, 02:01:45 am »
I was browsing the forum and I've read the tutorial on drawing tile maps, but it uses quads only. I would like to use a vector of vertex in order to draw each line of the array as a triangle strip, but I don't know how to do it yet. Currently this is the way I am storing each tile type from a file. I plan to use this array for path finding at a later point. Maybe I can use this to insert into the vertex vector?

if (file.is_open())
   {
      while (!file.eof())
         for (int row = 0; row < 1024; row++)
         {
            getline(file, line);
            stringstream ssLine(line);
            for (int col = 0; col < 1024; col++)
            {
               string sValue;
               getline(ssLine, sValue, ',');

               stringstream convertor(sValue);
               convertor >> MapTiles[row][col];
            

            }
         }

      file.close();
   }

the idea is to to have 1024 triangle strips, which I will draw, thus making it quicker.

Thanks in advance!

Pages: [1]
anything