~ubuntu-branches/debian/sid/astromenace/sid

« back to all changes in this revision

Viewing changes to AstroMenaceSource/Core/Texture/Texture.cpp

  • Committer: Package Import Robot
  • Author(s): Boris Pek, 1
  • Date: 2013-12-19 15:37:09 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20131219153709-vs62lyk7ts7o3rf5
Tags: 1.3.2+repack-2
Add patch debian/patches/fix_work_on_intel_videocards.patch:
Mesa developers have enabled GL_ARB_texture_storage for all drivers [1], so
i915 and i965 drivers now claim the support of this OpenGL extension, but
texture storage feature does not actually work there.
.
[1] http://lists.freedesktop.org/archives/mesa-dev/2013-June/041188.html
.
This patch is just workaround to make the game work on intel videocards with
new Mesa. But real problem should be fixed in Mesa.
(Closes: #718680)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/************************************************************************************
2
2
 
3
3
        AstroMenace (Hardcore 3D space shooter with spaceship upgrade possibilities)
4
 
        Copyright © 2006-2012 Michael Kurinnoy, Viewizard
 
4
        Copyright © 2006-2013 Michael Kurinnoy, Viewizard
5
5
 
6
6
 
7
7
        AstroMenace is free software: you can redistribute it and/or modify
152
152
{
153
153
        if (width == Texture->Width && height == Texture->Height) return;
154
154
 
155
 
        int             i, j, x, y, offset_y, offset_x;
 
155
        int i, j, x, y, offset_y, offset_x;
156
156
 
157
157
        // переносим во временный массив данные...
158
158
        BYTE *src = *DIB;
170
170
                        x = (i * Texture->Width) / width;
171
171
                        offset_x = (offset_y + x) * Texture->Bytes;
172
172
 
173
 
                        dst[(i+j*width)*Texture->Bytes] = src[(x+y*Texture->Width)*Texture->Bytes];
174
 
                        dst[(i+j*width)*Texture->Bytes+1] = src[(x+y*Texture->Width)*Texture->Bytes+1];
175
 
                        dst[(i+j*width)*Texture->Bytes+2] = src[(x+y*Texture->Width)*Texture->Bytes+2];
 
173
                        dst[(i+j*width)*Texture->Bytes] = src[offset_x];
 
174
                        dst[(i+j*width)*Texture->Bytes+1] = src[offset_x+1];
 
175
                        dst[(i+j*width)*Texture->Bytes+2] = src[offset_x+2];
176
176
                        if (Texture->Bytes == 4)
177
 
                                dst[(i+j*width)*Texture->Bytes+3] = src[(x+y*Texture->Width)*Texture->Bytes+3];
 
177
                                dst[(i+j*width)*Texture->Bytes+3] = src[offset_x+3];
178
178
                }
179
179
        }
180
180
 
484
484
//------------------------------------------------------------------------------------
485
485
// загрузка текстуры из файла и подключение к менеджеру текстур
486
486
//------------------------------------------------------------------------------------
487
 
eTexture* vw_LoadTexture(const char *nName, const char *RememberAsName, bool NeedCompression, int LoadAs, int NeedResizeW, int NeedResizeH)
 
487
eTexture* vw_LoadTexture(const char *nName, const char *RememberAsName, int CompressionType, int LoadAs, int NeedResizeW, int NeedResizeH)
488
488
{
489
489
        // временно, файл текстуры
490
490
        eFILE *pFile = 0;
592
592
 
593
593
        if (RememberAsName == NULL)
594
594
        {
595
 
                Result = vw_CreateTextureFromMemory(nName, tmp_image, DWidth, DHeight, DChanels, NeedCompression, NeedResizeW, NeedResizeH);
 
595
                Result = vw_CreateTextureFromMemory(nName, tmp_image, DWidth, DHeight, DChanels, CompressionType, NeedResizeW, NeedResizeH);
596
596
        }
597
597
        else // иначе, есть имя под которым надо запомнить
598
598
        {
599
 
                Result = vw_CreateTextureFromMemory(RememberAsName, tmp_image, DWidth, DHeight, DChanels, NeedCompression, NeedResizeW, NeedResizeH);
 
599
                Result = vw_CreateTextureFromMemory(RememberAsName, tmp_image, DWidth, DHeight, DChanels, CompressionType, NeedResizeW, NeedResizeH);
600
600
        }
601
601
 
602
602
 
617
617
//------------------------------------------------------------------------------------
618
618
// создание текстуры из памяти
619
619
//------------------------------------------------------------------------------------
620
 
eTexture* vw_CreateTextureFromMemory(const char *TextureName, BYTE * DIB, int DWidth, int DHeight, int DChanels, bool NeedCompression, int NeedResizeW, int NeedResizeH)
 
620
eTexture* vw_CreateTextureFromMemory(const char *TextureName, BYTE * DIB, int DWidth, int DHeight, int DChanels, int CompressionType, int NeedResizeW, int NeedResizeH, bool NeedDuplicateCheck)
621
621
{
622
622
        // проверяем в списке, если уже создавали ее - просто возвращаем указатель
623
 
        eTexture *Tmp = StartTexMan;
624
 
        while (Tmp != 0)
 
623
        if (NeedDuplicateCheck)
625
624
        {
626
 
                eTexture *Tmp1 = Tmp->Next;
627
 
                if(vw_strcmp(Tmp->Name, TextureName) == 0)
 
625
                eTexture *Tmp = StartTexMan;
 
626
                while (Tmp != 0)
628
627
                {
629
 
                        printf("Texture already loaded: %s\n", TextureName);
630
 
                        return Tmp;
 
628
                        eTexture *Tmp1 = Tmp->Next;
 
629
                        if(vw_strcmp(Tmp->Name, TextureName) == 0)
 
630
                        {
 
631
                                printf("Texture already loaded: %s\n", TextureName);
 
632
                                return Tmp;
 
633
                        }
 
634
                        Tmp = Tmp1;
631
635
                }
632
 
                Tmp = Tmp1;
633
636
        }
634
637
 
635
638
 
707
710
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
708
711
        // Создаем текстуру
709
712
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
710
 
        Texture->TextureID = vw_BuildTexture(tmp_image, Texture->Width, Texture->Height, MipMap, Texture->Bytes, NeedCompression);
 
713
        Texture->TextureID = vw_BuildTexture(tmp_image, Texture->Width, Texture->Height, MipMap, Texture->Bytes, CompressionType);
711
714
        // устанавливаем параметры
712
715
        vw_SetTextureFiltering(FilteringTexMan);
713
716
        vw_SetTextureAddressMode(Address_ModeTexMan);