Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMal Duffin <malachyduffin@gmail.com>2007-09-29 22:51:01 +0400
committerMal Duffin <malachyduffin@gmail.com>2007-09-29 22:51:01 +0400
commit51b56a4d3f17e8cea35ba02132af0c2b893e1ff2 (patch)
tree721c5d1d3e015cb4432e22d4bf23f75d93319ad9 /source/gameengine/GamePlayer
parentae40a1d86e5917dbd23ac4bcdcbeca07a3505e0d (diff)
GE Patch by Hamed Zaghaghi - Adding Motion Blur to the Game Engine.
I reviewed the code, suggested an update ( initialising accumulation buffer ), and tested the resulting update successfully. It's great to see more GE developers!GE Patch by Hamed Zaghaghi to add motion blur to the GE ( using the accumulation buffer ). I reviewed code and tested, gave some feedback ( initialising accumulation buffer ) which was implemented straight away, and re-reviewed. It's great to have another GE coder on the team!
Diffstat (limited to 'source/gameengine/GamePlayer')
-rw-r--r--source/gameengine/GamePlayer/common/GPC_RenderTools.cpp23
-rw-r--r--source/gameengine/GamePlayer/common/GPC_RenderTools.h3
2 files changed, 26 insertions, 0 deletions
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
index 0f6bec30437..cc5c392d51a 100644
--- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
@@ -570,4 +570,27 @@ void GPC_RenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,in
}
}
+void GPC_RenderTools::MotionBlur(RAS_IRasterizer* rasterizer)
+{
+ int state = rasterizer->GetMotionBlurState();
+ float motionblurvalue;
+ if(state)
+ {
+ motionblurvalue = rasterizer->GetMotionBlurValue();
+ if(state==1)
+ {
+ //bugfix:load color buffer into accum buffer for the first time(state=1)
+ glAccum(GL_LOAD, 1.0);
+ rasterizer->SetMotionBlurState(2);
+ }
+ else if(motionblurvalue>=0.0 && motionblurvalue<=1.0)
+ {
+ glAccum(GL_MULT, motionblurvalue);
+ glAccum(GL_ACCUM, 1-motionblurvalue);
+ glAccum(GL_RETURN, 1.0);
+ glFlush();
+ }
+ }
+}
+
unsigned int GPC_RenderTools::m_numgllights;
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.h b/source/gameengine/GamePlayer/common/GPC_RenderTools.h
index b7f73df3c34..e1f2a869c22 100644
--- a/source/gameengine/GamePlayer/common/GPC_RenderTools.h
+++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.h
@@ -149,6 +149,8 @@ public:
int applyLights(int objectlayer);
bool RayHit(KX_ClientObjectInfo* client, MT_Point3& hit_point, MT_Vector3& hit_normal, void * const data);
+
+ virtual void MotionBlur(RAS_IRasterizer* rasterizer);
protected:
/**
* Copied from KX_BlenderGL.cpp in KX_blenderhook
@@ -173,3 +175,4 @@ protected:
#endif // __GPC_RENDERTOOLS_H
+