|
|
@@ -315,7 +315,6 @@ bool View::Define(RenderSurface* renderTarget, Viewport* viewport)
|
|
|
return false;
|
|
|
|
|
|
hasScenePasses_ = false;
|
|
|
- flipVertical_ = false;
|
|
|
|
|
|
// Make sure that all necessary batch queues exist
|
|
|
scenePasses_.Clear();
|
|
|
@@ -400,13 +399,6 @@ bool View::Define(RenderSurface* renderTarget, Viewport* viewport)
|
|
|
litBasePassName_ = PASS_LITBASE;
|
|
|
litAlphaPassName_ = PASS_LITALPHA;
|
|
|
|
|
|
- // On OpenGL, flip the projection if rendering to a texture so that the texture can be addressed in the same way
|
|
|
- // as a render texture produced on Direct3D9
|
|
|
- #ifdef URHO3D_OPENGL
|
|
|
- if (renderTarget_)
|
|
|
- flipVertical_ = true;
|
|
|
- #endif
|
|
|
-
|
|
|
// Go through commands to check for deferred rendering and other flags
|
|
|
deferred_ = false;
|
|
|
deferredAmbient_ = false;
|
|
|
@@ -502,12 +494,12 @@ void View::Update(const FrameInfo& frame)
|
|
|
for (HashMap<StringHash, BatchQueue>::Iterator i = batchQueues_.Begin(); i != batchQueues_.End(); ++i)
|
|
|
i->second_.Clear(maxSortedInstances);
|
|
|
|
|
|
- if (camera_)
|
|
|
- {
|
|
|
- // Set automatic aspect ratio if required
|
|
|
- if (camera_->GetAutoAspectRatio())
|
|
|
- camera_->SetAspectRatioInternal((float)frame_.viewSize_.x_ / (float)frame_.viewSize_.y_);
|
|
|
- }
|
|
|
+ if (hasScenePasses_ && (!camera_ || !octree_))
|
|
|
+ return;
|
|
|
+
|
|
|
+ // Set automatic aspect ratio if required
|
|
|
+ if (camera_->GetAutoAspectRatio())
|
|
|
+ camera_->SetAspectRatioInternal((float)frame_.viewSize_.x_ / (float)frame_.viewSize_.y_);
|
|
|
|
|
|
GetDrawables();
|
|
|
GetBatches();
|
|
|
@@ -515,6 +507,9 @@ void View::Update(const FrameInfo& frame)
|
|
|
|
|
|
void View::Render()
|
|
|
{
|
|
|
+ if (hasScenePasses_ && (!octree_ || !camera_))
|
|
|
+ return;
|
|
|
+
|
|
|
// Actually update geometry data now
|
|
|
UpdateGeometries();
|
|
|
|
|
|
@@ -546,15 +541,20 @@ void View::Render()
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
- #ifdef URHO3D_OPENGL
|
|
|
- if (camera_)
|
|
|
- camera_->SetFlipVertical(flipVertical_);
|
|
|
- #endif
|
|
|
+ if (renderTarget_)
|
|
|
+ {
|
|
|
+ // On OpenGL, flip the projection if rendering to a texture so that the texture can be addressed in the same way
|
|
|
+ // as a render texture produced on Direct3D9
|
|
|
+ #ifdef URHO3D_OPENGL
|
|
|
+ if (camera_)
|
|
|
+ camera_->SetFlipVertical(true);
|
|
|
+ #endif
|
|
|
+ }
|
|
|
|
|
|
// Render
|
|
|
ExecuteRenderPathCommands();
|
|
|
|
|
|
- #ifdef URHO3D_OPENGL
|
|
|
+ #ifdef URHO_OPENGL
|
|
|
if (camera_)
|
|
|
camera_->SetFlipVertical(false);
|
|
|
#endif
|
|
|
@@ -569,7 +569,7 @@ void View::Render()
|
|
|
BlitFramebuffer(static_cast<Texture2D*>(currentRenderTarget_->GetParentTexture()), renderTarget_, true);
|
|
|
|
|
|
// If this is a main view, draw the associated debug geometry now
|
|
|
- if (!renderTarget_ && camera_ && octree_)
|
|
|
+ if (!renderTarget_ && octree_ && camera_)
|
|
|
{
|
|
|
DebugRenderer* debug = octree_->GetComponent<DebugRenderer>();
|
|
|
if (debug && debug->IsEnabledEffective())
|
|
|
@@ -669,9 +669,6 @@ void View::SetCameraShaderParameters(Camera* camera, bool setProjection, bool ov
|
|
|
|
|
|
void View::GetDrawables()
|
|
|
{
|
|
|
- if (!camera_ || !octree_)
|
|
|
- return;
|
|
|
-
|
|
|
PROFILE(GetDrawables);
|
|
|
|
|
|
WorkQueue* queue = GetSubsystem<WorkQueue>();
|
|
|
@@ -838,9 +835,6 @@ void View::GetDrawables()
|
|
|
|
|
|
void View::GetBatches()
|
|
|
{
|
|
|
- if (!camera_ || !octree_)
|
|
|
- return;
|
|
|
-
|
|
|
WorkQueue* queue = GetSubsystem<WorkQueue>();
|
|
|
PODVector<Light*> vertexLights;
|
|
|
BatchQueue* alphaQueue = batchQueues_.Contains(alphaPassName_) ? &batchQueues_[alphaPassName_] : (BatchQueue*)0;
|
|
|
@@ -1934,8 +1928,8 @@ void View::DrawFullscreenQuad(bool nearQuad)
|
|
|
Matrix3x4 model = Matrix3x4::IDENTITY;
|
|
|
Matrix4 projection = Matrix4::IDENTITY;
|
|
|
|
|
|
- #ifdef URHO3D_OPENGL
|
|
|
- if (flipVertical_)
|
|
|
+ #ifdef URHO_OPENGL
|
|
|
+ if (camera_ && camera_->GetFlipVertical())
|
|
|
projection.m11_ = -1.0f;
|
|
|
model.m23_ = nearQuad ? -1.0f : 1.0f;
|
|
|
#else
|