1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-25 14:15:46 +00:00

randVector() & generateEmptyTexture() cleanup

This commit is contained in:
fgenesis 2011-11-20 17:03:09 +01:00
parent 385d05f905
commit e7c8b0093b
2 changed files with 7 additions and 26 deletions

View file

@ -807,26 +807,10 @@ GLuint generateEmptyTexture(int quality) // Create An Empty Texture
// Create Storage Space For Texture Data (128x128x4)
int size = (quality * quality)* 4;
data = (unsigned int*)new GLuint[(size * sizeof(unsigned int))];
data = (unsigned int*)new GLuint[size];
// HACK: changed code here
memset(data, 0, size * sizeof(GLuint)); // Clear Storage Memory
for (int i = 0; i < size; i++)
{
data[i] = 0;
}
/*
#ifdef BBGE_BUILD_WINDOWS
ZeroMemory(data,((quality * quality)* 4 * sizeof(unsigned int))); // Clear Storage Memory
#else
for (int i = 0; i < size; i++)
{
data[i] = 0;
}
#endif
*/
#ifdef BBGE_BUILD_OPENGL
glGenTextures(1, &txtnumber); // Create 1 Texture
@ -835,19 +819,16 @@ GLuint generateEmptyTexture(int quality) // Create An Empty Texture
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 4, quality, quality, 0,
GL_RGBA, GL_UNSIGNED_BYTE, data); // Build Texture Using Information In data
#endif
delete [] data; // Release data
#endif
return txtnumber; // Return The Texture ID
}
Vector randVector(int mag)
Vector randVector(float mag)
{
// FIXME: Is this really what you wanted? I'd suggest:
// float angle = (rand() / (float)RAND_MAX) * PI;
// --achurch
float angle = (rand()&314);
float angle = (rand() / (float)RAND_MAX) * 2.0f * PI;
float x = sinf(angle), y = cosf(angle);
return Vector(x*mag, y*mag);
}

View file

@ -258,7 +258,7 @@ float sqr(float x)
}
int randAngle360();
Vector randVector(int magnitude);
Vector randVector(float magnitude);
std::string splitCamelCase(const std::string &input);
std::string removeSpaces(const std::string &input);
int randRange(int r1, int r2);