#ifndef DALI_SCENE3D_LOADER_SHADER_DEFINITION_H
#define DALI_SCENE3D_LOADER_SHADER_DEFINITION_H
/*
- * 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.
*
*/
-// INTERNAL INCLUDES
-#include "dali-scene3d/public-api/loader/renderer-state.h"
-
// EXTERNAL INCLUDES
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/rendering/shader.h>
#include <memory>
-#include "dali/public-api/common/vector-wrapper.h"
-#include "dali/public-api/rendering/shader.h"
-namespace Dali
-{
-namespace Scene3D
-{
-namespace Loader
+// INTERNAL INCLUDES
+#include <dali-scene3d/public-api/loader/renderer-state.h>
+#include <dali-scene3d/public-api/loader/shader-option.h>
+
+namespace Dali::Scene3D::Loader
{
-/*
+/**
* @brief Defines a shader with paths to the files which define its
* vertex and fragment components, and a mapping of uniform names (which are
* used to refer to them in GLSL) to data.
+ * @SINCE_2_0.7
*/
struct DALI_SCENE3D_API ShaderDefinition
{
{
std::string mVertexShaderSource;
std::string mFragmentShaderSource;
+ std::string mShadowVertexShaderSource;
+ std::string mShadowFragmentShaderSource;
};
- /*
- * @brief Apply the defines values to shader.
- */
- static void ApplyDefine(std::string& shaderCode, const std::string& definevar);
-
ShaderDefinition() = default;
ShaderDefinition(const ShaderDefinition& other);
- ShaderDefinition& operator=(const ShaderDefinition& other);
+ ShaderDefinition& operator=(const ShaderDefinition& other) = delete;
- ShaderDefinition(ShaderDefinition&&) = default;
+ ShaderDefinition(ShaderDefinition&&) = default;
ShaderDefinition& operator=(ShaderDefinition&&) = default;
- /*
+ /**
* @brief Attempts to load the source of the vertex and fragment shaders,
* then performs pre-processing of defines.
+ * @SINCE_2_0.7
* @note This may be called from any thread.
*/
RawData LoadRaw(const std::string& shadersPath) const;
- /*
+ /**
* @brief Creates a DALi Shader from the sources in @a raw, traverses
* uniforms to get them to register their data against their name,
* then returns the Shader.
+ * @SINCE_2_0.7
* @note This must be called from the event thread.
*/
Shader Load(RawData&& raw) const;
std::shared_ptr<RawData> mRawData;
RendererState::Type mRendererState = RendererState::NONE;
- std::string mVertexShaderPath;
- std::string mFragmentShaderPath;
- std::vector<std::string> mDefines;
- std::vector<std::string> mHints;
- Property::Map mUniforms;
- bool mUseBuiltInShader{false};
+ std::string mVertexShaderPath;
+ std::string mFragmentShaderPath;
+ std::vector<std::string> mDefines;
+ std::vector<ShaderOption::MacroDefinition> mMacros;
+ std::vector<std::string> mHints;
+ Property::Map mUniforms;
+ bool mUseBuiltInShader{false};
};
-} // namespace Loader
-} // namespace Scene3D
-} // namespace Dali
+} // namespace Dali::Scene3D::Loader
#endif // DALI_SCENE3D_LOADER_SHADER_DEFINITION_H