clouds fixed
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
@@ -26,14 +26,16 @@ public:
|
||||
glm::vec4 getUVsExtended(int index, int lengthX, int lengthY)
|
||||
{
|
||||
int tileX = index % dims.x;
|
||||
int tileY = index / dims.x;
|
||||
int tileY = index / dims.x + lengthY -1 ;
|
||||
int secondTileX = lengthX % dims.x;
|
||||
std::cout << "secondTileX: " << secondTileX << "\n";
|
||||
glm::vec4 UV;
|
||||
UV.x = tileX / (float)dims.x;
|
||||
UV.y = tileY / (float)dims.y;
|
||||
UV.y = tileY / (float)dims.y ;
|
||||
UV.z = UV.x + (float)secondTileX / dims.x;
|
||||
UV.w = UV.y - (float)lengthY / dims.y;
|
||||
UV.w = UV.y - (float)1*lengthY / dims.y;
|
||||
std::cout << "uvs: " << UV.x << " " << UV.y << " " << UV.z << " " << UV.w << " "
|
||||
<< "\n";
|
||||
return UV;
|
||||
}
|
||||
};
|
||||
@@ -8,7 +8,7 @@ Cloud::Cloud(float speed, glm::vec2 pos, glm::vec2 size, int cloudIndex)
|
||||
{22, 2, 1},
|
||||
{24, 1, 1},
|
||||
{25, 3, 1},
|
||||
{42, 6, 2}};
|
||||
{42, 6, 3}};
|
||||
|
||||
glm::vec4 spriteUVs = spriteSheet.getUVsExtended(cloudIndexes[cloudIndex][0], cloudIndexes[cloudIndex][1], cloudIndexes[cloudIndex][2]);
|
||||
GLfloat vertices[] = {
|
||||
@@ -78,9 +78,9 @@ Background::Background()
|
||||
glm::vec2(xScalar - 500.0f, yScalar),
|
||||
glm::vec2(128.0f * (float)cloudIndexes[cloudIndex][1], 128.0f * (float)cloudIndexes[cloudIndex][2]) * sizeScalar, cloudIndex));
|
||||
}
|
||||
clouds.push_back(new Cloud(1.0f,
|
||||
glm::vec2(1000.0f, 300.0f),
|
||||
glm::vec2(128.0f * 6.0f, 128.0f * 3.0f), 4));
|
||||
// clouds.push_back(new Cloud(1.0f,
|
||||
// glm::vec2(800.0f, 300.0f),
|
||||
// glm::vec2(128.0f * 6.0f, 128.0f * 3.0f)*(4.0f/3.0f), 4));
|
||||
}
|
||||
void Background::drawBackground(SpriteRenderer &renderer, float dt)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user