Actor& mActor;
};
+struct CulledPropertyNotificationFunctor
+{
+ CulledPropertyNotificationFunctor( bool& signalCalled, PropertyNotification& propertyNotification )
+ : mSignalCalled( signalCalled ),
+ mPropertyNotification( propertyNotification )
+ { }
+
+ void operator()( PropertyNotification& source )
+ {
+ mSignalCalled = true;
+ mPropertyNotification = source;
+ }
+
+ bool& mSignalCalled;
+ PropertyNotification& mPropertyNotification;
+};
+
} // anonymous namespace
END_TEST;
}
+
+int utcDaliActorCulled(void)
+{
+ TestApplication application;
+ auto stage = Stage::GetCurrent();
+
+ tet_infoline( "Check that the actor is culled if the actor is out of the screen" );
+
+ Actor actor = Actor::New();
+ actor.SetSize( 10.0f, 10.0f );
+
+ Geometry geometry = CreateQuadGeometry();
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
+ actor.AddRenderer( renderer );
+
+ stage.Add( actor );
+
+ application.SendNotification();
+ application.Render( 0 );
+
+ DALI_TEST_EQUALS( actor.GetProperty< bool >( DevelActor::Property::CULLED ), false, TEST_LOCATION );
+
+ PropertyNotification notification = actor.AddPropertyNotification( DevelActor::Property::CULLED, LessThanCondition( 0.5f ) );
+ notification.SetNotifyMode( PropertyNotification::NotifyOnChanged );
+
+ // Connect NotifySignal
+ bool propertyNotificationSignal( false );
+ PropertyNotification source;
+ CulledPropertyNotificationFunctor f( propertyNotificationSignal, source );
+ notification.NotifySignal().Connect( &application, f ) ;
+
+ actor.SetPosition( 1000.0f, 1000.0f );
+
+ application.SendNotification();
+ application.Render();
+
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( actor.GetProperty< bool >( DevelActor::Property::CULLED ), true, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( propertyNotificationSignal, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( source.GetTargetProperty(), static_cast< int >( DevelActor::Property::CULLED ), TEST_LOCATION );
+ DALI_TEST_EQUALS( source.GetTarget().GetProperty< bool >( source.GetTargetProperty() ), true, TEST_LOCATION );
+
+ END_TEST;
+}
* @note Setting this to false will allow scaling or rotation around the anchor-point without affecting the actor's position.
*/
POSITION_USES_ANCHOR_POINT = INHERIT_LAYOUT_DIRECTION + 4,
+
+ /**
+ * @brief Returns whether the actor is culled or not.
+ * @details Name "culled", type Property::BOOLEAN. Read-only
+ * @note True means that the actor is out of the view frustum.
+ */
+ CULLED = INHERIT_LAYOUT_DIRECTION + 5,
};
} // namespace Property
DALI_PROPERTY( "opacity", FLOAT, true, true, true, Dali::DevelActor::Property::OPACITY )
DALI_PROPERTY( "screenPosition", VECTOR2, false, false, false, Dali::DevelActor::Property::SCREEN_POSITION )
DALI_PROPERTY( "positionUsesAnchorPoint", BOOLEAN, true, false, false, Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT )
+DALI_PROPERTY( "culled", BOOLEAN, false, false, true, Dali::DevelActor::Property::CULLED )
DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX )
// Signals
property = &mNode->mWorldMatrix;
break;
+ case Dali::DevelActor::Property::CULLED:
+ property = &mNode->mCulled;
+ break;
+
default:
break;
}
break;
}
+ case DevelActor::Property::CULLED:
+ {
+ value = mNode->IsCulled( GetEventThreadServices().GetEventBufferIndex() );
+ break;
+ }
+
default:
{
// Must be an event-side only property
bool cull )
{
bool inside( true );
- const Node* node = renderable.mNode;
+ Node* node = renderable.mNode;
if( cull && renderable.mRenderer && !renderable.mRenderer->GetShader().HintEnabled( Dali::Shader::Hint::MODIFIES_GEOMETRY ) )
{
Matrix::Multiply( item.mModelViewMatrix, item.mModelMatrix, viewMatrix );
}
+
+ node->SetCulled( updateBufferIndex, false );
+ }
+ else
+ {
+ node->SetCulled( updateBufferIndex, true );
}
}
mOrientation(), // Initialized to identity by default
mScale( TRANSFORM_PROPERTY_SCALE ),
mVisible( true ),
+ mCulled( false ),
mColor( Color::WHITE ),
mWorldPosition( TRANSFORM_PROPERTY_WORLD_POSITION, Vector3( 0.0f,0.0f,0.0f ) ), // Zero initialized by default
mWorldScale( TRANSFORM_PROPERTY_WORLD_SCALE, Vector3( 1.0f,1.0f,1.0f ) ),
}
}
+ /**
+ * @brief Sets whether the node is culled or not.
+ * @param[in] bufferIndex The buffer to read from.
+ * @param[in] culled True if the node is culled.
+ */
+ void SetCulled( BufferIndex bufferIndex, bool culled )
+ {
+ mCulled[bufferIndex] = culled;
+ }
+
+ /**
+ * @brief Retrieves whether the node is culled or not.
+ * @param[in] bufferIndex The buffer to read from.
+ * @return True if the node is culled.
+ */
+ bool IsCulled( BufferIndex bufferIndex ) const
+ {
+ return mCulled[bufferIndex];
+ }
+
public:
/**
* @copydoc UniformMap::Add
TransformManagerPropertyVector3 mScale; ///< Local transform; scale relative to parent node
AnimatableProperty<bool> mVisible; ///< Visibility can be inherited from the Node hierachy
+ AnimatableProperty<bool> mCulled; ///< True if the node is culled. This is not animatable. It is just double-buffered.
AnimatableProperty<Vector4> mColor; ///< Color can be inherited from the Node hierarchy
// Inherited properties; read-only from public API