/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
* These textures are based off version of Wave engine sample
* Take from https://github.com/WaveEngine/Samples
*
- * Copyright (c) 2022 Wave Coorporation
+ * Copyright (c) 2023 Wave Coorporation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
return texture;
}
-
// For ResourceReady
static bool gOnRelayoutCallBackCalled = false;
-void OnRelayoutCallback(Actor actor)
+void OnRelayoutCallback(Actor actor)
{
gOnRelayoutCallBackCalled = true;
}
static bool gResourceReadyCalled = false;
-void OnResourceReady(Control control)
+void OnResourceReady(Control control)
{
gResourceReadyCalled = true;
}
application.SendNotification();
application.Render();
-
renderTaskCount = application.GetScene().GetRenderTaskList().GetTaskCount();
DALI_TEST_EQUALS(2u, renderTaskCount, TEST_LOCATION);
DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
- Dali::Texture diffuseTexture = GetDiffuseTexture(modelView1);
+ Dali::Texture diffuseTexture = GetDiffuseTexture(modelView1);
Dali::Texture specularTexture = GetSpecularTexture(modelView1);
gResourceReadyCalled = false;
DALI_TEST_NOT_EQUALS(GetDiffuseTexture(modelView1), diffuseTexture, 0.0f, TEST_LOCATION);
DALI_TEST_NOT_EQUALS(GetSpecularTexture(modelView1), specularTexture, 0.0f, TEST_LOCATION);
- diffuseTexture = GetDiffuseTexture(modelView1);
+ diffuseTexture = GetDiffuseTexture(modelView1);
specularTexture = GetSpecularTexture(modelView1);
// reset SceneView IBL
application.SendNotification();
application.Render();
- Dali::Texture diffuseTexture = GetDiffuseTexture(modelView1);
+ Dali::Texture diffuseTexture = GetDiffuseTexture(modelView1);
Dali::Texture specularTexture = GetSpecularTexture(modelView1);
gResourceReadyCalled = false;
modelView1.SetImageBasedLightSource("", "");
DALI_TEST_NOT_EQUALS(GetDiffuseTexture(modelView1), diffuseTexture, 0.0f, TEST_LOCATION);
DALI_TEST_NOT_EQUALS(GetSpecularTexture(modelView1), specularTexture, 0.0f, TEST_LOCATION);
- diffuseTexture = GetDiffuseTexture(modelView1);
+ diffuseTexture = GetDiffuseTexture(modelView1);
specularTexture = GetSpecularTexture(modelView1);
// reset SceneView IBL
END_TEST;
}
+int UtcDaliSceneViewFramebufferMultiSamplingLevel(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::SceneView view = Scene3D::SceneView::New();
+ view.SetProperty(Dali::Actor::Property::SIZE, Vector2(100, 100));
+
+ application.GetScene().Add(view);
+
+ application.SendNotification();
+ application.Render();
+
+ uint8_t expectValue = 0u; // Default MultiSamplingLevel is 0.
+ uint8_t multiSamplingLevel = view.GetFramebufferMultiSamplingLevel();
+ DALI_TEST_EQUALS(multiSamplingLevel, expectValue, TEST_LOCATION);
+
+ expectValue = 4u; // Change value.
+ view.UseFramebuffer(true);
+ view.SetFramebufferMultiSamplingLevel(expectValue);
+
+ multiSamplingLevel = view.GetFramebufferMultiSamplingLevel();
+ DALI_TEST_EQUALS(multiSamplingLevel, expectValue, TEST_LOCATION);
+
+ // Note : we don't check multi sampling level is applied to framebuffer, or not.
+ view.UseFramebuffer(false);
+ expectValue = 2u; // Change value.
+ view.SetFramebufferMultiSamplingLevel(expectValue);
+
+ application.SendNotification();
+ application.Render();
+
+ multiSamplingLevel = view.GetFramebufferMultiSamplingLevel();
+ DALI_TEST_EQUALS(multiSamplingLevel, expectValue, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliSceneViewResourceReady(void)
{
ToolkitTestApplication application;
gOnRelayoutCallBackCalled = false;
- gResourceReadyCalled = false;
- Scene3D::SceneView view = Scene3D::SceneView::New();
+ gResourceReadyCalled = false;
+ Scene3D::SceneView view = Scene3D::SceneView::New();
view.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
view.OnRelayoutSignal().Connect(OnRelayoutCallback);
view.ResourceReadySignal().Connect(OnResourceReady);
DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
gOnRelayoutCallBackCalled = false;
- gResourceReadyCalled = false;
+ gResourceReadyCalled = false;
view.SetImageBasedLightSource(TEST_DIFFUSE_TEXTURE, TEST_SPECULAR_TEXTURE);
{
ToolkitTestApplication application;
- gResourceReadyCalled = false;
+ gResourceReadyCalled = false;
Scene3D::SceneView view = Scene3D::SceneView::New();
view.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
view.ResourceReadySignal().Connect(OnResourceReady);
{
ToolkitTestApplication application;
- gResourceReadyCalled = false;
+ gResourceReadyCalled = false;
Scene3D::SceneView view = Scene3D::SceneView::New();
view.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
view.ResourceReadySignal().Connect(OnResourceReady);
{
ToolkitTestApplication application;
- gResourceReadyCalled = false;
+ gResourceReadyCalled = false;
Scene3D::SceneView view = Scene3D::SceneView::New();
view.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
view.ResourceReadySignal().Connect(OnResourceReady);
{
ToolkitTestApplication application;
- gResourceReadyCalled = false;
+ gResourceReadyCalled = false;
Scene3D::SceneView view = Scene3D::SceneView::New();
view.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
view.ResourceReadySignal().Connect(OnResourceReady);
int UtcDaliSceneViewCreateAndRemoveRenderTask(void)
{
ToolkitTestApplication application;
- RenderTaskList taskList = application.GetScene().GetRenderTaskList();
+ RenderTaskList taskList = application.GetScene().GetRenderTaskList();
uint32_t renderTaskCount = taskList.GetTaskCount();
#include <dali/devel-api/adaptor-framework/window-devel.h>
#include <dali/devel-api/common/stage.h>
#include <dali/devel-api/rendering/frame-buffer-devel.h>
+#include <dali/integration-api/adaptor-framework/adaptor.h>
#include <dali/integration-api/debug.h>
#include <dali/public-api/math/math-utils.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/integration-api/adaptor-framework/adaptor.h>
#include <string_view>
// INTERNAL INCLUDES
Property::Index RENDERING_BUFFER = Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX + 1;
constexpr int32_t DEFAULT_ORIENTATION = 0;
-constexpr uint8_t DEFAULT_FRAME_BUFFER_MULTI_SAMPLING_LEVEL = 4u;
-
static constexpr std::string_view SKYBOX_INTENSITY_STRING = "uIntensity";
Dali::Actor CreateSkybox()
void SceneView::SetImageBasedLightSource(const std::string& diffuseUrl, const std::string& specularUrl, float scaleFactor)
{
bool needIblReset = false;
- bool isOnScene = Self().GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE);
+ bool isOnScene = Self().GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE);
if(mDiffuseIblUrl != diffuseUrl)
{
mDiffuseIblUrl = diffuseUrl;
if(mDiffuseIblUrl.empty())
{
- needIblReset = true;
+ needIblReset = true;
}
else
{
mSpecularIblUrl = specularUrl;
if(mSpecularIblUrl.empty())
{
- needIblReset = true;
+ needIblReset = true;
}
else
{
return mUseFrameBuffer;
}
+void SceneView::SetFramebufferMultiSamplingLevel(uint8_t multiSamplingLevel)
+{
+ if(mFrameBufferMultiSamplingLevel != multiSamplingLevel)
+ {
+ mFrameBufferMultiSamplingLevel = multiSamplingLevel;
+
+ // Create new framebuffer with changed multiSamplingLevel.
+ if(mRenderTask && mFrameBuffer && mTexture)
+ {
+ Vector3 size = Self().GetProperty<Vector3>(Dali::Actor::Property::SIZE);
+
+ mFrameBuffer = FrameBuffer::New(size.width, size.height, FrameBuffer::Attachment::DEPTH_STENCIL);
+ mFrameBuffer.AttachColorTexture(mTexture);
+ DevelFrameBuffer::SetMultiSamplingLevel(mFrameBuffer, mFrameBufferMultiSamplingLevel);
+ mRenderTask.SetFrameBuffer(mFrameBuffer);
+
+ // Note : we don't need to create new visual since visual's url is depend on mTexture.
+ }
+ }
+}
+
+uint8_t SceneView::GetFramebufferMultiSamplingLevel() const
+{
+ return mFrameBufferMultiSamplingLevel;
+}
+
void SceneView::SetSkybox(const std::string& skyboxUrl)
{
if(mSkyboxUrl != skyboxUrl)
mTexture = Dali::Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, unsigned(size.width), unsigned(size.height));
mFrameBuffer = FrameBuffer::New(size.width, size.height, FrameBuffer::Attachment::DEPTH_STENCIL);
mFrameBuffer.AttachColorTexture(mTexture);
- DevelFrameBuffer::SetMultiSamplingLevel(mFrameBuffer, DEFAULT_FRAME_BUFFER_MULTI_SAMPLING_LEVEL);
+ DevelFrameBuffer::SetMultiSamplingLevel(mFrameBuffer, mFrameBufferMultiSamplingLevel);
Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::Image::GenerateUrl(mFrameBuffer, 0u);
Property::Map imagePropertyMap;
bool isOnScene = Self().GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE);
if(mSkyboxUrl != skyboxUrl || mSkyboxEnvironmentMapType != skyboxEnvironmentMapType)
{
- mSkyboxDirty = true;
- mSkyboxResourceReady = false;
- mSkyboxUrl = skyboxUrl;
+ mSkyboxDirty = true;
+ mSkyboxResourceReady = false;
+ mSkyboxUrl = skyboxUrl;
mSkyboxEnvironmentMapType = skyboxEnvironmentMapType;
}
Shader skyboxShader;
if(mSkyboxEnvironmentMapType == Scene3D::EnvironmentMapType::CUBEMAP)
{
- skyboxShader = Shader::New(SHADER_SKYBOX_SHADER_VERT.data(), SHADER_SKYBOX_SHADER_FRAG.data());
+ skyboxShader = Shader::New(SHADER_SKYBOX_SHADER_VERT.data(), SHADER_SKYBOX_SHADER_FRAG.data());
}
else
{
#include <dali/public-api/rendering/texture.h>
// INTERNAL INCLUDES
-#include <dali-scene3d/public-api/controls/scene-view/scene-view.h>
#include <dali-scene3d/internal/common/environment-map-load-task.h>
#include <dali-scene3d/internal/common/image-based-light-observer.h>
+#include <dali-scene3d/public-api/controls/scene-view/scene-view.h>
namespace Dali
{
bool IsUsingFramebuffer() const;
/**
+ * @copydoc SceneView::SetFramebufferMultiSamplingLevel()
+ */
+ void SetFramebufferMultiSamplingLevel(uint8_t multiSamplingLevel);
+
+ /**
+ * @copydoc SceneView::GetFramebufferMultiSamplingLevel()
+ */
+ uint8_t GetFramebufferMultiSamplingLevel() const;
+
+ /**
* @copydoc SceneView::SetSkybox()
*/
void SetSkybox(const std::string& skyboxUrl);
Dali::Actor mSkybox;
Quaternion mSkyboxOrientation;
float mSkyboxIntensity{1.0f};
+ uint8_t mFrameBufferMultiSamplingLevel{0u};
// Asynchronous Loading.
- EnvironmentMapLoadTaskPtr mSkyboxLoadTask;
- EnvironmentMapLoadTaskPtr mIblDiffuseLoadTask;
- EnvironmentMapLoadTaskPtr mIblSpecularLoadTask;
- std::string mSkyboxUrl;
- std::string mDiffuseIblUrl;
- std::string mSpecularIblUrl;
+ EnvironmentMapLoadTaskPtr mSkyboxLoadTask;
+ EnvironmentMapLoadTaskPtr mIblDiffuseLoadTask;
+ EnvironmentMapLoadTaskPtr mIblSpecularLoadTask;
+ std::string mSkyboxUrl;
+ std::string mDiffuseIblUrl;
+ std::string mSpecularIblUrl;
Scene3D::EnvironmentMapType mSkyboxEnvironmentMapType{Scene3D::EnvironmentMapType::AUTO};
Dali::Texture mSkyboxTexture;