[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16191] branches/apricot/source: Apricot Branch: two bugfixes for issues with game engine draw
Brecht Van Lommel
brechtvanlommel at pandora.be
Tue Aug 19 19:08:21 CEST 2008
Revision: 16191
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16191
Author: blendix
Date: 2008-08-19 19:08:20 +0200 (Tue, 19 Aug 2008)
Log Message:
-----------
Apricot Branch: two bugfixes for issues with game engine draw
state switching textures and object color, showed as flickering.
Modified Paths:
--------------
branches/apricot/source/blender/gpu/GPU_draw.h
branches/apricot/source/blender/gpu/GPU_material.h
branches/apricot/source/blender/gpu/intern/gpu_draw.c
branches/apricot/source/blender/gpu/intern/gpu_extensions.c
branches/apricot/source/blender/gpu/intern/gpu_material.c
branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.cpp
branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.h
branches/apricot/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
Modified: branches/apricot/source/blender/gpu/GPU_draw.h
===================================================================
--- branches/apricot/source/blender/gpu/GPU_draw.h 2008-08-19 14:39:11 UTC (rev 16190)
+++ branches/apricot/source/blender/gpu/GPU_draw.h 2008-08-19 17:08:20 UTC (rev 16191)
@@ -104,7 +104,7 @@
void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h);
void GPU_update_images_framechange(void);
int GPU_update_image_time(struct Image *ima, double time);
-int GPU_verify_image(struct Image *ima, int tftile, int tfmode);
+int GPU_verify_image(struct Image *ima, int tftile, int tfmode, int compare);
void GPU_free_image(struct Image *ima);
void GPU_free_images(void);
Modified: branches/apricot/source/blender/gpu/GPU_material.h
===================================================================
--- branches/apricot/source/blender/gpu/GPU_material.h 2008-08-19 14:39:11 UTC (rev 16190)
+++ branches/apricot/source/blender/gpu/GPU_material.h 2008-08-19 17:08:20 UTC (rev 16191)
@@ -127,6 +127,7 @@
void GPU_material_bind(GPUMaterial *material, int lay, double time);
void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[][4], float viewmat[][4], float viewinv[][4], float obcol[4]);
void GPU_material_unbind(GPUMaterial *material);
+int GPU_material_bound(GPUMaterial *material);
void GPU_material_vertex_attributes(GPUMaterial *material,
struct GPUVertexAttribs *attrib);
Modified: branches/apricot/source/blender/gpu/intern/gpu_draw.c
===================================================================
--- branches/apricot/source/blender/gpu/intern/gpu_draw.c 2008-08-19 14:39:11 UTC (rev 16190)
+++ branches/apricot/source/blender/gpu/intern/gpu_draw.c 2008-08-19 17:08:20 UTC (rev 16191)
@@ -335,7 +335,7 @@
}
}
-int GPU_verify_image(Image *ima, int tftile, int tfmode)
+int GPU_verify_image(Image *ima, int tftile, int tfmode, int compare)
{
ImBuf *ibuf = NULL;
unsigned int *bind = NULL;
@@ -362,7 +362,7 @@
}
/* if same image & tile, we're done */
- if(ima == GTS.curima && GTS.curtile == GTS.tile &&
+ if(compare && ima == GTS.curima && GTS.curtile == GTS.tile &&
GTS.tilemode == GTS.curtilemode && GTS.curtileXRep == GTS.tileXRep &&
GTS.curtileYRep == GTS.tileYRep)
return (ima!=0);
@@ -526,7 +526,7 @@
gpu_verify_alpha_mode(tface);
gpu_verify_reflection(ima);
- if(GPU_verify_image(ima, tface->tile, tface->mode)) {
+ if(GPU_verify_image(ima, tface->tile, tface->mode, 1)) {
GTS.curtile= GTS.tile;
GTS.curima= GTS.ima;
GTS.curtilemode= GTS.tilemode;
Modified: branches/apricot/source/blender/gpu/intern/gpu_extensions.c
===================================================================
--- branches/apricot/source/blender/gpu/intern/gpu_extensions.c 2008-08-19 14:39:11 UTC (rev 16190)
+++ branches/apricot/source/blender/gpu/intern/gpu_extensions.c 2008-08-19 17:08:20 UTC (rev 16191)
@@ -314,7 +314,7 @@
glGetIntegerv(GL_TEXTURE_BINDING_2D, &lastbindcode);
GPU_update_image_time(ima, time);
- bindcode = GPU_verify_image(ima, 0, 0);
+ bindcode = GPU_verify_image(ima, 0, 0, 0);
if(ima->gputexture) {
ima->gputexture->bindcode = bindcode;
Modified: branches/apricot/source/blender/gpu/intern/gpu_material.c
===================================================================
--- branches/apricot/source/blender/gpu/intern/gpu_material.c 2008-08-19 14:39:11 UTC (rev 16190)
+++ branches/apricot/source/blender/gpu/intern/gpu_material.c 2008-08-19 17:08:20 UTC (rev 16191)
@@ -85,6 +85,7 @@
/* for binding the material */
GPUPass *pass;
GPUVertexAttribs attribs;
+ int bound;
int builtins;
int alpha, obcolalpha;
int dynproperty;
@@ -246,6 +247,7 @@
}
GPU_pass_bind(material->pass, time);
+ material->bound = 1;
}
}
@@ -305,10 +307,17 @@
void GPU_material_unbind(GPUMaterial *material)
{
- if (material->pass)
+ if (material->pass) {
+ material->bound = 0;
GPU_pass_unbind(material->pass);
+ }
}
+int GPU_material_bound(GPUMaterial *material)
+{
+ return material->bound;
+}
+
void GPU_material_vertex_attributes(GPUMaterial *material, GPUVertexAttribs *attribs)
{
*attribs = material->attribs;
Modified: branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.cpp
===================================================================
--- branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.cpp 2008-08-19 14:39:11 UTC (rev 16190)
+++ branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.cpp 2008-08-19 17:08:20 UTC (rev 16191)
@@ -41,7 +41,6 @@
mScene(scene),
mMat(ma),
mGPUMat(NULL),
- mBound(false),
mLightLayer(lightlayer)
{
mBlenderScene = GetSceneForName(scene->GetName());
@@ -72,14 +71,10 @@
void BL_BlenderShader::SetProg(bool enable, double time)
{
if(VerifyShader()) {
- if(enable) {
+ if(enable)
GPU_material_bind(mGPUMat, mLightLayer, time);
- mBound = true;
- }
- else {
+ else
GPU_material_unbind(mGPUMat);
- mBound = false;
- }
}
}
@@ -154,7 +149,7 @@
VerifyShader();
- if(!mGPUMat || !mBound)
+ if(!mGPUMat || !GPU_material_bound(mGPUMat))
return;
MT_Matrix4x4 model;
Modified: branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.h
===================================================================
--- branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.h 2008-08-19 14:39:11 UTC (rev 16190)
+++ branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.h 2008-08-19 17:08:20 UTC (rev 16191)
@@ -31,7 +31,6 @@
struct Scene *mBlenderScene;
struct Material *mMat;
GPUMaterial *mGPUMat;
- bool mBound;
int mLightLayer;
int mBlendMode;
Modified: branches/apricot/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
===================================================================
--- branches/apricot/source/gameengine/Ketsji/KX_PolygonMaterial.cpp 2008-08-19 14:39:11 UTC (rev 16190)
+++ branches/apricot/source/gameengine/Ketsji/KX_PolygonMaterial.cpp 2008-08-19 17:08:20 UTC (rev 16191)
@@ -372,7 +372,7 @@
{
MTFace *tface = (MTFace*) PyCObject_AsVoidPtr(pytface);
RAS_IRasterizer *rasty = (RAS_IRasterizer*) PyCObject_AsVoidPtr(pyrasty);
- Image *ima = (Image*)m_tface->tpage;
+ Image *ima = (Image*)tface->tpage;
GPU_update_image_time(ima, rasty->GetTime());
Py_Return;
More information about the Bf-blender-cvs
mailing list