Browse Source

Added quad rendering missing elapsed time parameter fix from szamq. Also add delta time parameter to batch rendering. Closes #272.

Lasse Öörni 11 years ago
parent
commit
882f4da62e

+ 1 - 0
Docs/Urho3D.dox

@@ -92,6 +92,7 @@ Urho3D development, contributions and bugfixes by:
 - mightyCelu
 - mightyCelu
 - reattiva
 - reattiva
 - skaiware
 - skaiware
+- szamq
 
 
 Urho3D is greatly inspired by OGRE (http://www.ogre3d.org/) and Horde3D (http://www.horde3d.org/). Additional inspiration & research used:
 Urho3D is greatly inspired by OGRE (http://www.ogre3d.org/) and Horde3D (http://www.horde3d.org/). Additional inspiration & research used:
 
 

+ 2 - 1
Readme.txt

@@ -47,6 +47,7 @@ Urho3D development, contributions and bugfixes by:
 - mightyCelu
 - mightyCelu
 - reattiva
 - reattiva
 - skaiware
 - skaiware
+- szamq
 
 
 Urho3D is greatly inspired by OGRE (http://www.ogre3d.org) and Horde3D
 Urho3D is greatly inspired by OGRE (http://www.ogre3d.org) and Horde3D
 (http://www.horde3d.org). Additional inspiration & research used:
 (http://www.horde3d.org). Additional inspiration & research used:
@@ -630,4 +631,4 @@ V1.1    - Object and scene model refactoring.
         - Added OpenGL and cross-platform support.
         - Added OpenGL and cross-platform support.
         - Switched to kNet library for networking.
         - Switched to kNet library for networking.
 
 
-V1.0    - Original release.
+V1.0    - Original release.

+ 4 - 0
Source/Engine/Graphics/Batch.cpp

@@ -213,6 +213,10 @@ void Batch::Prepare(View* view, bool setModelTransform) const
     // Set global frame parameters
     // Set global frame parameters
     if (graphics->NeedParameterUpdate(SP_FRAME, (void*)0))
     if (graphics->NeedParameterUpdate(SP_FRAME, (void*)0))
     {
     {
+        const FrameInfo& frame = view->GetFrameInfo();
+        graphics->SetShaderParameter(VSP_DELTATIME, frame.timeStep_);
+        graphics->SetShaderParameter(PSP_DELTATIME, frame.timeStep_);
+        
         Scene* scene = view->GetScene();
         Scene* scene = view->GetScene();
         if (scene)
         if (scene)
         {
         {

+ 7 - 0
Source/Engine/Graphics/View.cpp

@@ -1582,6 +1582,13 @@ void View::RenderQuad(RenderPathCommand& command)
     graphics_->SetShaderParameter(VSP_DELTATIME, frame_.timeStep_);
     graphics_->SetShaderParameter(VSP_DELTATIME, frame_.timeStep_);
     graphics_->SetShaderParameter(PSP_DELTATIME, frame_.timeStep_);
     graphics_->SetShaderParameter(PSP_DELTATIME, frame_.timeStep_);
 
 
+    if (scene_)
+    {
+        float elapsedTime = scene_->GetElapsedTime();
+        graphics_->SetShaderParameter(VSP_ELAPSEDTIME, elapsedTime);
+        graphics_->SetShaderParameter(PSP_ELAPSEDTIME, elapsedTime);
+    }
+
     float nearClip = camera_->GetNearClip();
     float nearClip = camera_->GetNearClip();
     float farClip = camera_->GetFarClip();
     float farClip = camera_->GetFarClip();
     graphics_->SetShaderParameter(VSP_NEARCLIP, nearClip);
     graphics_->SetShaderParameter(VSP_NEARCLIP, nearClip);

+ 2 - 0
Source/Engine/Graphics/View.h

@@ -135,6 +135,8 @@ public:
     Octree* GetOctree() const { return octree_; }
     Octree* GetOctree() const { return octree_; }
     /// Return camera.
     /// Return camera.
     Camera* GetCamera() const { return camera_; }
     Camera* GetCamera() const { return camera_; }
+    /// Return information of the frame being rendered.
+    const FrameInfo& GetFrameInfo() const { return frame_; }
     /// Return the rendertarget. 0 if using the backbuffer.
     /// Return the rendertarget. 0 if using the backbuffer.
     RenderSurface* GetRenderTarget() const { return renderTarget_; }
     RenderSurface* GetRenderTarget() const { return renderTarget_; }
     /// Return geometry objects.
     /// Return geometry objects.