The Render::Renderer is created when SceneGraph::Renderer is added to the update...
[platform/core/uifw/dali-core.git] / dali / internal / event / rendering / renderer-impl.cpp
index e2367ea..2b80191 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -20,7 +20,6 @@
 
 // INTERNAL INCLUDES
 #include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/rendering/renderer.h> // Dali::Renderer
 #include <dali/internal/event/common/object-impl-helper.h> // Dali::Internal::ObjectHelper
 #include <dali/internal/event/common/property-helper.h> // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
 #include <dali/internal/event/common/property-input-impl.h>
@@ -54,7 +53,18 @@ DALI_PROPERTY( "blendPreMultipliedAlpha",         BOOLEAN,   true, false,  false
 DALI_PROPERTY( "indexRangeFirst",                 INTEGER,   true, false,  false, Dali::Renderer::Property::INDEX_RANGE_FIRST )
 DALI_PROPERTY( "indexRangeCount",                 INTEGER,   true, false,  false, Dali::Renderer::Property::INDEX_RANGE_COUNT )
 DALI_PROPERTY( "depthWriteMode",                  INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_WRITE_MODE )
-DALI_PROPERTY_TABLE_END( DEFAULT_OBJECT_PROPERTY_START_INDEX )
+DALI_PROPERTY( "depthFunction",                   INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_FUNCTION )
+DALI_PROPERTY( "depthTestMode",                   INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_TEST_MODE )
+DALI_PROPERTY( "stencilFunction",                 INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_FUNCTION )
+DALI_PROPERTY( "stencilFunctionMask",             INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_FUNCTION_MASK )
+DALI_PROPERTY( "stencilFunctionReference",        INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE )
+DALI_PROPERTY( "stencilMask",                     INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_MASK )
+DALI_PROPERTY( "stencilMode",                     INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_MODE )
+DALI_PROPERTY( "stencilOperationOnFail",          INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL )
+DALI_PROPERTY( "stencilOperationOnZFail",         INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL )
+DALI_PROPERTY( "stencilOperationOnZPass",         INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS )
+DALI_PROPERTY( "writeToColorBuffer",              BOOLEAN,   true, false,  false, Dali::Renderer::Property::WRITE_TO_COLOR_BUFFER )
+DALI_PROPERTY_TABLE_END( DEFAULT_RENDERER_PROPERTY_START_INDEX )
 
 const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> RENDERER_IMPL = { DEFAULT_PROPERTY_DETAILS };
 
@@ -470,7 +480,34 @@ void Renderer::SetDefaultProperty( Property::Index index,
         mDepthWriteMode = mode;
         SetDepthWriteModeMessage( GetEventThreadServices(), *mSceneObject, mode );
       }
-
+      break;
+    }
+    case Dali::Renderer::Property::DEPTH_FUNCTION:
+    {
+      int value;
+      propertyValue.Get( value );
+      DepthFunction::Type depthFunction = static_cast<DepthFunction::Type>(value);
+      if( depthFunction != mDepthFunction )
+      {
+        mDepthFunction = depthFunction;
+        SetDepthFunctionMessage( GetEventThreadServices(), *mSceneObject, depthFunction );
+      }
+      break;
+    }
+    case Dali::Renderer::Property::DEPTH_TEST_MODE:
+    {
+      int value;
+      propertyValue.Get( value );
+      DepthTestMode::Type mode = static_cast<DepthTestMode::Type>(value);
+      if( mode != mDepthTestMode )
+      {
+        mDepthTestMode = mode;
+        SetDepthTestModeMessage( GetEventThreadServices(), *mSceneObject, mode );
+      }
+      break;
+    }
+    default:
+    {
       break;
     }
   }
@@ -586,6 +623,16 @@ Property::Value Renderer::GetDefaultProperty( Property::Index index ) const
       value = mDepthWriteMode;
       break;
     }
+    case Dali::Renderer::Property::DEPTH_FUNCTION:
+    {
+      value = mDepthFunction;
+      break;
+    }
+    case Dali::Renderer::Property::DEPTH_TEST_MODE:
+    {
+      value = mDepthTestMode;
+      break;
+    }
   }
   return value;
 }
@@ -648,7 +695,6 @@ void Renderer::Connect()
 {
   if( mOnStageCount == 0 )
   {
-    OnStageConnectMessage( GetEventThreadServices(), *mSceneObject );
     mTextureSetConnector.OnStageConnect();
   }
   ++mOnStageCount;
@@ -659,7 +705,6 @@ void Renderer::Disconnect()
   --mOnStageCount;
   if( mOnStageCount == 0 )
   {
-    OnStageDisconnectMessage( GetEventThreadServices(), *mSceneObject);
     mTextureSetConnector.OnStageDisconnect();
   }
 }
@@ -675,6 +720,8 @@ Renderer::Renderer()
   mBlendMode( BlendMode::AUTO ),
   mBlendingOptions(),
   mDepthWriteMode( DepthWriteMode::AUTO ),
+  mDepthFunction( DepthFunction::LESS ),
+  mDepthTestMode( DepthTestMode::AUTO ),
   mPremultipledAlphaEnabled( false )
 {
 }