#define DALI_SCENE3D_INTERNAL_SCENE_VIEW_H
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
#include <dali-scene3d/internal/common/environment-map-load-task.h>
#include <dali-scene3d/internal/common/light-observer.h>
#include <dali-scene3d/public-api/controls/scene-view/scene-view.h>
+#include <dali-scene3d/public-api/loader/shader-manager.h>
namespace Dali
{
void RemoveLight(Scene3D::Light light);
/**
+ * @brief Set a shadow to this scene by input light.
+ * Currently, SceneView supports only one shadow.
+ *
+ * @param[in] light Light object to make shadow.
+ * @note The shadow will be drawn if the input light is turn on in current scene.
+ */
+ void SetShadow(Scene3D::Light light);
+
+ /**
+ * @brief Removes Shadow from this SceneView.
+ *
+ * @param[in] light Light object to be removed.
+ */
+ void RemoveShadow(Scene3D::Light light);
+
+ /**
* @copydoc SceneView::GetActivatedLightCount()
*/
uint32_t GetActivatedLightCount() const;
bool IsUsingFramebuffer() const;
/**
+ * @copydoc SceneView::SetResolution()
+ */
+ void SetResolution(uint32_t width, uint32_t height);
+
+ /**
+ * @copydoc SceneView::GetResolutionWidth()
+ */
+ uint32_t GetResolutionWidth();
+
+ /**
+ * @copydoc SceneView::GetResolutionHeight()
+ */
+ uint32_t GetResolutionHeight();
+
+ /**
+ * @copydoc SceneView::ResetResolution()
+ */
+ void ResetResolution();
+
+ /**
* @copydoc SceneView::SetFramebufferMultiSamplingLevel()
*/
void SetFramebufferMultiSamplingLevel(uint8_t multiSamplingLevel);
*/
Quaternion GetSkyboxOrientation() const;
+ /**
+ * @brief Retrieves ShaderManager of this SceneView.
+ * @return ShaderManager of this SceneView.
+ */
+ Dali::Scene3D::Loader::ShaderManagerPtr GetShaderManager() const;
+
+ /**
+ * @brief Updates shader uniforms about shadow.
+ * @param[in] light Light that makes shadow.
+ */
+ void UpdateShadowUniform(Scene3D::Light light);
+
+ /**
+ * @brief Sets alpha mask url
+ * @param[in] alphaMaskUrl Url for alpha mask.
+ */
+ void SetAlphaMaskUrl(std::string& alphaMaskUrl);
+
+ /**
+ * @brief Retrieves alpha mask url
+ * @return Alpha mask url.
+ */
+ std::string GetAlphaMaskUrl();
+
+ /**
+ * @brief Sets mask content scale factor
+ * @param[in] maskContentScaleFactor Scale factor for mask content.
+ */
+ void SetMaskContentScaleFactor(float maskContentScaleFactor);
+
+ /**
+ * @brief Retrieves mask content scale factor
+ * @return Scale factor for mask content.
+ */
+ float GetMaskContentScaleFactor();
+
+ /**
+ * @brief Sets whether the rendered result will be crop to mask or not.
+ * @param[in] enableCropToMask True for crop rendered result to mask.
+ */
+ void EnableCropToMask(bool enableCropToMask);
+
+ /**
+ * @brief Retrieves whether the crop to mask is enabled or not.
+ * @return True when rendered result is cropped to mask.
+ */
+ bool IsEnabledCropToMask();
+
+ /**
+ * @brief Gets current RenderTask
+ */
+ Dali::RenderTask GetRenderTask();
+
+ // Properties
+
+ /**
+ * Called when a property of an object of this type is set.
+ * @param[in] object The object whose property is set.
+ * @param[in] index The property index.
+ * @param[in] value The new property value.
+ */
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
+
+ /**
+ * Called to retrieve a property of an object of this type.
+ * @param[in] object The object whose property is to be retrieved.
+ * @param[in] index The property index.
+ * @return The current value of the property.
+ */
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
+
protected:
/**
* @brief Constructs a new SceneView.
void NotifyImageBasedLightTextureChange();
/**
- * @brief Internal method to add an Light object to this SceneView.
- *
- * @param[in] light Light object to be added.
- * @return True if successed to enable.
- */
- bool AddLightInternal(Scene3D::Light light);
-
- /**
- * @brief Internal method to remove an Light object to this SceneView.
- *
- * @param[in] light Light object to be added.
- * @return Index of removed light in enabled light list. If failed to remove it returns negative value;
+ * @brief Update shadowMap framebuffer when the size should be changed.
+ * @param[in] shadowMapSize The size of shadowMap texture. The texture's width and hight is equal.
*/
- int32_t RemoveLightInternal(Scene3D::Light light);
+ void UpdateShadowMapBuffer(uint32_t shadowMapSize);
private:
Toolkit::Visual::Base mVisual;
float mSkyboxIntensity{1.0f};
uint8_t mFrameBufferMultiSamplingLevel{0u};
+ bool mWindowSizeChanged{false};
+ uint32_t mWindowWidth{0};
+ uint32_t mWindowHeight{0};
+
+ // Masking
+ std::string mAlphaMaskUrl;
+ float mMaskContentScaleFactor{1.0f};
+ bool mCropToMask{true};
+ bool mMaskingPropertyChanged{false};
+
+ // Shader Factory
+ Dali::Scene3D::Loader::ShaderManagerPtr mShaderManager;
+
// Light
std::vector<std::pair<Scene3D::Light, bool>> mLights; // Pair of Light object and flag that denotes the light is currently activated or not.
- std::vector<Scene3D::Light> mActivatedLights;
- uint32_t mActivatedLightCount{0u};
+ Dali::FrameBuffer mShadowFrameBuffer;
+ Dali::RenderTask mShadowMapRenderTask;
+ Scene3D::Light mShadowLight;
+ Dali::Texture mShadowTexture;
// Asynchronous Loading.
EnvironmentMapLoadTaskPtr mSkyboxLoadTask;
bool mSkyboxDirty{false};
bool mIblDiffuseDirty{false};
bool mIblSpecularDirty{false};
-
- // TODO : Light Source
};
} // namespace Internal