Remove render thread culling as its not used for new mesh 01/50301/2
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Tue, 27 Oct 2015 15:43:26 +0000 (15:43 +0000)
committerKimmo Hoikka <kimmo.hoikka@samsung.com>
Tue, 27 Oct 2015 15:51:07 +0000 (08:51 -0700)
- stop calling dynamic cast per renderer per frame
- remove render thread culling as new mesh culling is done in update

Change-Id: I9e0ce9d60022e09a67b412f0c03f04c9f648d1db

automated-tests/src/dali-internal/CMakeLists.txt
automated-tests/src/dali-internal/utc-Dali-Internal-Image-Culling.cpp [deleted file]
dali/internal/file.list
dali/internal/render/common/culling-algorithms.cpp [deleted file]
dali/internal/render/common/culling-algorithms.h [deleted file]
dali/internal/render/renderers/render-image-renderer.cpp
dali/internal/render/renderers/render-image-renderer.h
dali/internal/render/renderers/render-new-renderer.cpp
dali/internal/render/renderers/render-new-renderer.h
dali/internal/render/renderers/render-renderer.cpp
dali/internal/render/renderers/render-renderer.h

index 8678b55..a62764a 100644 (file)
@@ -9,7 +9,6 @@ SET(TC_SOURCES
         utc-Dali-Internal-Handles.cpp
         utc-Dali-Internal-ImageFactory.cpp
         utc-Dali-Internal-ResourceClient.cpp
-        utc-Dali-Internal-Image-Culling.cpp
         utc-Dali-Internal-FixedSizeMemoryPool.cpp
         utc-Dali-Internal-MemoryPoolObjectAllocator.cpp
         utc-Dali-Internal-FrustumCulling.cpp
diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-Image-Culling.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-Image-Culling.cpp
deleted file mode 100644 (file)
index 178f981..0000000
+++ /dev/null
@@ -1,847 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-
-#include <dali-test-suite-utils.h>
-
-using namespace Dali;
-
-void utc_dali_internal_image_culling_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void utc_dali_internal_image_culling_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-
-namespace
-{
-#define NUM_ROWS 9
-#define NUM_COLS 9
-#define NUM_ROWS_PER_PANE 3
-#define NUM_COLS_PER_PANE 3
-const unsigned int TEXTURE_ID_OFFSET = 23;
-
-Image LoadImage( TestApplication& application, GLuint textureId, int width, int height )
-{
-  Image image;
-  char* filename = NULL;
-  int numChars = asprintf(&filename, "image%u.png", textureId );
-
-  if( numChars > 0 )
-  {
-    const Vector2 closestImageSize( width, height );
-    application.GetPlatform().SetClosestImageSize(closestImageSize);
-
-    image = ResourceImage::New( filename, ResourceImage::IMMEDIATE, Image::NEVER );
-    free (filename);
-  }
-  DALI_TEST_CHECK(image);
-  application.SendNotification();
-  application.Render(16);
-
-  std::vector<GLuint> ids;
-  ids.push_back( textureId );
-  application.GetGlAbstraction().SetNextTextureIds( ids );
-
-  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
-  Integration::ResourcePointer resource(bitmap);
-  bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, width, height, width, height);
-  DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
-  Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
-  DALI_TEST_CHECK( request != NULL );
-  if(request)
-  {
-    application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
-  }
-  application.SendNotification();
-  application.Render(16);
-  application.GetPlatform().ClearReadyResources();
-  application.GetPlatform().DiscardRequest();
-  application.SendNotification();
-  application.Render(16);
-
-  return image;
-}
-
-ImageActor CreateOnStageActor(TestApplication& application, Image image, int width, int height, bool testDraw)
-{
-  ImageActor imageActor = ImageActor::New(image);
-  Stage::GetCurrent().Add(imageActor);
-
-  imageActor.SetParentOrigin(ParentOrigin::CENTER);
-  application.SendNotification();
-  application.Render(16);
-  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
-  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
-
-  if(testDraw)
-  {
-    DALI_TEST_CHECK( drawTrace.FindMethod( "DrawArrays" ) );
-    DALI_TEST_CHECK( textureTrace.FindMethod( "BindTexture" ) );
-    const std::vector<GLuint>& textures = glAbstraction.GetBoundTextures(GL_TEXTURE0);
-    DALI_TEST_CHECK( textures.size() > 0 );
-    if( textures.size() > 0 )
-    {
-      DALI_TEST_CHECK( textures[0] == 23 );
-    }
-  }
-  return imageActor;
-}
-
-
-void TestImageInside( TestApplication& application, int width, int height )
-{
-  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
-  textureTrace.Enable(true);
-  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
-  drawTrace.Enable(true);
-
-  Image image = LoadImage( application, 23, width, height );
-
-  ImageActor imageActor = CreateOnStageActor(application, image, width, height, true);
-  imageActor.SetPosition(0.0f, 0.0f, 0.0f);
-
-  Vector3 imageSize = imageActor.GetCurrentSize();
-  DALI_TEST_EQUALS( imageSize, Vector3(width, height, 0), TEST_LOCATION);
-
-  drawTrace.Reset();
-  imageActor.SetParentOrigin(ParentOrigin::TOP_LEFT);
-  application.SendNotification();
-  application.Render(16);
-  DALI_TEST_CHECK( drawTrace.FindMethod( "DrawArrays" ) );
-
-  drawTrace.Reset();
-  imageActor.SetParentOrigin(ParentOrigin::TOP_RIGHT);
-  application.SendNotification();
-  application.Render(16);
-  DALI_TEST_CHECK( drawTrace.FindMethod( "DrawArrays" ) );
-
-  drawTrace.Reset();
-  imageActor.SetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
-  application.SendNotification();
-  application.Render(16);
-  DALI_TEST_CHECK( drawTrace.FindMethod( "DrawArrays" ) );
-
-  drawTrace.Reset();
-  imageActor.SetParentOrigin(ParentOrigin::BOTTOM_LEFT);
-  application.SendNotification();
-  application.Render(16);
-  DALI_TEST_CHECK( drawTrace.FindMethod( "DrawArrays" ) );
-}
-
-
-bool RepositionActor(TestApplication& application, Actor actor, float x, float y, bool inside)
-{
-  TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
-
-  drawTrace.Reset();
-  actor.SetPosition( x, y, 0.0f);
-  application.SendNotification();
-  application.Render(16);
-
-  bool found = drawTrace.FindMethod( "DrawArrays" );
-  return (inside && found) || (!inside && !found);
-}
-
-
-void RepositionActorWithAngle(TestApplication& application, Actor actor, float x, float y, float angle, bool inside)
-{
-  TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
-
-  drawTrace.Reset();
-  actor.SetPosition( x, y, 0.0f);
-  actor.SetOrientation( Degree(angle), Vector3::ZAXIS );
-  application.SendNotification();
-  application.Render(16);
-  if( inside )
-  {
-    bool found = drawTrace.FindMethod( "DrawArrays" );
-    if( ! found ) tet_printf( "Not drawn: Position:(%3.0f, %3.0f)\n", x, y );
-    DALI_TEST_CHECK( found );
-  }
-  else
-  {
-    bool found = drawTrace.FindMethod( "DrawArrays" );
-    if( found ) tet_printf( "Drawn when not needed: Position:(%3.0f, %3.0f)\n", x, y );
-    DALI_TEST_CHECK( ! found );
-  }
-}
-
-void RepositionActorOutside(TestApplication& application, Actor actor, float x, float y, bool drawn )
-{
-  TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
-
-  drawTrace.Reset();
-  actor.SetPosition( x, y, 0.0f);
-  application.SendNotification();
-  application.Render(16);
-  if( drawn )
-  {
-    bool found = drawTrace.FindMethod( "DrawArrays" );
-    if( ! found ) tet_printf( "Not drawn: Position:(%3.0f, %3.0f)\n", x, y );
-    DALI_TEST_CHECK( found );
-  }
-  else
-  {
-    bool found = drawTrace.FindMethod( "DrawArrays" );
-    if( found ) tet_printf( "Drawn unnecessarily: Position:(%3.0f, %3.0f)\n", x, y );
-    DALI_TEST_CHECK( ! found );
-  }
-
-}
-
-void SphereTestImageAtBoundary( TestApplication& application, int width, int height )
-{
-  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
-  textureTrace.Enable(true);
-  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
-  drawTrace.Enable(true);
-
-  Vector2 stageSize = Stage::GetCurrent().GetSize();
-
-  Image image = LoadImage(application, 23, width, height);
-  ImageActor imageActor = CreateOnStageActor(application, image, width, height, true);
-
-  Vector3 imageSize = imageActor.GetCurrentSize();
-  DALI_TEST_EQUALS( imageSize, Vector3(width, height, 0), TEST_LOCATION);
-
-  imageSize.z = 0.0f;
-  float radius = imageSize.Length() * 0.5f; // Radius of bounding box
-  tet_printf("Testing Stage Size: (%3.0f, %3.0f) image size:(%3.0f, %3.0f) := radius=%3.0f\n",
-             stageSize.x, stageSize.y, imageSize.x, imageSize.y, radius);
-
-  for( int i=0; i<=radius; i++ )
-  {
-    float x1 = -stageSize.x/2.0f - i;
-    float x2 =  stageSize.x/2.0f + i;
-    float y1 = -stageSize.y/2.0f - i;
-    float y2 =  stageSize.y/2.0f + i;
-
-    //tet_printf("Testing i=%d\n",i);
-
-    // Test paths marked with dots
-    //  + . . . . . .
-    //  .\_     ^
-    //  .  \_   | within radius
-    //  .    \  v
-    //  .     +-----
-    //  .     | Stage
-
-    for( int j=-10; j<=10; j++ )
-    {
-      float x = ((stageSize.x+2*radius)/21.0f) * j;
-      float y = ((stageSize.y+2*radius)/21.0f) * j;
-
-      RepositionActor( application, imageActor, x1, y, true );
-      RepositionActor( application, imageActor, x2, y, true );
-      RepositionActor( application, imageActor, x, y1, true );
-      RepositionActor( application, imageActor, x, y2, true );
-    }
-  }
-}
-
-void OBBTestImageAtBoundary( TestApplication& application, int width, int height )
-{
-  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
-  textureTrace.Enable(true);
-  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
-  drawTrace.Enable(true);
-
-  Vector2 stageSize = Stage::GetCurrent().GetSize();
-
-  Image image = LoadImage(application, 23, width, height);
-  ImageActor imageActor = CreateOnStageActor(application, image, width, height, true);
-
-  Vector3 imageSize = imageActor.GetCurrentSize();
-  DALI_TEST_EQUALS( imageSize, Vector3(width, height, 0), TEST_LOCATION);
-
-  imageSize.z = 0.0f;
-  tet_printf("Testing Stage Size: (%3.0f, %3.0f) image size:(%3.0f, %3.0f) \n",
-             stageSize.x, stageSize.y, imageSize.x, imageSize.y);
-
-  int successCount = 0;
-  int totalCount = 0;
-  for( int i=0; i<100; i++ )
-  {
-    float x1 = -stageSize.x/2.0f - imageSize.x*i/200.0f;
-    float x2 =  stageSize.x/2.0f + imageSize.x*i/200.0f;
-    float y1 = -stageSize.y/2.0f - imageSize.y*i/200.0f;
-    float y2 =  stageSize.y/2.0f + imageSize.y*i/200.0f;
-
-    //tet_printf("Testing i=%d\n",i);
-
-    // Test paths marked with dots
-    //  + . . . . . .
-    //  .\_     ^
-    //  .  \_   | within radius
-    //  .    \  v
-    //  .     +-----
-    //  .     | Stage
-
-    for( int j=-10; j<=10; j++ )
-    {
-      float x = ((stageSize.x+imageSize.x/2.0f)/21.0f) * j;
-      float y = ((stageSize.y+imageSize.y/2.0f)/21.0f) * j;
-
-      if(RepositionActor( application, imageActor, x1, y, true )) successCount++;
-      if(RepositionActor( application, imageActor, x2, y, true )) successCount++;
-      if(RepositionActor( application, imageActor, x, y1, true )) successCount++;
-      if(RepositionActor( application, imageActor, x, y2, true )) successCount++;
-
-      totalCount += 4;
-    }
-  }
-  DALI_TEST_EQUALS(successCount, totalCount, TEST_LOCATION);
-  tet_printf( "Test succeeded with %d passes out of %d tests\n", successCount, totalCount);
-}
-
-
-void SphereTestImageOutsideBoundary( TestApplication& application, int width, int height )
-{
-  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
-  textureTrace.Enable(true);
-  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
-  drawTrace.Enable(true);
-
-  Vector2 stageSize = Stage::GetCurrent().GetSize();
-
-  Image image = LoadImage( application, 23, width, height );
-
-  ImageActor imageActor = CreateOnStageActor(application, image, width, height, true);
-  Vector3 imageSize = imageActor.GetCurrentSize();
-  DALI_TEST_EQUALS( imageSize, Vector3(width, height, 0), TEST_LOCATION);
-
-  imageSize.z = 0.0f;
-  float radius = imageSize.Length() * 0.5f; // Radius of bounding box
-  tet_printf("Testing Stage Size: (%3.0f, %3.0f) image size:(%3.0f, %3.0f) := radius=%3.0f\n",
-             stageSize.x, stageSize.y, imageSize.x, imageSize.y, radius);
-
-  for( int i=0; i<100; i++ )
-  {
-    // Try from 3 times
-    float x1 = -stageSize.x/2.0f - imageSize.x*i/200.0f;
-    float x2 =  stageSize.x/2.0f + imageSize.x*i/200.0f;
-    float y1 = -stageSize.y/2.0f - imageSize.y*i/200.0f;
-    float y2 =  stageSize.y/2.0f + imageSize.y*i/200.0f;
-
-
-    //tet_printf("Testing i=%d\n",i);
-    for( int j=-10; j<=10; j++ )
-    {
-      float x = (stageSize.x/17.0f) * j; // use larger intervals to test more area
-      float y = (stageSize.y/17.0f) * j;
-
-      RepositionActor( application, imageActor, x1, y, false );
-      RepositionActor( application, imageActor, x2, y, false );
-      RepositionActor( application, imageActor, x, y1, false );
-      RepositionActor( application, imageActor, x, y2, false );
-    }
-  }
-}
-
-void OBBTestImageOutsideBoundary( TestApplication& application, int width, int height )
-{
-  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
-  textureTrace.Enable(true);
-  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
-  drawTrace.Enable(true);
-
-  Vector2 stageSize = Stage::GetCurrent().GetSize();
-
-  Image image = LoadImage( application, 23, width, height );
-
-  ImageActor imageActor = CreateOnStageActor(application, image, width, height, true);
-  Vector3 imageSize = imageActor.GetCurrentSize();
-  DALI_TEST_EQUALS( imageSize, Vector3(width, height, 0), TEST_LOCATION);
-
-  imageSize.z = 0.0f;
-  tet_printf("Testing Stage Size: (%3.0f, %3.0f) image size:(%3.0f, %3.0f)\n",
-             stageSize.x, stageSize.y, imageSize.x, imageSize.y);
-
-  int successCount=0;
-  int totalCount=0;
-
-  for( int i=0; i<=100; i++ )
-  {
-    float x1 = -stageSize.x/2.0f - imageSize.x * (1.5f + i/100.0f);
-    float x2 =  stageSize.x/2.0f + imageSize.x * (1.5f + i/100.0f);
-    float y1 = -stageSize.y/2.0f - imageSize.y * (1.5f + i/100.0f);
-    float y2 =  stageSize.y/2.0f + imageSize.y * (1.5f + i/100.0f);
-
-    for( int j=-10; j<=10; j++ )
-    {
-      float x = (stageSize.x/17.0f) * j; // use larger intervals to test more area
-      float y = (stageSize.y/17.0f) * j;
-
-      if(RepositionActor( application, imageActor, x1, y, false )) successCount++;
-      if(RepositionActor( application, imageActor, x2, y, false )) successCount++;
-      if(RepositionActor( application, imageActor, x, y1, false )) successCount++;
-      if(RepositionActor( application, imageActor, x, y2, false )) successCount++;
-      totalCount+=4;
-    }
-  }
-  DALI_TEST_EQUALS(successCount, totalCount, TEST_LOCATION);
-  tet_printf( "Test succeeded with %d passes out of %d tests\n", successCount, totalCount);
-}
-
-void TestPlaneOfImages(TestApplication& application, float z)
-{
-  Vector2 stageSize = Stage::GetCurrent().GetSize();
-  Vector2 imageSize = stageSize/3.0f;
-
-  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
-  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
-
-  // Create a grid of 9 x 9 actors; only the central 3x3 are in viewport
-
-  std::vector< Actor > actors;
-  for( int i = 0; i < NUM_ROWS*NUM_COLS; i++ )
-  {
-    GLuint textureId = TEXTURE_ID_OFFSET+i;
-    Image image = LoadImage( application, textureId, imageSize.x, imageSize.y );
-    ImageActor imageActor = CreateOnStageActor(application, image, imageSize.x, imageSize.y, false );
-    actors.push_back(imageActor);
-  }
-  application.SendNotification();
-  application.Render(16);
-
-  drawTrace.Reset();
-  textureTrace.Reset();
-  drawTrace.Enable(true);
-  textureTrace.Enable(true);
-  application.GetGlAbstraction().ClearBoundTextures();
-
-  for( int row=0; row<NUM_ROWS; row++)
-  {
-    for( int col=0; col<NUM_COLS; col++)
-    {
-      // col:    0   1   2  | 3   4   5 | 6   7   8
-      //
-      //        -4/3 -1 -2/3 -1/3  0 1/3 |2/3 1  4/3
-      // col*2 -5
-      //         0   2   4
-      // NUM_COLS = 9 NUM_COLS_PER_PANE = 3   (A pane is stage sized)
-      //
-      // NUM_COLS / NUM_COLS_PER_PANE => number of panes
-      // 3 per pane, splits into -1/3, 0, +1/3
-      // number of lh planes * number of cols per plane
-      // Center column maps to zero, index of center column = num_cols / 2 rounded down
-      // index - that  and divide by number of cols per pane.
-      // 0 1 2 3 4  5 6 7 8  9 10 11 12
-      float xOffset = (int)(col - (NUM_COLS/2));
-      float yOffset = (int)(row - (NUM_ROWS/2));
-      float x = stageSize.x*xOffset / (float)(NUM_COLS_PER_PANE);
-      float y = stageSize.y*yOffset / (float)(NUM_ROWS_PER_PANE);
-      actors[row*NUM_COLS+col].SetPosition( x, y, z );
-    }
-  }
-
-  application.SendNotification();
-  application.Render(16);
-
-  DALI_TEST_CHECK( drawTrace.FindMethod( "DrawArrays" ) );
-
-  typedef std::vector<GLuint> TexVec;
-  const TexVec& textures = glAbstraction.GetBoundTextures(GL_TEXTURE0);
-  DALI_TEST_CHECK( textures.size() >= NUM_ROWS_PER_PANE * NUM_COLS_PER_PANE );
-  if( textures.size() > 0 )
-  {
-    int foundCount=0;
-    int expectedCount = 0;
-    for(unsigned int row=0; row<NUM_ROWS; row++)
-    {
-      for(unsigned int col=0; col<NUM_ROWS; col++)
-      {
-        Vector3 pos = actors[row*NUM_COLS+col].GetCurrentPosition();
-        if( -stageSize.x/2.0f <= pos.x && pos.x <= stageSize.x/2.0f &&
-            -stageSize.y/2.0f <= pos.y && pos.y <= stageSize.y/2.0f )
-        {
-          expectedCount++;
-          GLuint texId = (row*NUM_COLS+col)+TEXTURE_ID_OFFSET;
-
-          for(TexVec::const_iterator iter = textures.begin(); iter != textures.end(); iter++)
-          {
-            if(*iter == texId)
-            {
-              foundCount++;
-            }
-          }
-        }
-      }
-    }
-    tet_printf("Number of expected draws: %u\n", expectedCount);
-    DALI_TEST_EQUALS(foundCount, expectedCount, TEST_LOCATION);
-  }
-  int numDrawCalls = drawTrace.CountMethod("DrawArrays");
-  DALI_TEST_CHECK( numDrawCalls >= NUM_ROWS_PER_PANE * NUM_COLS_PER_PANE );
-
-  tet_printf("Number of bound textures: %u\n", textures.size());
-  tet_printf("Number of draw calls: %d\n", numDrawCalls);
-}
-
-} // namespace
-
-int UtcDaliImageCulling_Inside01(void)
-{
-  tet_infoline( "Testing that 80x80 image positioned inside the stage is drawn\n");
-
-  TestApplication application;
-
-  TestImageInside(application, 80, 80);
-
-  END_TEST;
-}
-
-int UtcDaliImageCulling_Inside02(void)
-{
-  tet_infoline( "Testing that 120x40 image positioned inside the stage is drawn\n");
-
-  TestApplication application;
-
-  TestImageInside(application, 120, 40);
-
-  END_TEST;
-}
-
-int UtcDaliImageCulling_Inside03(void)
-{
-  tet_infoline( "Testing that 40x120 image positioned inside the stage is drawn\n");
-
-  TestApplication application;
-
-  TestImageInside(application, 40, 120);
-
-  END_TEST;
-}
-
-int UtcDaliImageCulling_Inside04(void)
-{
-  tet_infoline( "Testing that 500x2 image positioned inside the stage is drawn\n");
-  TestApplication application;
-  TestImageInside(application, 500, 2);
-  END_TEST;
-}
-
-int UtcDaliImageCulling_Inside05(void)
-{
-  tet_infoline( "Testing that 2x500 image positioned inside the stage is drawn\n");
-  TestApplication application;
-  TestImageInside(application, 2, 500);
-  END_TEST;
-}
-
-
-int UtcDaliImageCulling_WithinBoundary01(void)
-{
-  tet_infoline("Test that 80x80 image positioned outside the stage but with bounding box intersecting the stage is drawn\n");
-
-  TestApplication application;
-  OBBTestImageAtBoundary( application, 80, 80);
-  END_TEST;
-}
-int UtcDaliImageCulling_WithinBoundary02(void)
-{
-  tet_infoline("Test that 120x40 image positioned outside the stage but with bounding box intersecting the stage is drawn\n");
-
-  TestApplication application;
-  OBBTestImageAtBoundary( application, 120, 40 );
-  END_TEST;
-}
-int UtcDaliImageCulling_WithinBoundary03(void)
-{
-  tet_infoline("Test that 40x120 image positioned outside the stage but with bounding box intersecting the stage is drawn\n");
-
-  TestApplication application;
-  OBBTestImageAtBoundary( application, 40, 120);
-  END_TEST;
-}
-
-int UtcDaliImageCulling_WithinBoundary04(void)
-{
-  tet_infoline("Test that 500x2 images positioned outside the stage but with bounding box intersecting the stage is drawn\n");
-
-  TestApplication application;
-  OBBTestImageAtBoundary( application, 500, 2 );
-  END_TEST;
-}
-
-int UtcDaliImageCulling_WithinBoundary05(void)
-{
-  tet_infoline("Test that 2x500 images positioned outside the stage but with bounding box intersecting the stage is drawn\n");
-
-  TestApplication application;
-  OBBTestImageAtBoundary( application, 2, 500 );
-  END_TEST;
-}
-
-int UtcDaliImageCulling_OutsideBoundary01(void)
-{
-  tet_infoline("Test that 80x80 image positioned outside the stage by more than 2 times\n"
-               "the radius of the bounding circle  is not drawn\n");
-
-  TestApplication application;
-  OBBTestImageOutsideBoundary( application, 80, 80 );
-  END_TEST;
-}
-
-int UtcDaliImageCulling_OutsideBoundary02(void)
-{
-  tet_infoline("Test that 120x40 image positioned outside the stage by more than 2 times\n"
-               "the radius of the bounding circle  is not drawn\n");
-
-  TestApplication application;
-  OBBTestImageOutsideBoundary( application, 120, 40 );
-  END_TEST;
-}
-int UtcDaliImageCulling_OutsideBoundary03(void)
-{
-  tet_infoline("Test that 40x120 image positioned outside the stage by more than 2 times\n"
-               "the radius of the bounding circle  is not drawn\n");
-
-  TestApplication application;
-  OBBTestImageOutsideBoundary( application, 40, 120 );
-  END_TEST;
-}
-
-int UtcDaliImageCulling_OutsideBoundary04(void)
-{
-  tet_infoline("Test that 500x2 image positioned outside the stage by more than 2 times\n"
-               "the radius of the bounding circle  is not drawn\n");
-
-  TestApplication application;
-  OBBTestImageOutsideBoundary( application, 500, 2 );
-  END_TEST;
-}
-
-int UtcDaliImageCulling_OutsideBoundary05(void)
-{
-  tet_infoline("Test that 2x500 image positioned outside the stage by more than 2 times\n"
-               "the radius of the bounding circle  is not drawn\n");
-
-  TestApplication application;
-  OBBTestImageOutsideBoundary( application, 2, 500 );
-  END_TEST;
-}
-
-int UtcDaliImageCulling_OutsideIntersect01(void)
-{
-  TestApplication application;
-
-  tet_infoline("Test that actors positioned outside the stage with bounding boxes also\n"
-               "outside the stage but intersecting it are still drawn");
-
-  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
-  textureTrace.Enable(true);
-  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
-  drawTrace.Enable(true);
-  Vector2 stageSize = Stage::GetCurrent().GetSize();
-
-  float width = stageSize.x*5.0f;
-  float height = stageSize.y*0.2f;
-  Image image = LoadImage( application, 23,  width, height);
-  ImageActor imageActor = CreateOnStageActor(application, image, width, height, true);
-
-  RepositionActor( application, imageActor, stageSize.x*1.2f, 0.0f, true);
-  RepositionActor( application, imageActor, stageSize.x*1.2f, -stageSize.y*0.55f, true);
-  RepositionActor( application, imageActor, stageSize.x*1.2f, stageSize.y*0.55f, true);
-  END_TEST;
-}
-
-int UtcDaliImageCulling_OutsideIntersect02(void)
-{
-  TestApplication application;
-
-  tet_infoline("Test that actors positioned outside the stage with bounding boxes also\n"
-               "outside the stage that cross planes are not drawn");
-
-  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
-  textureTrace.Enable(true);
-  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
-  drawTrace.Enable(true);
-  Vector2 stageSize = Stage::GetCurrent().GetSize();
-
-  float width = stageSize.x*5.0f;
-  float height = stageSize.y*0.2f;
-  Image image = LoadImage( application, 23,  width, height);
-  ImageActor imageActor = CreateOnStageActor(application, image, width, height, true);
-
-  RepositionActor( application, imageActor,  stageSize.x*10.0f,  stageSize.y*0.5f, false);
-  RepositionActor( application, imageActor, -stageSize.x*10.0f,  stageSize.y*0.5f, false);
-  RepositionActor( application, imageActor,  stageSize.x*10.0f, -stageSize.y*0.5f, false);
-  RepositionActor( application, imageActor, -stageSize.x*10.0f, -stageSize.y*0.5f, false);
-  END_TEST;
-}
-
-int UtcDaliImageCulling_OutsideIntersect03(void)
-{
-  TestApplication application;
-
-  tet_infoline("Test that image actor larger than the stage, positioned outside the stage \n"
-               "with bounding boxes also outside the stage but intersecting it is still drawn\n");
-
-  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
-  textureTrace.Enable(true);
-  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
-  drawTrace.Enable(true);
-  Vector2 stageSize = Stage::GetCurrent().GetSize();
-
-  // Try an actor bigger than the stage, with center outside stage
-  float width = stageSize.x*5.0f;
-  float height = stageSize.y*5.0f;
-  Image image = LoadImage( application, 23,  width, height);
-  ImageActor imageActor = CreateOnStageActor(application, image, width, height, true);
-
-  RepositionActor( application, imageActor, stageSize.x*1.2f, 0.0f, true);
-  RepositionActor( application, imageActor, stageSize.x*1.2f, -stageSize.y*1.1f, true);
-  RepositionActor( application, imageActor, stageSize.x*1.2f, stageSize.y*1.1f, true);
-
-  END_TEST;
-}
-
-int UtcDaliImageCulling_OutsideIntersect04(void)
-{
-  TestApplication application;
-
-  tet_infoline("Test that image actors positioned outside the stage, with bounding boxes\n"
-               "also outside the stage but intersecting it, and angled at 45 degrees to\n"
-               "the corners are still drawn\n");
-
-  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
-  textureTrace.Enable(true);
-  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
-  drawTrace.Enable(true);
-  Vector2 stageSize = Stage::GetCurrent().GetSize();
-
-  // Test image at 45 degrees outside corners of stage
-  float width = 400.0f;
-  float height = 200.0f;
-  Image image = LoadImage( application, 23,  width, height);
-  ImageActor imageActor = CreateOnStageActor(application, image, width, height, true);
-
-  RepositionActorWithAngle( application, imageActor, -stageSize.x*0.55f, -stageSize.y*0.55, 135.0f, true);
-  RepositionActorWithAngle( application, imageActor, -stageSize.x*0.55f,  stageSize.y*0.55, 225.0f, true);
-  RepositionActorWithAngle( application, imageActor,  stageSize.x*0.55f, -stageSize.y*0.55,  45.0f, true);
-  RepositionActorWithAngle( application, imageActor,  stageSize.x*0.55f,  stageSize.y*0.55, 315.0f, true);
-
-  END_TEST;
-}
-
-int UtcDaliImageCulling_Plane01(void)
-{
-  tet_infoline("Test that a set of image actors with different images are drawn appropriately");
-
-  TestApplication application;
-
-  TestPlaneOfImages(application, 0.0f);
-  END_TEST;
-}
-
-int UtcDaliImageCulling_Plane02(void)
-{
-  tet_infoline("Test that a set of image actors with different images are drawn appropriately");
-
-  TestApplication application;
-
-  TestPlaneOfImages(application, 100.0f);
-  END_TEST;
-}
-
-int UtcDaliImageCulling_Plane03(void)
-{
-  tet_infoline("Test that a set of image actors with different images are drawn appropriately");
-
-  TestApplication application;
-
-  TestPlaneOfImages(application, -100.0f);
-  END_TEST;
-}
-
-int UtcDaliImageCulling_Plane04(void)
-{
-  tet_infoline("Test that a set of image actors with different images are drawn appropriately");
-
-  TestApplication application;
-
-  TestPlaneOfImages(application, -200.0f);
-  END_TEST;
-}
-
-int UtcDaliImageCulling_Disable(void)
-{
-  tet_infoline("Test that culling can be disabled");
-
-  TestApplication application;
-  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
-  textureTrace.Enable(true);
-  TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
-  drawTrace.Enable(true);
-
-  Vector2 stageSize = Stage::GetCurrent().GetSize();
-  float width=80;
-  float height=80;
-  Image image = LoadImage( application, 23, width, height );
-
-  ImageActor imageActor = CreateOnStageActor(application, image, width, height, true);
-  Vector3 imageSize = imageActor.GetCurrentSize();
-  DALI_TEST_EQUALS( imageSize, Vector3(width, height, 0), TEST_LOCATION);
-
-  imageSize.z = 0.0f;
-
-  tet_infoline("Setting cull mode to false\n");
-  Stage::GetCurrent().GetRenderTaskList().GetTask(0).SetCullMode(false);
-
-  float x1 = -stageSize.x - imageSize.x;
-  float x2 =  stageSize.x + imageSize.x;
-  float y1 = -stageSize.y - imageSize.y;
-  float y2 =  stageSize.y + imageSize.y;
-
-  // Positioning actors outside stage, with no culling, they should still be drawn.
-  RepositionActorOutside( application, imageActor, x1, y1, true );
-  RepositionActorOutside( application, imageActor, x2, y1, true );
-  RepositionActorOutside( application, imageActor, x1, y2, true );
-  RepositionActorOutside( application, imageActor, x2, y2, true );
-
-  tet_infoline("Setting cull mode to true\n");
-  Stage::GetCurrent().GetRenderTaskList().GetTask(0).SetCullMode(true);
-
-  RepositionActorOutside( application, imageActor, x1, y1, false );
-  RepositionActorOutside( application, imageActor, x2, y1, false );
-  RepositionActorOutside( application, imageActor, x1, y2, false );
-  RepositionActorOutside( application, imageActor, x2, y2, false );
-
-  END_TEST;
-}
index f0a25b6..b90e95f 100644 (file)
@@ -94,7 +94,6 @@ internal_src_files = \
   $(internal_src_dir)/event/size-negotiation/memory-pool-relayout-container.cpp \
   $(internal_src_dir)/event/size-negotiation/relayout-controller-impl.cpp \
   \
-  $(internal_src_dir)/render/common/culling-algorithms.cpp \
   $(internal_src_dir)/render/common/render-algorithms.cpp \
   $(internal_src_dir)/render/common/render-debug.cpp \
   $(internal_src_dir)/render/common/render-instruction.cpp \
diff --git a/dali/internal/render/common/culling-algorithms.cpp b/dali/internal/render/common/culling-algorithms.cpp
deleted file mode 100644 (file)
index 9e275cf..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "culling-algorithms.h"
-
-namespace Dali
-{
-namespace Internal
-{
-namespace SceneGraph
-{
-
-bool Is2dBoxOutsideClipSpace(const Matrix& modelViewProjectionMatrix,
-                             const Rect<float>& boundingBox )
-{
-  // First, calculate if the center is inside clip space:
-
-  // Downside is mvp matrix calc per renderer per frame
-  // and up to 4 matrix * vector calls.
-  const Matrix& mvp = modelViewProjectionMatrix;
-  const Vector4 translation = mvp.GetTranslation();
-
-  // Upside is point test is very simple:
-  if( -translation.w <= translation.x  &&  translation.x <= translation.w &&
-      -translation.w <= translation.y  &&  translation.y <= translation.w &&
-      -translation.w <= translation.z  &&  translation.z <= translation.w)
-  {
-    // Definitely inside clip space - don't do any more processing
-    return false;
-  }
-
-  // Transform oriented bounding box to clip space:
-  Vector4 topLeft(    boundingBox.x, boundingBox.y, 0.0f, 1.0f);
-  Vector4 topRight(   boundingBox.x + boundingBox.width, boundingBox.y, 0.0f, 1.0f);
-  Vector4 bottomLeft( boundingBox.x, boundingBox.y + boundingBox.height, 0.0f, 1.0f);
-  Vector4 bottomRight(boundingBox.x + boundingBox.width, boundingBox.y + boundingBox.height, 0.0f, 1.0f);
-
-  Vector4 topLeftClip = mvp * topLeft;
-  if( -topLeftClip.w <= topLeftClip.x && topLeftClip.x <= topLeftClip.w &&
-      -topLeftClip.w <= topLeftClip.y && topLeftClip.y <= topLeftClip.w &&
-      -topLeftClip.w <= topLeftClip.z && topLeftClip.z <= topLeftClip.w )
-  {
-    // Definitely inside clip space - don't do any more processing
-    return false;
-  }
-
-  Vector4 bottomRightClip = mvp * bottomRight;
-  if( -bottomRightClip.w <= bottomRightClip.x && bottomRightClip.x <= bottomRightClip.w &&
-      -bottomRightClip.w <= bottomRightClip.y && bottomRightClip.y <= bottomRightClip.w &&
-      -bottomRightClip.w <= bottomRightClip.z && bottomRightClip.z <= bottomRightClip.w )
-  {
-    // Definitely inside clip space - don't do any more processing
-    return false;
-  }
-
-  Vector4 topRightClip = mvp * topRight;
-  if( -topRightClip.w <= topRightClip.x && topRightClip.x <= topRightClip.w &&
-      -topRightClip.w <= topRightClip.y && topRightClip.y <= topRightClip.w &&
-      -topRightClip.w <= topRightClip.z && topRightClip.z <= topRightClip.w )
-  {
-    // Definitely inside clip space - don't do any more processing
-    return false;
-  }
-
-  Vector4 bottomLeftClip = mvp * bottomLeft;
-  if( -bottomLeftClip.w <= bottomLeftClip.x && bottomLeftClip.x <= bottomLeftClip.w &&
-      -bottomLeftClip.w <= bottomLeftClip.y && bottomLeftClip.y <= bottomLeftClip.w &&
-      -bottomLeftClip.w <= bottomLeftClip.z && bottomLeftClip.z <= bottomLeftClip.w )
-  {
-    // Definitely inside clip space - don't do any more processing
-    return false;
-  }
-
-  // Check to see if all four points are outside each plane
-
-  unsigned int insideLeftPlaneCount=0;
-  unsigned int insideRightPlaneCount=0;
-  unsigned int insideTopPlaneCount=0;
-  unsigned int insideBottomPlaneCount=0;
-
-  if(-topLeftClip.w <= topLeftClip.x) { insideLeftPlaneCount++; }
-  if(-topRightClip.w <= topRightClip.x){ insideLeftPlaneCount++; }
-  if(-bottomRightClip.w <= bottomRightClip.x) {insideLeftPlaneCount++;}
-  if(-bottomLeftClip.w <= bottomLeftClip.x) {insideLeftPlaneCount++;}
-
-  if( insideLeftPlaneCount == 0 )
-  {
-    return true;
-  }
-
-  if(topLeftClip.x <= topLeftClip.w) { insideRightPlaneCount++;}
-  if(topRightClip.x <= topRightClip.w) { insideRightPlaneCount++; }
-  if(bottomRightClip.x <= bottomRightClip.w) { insideRightPlaneCount++; }
-  if(bottomLeftClip.x <= bottomLeftClip.w ) { insideRightPlaneCount++; }
-
-  if( insideRightPlaneCount == 0 )
-  {
-    return true;
-  }
-
-  if(-topLeftClip.w <= topLeftClip.y ) {insideTopPlaneCount++; }
-  if(-topRightClip.w <= topRightClip.y) {insideTopPlaneCount++; }
-  if(-bottomRightClip.w <= bottomRightClip.y) {insideTopPlaneCount++;}
-  if(-bottomLeftClip.w <= bottomLeftClip.y) { insideTopPlaneCount++;}
-
-  if( insideTopPlaneCount == 0 )
-  {
-    return true;
-  }
-
-  if(topLeftClip.y <= topLeftClip.w) { insideBottomPlaneCount++; }
-  if(topRightClip.y <= topRightClip.w) { insideBottomPlaneCount++; }
-  if(bottomRightClip.y <= bottomRightClip.w) { insideBottomPlaneCount++; }
-  if(bottomLeftClip.y <= bottomLeftClip.w) { insideBottomPlaneCount++; }
-
-  if( insideBottomPlaneCount == 0 )
-  {
-    return true;
-  }
-
-  // Test if any planes are bisected, if they are, then there is likely to
-  // be an intersection into clip space.
-
-  if( insideLeftPlaneCount < 4 )
-  {
-    return false;
-  }
-  if( insideRightPlaneCount < 4 )
-  {
-    return false;
-  }
-  if( insideTopPlaneCount < 4 )
-  {
-    return false;
-  }
-  if( insideBottomPlaneCount < 4 )
-  {
-    return false;
-  }
-
-  return true;
-}
-
-
-} // SceneGraph
-} // Internal
-} // Dali
diff --git a/dali/internal/render/common/culling-algorithms.h b/dali/internal/render/common/culling-algorithms.h
deleted file mode 100644 (file)
index 7ed32b0..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef _DALI_INTERNAL_SCENE_GRAPH_CULLING_ALGORITHMS_H_
-#define _DALI_INTERNAL_SCENE_GRAPH_CULLING_ALGORITHMS_H_
-
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <dali/public-api/math/matrix.h>
-#include <dali/public-api/math/vector2.h>
-#include <dali/public-api/math/rect.h>
-
-namespace Dali
-{
-namespace Internal
-{
-namespace SceneGraph
-{
-
-/**
- * Determine if the given bounding box is outside clip space (given by the
- * model view projection matrix).
- * @param[in] modelViewProjectionMatrix The clip space matrix
- * @param[in] boundingBox The bounding box of the geometry in object space
- * @return true if the bounding box is outside clip space
- */
-bool Is2dBoxOutsideClipSpace(const Matrix& modelViewProjectionMatrix,
-                             const Rect<float>& boundingBox );
-} // SceneGraph
-} // Internal
-} // Dali
-
-#endif //_DALI_INTERNAL_SCENE_GRAPH_CULLING_ALGORITHMS_H_
index 6df5ebc..06f2c7e 100644 (file)
@@ -22,7 +22,6 @@
 #include <dali/public-api/common/dali-common.h>
 #include <dali/integration-api/debug.h>
 #include <dali/internal/common/internal-constants.h>
-#include <dali/internal/render/common/culling-algorithms.h>
 #include <dali/internal/render/common/performance-monitor.h>
 #include <dali/internal/render/common/vertex.h>
 #include <dali/internal/render/gl-resources/gpu-buffer.h>
@@ -248,20 +247,6 @@ bool ImageRenderer::CheckResources()
   return true;
 }
 
-bool ImageRenderer::IsOutsideClipSpace( Context& context, const Matrix& modelViewProjectionMatrix )
-{
-  context.IncrementRendererCount();
-
-  Rect<float> boundingBox( mGeometrySize.x * -0.5f, mGeometrySize.y * -0.5f, mGeometrySize.x, mGeometrySize.y );
-
-  if(SceneGraph::Is2dBoxOutsideClipSpace( modelViewProjectionMatrix, boundingBox ) )
-  {
-    context.IncrementCulledCount();
-    return true;
-  }
-  return false;
-}
-
 void ImageRenderer::DoRender( Context& context, SceneGraph::TextureCache& textureCache, const SceneGraph::NodeDataProvider& node, BufferIndex bufferIndex, Program& program, const Matrix& modelViewMatrix, const Matrix& viewMatrix )
 {
   DALI_LOG_INFO( gImageRenderFilter, Debug::Verbose, "DoRender() textureId=%d  texture:%p\n", mTextureId, mTexture);
index f62528c..1db683a 100644 (file)
@@ -137,11 +137,6 @@ public:
   virtual bool CheckResources();
 
   /**
-   * @copydoc Dali::Internal::SceneGraph::Renderer::IsOutsideClipSpace()
-   */
-  virtual bool IsOutsideClipSpace( Context& context, const Matrix& modelViewProjectionMatrix );
-
-  /**
    * @copydoc Dali::Internal::SceneGraph::Renderer::DoRender()
    */
   virtual void DoRender( Context& context, SceneGraph::TextureCache& textureCache, const SceneGraph::NodeDataProvider& node, BufferIndex bufferIndex, Program& program, const Matrix& modelViewMatrix, const Matrix& viewMatrix );
index 79f3f1b..4552bb0 100644 (file)
@@ -90,12 +90,6 @@ bool NewRenderer::CheckResources()
   return true;
 }
 
-bool NewRenderer::IsOutsideClipSpace( Context& context, const Matrix& modelViewProjectionMatrix )
-{
-  // @todo MESH_REWORK Add clipping
-  return false;
-}
-
 void NewRenderer::DoSetUniforms( Context& context, BufferIndex bufferIndex, SceneGraph::Shader* shader, Program* program, unsigned int programIndex )
 {
   // Do nothing, we're going to set up the uniforms with our own code instead
index 2489a6b..42e981b 100644 (file)
@@ -40,7 +40,6 @@ namespace Render
 /**
  * The new geometry renderer.
  *
- * @todo MESH_REWORK It will be merged into the base class eventually
  */
 class NewRenderer : public Renderer
 {
@@ -62,6 +61,9 @@ public:
    */
   NewRenderer( SceneGraph::RenderDataProvider* dataProviders, SceneGraph::RenderGeometry* renderGeometry );
 
+  /**
+   * Virtual destructor
+   */
   virtual ~NewRenderer();
 
   /**
@@ -98,6 +100,15 @@ public:
   }
 
 public: // Implementation of Renderer
+
+  /**
+   * @copydoc SceneGraph::Renderer::GetNewRenderer()
+   */
+  virtual NewRenderer* GetNewRenderer()
+  {
+    return this;
+  }
+
   /**
    * @copydoc SceneGraph::Renderer::RequiresDepthTest()
    */
@@ -109,12 +120,6 @@ public: // Implementation of Renderer
   virtual bool CheckResources();
 
   /**
-   * @copydoc SceneGraph::Renderer::IsOutsideClipSpace()
-   */
-  virtual bool IsOutsideClipSpace( Context& context,
-                                   const Matrix& modelViewProjectionMatrix );
-
-  /**
    * @copydoc SceneGraph::Renderer::DoSetUniforms()
    */
   virtual void DoSetUniforms( Context& context, BufferIndex bufferIndex, SceneGraph::Shader* shader, Program* program, unsigned int programIndex );
index f7be8e6..5f1beed 100644 (file)
@@ -53,10 +53,9 @@ inline void SetMatrices( Program& program,
                          const Matrix& modelMatrix,
                          const Matrix& viewMatrix,
                          const Matrix& projectionMatrix,
-                         const Matrix& modelViewMatrix,
-                         const Matrix& modelViewProjectionMatrix )
+                         const Matrix& modelViewMatrix )
 {
-  GLint loc = program.GetUniformLocation(Program::UNIFORM_MODEL_MATRIX);
+  GLint loc = program.GetUniformLocation( Program::UNIFORM_MODEL_MATRIX );
   if( Program::UNIFORM_UNKNOWN != loc )
   {
     program.SetUniformMatrix4fv( loc, 1, modelMatrix.AsFloat() );
@@ -89,7 +88,8 @@ inline void SetMatrices( Program& program,
   loc = program.GetUniformLocation( Program::UNIFORM_MVP_MATRIX );
   if( Program::UNIFORM_UNKNOWN != loc )
   {
-    program.SetUniformMatrix4fv( loc, 1, modelViewProjectionMatrix.AsFloat() );
+    Matrix::Multiply( gModelViewProjectionMatrix, modelViewMatrix, projectionMatrix );
+    program.SetUniformMatrix4fv( loc, 1, gModelViewProjectionMatrix.AsFloat() );
   }
 
   loc = program.GetUniformLocation( Program::UNIFORM_NORMAL_MATRIX );
@@ -145,7 +145,7 @@ void Renderer::Render( Context& context,
                        bool cull,
                        bool blend )
 {
-  NewRenderer* renderer = dynamic_cast<NewRenderer*>(this);
+  NewRenderer* renderer = GetNewRenderer(); // avoid a dynamic cast per item per frame
 
   if( renderer )
   {
@@ -166,10 +166,6 @@ void Renderer::Render( Context& context,
     return;
   }
 
-  // Calculate the MVP matrix first so we can do the culling test
-  const Matrix& modelMatrix = node.GetModelMatrix( bufferIndex );
-  Matrix::Multiply( gModelViewProjectionMatrix, modelViewMatrix, projectionMatrix );
-
   // Get the program to use:
   Program* program = mShader->GetProgram();
   if( !program )
@@ -182,17 +178,6 @@ void Renderer::Render( Context& context,
       DALI_LOG_ERROR( "Failed to get program for shader at address %p.", (void*) &*mShader );
       return;
     }
-
-  }
-
-  // Check culling (does not need the program to be in use)
-  if( cull && ! program->ModifiesGeometry() )
-  {
-    if( IsOutsideClipSpace( context, gModelViewProjectionMatrix ) )
-    {
-      // don't do any further gl state changes as this renderer is not visible
-      return;
-    }
   }
 
   // Take the program into use so we can send uniforms to it
@@ -204,7 +189,8 @@ void Renderer::Render( Context& context,
 
   // Ignore missing uniforms - custom shaders and flat color shaders don't have SAMPLER
   // set projection and view matrix if program has not yet received them yet this frame
-  SetMatrices( *program, modelMatrix, viewMatrix, projectionMatrix, modelViewMatrix, gModelViewProjectionMatrix );
+  const Matrix& modelMatrix = node.GetModelMatrix( bufferIndex );
+  SetMatrices( *program, modelMatrix, viewMatrix, projectionMatrix, modelViewMatrix );
 
   // set color uniform
   GLint loc = program->GetUniformLocation( Program::UNIFORM_COLOR );
index 4746e63..7bf76f7 100644 (file)
@@ -50,6 +50,7 @@ class NodeDataProvider;
 namespace Render
 {
 class UniformNameCache;
+class NewRenderer;
 
 /**
  * Renderers are used to render meshes
@@ -145,6 +146,14 @@ private:
   Renderer& operator=( const Renderer& rhs );
 
   /**
+   * @return NewRenderer or NULL if this is an old renderer
+   */
+  virtual NewRenderer* GetNewRenderer()
+  {
+    return NULL;
+  }
+
+  /**
    * Checks if renderer's resources are ready to be used.
    *
    * @return \e true if they are. Otherwise \e false.
@@ -152,13 +161,6 @@ private:
   virtual bool CheckResources() = 0;
 
   /**
-   * Checks if renderer is culled.
-   * @param[in] modelViewProjectionMatrix The MVP matrix.
-   * @return \e true if it is. Otherwise \e false.
-   */
-  virtual bool IsOutsideClipSpace( Context& context, const Matrix& modelViewProjectionMatrix ) = 0;
-
-  /**
    * Called from Render prior to DoRender().
    * @todo MESH_REWORK Remove after merge
    */