Revision: 15471 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15471 Author: blendix Date: 2008-07-07 17:12:42 +0200 (Mon, 07 Jul 2008)
Log Message: ----------- Apricot Branch: Bugfix to make custom glsl shaders work with blender glsl shaders. Modified Paths: -------------- branches/apricot/source/blender/gpu/intern/gpu_codegen.c branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.cpp branches/apricot/source/gameengine/Ketsji/KX_BlenderMaterial.cpp branches/apricot/source/gameengine/Ketsji/KX_GameObject.cpp Modified: branches/apricot/source/blender/gpu/intern/gpu_codegen.c =================================================================== --- branches/apricot/source/blender/gpu/intern/gpu_codegen.c 2008-07-07 14:36:33 UTC (rev 15470) +++ branches/apricot/source/blender/gpu/intern/gpu_codegen.c 2008-07-07 15:12:42 UTC (rev 15471) @@ -141,19 +141,19 @@ int definetex; /* input is responsible for defining the pixel? */ int textarget; /* GL_TEXTURE_* */ + struct Image *ima; /* image */ + struct ImageUser *iuser;/* image user */ + float *dynamicvec; /* vector data in case it is dynamic */ + GPUTexture *tex; /* input texture, only set at runtime */ + char shadername[32]; /* name in shader */ + float vec[16]; /* vector data */ - float *dynamicvec; /* vector data in case it is dynamic */ GPUNodeLink *link; - GPUTexture *tex; /* input texture, only set at runtime */ int dynamictex; /* dynamic? */ - struct Image *ima; /* image */ - struct ImageUser *iuser;/* image user */ int attribtype; /* attribute type */ char attribname[32]; /* attribute name */ int attribfirst; /* this is the first one that is bound */ GPUBuiltin builtin; /* builtin uniform */ - - char shadername[32]; /* name in shader */ } GPUInput; struct GPUPass { @@ -676,7 +676,7 @@ code = BLI_dynstr_get_cstring(ds); BLI_dynstr_free(ds); - if(G.f & G_DEBUG) printf("%s\n", code); + //if(G.f & G_DEBUG) printf("%s\n", code); return code; } @@ -719,7 +719,7 @@ BLI_dynstr_free(ds); - if(G.f & G_DEBUG) printf("%s\n", code); + //if(G.f & G_DEBUG) printf("%s\n", code); return code; } Modified: branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.cpp =================================================================== --- branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.cpp 2008-07-07 14:36:33 UTC (rev 15470) +++ branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.cpp 2008-07-07 15:12:42 UTC (rev 15471) @@ -75,6 +75,8 @@ GPUVertexAttribs attribs; int i, attrib_num; + ras->SetAttribNum(0); + if(!mGPUMat) return; Modified: branches/apricot/source/gameengine/Ketsji/KX_BlenderMaterial.cpp =================================================================== --- branches/apricot/source/gameengine/Ketsji/KX_BlenderMaterial.cpp 2008-07-07 14:36:33 UTC (rev 15470) +++ branches/apricot/source/gameengine/Ketsji/KX_BlenderMaterial.cpp 2008-07-07 15:12:42 UTC (rev 15471) @@ -128,32 +128,31 @@ // when material are reused between objects return; - if(mMaterial->glslmat) { + if(mMaterial->glslmat) SetBlenderGLSLShader(); - } - else { - // for each unique material... - int i; - for(i=0; i<mMaterial->num_enabled; i++) { - if( mMaterial->mapping[i].mapping & USEENV ) { - if(!GLEW_ARB_texture_cube_map) { - spit("CubeMap textures not supported"); - continue; - } - if(!mTextures[i].InitCubeMap(i, mMaterial->cubemap[i] ) ) + + // for each unique material... + int i; + for(i=0; i<mMaterial->num_enabled; i++) { + if( mMaterial->mapping[i].mapping & USEENV ) { + if(!GLEW_ARB_texture_cube_map) { + spit("CubeMap textures not supported"); + continue; + } + if(!mTextures[i].InitCubeMap(i, mMaterial->cubemap[i] ) ) + spit("unable to initialize image("<<i<<") in "<< + mMaterial->matname<< ", image will not be available"); + } + + else { + if( mMaterial->img[i] ) { + if( ! mTextures[i].InitFromImage(i, mMaterial->img[i], (mMaterial->flag[i] &MIPMAP)!=0 )) spit("unable to initialize image("<<i<<") in "<< - mMaterial->matname<< ", image will not be available"); - } - - else { - if( mMaterial->img[i] ) { - if( ! mTextures[i].InitFromImage(i, mMaterial->img[i], (mMaterial->flag[i] &MIPMAP)!=0 )) - spit("unable to initialize image("<<i<<") in "<< - mMaterial->matname<< ", image will not be available"); - } + mMaterial->matname<< ", image will not be available"); } } } + mBlendFunc[0] =0; mBlendFunc[1] =0; mConstructed = true; @@ -489,7 +488,7 @@ { if(mShader && GLEW_ARB_shader_objects) mShader->Update(ms, rasty); - if(mBlenderShader && GLEW_ARB_shader_objects) + else if(mBlenderShader && GLEW_ARB_shader_objects) mBlenderShader->Update(ms, rasty); } @@ -531,6 +530,7 @@ ras->SetAttribNum(0); if(mShader && GLEW_ARB_shader_objects) { if(mShader->GetAttribute() == BL_Shader::SHD_TANGENT) { + ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_DISABLE, 0); ras->SetAttrib(RAS_IRasterizer::RAS_TEXTANGENT, 1); ras->SetAttribNum(2); } Modified: branches/apricot/source/gameengine/Ketsji/KX_GameObject.cpp =================================================================== --- branches/apricot/source/gameengine/Ketsji/KX_GameObject.cpp 2008-07-07 14:36:33 UTC (rev 15470) +++ branches/apricot/source/gameengine/Ketsji/KX_GameObject.cpp 2008-07-07 15:12:42 UTC (rev 15471) @@ -1289,7 +1289,7 @@ return meshproxy; } } - return NULL; + Py_RETURN_NONE; } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs