Przeglądaj źródła

gpu: temporarily enable alpha blending in the vertex buffer code.

legacy
Sam Hocevar sam 12 lat temu
rodzic
commit
cbf13dac65
2 zmienionych plików z 21 dodań i 7 usunięć
  1. +21
    -2
      src/gpu/vertexbuffer.cpp
  2. +0
    -5
      src/video.cpp

+ 21
- 2
src/gpu/vertexbuffer.cpp Wyświetl plik

@@ -123,6 +123,9 @@ void VertexDeclaration::Bind()
void VertexDeclaration::DrawElements(MeshPrimitive type, int skip, int count)
{
#if defined _XBOX || defined USE_D3D9
g_d3ddevice->SetRenderState(D3DRS_ALPHABLENDENABLE, 1);
g_d3ddevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
g_d3ddevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
if (FAILED(g_d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW)))
Abort();
switch (type)
@@ -133,6 +136,13 @@ void VertexDeclaration::DrawElements(MeshPrimitive type, int skip, int count)
break;
}
#else
# if defined HAVE_GL_2X && !defined __APPLE__
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GEQUAL, 0.01f);
# endif
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

switch (type)
{
case MeshPrimitive::Triangles:
@@ -147,8 +157,10 @@ void VertexDeclaration::DrawIndexedElements(MeshPrimitive type, int vbase,
int skip, int count)
{
#if defined _XBOX || defined USE_D3D9
if (FAILED(g_d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW)))
Abort();
g_d3ddevice->SetRenderState(D3DRS_ALPHABLENDENABLE, 1);
g_d3ddevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
g_d3ddevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
g_d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);
switch (type)
{
case MeshPrimitive::Triangles:
@@ -157,6 +169,13 @@ void VertexDeclaration::DrawIndexedElements(MeshPrimitive type, int vbase,
break;
}
#else
# if defined HAVE_GL_2X && !defined __APPLE__
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GEQUAL, 0.01f);
# endif
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

switch (type)
{
case MeshPrimitive::Triangles:


+ 0
- 5
src/video.cpp Wyświetl plik

@@ -131,10 +131,6 @@ void Video::Setup(ivec2 size)
}

g_d3ddevice = VideoData::d3d_dev;

g_d3ddevice->SetRenderState(D3DRS_ALPHABLENDENABLE, 1);
g_d3ddevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
g_d3ddevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
#else
# if defined USE_GLEW && !defined __APPLE__
/* Initialise GLEW if necessary */
@@ -154,7 +150,6 @@ void Video::Setup(ivec2 size)
glClearDepth(1.0);

# if defined HAVE_GL_2X && !defined __APPLE__
glShadeModel(GL_SMOOTH);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
# endif
#endif


Ładowanie…
Anuluj
Zapisz