TexFace to Material Settings big patch
[blender.git] / source / gameengine / Rasterizer / RAS_OpenGLRasterizer / RAS_OpenGLRasterizer.cpp
index 6ad9e59147476f3c126b24ad0866e9aea5f87056..d9039a2a68d734472db1ed41fd78d0d11cb37ee0 100644 (file)
@@ -89,7 +89,7 @@ RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas)
        m_motionblurvalue(-1.0),
        m_texco_num(0),
        m_attrib_num(0),
-       //m_last_blendmode(GPU_BLEND_SOLID),
+       //m_last_alphablend(GPU_BLEND_SOLID),
        m_last_frontface(true),
        m_materialCachingInfo(0)
 {
@@ -126,8 +126,8 @@ bool RAS_OpenGLRasterizer::Init()
 
        glDisable(GL_BLEND);
        glDisable(GL_ALPHA_TEST);
-       //m_last_blendmode = GPU_BLEND_SOLID;
-       GPU_set_material_blend_mode(GPU_BLEND_SOLID);
+       //m_last_alphablend = GPU_BLEND_SOLID;
+       GPU_set_material_alpha_blend(GPU_BLEND_SOLID);
 
        glFrontFace(GL_CCW);
        m_last_frontface = true;
@@ -303,8 +303,8 @@ bool RAS_OpenGLRasterizer::BeginFrame(int drawingmode, double time)
 
        glDisable(GL_BLEND);
        glDisable(GL_ALPHA_TEST);
-       //m_last_blendmode = GPU_BLEND_SOLID;
-       GPU_set_material_blend_mode(GPU_BLEND_SOLID);
+       //m_last_alphablend = GPU_BLEND_SOLID;
+       GPU_set_material_alpha_blend(GPU_BLEND_SOLID);
 
        glFrontFace(GL_CCW);
        m_last_frontface = true;
@@ -873,10 +873,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
                // MCol *mcol = (MCol*)ms.m_pDerivedMesh->getFaceDataArray(ms.m_pDerivedMesh, CD_MCOL); /* UNUSED */
 
                // handle two-side
-               if (current_polymat->GetDrawingMode() & RAS_IRasterizer::KX_TWOSIDE)
-                       this->SetCullFace(false);
-               else
+               if (current_polymat->GetDrawingMode() & RAS_IRasterizer::KX_BACKCULL)
                        this->SetCullFace(true);
+               else
+                       this->SetCullFace(false);
 
                if (current_polymat->GetFlag() & RAS_BLENDERGLSL) {
                        // GetMaterialIndex return the original mface material index, 
@@ -890,9 +890,9 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
                        else
                                memset(&current_gpu_attribs, 0, sizeof(current_gpu_attribs));
                        // DM draw can mess up blending mode, restore at the end
-                       int current_blend_mode = GPU_get_material_blend_mode();
+                       int current_blend_mode = GPU_get_material_alpha_blend();
                        ms.m_pDerivedMesh->drawFacesGLSL(ms.m_pDerivedMesh, CheckMaterialDM);
-                       GPU_set_material_blend_mode(current_blend_mode);
+                       GPU_set_material_alpha_blend(current_blend_mode);
                } else {
                        //ms.m_pDerivedMesh->drawMappedFacesTex(ms.m_pDerivedMesh, CheckTexfaceDM, mcol);
                        current_blmat_nr = current_polymat->GetMaterialIndex();
@@ -1204,36 +1204,36 @@ void RAS_OpenGLRasterizer::DisableMotionBlur()
        m_motionblurvalue = -1.0;
 }
 
-void RAS_OpenGLRasterizer::SetBlendingMode(int blendmode)
+void RAS_OpenGLRasterizer::SetAlphaBlend(int alphablend)
 {
-       GPU_set_material_blend_mode(blendmode);
+       GPU_set_material_alpha_blend(alphablend);
 /*
-       if(blendmode == m_last_blendmode)
+       if(alphablend == m_last_alphablend)
                return;
 
-       if(blendmode == GPU_BLEND_SOLID) {
+       if(alphablend == GPU_BLEND_SOLID) {
                glDisable(GL_BLEND);
                glDisable(GL_ALPHA_TEST);
                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        }
-       else if(blendmode == GPU_BLEND_ADD) {
+       else if(alphablend == GPU_BLEND_ADD) {
                glBlendFunc(GL_ONE, GL_ONE);
                glEnable(GL_BLEND);
                glDisable(GL_ALPHA_TEST);
        }
-       else if(blendmode == GPU_BLEND_ALPHA) {
+       else if(alphablend == GPU_BLEND_ALPHA) {
                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                glEnable(GL_BLEND);
                glEnable(GL_ALPHA_TEST);
                glAlphaFunc(GL_GREATER, 0.0f);
        }
-       else if(blendmode == GPU_BLEND_CLIP) {
+       else if(alphablend == GPU_BLEND_CLIP) {
                glDisable(GL_BLEND); 
                glEnable(GL_ALPHA_TEST);
                glAlphaFunc(GL_GREATER, 0.5f);
        }
 
-       m_last_blendmode = blendmode;
+       m_last_alphablend = alphablend;
 */
 }