OpenAL is no more

This commit is contained in:
Milan Nikolic 2017-12-05 19:45:13 +01:00
parent 275bcd3efc
commit 1923507276
25 changed files with 18868 additions and 1893 deletions

View file

@ -58,6 +58,8 @@
#define SUPPORT_FILEFORMAT_PNG
#define SUPPORT_FILEFORMAT_DDS
#define SUPPORT_FILEFORMAT_HDR
#define SUPPORT_FILEFORMAT_KTX
#define SUPPORT_FILEFORMAT_ASTC
#define SUPPORT_IMAGE_MANIPULATION
#define SUPPORT_IMAGE_GENERATION
//-------------------------------------------------
@ -536,14 +538,13 @@ Image GetTextureData(Texture2D texture)
{
image.width = texture.width;
image.height = texture.height;
image.format = texture.format;
image.mipmaps = 1;
if (rlGetVersion() == OPENGL_ES_20)
{
// NOTE: Data retrieved on OpenGL ES 2.0 comes as RGBA (from framebuffer)
image.format = UNCOMPRESSED_R8G8B8A8;
}
else image.format = texture.format;
// NOTE: Data retrieved on OpenGL ES 2.0 should be RGBA
// coming from FBO color buffer, but it seems original
// texture format is retrieved on RPI... weird...
//image.format = UNCOMPRESSED_R8G8B8A8;
TraceLog(LOG_INFO, "Texture pixel data obtained successfully");
}
@ -622,9 +623,9 @@ void ImageFormat(Image *image, int newFormat)
for (int i = 0; i < image->width*image->height; i++)
{
r = (unsigned char)(round((float)pixels[k].r*31/255));
g = (unsigned char)(round((float)pixels[k].g*63/255));
b = (unsigned char)(round((float)pixels[k].b*31/255));
r = (unsigned char)(round((float)pixels[i].r*31.0f/255));
g = (unsigned char)(round((float)pixels[i].g*63.0f/255));
b = (unsigned char)(round((float)pixels[i].b*31.0f/255));
((unsigned short *)image->data)[i] = (unsigned short)r << 11 | (unsigned short)g << 5 | (unsigned short)b;
}
@ -655,9 +656,9 @@ void ImageFormat(Image *image, int newFormat)
for (int i = 0; i < image->width*image->height; i++)
{
r = (unsigned char)(round((float)pixels[i].r*31/255));
g = (unsigned char)(round((float)pixels[i].g*31/255));
b = (unsigned char)(round((float)pixels[i].b*31/255));
r = (unsigned char)(round((float)pixels[i].r*31.0f/255));
g = (unsigned char)(round((float)pixels[i].g*31.0f/255));
b = (unsigned char)(round((float)pixels[i].b*31.0f/255));
a = (pixels[i].a > ALPHA_THRESHOLD) ? 1 : 0;
((unsigned short *)image->data)[i] = (unsigned short)r << 11 | (unsigned short)g << 6 | (unsigned short)b << 1 | (unsigned short)a;
@ -675,12 +676,12 @@ void ImageFormat(Image *image, int newFormat)
for (int i = 0; i < image->width*image->height; i++)
{
r = (unsigned char)(round((float)pixels[i].r*15/255));
g = (unsigned char)(round((float)pixels[i].g*15/255));
b = (unsigned char)(round((float)pixels[i].b*15/255));
a = (unsigned char)(round((float)pixels[i].a*15/255));
((unsigned short *)image->data)[i] = (unsigned short)r << 12 | (unsigned short)g << 8| (unsigned short)b << 4| (unsigned short)a;
r = (unsigned char)(round((float)pixels[i].r*15.0f/255));
g = (unsigned char)(round((float)pixels[i].g*15.0f/255));
b = (unsigned char)(round((float)pixels[i].b*15.0f/255));
a = (unsigned char)(round((float)pixels[i].a*15.0f/255));
((unsigned short *)image->data)[i] = (unsigned short)r << 12 | (unsigned short)g << 8 | (unsigned short)b << 4 | (unsigned short)a;
}
} break;
@ -801,7 +802,7 @@ void ImageToPOT(Image *image, Color fillColor)
// Copy an image to a new image
Image ImageCopy(Image image)
{
Image newImage;
Image newImage = { 0 };
int byteSize = image.width*image.height;
@ -1087,7 +1088,8 @@ Image ImageTextEx(SpriteFont font, const char *text, float fontSize, int spacing
ImageDraw(&imText, imFont, letter.rec, (Rectangle){ posX + letter.offsetX,
letter.offsetY, letter.rec.width, letter.rec.height });
posX += letter.advanceX + spacing;
if (letter.advanceX == 0) posX += letter.rec.width + spacing;
else posX += letter.advanceX + spacing;
}
UnloadImage(imFont);