MeshDefinition meshDefinition;
MaterialDefinition materialDefinition;
ShaderParameters shaderParameter{meshDefinition, materialDefinition, nodeDefinition};
+
// Only define skinning accessors for skinning test...
if(permutationSet.permutations.size() > 1)
{
{
option1.AddOption(optionType);
}
+ // No permutation uses extra joint weights.
+ option1.AddJointMacros(0);
rendererState = (rendererState | permutation->rendererStateSet) & ~permutation->rendererStateClear;
}
option1.AddOption(ShaderOption::Type::THREE_TEXTURE);
{"uMvpMatrix", GL_FLOAT_MAT4, 1},
{"uNormalMatrix", GL_FLOAT_MAT4, 1},
{"uProjection", GL_FLOAT_MAT4, 1},
+ {"uScale", GL_FLOAT_VEC3, 1},
{"uSize", GL_FLOAT_VEC3, 1},
{"uViewMatrix", GL_FLOAT_MAT4, 1},
{"uLightCameraProjectionMatrix", GL_FLOAT_MAT4, 1},
UniformData("uMvpMatrix", Property::Type::MATRIX),
UniformData("uNormalMatrix", Property::Type::MATRIX3),
UniformData("uProjection", Property::Type::MATRIX),
+ UniformData("uScale", Property::Type::VECTOR3),
UniformData("uSize", Property::Type::VECTOR3),
UniformData("uViewMatrix", Property::Type::MATRIX),
UniformData("uLightCameraProjectionMatrix", Property::Type::MATRIX),
#define MORPH defined(MORPH_POSITION) || defined(MORPH_NORMAL) || defined(MORPH_TANGENT)
-// If needed, define these strings in code, insert after each.
+// These lines in the shader may be replaced with actual definitions by the model loader,
+// if they are needed. Note, some shader compilers have problems with spurious ";", so
+// the macro invocations don't have a trailing ";". The replacement strings in the model
+// loader will provide it instead.
#define ADD_EXTRA_SKINNING_ATTRIBUTES
#define ADD_EXTRA_WEIGHTS
#ifdef SKINNING
in vec4 aJoints0;
in vec4 aWeights0;
-ADD_EXTRA_SKINNING_ATTRIBUTES;
+ADD_EXTRA_SKINNING_ATTRIBUTES
#endif
#ifdef MORPH
uBone[int(aJoints0.z)] * aWeights0.z +
uBone[int(aJoints0.w)] * aWeights0.w;
- ADD_EXTRA_WEIGHTS;
+ ADD_EXTRA_WEIGHTS
position = bone * position;
normal = uYDirection * (bone * vec4(normal, 0.0)).xyz;
shaderOption.AddOption(Scene3D::Loader::ShaderOption::Type::SKINNING);
shaderOption.AddJointMacros(mNumberOfJointSets);
}
+ else
+ {
+ shaderOption.AddJointMacros(0);
+ }
if(mHasVertexColor)
{
shaderOption.AddOption(Scene3D::Loader::ShaderOption::Type::COLOR_ATTRIBUTE);
{
Property::Map oldMap = GetMap(mShader);
DALI_LOG_WRITE_FILE(tmpFilename("oldShader", ".txt"), "Vertex Shader:\n"
- << oldMap["vertex"] << "\n\nFragmentShader: " << oldMap["fragment"] << "\n");
+ << oldMap["vertex"] << "\n\nFragmentShader: " << oldMap["fragment"] << "\n");
}
if(newShader)
{
Property::Map newMap = GetMap(newShader);
DALI_LOG_WRITE_FILE(tmpFilename("newShader", ".txt"), "Vertex Shader:\n"
- << newMap["vertex"] << "\n\nFragmentShader: " << newMap["fragment"] << "\n");
+ << newMap["vertex"] << "\n\nFragmentShader: " << newMap["fragment"] << "\n");
}
#endif
}
namespace Dali::Scene3D::Loader
{
/**
- * @return Given a name, provide a AlphaFunction; if the name was not
- * recognised, get the default one.
+ * @brief Given a name, provides an AlphaFunction.
+ * @SINCE_2_0.7
+ * @return The AlphaFunction
+ * @note If the name was not recognised, the default one is returned
*/
AlphaFunction DALI_SCENE3D_API GetAlphaFunction(const std::string& name, bool* found = nullptr);
/**
- * @brief Registers an alpha function only if one with the same @a name has
- * not yet been registered. Throws Exception the name isn't unique.
+ * @brief Registers an alpha function only if one with the same @a name has not yet been registered.
+ * @SINCE_2_0.7
+ * @note Throws an exception if the name is not unique
*/
void DALI_SCENE3D_API RegisterAlphaFunction(const std::string& name, AlphaFunction alphaFn) noexcept(false);
namespace Dali::Scene3D::Loader
{
/**
- * @brief Intermediate representation for a property that's given to
- * a Animation to animate. Since there is no getting an
- * animated property back from the Animation (i.e. past AnimateBetween/By/To()),
- * changing properties (e.g. from the SDK) requires the whole Animation
- * object to be recreated with all of its properties (incl. modifications).
+ * @brief Intermediate representation for a property that's given to a Animation to animate.
+ *
+ * Since there is no getting an animated property back from the Animation (i.e. past AnimateBetween/By/To()),
+ * changing properties (e.g. from the SDK) requires the whole Animation object to be recreated with all of
+ * its properties (incl. modifications).
+ * @SINCE_2_0.7
*/
struct DALI_SCENE3D_API AnimatedProperty
{
public: // METHODS
/**
- * @brief Function to obtain an Actor based on its property. Its processing will
- * ignore empty handles returned by it.
+ * @brief Function to obtain an Actor based on its property. Its processing will ignore empty handles returned by it.
+ * @SINCE_2_0.7
*/
using GetActor = std::function<Actor(const AnimatedProperty&)>;
/**
+ * @brief Get the property object of the given actor.
+ * @SINCE_2_0.7
* @return The Property object (of the given @a actor) whose value is being animated.
*/
Property GetProperty(Actor& actor) const
/**
* @brief The type of the Property (of the given @a actor) that is being animated.
+ * @SINCE_2_0.7
*/
Property::Type GetPropertyType(Actor& actor) const
{
/**
* @brief Registers the animation of this property against the given @a anim.
- * @a getActor will be used to obtain the Actor named by this property.
- * Failing to find the actor purely means that this property will not be
- * animated.
+ *
+ * @a getActor will be used to obtain the Actor named by this property.
+ * Failing to find the actor purely means that this property will not be
+ * animated.
+ * @SINCE_2_0.7
*/
void Animate(Animation& anim, GetActor getActor) const;
{
/**
* @brief Animation handle + name + definition of properties.
+ * @SINCE_2_0.7
*/
class DALI_SCENE3D_API AnimationDefinition
{
static const float MIN_DURATION_SECONDS;
/**
- * @brief Saves the original end action of @a anim, sets the end action to
- * Discard, then stops the animation and returns the end action.
+ * @brief Saves the original end action of @a anim, sets the end action to Discard, then stops
+ * the animation and returns the end action.
+ * @SINCE_2_0.7
*/
static Animation::EndAction StopForModification(Animation& anim);
AnimationDefinition& operator=(AnimationDefinition&& other);
/**
- * @brief Registers the properties against the given @a animation. @a getActor
- * will be used to obtain the Actors for each AnimatedProperty.
+ * @brief Registers the properties against the given @a animation.
+ *
+ * @a getActor will be used to obtain the Actors for each AnimatedProperty.
+ * @SINCE_2_0.7
*/
void Animate(Animation& animation, AnimatedProperty::GetActor getActor);
/**
- * @brief Creates a new Animation and Animates() its properties. @a getActor
- * will be used to obtain the Actors for each AnimatedProperty.
+ * @brief Creates a new Animation and Animates() its properties.
+ *
+ * @a getActor will be used to obtain the Actors for each AnimatedProperty.
+ * @SINCE_2_0.7
*/
Animation ReAnimate(AnimatedProperty::GetActor getActor);
/**
* @brief Set the name of the animation.
*
+ * @SINCE_2_2.22
* @param[in] name The name of the animation.
*/
void SetName(const std::string& name);
/**
* @brief Get the name of the animation.
*
+ * @SINCE_2_2.22
* @return The name of the animation.
*/
const std::string& GetName() const;
/**
* @brief Set the duration of the animation in seconds.
*
+ * @SINCE_2_2.22
* @param[in] duration The duration of the animation in seconds.
*/
void SetDuration(float duration);
/**
* @brief Get the duration of the animation in seconds.
*
+ * @SINCE_2_2.22
* @return The duration of the animation in seconds.
*/
float GetDuration() const;
/**
* @brief Set the number of times to loop the animation.
*
+ * @SINCE_2_2.22
* @param[in] loopCount The number of times to loop the animation. Use -1 for infinite looping.
*/
void SetLoopCount(int32_t loopCount);
/**
* @brief Get the number of times to loop the animation.
*
+ * @SINCE_2_2.22
* @return The number of times to loop the animation. Use -1 for infinite looping.
*/
int GetLoopCount() const;
/**
* @brief Set what should happen when an animation is disconnected from an object.
*
+ * @SINCE_2_2.22
* @param[in] disconnectAction What should happen when an animation is disconnected from an object.
*/
void SetDisconnectAction(Animation::EndAction disconnectAction);
/**
* @brief Get what should happen when an animation is disconnected from an object.
*
+ * @SINCE_2_2.22
* @return What should happen when an animation is disconnected from an object.
*/
Animation::EndAction GetDisconnectAction() const;
/**
* @brief Set what should happen when an animation reaches its end.
*
+ * @SINCE_2_2.22
* @param[in] endAction What should happen when an animation reaches its end.
*/
void SetEndAction(Animation::EndAction endAction);
/**
* @brief Get what should happen when an animation reaches its end.
*
+ * @SINCE_2_2.22
* @return What should happen when an animation reaches its end.
*/
Animation::EndAction GetEndAction() const;
/**
* @brief Set a speed factor for this animation. This can be used to speed up or slow down playback of this animation relative to other animations in a scene.
*
+ * @SINCE_2_2.22
* @param[in] speedFactor The speed factor for this animation. 1.0 is normal speed, 2.0 is double speed, 0.5 is half speed, etc.
*/
void SetSpeedFactor(float speedFactor);
/**
* @brief Get a speed factor for this animation. This can be used to speed up or slow down playback of this animation relative to other animations in a scene.
*
+ * @SINCE_2_2.22
* @return The speed factor for this animation. 1.0 is normal speed, 2.0 is double speed, 0.5 is half speed, etc.
*/
float GetSpeedFactor() const;
/**
* @brief Set a range within which to play this animation. This can be used to play only part of an animation or to play it backwards by setting playRange.y < playRange.x
*
+ * @SINCE_2_2.22
* @param[in] playRange A range within which to play this animation. x = start time in seconds, y = end time in seconds
*/
void SetPlayRange(const Vector2& playRange);
/**
* @brief Get a range within which to play this animation. This can be used to play only part of an animation or to play it backwards by setting playRange.y < playRange.x
*
+ * @SINCE_2_2.22
* @return A range within which to play this animation. x = start time in seconds, y = end time in seconds
*/
Vector2 GetPlayRange() const;
/**
* @brief Reserves Animated property vector's size
*
+ * @SINCE_2_2.22
* @param[in] size The size to reserve property
*/
void ReserveSize(uint32_t size);
/**
* @brief Retrieves the number of animated properties' count
*
+ * @SINCE_2_2.22
* @return The count of animated properties.
*/
uint32_t GetPropertyCount() const;
/**
* @brief Add a property that will be animated by this AnimationDefinition
*
+ * @SINCE_2_2.22
* @param[in] index The index the property will be stored.
* @param[in] property The property that will be animated by this AnimationDefinition
*/
/**
* @brief Retrieves animated property at the index
*
+ * @SINCE_2_2.22
* @param[in] index The index of property to be retrieved.
*/
AnimatedProperty& GetPropertyAt(uint32_t index);
/**
* @brief Retrieves animated property at the index
*
+ * @SINCE_2_2.34
* @param[in] index The index of property to be retrieved.
*/
const AnimatedProperty& GetPropertyAt(uint32_t index) const;
/**
* @brief Registers properties based on the mesh definition (and geometry) and identified by the above string constants,
* on the given @a renderer and @a actor.
+ * @SINCE_2_0.7
*/
static void ConfigureProperties(const BlendShapeData& data, Renderer renderer);
{
/**
* @brief Defines a buffer that is loaded from input uri.
+ *
* The buffer can contain 3D resource data such as mesh, animation, and texture.
+ * @SINCE_2_2.12
*/
struct DALI_SCENE3D_API BufferDefinition
{
/**
* @brief Retrieves data stream of this buffer.
+ * @SINCE_2_2.12
* @return iostream of this buffer
*/
std::iostream& GetBufferStream();
/**
* @brief Retrieves uri of this buffer
+ * @SINCE_2_2.12
* @return uri of the buffer
*/
std::string GetUri();
/**
* @brief Checks whether the buffer is available or not.
+ *
* It is available, if the buffer is successfully loaded from file or base64 stream.
+ * @SINCE_2_2.12
* @return True if it is available.
*/
bool IsAvailable();
private:
+ /// @cond internal
/**
* @brief Loads buffer from file or encoded stream.
*/
void LoadBuffer();
+ /// @endcond
public: // DATA
std::string mResourcePath;
/**
* @brief Loads motion capture data from bvh file format.
*
+ * @SINCE_2_1.32
* @param[in] path The file path.
* @param[in] animationName Name of the motion capture animation
* @param[in] scale The scale factor to set on the position property manually.
/**
* @brief Loads motion capture data from bvh data stream.
*
+ * @SINCE_2_2.23
* @param[in] rawBuffer The bvh buffer.
* @param[in] rawBufferLength The length of buffer.
* @param[in] animationName Name of the motion capture animation
bool isPerspective = true;
/**
- * @return The view-projection matrix of the camera.
+ * @brief Retrieves the view-projection of the camera.
+ * @SINCE_2_0.7
+ * @return The view-projection matrix of the camera
*/
ViewProjection GetViewProjection() const;
/**
- * @brief Calculates the @a position, @a orientation and @a scale that's defined
- * for this camera, and writes it into the respective variable.
+ * @brief Calculates the @a position, @a orientation and @a scale that's defined for this camera,
+ * and writes it into the respective variable.
+ * @SINCE_2_0.7
*/
void CalculateTransformComponents(Vector3& position, Quaternion& orientation, Vector3& scale) const;
/**
- * @brief Configures the camera in the way that it is supposed to be used with
- * scene3d scenes. This means inverted Y and a rotation of 180 degrees
- * along the Y axis, plus whatever the parameters define.
+ * @brief Configures the camera in the way that it is supposed to be used with scene3d scenes.
*
+ * This means inverted Y and a rotation of 180 degrees along the Y axis, plus whatever the parameters define.
+ * @SINCE_2_0.7
* @return True if success to generate camera. False otherwise.
*/
bool ConfigureCamera(CameraActor& camera, bool invertY = true) const;
* @brief Offers a description of an aspect of the scene that can be customized:
* the number of options, and the name of the nodes that are registered
* for the tag, whose children will be shown / hidden based on selection.
+ * @SINCE_2_0.7
*/
struct DALI_SCENE3D_API Customization
{
/**
* @brief A mapping of customizations to tags.
+ * @SINCE_2_0.7
*/
struct DALI_SCENE3D_API Map
{
/**
* @brief Maps the given @a customization to the given @a tag, overwriting any previous mapping to the same tag.
+ * @SINCE_2_0.7
* @return Pointer to the inserted (or pre-existing) Customization instance.
*/
Customization* Set(Tag tag, Customization&& customization);
/**
* @brief Attempts to retrieve a const Customization based on the given @a tag.
+ * @SINCE_2_0.7
*/
const Customization* Get(Tag tag) const;
/**
* @brief Attempts to retrieve a Customization based on the given @a tag.
+ * @SINCE_2_0.7
*/
Customization* Get(Tag tag);
/**
* @brief Returns the number of elements.
+ * @SINCE_2_0.7
*/
uint32_t Size() const;
- /*
+ /**
* @brief Removes every element from the Map.
+ * @SINCE_2_0.7
*/
void Clear();
/**
* @brief A mapping of choices - indices of children of customization nodes to use - to tags.
+ * @SINCE_2_0.7
*/
struct DALI_SCENE3D_API Choices
{
/**
* @brief Maps the given @a option to the given @a tag, overwriting any previous mapping to the same tag.
+ * @SINCE_2_0.7
*/
void Set(Tag tag, OptionType option);
/**
- * @brief Attempts to retrieve a Customization based on the given @a tag. Returns NONE if @a tag is not known.
+ * @brief Attempts to retrieve a Customization based on the given @a tag.
+ * @SINCE_2_0.7
+ * @return A Customization based on the given @a tag.
+ * @note Returns NONE if @a tag is not known.
*/
OptionType Get(Tag tag) const;
/**
* @brief Returns the number of elements.
+ * @SINCE_2_0.7
+ * @return The number of elements.
*/
uint32_t Size() const;
- /*
+ /**
* @brief Removes every element from the underlying map.
+ * @SINCE_2_0.7
*/
void Clear();
public:
/**
* @brief The absolute path of animation binaries referenced in the .dli.
+ * @SINCE_2_2.17
*/
std::string mAnimationsPath;
/**
* @brief Provides a facility to determine a color from a code instead of RGB(A) values.
+ * @SINCE_2_2.17
*/
ConvertColorCode mConvertColorCode{nullptr};
* root) element, whom they will attempt to process. This will take place before
* the parsing of scene Nodes and Animations, but after skeletons, environment, mesh,
* shader and material resources.
+ * @SINCE_2_2.17
*/
CategoryProcessorVector mPreNodeCategoryProcessors;
* @brief A collection of handlers, mapped to the names of the top level (i.e. below
* root) element, whom they will attempt to process. This will take place after
* the parsing of the scene Nodes and Animations.
+ * @SINCE_2_2.17
*/
CategoryProcessorVector mPostNodeCategoryProcessors;
/**
* @brief Provides an extension point to nodes. If provided, this function will be
* called with each JSON element and definition, of a scene node.
+ * @SINCE_2_2.17
* @note Constraints rely on ID resolution (from .dli to scene definition), which
* takes place after the parsing of the nodes; therefore AT THIS POINT the node
* IDs seen in constraints will still be the .dli IDs - NOT to be relied on for
/**
* @brief Provides an extension point to animations. If provided, this function will be
* called with each JSON element and fully processed definition, of an animation.
+ * @SINCE_2_2.17
*/
AnimationProcessor mAnimationPropertyProcessor;
};
namespace Dali::Scene3D::Loader
{
/**
- * @brief Defines an environment map with either or both of radiance
- * and irradiance maps.
+ * @brief Defines an environment map with either or both of radiance and irradiance maps.
+ * @SINCE_2_0.7
*/
struct DALI_SCENE3D_API EnvironmentDefinition
{
/**
* @brief Loads raw pixel data for the given diffuse and specular maps.
+ * @SINCE_2_0.7
+ * @return The raw data for the given diffuse and specular maps
* @note This can be done on any thread.
*/
RawData LoadRaw(const std::string& environmentsPath);
/**
- * @brief Creates DALi cubemap Textures from the pixel data in @a raw, then
- * returns them in a Textures object.
+ * @brief Creates DALi cubemap Textures from the pixel data in @a raw, then returns them in a Textures object.
+ * @SINCE_2_0.7
+ * @return DALi cubemap Textures
* @note This must only be called from the event thread.
*/
Textures Load(RawData&& raw);
/**
* @brief Get default intensity value.
+ * @SINCE_2_2.1
* @return Default intensity. (1.0f)
*/
static float GetDefaultIntensity();
private:
+ /// @cond internal
static void LoadBrdfTexture();
+ /// @endcond internal
public: // DATA
std::string mDiffuseMapPath;
{
/**
* @brief Stores the pixel data objects for environment map texture.
+ *
* EnvironmentMapData supports cube map that contains textures for 6 faces, or
* an equirectangular image.
+ * @SINCE_2_2.11
*/
class DALI_SCENE3D_API EnvironmentMapData
{
public:
/**
* @brief Retrieves environment map texture from image file
+ * @SINCE_2_2.11
* @return texture for loaded environment map.
*/
Texture GetTexture();
/**
* @brief Sets environment map type
+ * @SINCE_2_2.11
* @param[in] environmentMapType environment map type
*/
void SetEnvironmentMapType(Dali::Scene3D::EnvironmentMapType environmentMapType)
/**
* @brief Retrieves environment map type.
+ * @SINCE_2_2.11
* @return environment map type
*/
Dali::Scene3D::EnvironmentMapType GetEnvironmentMapType() const
return mEnvironmentMapType;
}
+ /**
+ * @brief Sets the mipmap levels
+ * @SINCE_2_2.19
+ * @param[in] mipmapLevels No. of mipmap levels
+ */
void SetMipmapLevels(uint32_t mipmapLevels)
{
mMipmapLevels = mipmapLevels;
}
- uint32_t GetMipmapLevels()
+ /**
+ * @brief Retrieves the number of mipmap levels
+ * @SINCE_2_2.19
+ * @return No. of mipmap levels
+ */
+ uint32_t GetMipmapLevels() const
{
return mMipmapLevels;
}
/**
* @brief Loads environment map data from a environment map file.
*
+ * @SINCE_2_1.32
* @param[in] environmentMapUrl The environment map file url.
* @param[out] environmentMapData The data structure with all pixel data objects.
* @return bool True if the loading is succeded.
*\r
* Throws a DaliException on error.\r
*\r
+ * @SINCE_2_1.30\r
* @param[in] url The url of the file containing the facial animation.\r
*\r
* @return An animation definition.\r
*\r
* Throws a DaliException on error.\r
*\r
+ * @SINCE_2_2.23\r
* @param[in] rawBuffer The raw buffer containing the facial animation.\r
* @param[in] rawBufferLength The length of raw buffer.\r
*\r
/**
* @brief Loads cube map data texture from a ktx file.
*
+ * @SINCE_2_0.7
* @param[in] path The file path.
* @param[out] environmentMapData The data structure with all pixel data objects.
* @return bool True if the loading is succeded.
/**
* @brief The outputs from loading and processing a scene.
+ * @SINCE_2_0.7
*/
struct DALI_SCENE3D_API LoadResult
{
/**
* @brief The bundle to store resources in.
+ * @SINCE_2_0.7
*/
ResourceBundle& mResources;
/**
* @brief The scene definition to populate.
+ * @SINCE_2_0.7
*/
SceneDefinition& mScene;
/**
* @brief The metadata of the scene.
+ * @SINCE_2_2.5
*/
SceneMetadata& mSceneMetadata;
/**
* @brief The list of animation definitions, in lexicographical order of their names.
+ * @SINCE_2_0.7
*/
std::vector<AnimationDefinition>& mAnimationDefinitions;
/**
* @brief The list of animation group definitions, in lexicographical order of their names.
+ * @SINCE_2_0.7
*/
std::vector<AnimationGroupDefinition>& mAnimationGroupDefinitions;
/**
* @brief The camera parameters that were loaded from the scene.
+ * @SINCE_2_0.7
*/
std::vector<CameraParameters>& mCameraParameters;
/**
* @brief The light parameters that were loaded from the scene.
+ * @SINCE_2_0.7
*/
std::vector<LightParameters>& mLightParameters;
};
{\r
/**\r
* @brief Defines the matadata for an image.\r
+ * @SINCE_2_2.5\r
*/\r
struct ImageMetadata\r
{\r
- ImageDimensions mMinSize{}; ///< The minimum required image size for rendering\r
- SamplingMode::Type mSamplingMode{SamplingMode::BOX_THEN_LINEAR}; ///< The sampling mode used to resize the image\r
+ ImageDimensions mMinSize{}; ///< The minimum required image size for rendering. @SINCE_2_2.5\r
+ SamplingMode::Type mSamplingMode{SamplingMode::BOX_THEN_LINEAR}; ///< The sampling mode used to resize the image. @SINCE_2_2.5\r
};\r
\r
/**\r
* @brief Stores the metadata for a scene.\r
*\r
+ * @SINCE_2_2.5\r
* @note The supported format is the following:\r
* {\r
* "images": (optional) [ {\r
};\r
\r
/**\r
- * @brief Attempts to load and process a json file specifying scene metadata\r
- * for pre-processing the scene resources: e.g. the minimum size required for rendering images, etc.\r
+ * @brief Attempts to load and process a json file specifying scene metadata for pre-processing the scene resources.\r
+ *\r
+ * e.g. the minimum size required for rendering images, etc.\r
+ * @SINCE_2_2.5\r
* @note Will fail quietly if the file is not present.\r
*/\r
DALI_SCENE3D_API void LoadSceneMetadata(const std::string& url, SceneMetadata& sceneMetadata);\r
{
/**
* @brief Helper enum for encoding and decoding sampler states.
+ * @SINCE_2_0.7
*/
struct DALI_SCENE3D_API SamplerFlags
{
};
/**
- * @return SamplerFlags bit pattern calculated from the given Dali Sampler settings.
+ * @brief Retrieves the bit pattern calculated from the given Dali Sampler settings.
+ * @SINCE_2_0.7
+ * @return SamplerFlags bit pattern.
*/
static Type Encode(FilterMode::Type minFilter, FilterMode::Type magFilter, WrapMode::Type wrapS, WrapMode::Type wrapT);
/**
* @brief Decodes the minification filter patter of @a flags into the corresponding FilterMode.
+ * @SINCE_2_0.7
*/
static FilterMode::Type GetMinFilter(Type flags);
/**
* @brief Decodes the magnification filter patter of @a flags into the corresponding FilterMode.
+ * @SINCE_2_0.7
*/
static FilterMode::Type GetMagFilter(Type flags);
/**
* @brief Decodes the horizontal wrap pattern of @a flags into the corresponding WrapMode.
+ * @SINCE_2_0.7
*/
static WrapMode::Type GetWrapS(Type flags);
/**
* @brief Decodes the vertical wrap pattern of @a flags into the corresponding WrapMode.
+ * @SINCE_2_0.7
*/
static WrapMode::Type GetWrapT(Type flags);
/**
* @brief Creates a Sampler with the settings encoded in @a flags.
+ * @SINCE_2_0.7
*/
static Sampler MakeSampler(Type flags);
};
/**
* @brief Defines a texture from a combination of an image URI and its sampler definition.
+ * @SINCE_2_0.7
*/
struct DALI_SCENE3D_API TextureDefinition
{
* is enabled, and an index of an environment (usually of all environments in a
* scene). Textures from the environment are added last when the DALi TextureSet
* is being created.
+ * @SINCE_2_0.7
*/
struct DALI_SCENE3D_API MaterialDefinition
{
/**
* @brief A(n image based) texture that's used in a material.
+ * @SINCE_2_0.7
*/
struct TextureStage
{
/**
* @brief Loads (or, in the case of solid color materials, creates) raw pixel data,
* which is then returned.
+ * @SINCE_2_0.7
* @note This may be called from any thread.
*/
RawData LoadRaw(const std::string& imagesPath);
* @brief Creates Textures from the pixel data in @a raw, gets the
* the cube maps from the iEnvironment'th element of @a environments,
* then creates a DALi TextureSet and returns it.
+ * @SINCE_2_0.7
* @note This must be called from the event thread.
* @note The textures are added in the following order: 2D, cube maps.
*/
/**
* @brief Checks if the given mask matches any of the textures defined.
+ * @SINCE_2_0.7
*/
bool CheckTextures(uint32_t flags) const;
/**
* @return The alpha test reference value.
+ * @SINCE_2_0.7
* @note A value of 0.f means no alpha testing.
*/
float GetAlphaCutoff() const
/**
* @brief Encodes the alpha test reference @a value in flags.
+ * @SINCE_2_0.7
* @note A value of 0.f means no alpha testing.
*/
void SetAlphaCutoff(float value)
/**
* @brief A stack of matrices whereby each newly pushed matrix is stored
* after being multiplied by the previous one (if any).
+ * @SINCE_2_0.7
* @note Current implementation reserves space for 16 matrices.
*/
class DALI_SCENE3D_API MatrixStack
* @brief Defines a mesh with its attributes, the primitive type to render it as,
* and the file to load it from with the offset and length information for the
* individual attribute buffers.
+ * @SINCE_2_0.7
*/
struct DALI_SCENE3D_API MeshDefinition
{
/**
* @brief Describes raw data in terms of its position and size in a buffer.
- * All units in bytes.
+ *
+ * All units in bytes.
+ * @SINCE_2_0.7
*/
struct Blob
{
/**
* @brief Calculates the size of a tightly-packed buffer for the elements from the blob.
+ * @SINCE_2_0.7
*/
uint32_t GetBufferSize() const;
/**
* @brief Convenience method to tell whether a Blob has meaningful data.
+ * @SINCE_2_0.7
*/
bool IsDefined() const
{
}
/**
- * @brief Convenience method to tell whether the elements stored in the blob follow each
- * other tightly. The opposite would be interleaving.
+ * @brief Convenience method to tell whether the elements stored in the blob follow each other tightly.
+ *
+ * The opposite would be interleaving.
+ * @SINCE_2_0.7
*/
bool IsConsecutive() const
{
/**
* @brief Computes the min / max of the input value data.
- * The min and max are stored in mMin and mMax.
*
+ * The min and max are stored in mMin and mMax.
+ * @SINCE_2_0.7
* @param[in] numComponents number of components of data type. e.g., 3 for Vector3.
* @param[in] count The number of data.
* @param[in] values Data for the mesh.
/**
* @brief Applies the min / max values, if they're defined in the model
*
+ * @SINCE_2_0.7
* @param[in] count The number of data.
* @param[in] values Data for the mesh that min / max values will be applied.
* @param[in] sparseIndices Pointer to array of sparse indices (or nullptr if not provided)
- *
*/
void ApplyMinMax(uint32_t count, float* values, std::vector<uint32_t>* sparseIndices = nullptr) const;
};
* @brief A sparse blob describes a change in a reference Blob.
* @p indices describe what positions of the reference Blob change and
* @p values describe the new values.
+ * @SINCE_2_0.7
*/
struct SparseBlob
{
/**
* @brief Stores a blend shape.
+ * @SINCE_2_0.7
*/
struct BlendShape
{
/**
* @brief Determines whether the mesh definition is that of a quad.
+ * @SINCE_2_0.7
*/
bool IsQuad() const;
/**
* @brief Determines whether the mesh is used for skeletal animation.
+ * @SINCE_2_0.7
*/
bool IsSkinned() const;
/**
* @brief Returns the number of joint sets defined by the mesh
*
+ * @SINCE_2_2.52
* @note Clamped to 4 to minimise GPU attrs.
*/
uint32_t GetNumberOfJointSets() const;
/**
* @brief Whether the mesh has blend shapes.
+ * @SINCE_2_0.7
*/
bool HasBlendShapes() const;
/**
* @brief Requests normals to be generated.
+ * @SINCE_2_0.7
* @note Generation happens in LoadRaw().
* @note Must have Vector3 positions defined.
*/
/**
* @brief Requests tangents to be generated.
+ * @SINCE_2_0.7
* @note Generation happens in LoadRaw().
* @note Must have Vector3 normals defined.
*/
void RequestTangents();
/**
- * @brief Loads raw geometry data, which includes index (optional) and
- * attribute buffers, as well as blend shape data. This is then returned.
+ * @brief Loads raw geometry data, which includes index (optional) and attribute buffers, as well as blend shape data.
+ *
+ * This is then returned.
+ * @SINCE_2_0.7
* @note This can be done on any thread.
*/
RawData LoadRaw(const std::string& modelsPath, BufferDefinition::Vector& buffers);
* attribute (and index) buffers and blend shape information (if available)
* from @a raw.
* If mFlipVertical was set, the UVs are flipped in Y, i.e. v = 1.0 - v.
+ * @SINCE_2_0.7
*/
MeshGeometry Load(RawData&& raw) const;
/**
* @brief Retrieves what Components information is in this mesh's BlendShape.
*
+ * @SINCE_2_2.21
* @param[out] hasPositions True if the BlendShape has position components
* @param[out] hasNormals True if the BlendShape has normal components
* @param[out] hasTangents True if the BlendShape has tangent components
{
struct DALI_SCENE3D_API MeshGeometry
{
- Geometry geometry; ///< The array of vertices.
- Texture blendShapeGeometry; ///< The array of vertices of the different blend shapes encoded inside a texture with power of two dimensions.
- Vector<float> blendShapeUnnormalizeFactor; ///< Factor used to unnormalize the geometry of the blend shape.
- unsigned int blendShapeBufferOffset{0}; ///< Offset used to calculate the start of each blend shape.
+ Geometry geometry; ///< The array of vertices. @SINCE_2_0.7
+ Texture blendShapeGeometry; ///< The array of vertices of the different blend shapes encoded inside a texture with power of two dimensions. @SINCE_2_0.7
+ Vector<float> blendShapeUnnormalizeFactor; ///< Factor used to unnormalize the geometry of the blend shape. @SINCE_2_0.7
+ unsigned int blendShapeBufferOffset{0}; ///< Offset used to calculate the start of each blend shape. @SINCE_2_0.20
};
} // namespace Dali::Scene3D::Loader
/**
* @brief ModelLoader Constructor.
+ * @SINCE_2_2.17
* @param[in] modelUrl Url of the model file to be loaded
* @param[in] resourceDirectoryUrl Url of directory that contains resources.
* @param[out] loadResult Loaded result that includes scene tree and resources.
/**
* @brief Request to load model from model url.
+ * @SINCE_2_2.17
* @param[in] pathProvider Path provider that defines resource paths.
* @param[in] loadOnlyRawResource If true, load Raw resource only, and do not create Dali::Handle
* If false, this loader load Raw resource and create Dali::Handle too.
/**
* @brief Set InputParameter.
- * Thie method store only a pointer of InputParameter.
+ *
+ * This method store only a pointer of InputParameter.
* The object of InputParameter should not be deleted until it is no longer used.
+ * @SINCE_2_2.17
* @param[in] inputParameter Input parameters that can be used in loading time.
*/
void SetInputParameter(InputParameter& inputParameter);
/**
- * @brief Retrieves loaded scene
+ * @brief Retrieves loaded scene.
+ * @SINCE_2_2.17
* @return SceneDefinition that is loaded from file
*/
Dali::Scene3D::Loader::SceneDefinition& GetScene();
/**
- * @brief Retrieves resource bundle that includes resource information
+ * @brief Retrieves resource bundle that includes resource information.
+ * @SINCE_2_2.17
* @return ResourceBundle for model resources
*/
Dali::Scene3D::Loader::ResourceBundle& GetResources();
/**
- * @brief Retrieves loaded AnimationDefinition
+ * @brief Retrieves loaded AnimationDefinition.
+ * @SINCE_2_2.17
* @return AnimationDefinition that is loaded from file
*/
std::vector<Dali::Scene3D::Loader::AnimationDefinition>& GetAnimations();
/**
- * @brief Retrieves loaded CameraParameters
+ * @brief Retrieves loaded CameraParameters.
+ * @SINCE_2_2.17
* @return CameraParameters list that is loaded from file
*/
std::vector<Dali::Scene3D::Loader::CameraParameters>& GetCameras();
/**
- * @brief Retrieves ResourceChoices
+ * @brief Retrieves ResourceChoices.
+ * @SINCE_2_2.17
* @return Choices for loaded Resources
*/
Dali::Scene3D::Loader::Customization::Choices& GetResourceChoices();
private:
/**
* @brief Create model loader for each file format.
+ * @SINCE_2_2.17
*/
void CreateModelLoader();
/**
* @brief Load resource of the model.
+ * @SINCE_2_2.17
*/
void LoadResource(Dali::Scene3D::Loader::ResourceBundle::PathProvider& pathProvider, bool loadOnlyRawResource);
reinterpret_cast<uint8_t*>(meshFaces.data()),
reinterpret_cast<uint8_t*>(meshFaces.data()) + (meshFaces.size() * sizeof(NavigationMesh::Face)));
- auto retval = std::move(NavigationMeshFactory::CreateFromBuffer(navigationMeshBinary));
- return retval;
+ return NavigationMeshFactory::CreateFromBuffer(navigationMeshBinary);
}
std::unique_ptr<Algorithm::NavigationMesh> NavigationMeshFactory::CreateFromVertexFaceList(const std::vector<Vector3>& vertices, const std::vector<Vector3>& normals, const std::vector<uint32_t>& faceIndices)
/**
* @brief Interface to report (const) resource ids to.
+ * @SINCE_2_0.7
*/
class DALI_SCENE3D_API IResourceReceiver
{
/**
* @brief Interface to report modifiable resource ids to.
+ * @SINCE_2_0.7
* @note These are supposed to be transient. Obviously, the references collected
* this way must not outlive the objects that they came from.
*/
* @brief Intermediate representation for a constraint that shall be
* set up after the Actors were created. The target of the constraint
* is the node definition that carries it.
+ * @SINCE_2_0.7
*/
struct DALI_SCENE3D_API ConstraintDefinition
{
/**
* @brief Information about a skeleton and the shader that needs to be configured with it.
+ * @SINCE_2_0.7
* @note Multiple skeletons shalt not share the same shader.
*/
struct DALI_SCENE3D_API SkinningShaderConfigurationRequest
/**
* @brief Needed to configure blend shape properties.
+ * @SINCE_2_0.7
*/
struct DALI_SCENE3D_API BlendshapeShaderConfigurationRequest
{
/**
* @brief Request for creating a constraint, output from NodeDefinition::OnCreate.
+ * @SINCE_2_0.7
*/
struct DALI_SCENE3D_API ConstraintRequest
{
* @brief Defines a node, consisting of a name, a transform, a size, a list of child nodes,
* and slots for customization and rendering logic, which are mutually exclusive in the
* current implementation.
+ * @SINCE_2_0.7
*/
struct DALI_SCENE3D_API NodeDefinition
{
public: // METHODS
/**
* @brief Creates a ModelNode from this definition only.
+ * @SINCE_2_0.7
* @note Not recursive.
*/
ModelNode CreateModelNode(CreateParams& params);
/**
* @brief Gets local space matrix of this node
+ * @SINCE_2_1.32
* @return Matrix of local space.
*/
Matrix GetLocalSpace() const;
/**
* @brief Retrieves minimum and maximum position of this node in local space.
+ * @SINCE_2_1.32
* @param[in] resources ResourceBundle that contains mesh information of this node.
* @param[out] min Minimum position of the mesh of this node.
* @param[out] max Maximum position of the mesh of this node.
/**
* @brief Retrieves Scale Factor uniform name.
+ *
* This uniform name can be used to change scale factor for ibl.
+ * @SINCE_2_1.32
* @return std::string_view of the scale factor uniform name.
*/
static std::string_view GetIblScaleFactorUniformName();
/**
* @brief Retrieves ibl Ydirection uniform name.
+ *
* This uniform name can be used to flip y direction of ibl in shader.
+ * @SINCE_2_1.32
* @return std::string_view of the YDirection uniform name.
*/
static std::string_view GetIblYDirectionUniformName();
/**
* @brief Retrieves ibl MaxLod uniform name.
+ *
* This uniform name can be used to set max lod of ibl in shader.
+ * @SINCE_2_2.19
* @return std::string_view of the Max Lod uniform name.
*/
static std::string_view GetIblMaxLodUniformName();
/**
* @brief Parameters for an Arc node.
+ * @SINCE_2_0.7
*/
class DALI_SCENE3D_API ArcRenderable : public ModelRenderable
{
{
namespace RendererState
{
-/*
- * @brief Attempts to interpret a string for renderer states, which can be a combination of the following
+/**
+ * @brief Attempts to interpret a string for renderer states.
+ *
+ * Wwhich can be a combination of the following:
* (using '|' as a delimiter, if multiple specified):<br/>
* - one of Value, exc. for NONE or those with the _BITS, _SHIFT, _MASK or _ITEMS suffix;<br/>
* - DEPTH_FUNC:${one of Comparison::Type, exc. OMIT};<br/>
* - BLEND_(SRC_DST)_(RGB|ALPHA):${one of BlendFactor::Type, exc. OMIT};<br/>
* - BUFFER_MODE:${one of BufferMode::Type, exc. OMIT};
+ * @SINCE_2_0.7
* @param string The string to parse;
* @param length The length of the string; If left at 0, strlen() will be called, which of
* course is only suitable i the string is null-terminated.
namespace Dali::Scene3D::Loader
{
-/*
+/**
* @brief Contains values for comparison functions used in depth and stencil testing.
+ * @SINCE_2_0.7
* @note Relative order of members must match DepthFunction::Type and StencilFunction::Type.
*/
struct DALI_SCENE3D_API Comparison
Comparison() = delete;
};
-/*
+/**
* @brief Determines the blend factor used.
+ * @SINCE_2_0.7
* @note Relative order of members must match BlendFactor::Type.
*/
struct DALI_SCENE3D_API BlendFactor
BlendFactor() = delete;
};
-/*
+/**
* @brief Determines which buffers shall the Renderer write into.
+ * @SINCE_2_0.7
* @note Relative order of members must match RenderMode::Type.
*/
struct DALI_SCENE3D_API BufferMode
{
enum Type
{
- OMIT, ///< not specified - will not be updated
- NONE, ///< Don’t write to either color or stencil buffer (But will potentially render to depth buffer).
- AUTO, ///< Writes are managed by the Actor Clipping API. This is DALi's default.
- COLOR, ///< Ignore stencil properties. Write to the color buffer.
- STENCIL, ///< Use the stencil properties. Do not write to the color buffer.
- COLOR_STENCIL ///< Use the stencil properties AND Write to the color buffer.
+ OMIT, ///< not specified - will not be updated. @SINCE_2_0.7
+ NONE, ///< Don’t write to either color or stencil buffer (But will potentially render to depth buffer). @SINCE_2_0.7
+ AUTO, ///< Writes are managed by the Actor Clipping API. This is DALi's default. @SINCE_2_0.7
+ COLOR, ///< Ignore stencil properties. Write to the color buffer. @SINCE_2_0.7
+ STENCIL, ///< Use the stencil properties. Do not write to the color buffer. @SINCE_2_0.7
+ COLOR_STENCIL ///< Use the stencil properties AND Write to the color buffer. @SINCE_2_0.7
};
BufferMode() = delete;
};
-/*
+/**
* @brief Contains values and functionality for configuring Renderers.
+ * @SINCE_2_0.7
*/
namespace RendererState
{
DEFAULT = DEPTH_WRITE | DEPTH_TEST | CULL_BACK | (Comparison::LESS_EQUAL << DEPTH_FUNCTION_SHIFT),
};
-/*
+/**
* @brief Encodes the given blend factors into a RenderMode value, maskable into other options,
- * passable into ApplyRenderMode().
+ * passable into ApplyRenderMode().
+ * @SINCE_2_0.7
*/
inline DALI_SCENE3D_API constexpr uint32_t FromBlendFactors(BlendFactor::Type srcRgb, BlendFactor::Type destRgb, BlendFactor::Type srcAlpha, BlendFactor::Type destAlpha)
{
<< BLEND_FACTOR_BASE_SHIFT;
}
-/*
+/**
* @brief Applies the settings encoded in @a rendererState, to a @a renderer.
+ * @SINCE_2_0.7
* @note Depth function is only set if not Comparison::OMIT.
* @note Blend factors are only set if not BlendFactor::OMIT.
* @note Buffer mode is only set is not BufferMode::OMIT.
namespace Dali::Scene3D::Loader
{
-/*
+/**
* @brief The types of resources that .dli may define.
+ * @SINCE_2_0.7
*/
struct DALI_SCENE3D_API ResourceType
{
ResourceType() = delete;
};
-/*
- * @return The string value corresponding to the given resource @a type.
+/**
+ * @brief The string value corresponding to the given resource @a type.
+ * @SINCE_2_0.7
+ * @return The string value for type.
*/
DALI_SCENE3D_API const char* GetResourceTypeName(ResourceType::Value type);
using ResourceRefCounts = std::vector<Vector<uint32_t>>;
-/*
+/**
* @brief Stores all resource definitions along with the DALi resources that
* could be created from them, directly indexible into with values from a dli
* document.
+ * @SINCE_2_0.7
*/
class DALI_SCENE3D_API ResourceBundle
{
ResourceBundle& operator=(ResourceBundle&&) = default;
/**
- * @return A ResourceRefCounts object with the correct number of entries for
+ * @brief A ResourceRefCounts object with the correct number of entries for
* all resource types (based on the various resource definition vectors),
* with all reference counts set to 0.
+ * @SINCE_2_0.7
+ * @return A ResourceRefCounts object.
*/
ResourceRefCounts CreateRefCounter() const;
* @brief Based on a ResourceRefCounts, and more specifically the reference
* count of materials therein, it will calculate the reference count of
* environment maps.
+ * @SINCE_2_0.7
*/
void CountEnvironmentReferences();
/**
- * @brief Performs the loading of all resources based on their respective
- * reference count in @a refCounts. Resources that had a non-zero ref count will be
- * loaded unless we already have a handle to them (OR the ForceReload option was specified).
+ * @brief Performs the loading of all resources based on their respective reference count in @a refCounts.
+ *
+ * Resources that had a non-zero ref count will be loaded unless we already have a handle to them
+ * (OR the ForceReload option was specified).
* Any handles we have to resources that come in with a zero ref count will be reset,
* UNLESS the KeepUnused option was specified.
+ *
+ * @SINCE_2_0.7
* @param[in] pathProvider path provider for resource data.
* @param[in] options Option to load resource
* @note This method creates DALi objects like Dali::Texture, Dali::Geometry, etc.
Options::Type options = Options::None);
/**
- * @brief Loads of all resources based on their respective
- * reference count in @a refCounts. Resources that had a non-zero ref count will be
- * loaded unless we already have a handle to them (OR the ForceReload option was specified).
+ * @brief Loads of all resources based on their respective reference count in @a refCounts.
+ *
+ * Resources that had a non-zero ref count will be loaded unless we already have a handle to them
+ * (OR the ForceReload option was specified).
* Any handles we have to resources that come in with a zero ref count will be reset,
* UNLESS the KeepUnused option was specified.
+ *
+ * @SINCE_2_2.9
* @note This method don't create any of DALi objects.
* @param[in] pathProvider path provider for resource data.
* @param[in] options Option to load resource
/**
* @brief Generates DALi objects from already loaded Raw Resources.
+ * @SINCE_2_2.9
* @param[in] options Option to load resource
* @note This method generates DALi objects from raw data that is already
* loaded by LoadRawResources method. Therefore, LoadRawResources should be called first
{
class MatrixStack;
-/*
+/**
* @brief Intermediate representation of a scene with functionality required to
- * create DALi objects (Actors, Renderers) from it.
+ * create DALi objects (Actors, Renderers) from it.
+ * @SINCE_2_0.7
*/
class DALI_SCENE3D_API SceneDefinition
{
SceneDefinition(SceneDefinition&& other);
~SceneDefinition();
- /*
+ /**
* @brief Registers a scene root node.
+ * @SINCE_2_0.7
* @return The index of the scene root node *registration*.
*/
Index AddRootNode(Index iNode);
- /*
- * @return the list of scene root node IDs in the order of their loading.
+ /**
+ * @brief Retrieves a list of scene root node IDs in the order of loading.
+ * @SINCE_2_0.7
+ * @return List of scene root node IDs in the order of loading
*/
const std::vector<Index>& GetRoots() const;
- /*
+ /**
* @brief Removes scene root registration at the given index @a iRoot.
- * @note @a iRoot is the index of the registration (i.e. into the vector returned by GetRoots()),
- * not of the node.
+ * @SINCE_2_0.7
+ * @note @a iRoot is the index of the registration (i.e. into the vector returned by GetRoots()), not of the node.
*/
void RemoveRootNode(Index iRoot);
- /*
- * @return The number of node( definition)s in the scene.
+ /**
+ * @brief Retrieve the number of node(definition)s in the scene.
+ * @SINCE_2_0.7
+ * @return The number of node(definition)s in the scene
*/
uint32_t GetNodeCount() const;
- /*
- * @return Const pointer to the node (definition) at the given index.
+ /**
+ * @brief Retrieve a const pointer to the node (definition) at the given index.
+ * @SINCE_2_0.7
+ * @return Const pointer to the node (definition).
*/
const NodeDefinition* GetNode(Index iNode) const;
- /*
- * @return Pointer to the node (definition) at the given index.
+ /**
+ * @brief Retrive a pointer to the node (definition) at the given index.
+ * @SINCE_2_0.7
+ * @return Pointer to the node (definition).
*/
NodeDefinition* GetNode(Index iNode);
- /*
- * @brief Traverses the scene starting from the node at the given index into
- * nodes, using the given customization @a choices and the visitor @a v.
+ /**
+ * @brief Traverses the scene starting from the node at the given index into nodes,
+ * using the given customization @a choices and the visitor @a v.
+ * @SINCE_2_0.7
*/
void Visit(Index iNode, const Customization::Choices& choices, NodeDefinition::IVisitor& v);
- /*
- * @brief Traverses the scene starting from the node at the given index into
- * nodes, using the given customization @a choices and the visitor @a v.
+ /**
+ * @brief Traverses the scene starting from the node at the given index into nodes,
+ * using the given customization @a choices and the visitor @a v.
+ * @SINCE_2_0.7
*/
void Visit(Index iNode, const Customization::Choices& choices, NodeDefinition::IConstVisitor& v) const;
- /*
- * @brief Counts the references to meshes, shaders, materials that nodes in
- * the scene are holding, writing the results into @a refCounts.
+ /**
+ * @brief Counts the references to meshes, shaders, materials that nodes in the scene are holding,
+ * writing the results into @a refCounts.
+ * @SINCE_2_0.7
* @note @a refCounts' entries must have the correct size. Use ResourceBundle::GetRefCounter().
*/
void CountResourceRefs(Index iNode, const Customization::Choices& choices, ResourceRefCounts& refCounts) const;
- /*
- * @brief Given a bundle of @a resources that are loaded, and customization
- * @a choices, this method traverses the scene, creating the ModelNodes and renderers
- * from node definitions.
+ /**
+ * @brief Given a bundle of @a resources that are loaded, and customization @a choices,
+ * this method traverses the scene, creating the ModelNodes and renderers from node definitions.
+ * @SINCE_2_0.7
* @return Handle to the root node.
*/
ModelNode CreateNodes(Index iNode, const Customization::Choices& choices, NodeDefinition::CreateParams& params);
- /*
- * @brief Creates / update a registry of mappings from customization tags to
- * a lists of names of customizable nodes under each tag, and the number of
- * options. If @a outMissingChoices was specified, each tag that it encounters
- * in the scene but not in @a choices, will be registered on it with the default
- * choice of 0.
+ /**
+ * @brief Creates / update a registry of mappings from customization tags to a lists of names of
+ * customizable nodes under each tag, and the number of options.
+ *
+ * If @a outMissingChoices was specified, each tag that it encounters in the scene but not in @a choices,
+ * will be registered on it with the default choice of 0.
+ * @SINCE_2_0.7
*/
void GetCustomizationOptions(const Customization::Choices& choices,
Customization::Map& outCustomizationOptions,
Customization::Choices* outMissingChoices) const;
- /*
- * @brief Attempts to add @a nodeDef to the end of nodes, and its index to the end of
- * its parent's list of children (if iParent != NodeDefinition::INVALID_PARENT).
+ /**
+ * @brief Attempts to add @a nodeDef to the end of nodes, and its index to the end of its parent's
+ * list of children (if iParent != NodeDefinition::INVALID_PARENT).
+ * @SINCE_2_0.7
* @return If the operation was successful - which requires nodeDef->name to be unique -
* a pointer to the stored node definition; nullptr otherwise.
*/
NodeDefinition* AddNode(std::unique_ptr<NodeDefinition>&& nodeDef);
- /*
+ /**
* @brief Moves the node to some other parent and / or to a different index.
+ * @SINCE_2_0.7
* @return Whether the operation was successful.
* @note This is currently breaking an assumption of never having a child of a node at a lower
* index as that of the node itself, due to the fact that we're only changing parent ids (and
*/
bool ReparentNode(const std::string& name, const std::string& newParentName, Index siblingOrder);
- /*
+ /**
* @brief Removes a node with the given name, including all of its children, and updating
* the indices on all remaining node definitions.
+ * @SINCE_2_0.7
* @return Whether the operation was successful.
*/
bool RemoveNode(const std::string& name);
- /*
+ /**
* @brief Builds the model matrix stack for the node at the given @a index.
+ * @SINCE_2_0.7
* @note It only pushes new matrices; does not require the stack to be empty (or cares if it was not).
*/
void GetNodeModelStack(Index index, MatrixStack& model) const;
- /*
+ /**
* @brief Attempts to find the definition of a node with the given @a name. Only upon
* success, and if @a outIndex is non-null, the index of the node is written to it.
+ * @SINCE_2_0.7
* @return Pointer to the node definition; nullptr if not found.
* @note No ownership transfer.
*/
NodeDefinition* FindNode(const std::string& name, Index* outIndex = nullptr);
- /*
+ /**
* @brief Attempts to find the definition of a node with the given @a name. Only upon
* success, and if @a outIndex is non-null, the index of the node is written to it.
+ * @SINCE_2_0.7
* @return Pointer to the node definition; nullptr if not found.
* @note No ownership transfer.
*/
const NodeDefinition* FindNode(const std::string& name, Index* outIndex = nullptr) const;
- /*
- * @return The index of the given NodeDefinition@ a node, or -1 if the node definition
- * was not found.
+ /**
+ * @brief The index of the given NodeDefinition @a node, or -1 if the node definition was not found.
+ * @SINCE_2_0.7
+ * @return The index of the given NodeDefinition @a node, or -1 if the node definition was not found
*/
Index FindNodeIndex(const NodeDefinition& node) const;
- /*
+ /**
* @brief Calls @a consumer with up to @a limit NodeDefinitions that evaluate to true
* with @a predicate.
+ * @SINCE_2_0.7
* @note A @a limit value of 0 means no limit.
*/
void FindNodes(NodePredicate predicate, NodeConsumer consumer, unsigned int limit = 0);
- /*
- * @brief Calls @a consumer with up to @a limit NodeDefinitions that evaluate to true
- * with @a predicate.
+ /**
+ * @brief Calls @a consumer with up to @a limit NodeDefinitions that evaluate to true with @a predicate.
+ * @SINCE_2_0.7
* @note A @a limit value of 0 means no limit.
*/
void FindNodes(NodePredicate predicate, ConstNodeConsumer consumer, unsigned int limit = 0) const;
- /*
+ /**
* @brief Applies constraints from the given requests.
+ * @SINCE_2_0.7
*/
void ApplyConstraints(Actor& root,
std::vector<ConstraintRequest>&& constrainables,
StringCallback onError = DefaultErrorCallback) const;
- /*
- * @brief Ensures that there is no overlap between shaders used by nodes that have
- * meshes skinned to different skeletons.
+ /**
+ * @brief Ensures that there is no overlap between shaders used by nodes that have meshes skinned to different skeletons.
+ * @SINCE_2_0.7
*/
void EnsureUniqueSkinningShaderInstances(ResourceBundle& resources) const;
- /*
- * @brief Performs the configuration of the given skinning shaders with the given skeleton
- * This means that the absolute transforms of the joints are calculated and set as one of
- * the uniforms in the mat4 @b uBone array (in depth first traversal). Further, the following
- * are created:<br />
- * - a @b jointMatrix property on each joint Actor;<br />
- * - constraint from the Actor's local position and rotation (and if it has a @e joint
- * parent, the jointMatrix of the parent) to its @b jointMatrix property;<br />
- * - a constraint from the the Actor's @b jointMatrix property to the related entry in
- * the shader's @b uBone property;<br />
- * This ensures the automatic update of the skeletal animation, should any of the joints'
- * transform changes, by whatever means.
- * @return The success of the operations. Error messages will be posted to the optional
- * @a onError callback.
+ /**
+ * @brief Performs the configuration of the given skinning shaders with the given skeleton.
+ *
+ * This means that the absolute transforms of the joints are calculated and set as one of
+ * the uniforms in the mat4 @b uBone array (in depth first traversal). Further, the following
+ * are created:<br />
+ * - a @b jointMatrix property on each joint Actor;<br />
+ * - constraint from the Actor's local position and rotation (and if it has a @e joint
+ * parent, the jointMatrix of the parent) to its @b jointMatrix property;<br />
+ * - a constraint from the the Actor's @b jointMatrix property to the related entry in
+ * the shader's @b uBone property;<br />
+ * This ensures the automatic update of the skeletal animation, should any of the joints' transform changes,
+ * by whatever means.
+ * @SINCE_2_0.7
+ * @note Error messages will be posted to the optional @a onError callback.
* @note A maximum of SkinningDetails::MAX_JOINTS joints per skeleton are supported at the moment.
* @note Even if multiple skinned meshes use the same skinning shader, the correct number
* of separate instances need to be declared in the .dli to avoid clashing uniform
Actor root,
std::vector<SkinningShaderConfigurationRequest>&& requests) const;
- /*
+ /**
* @brief Ensures there is no two meshes with blend shapes sharing the same shader.
+ * @SINCE_2_0.7
*/
void EnsureUniqueBlendShapeShaderInstances(ResourceBundle& resources) const;
*
* For each node with blend shapes it registers into the actor the weights properties for each morph target
* and some needed uniforms into the shader.
- *
+ *
+ * @SINCE_2_0.7
* @param[in] root The root actor.
* @param[in] requests The requests to configure blend shapes.
* @param[in] resources The resources bundle. Meshes need to be accessed to configure the blend shapes.
void RedefineMacro(std::string& shaderCode, const std::string& macro, const std::string& value)
{
- std::string definition = "#define " + macro;
- std::size_t found = shaderCode.find(definition);
- if(found != std::string::npos)
+ if(!value.empty())
{
- std::size_t insertionPoint = found + definition.length();
+ std::string definition = "#define " + macro;
+ std::size_t found = shaderCode.find(definition);
+ if(found != std::string::npos)
+ {
+ std::size_t insertionPoint = found + definition.length();
- // Automatically insert line-continuation character into value
- std::regex re("\n");
- std::sregex_token_iterator first{value.begin(), value.end(), re, -1}, last;
- for(auto i = first; i != last; ++i)
+ // Automatically insert line-continuation character into value
+ std::regex re("\n");
+ std::sregex_token_iterator first{value.begin(), value.end(), re, -1}, last;
+ for(auto i = first; i != last; ++i)
+ {
+ std::string line = std::string(" \\\n") + (*i).str();
+ shaderCode.insert(insertionPoint, line);
+ insertionPoint += line.length();
+ }
+ }
+ }
+ else
+ {
+ std::size_t invocation = shaderCode.rfind(macro);
+ if(invocation != std::string::npos)
{
- std::string line = std::string(" \\\n") + (*i).str();
- shaderCode.insert(insertionPoint, line);
- insertionPoint += line.length();
+ std::size_t start = shaderCode.rfind("\n", invocation);
+ std::size_t end = shaderCode.find("\n", invocation);
+ shaderCode.erase(start, end - start);
}
}
}
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
{
ShaderDefinition() = default;
ShaderDefinition(const ShaderDefinition& other);
- ShaderDefinition& operator=(const ShaderDefinition& other);
+ ShaderDefinition& operator=(const ShaderDefinition& other) = delete;
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;
option.AddOption(ShaderOption::Type::SKINNING);
option.AddJointMacros(meshDef.mJoints.size());
}
+ else
+ {
+ option.AddJointMacros(0);
+ }
if(MaskMatch(meshDef.mFlags, MeshDefinition::FLIP_UVS_VERTICAL))
{
/**
* @brief This class is to manage Shaders.
+ *
* This class could be used as factory class to create Dali::Shader.
* And once created Dali::Shader is kept in this manager and will be returned when the same Dali::Shader is requested to be created.
+ * @SINCE_2_2.34
*/
class DALI_SCENE3D_API ShaderManager : public RefObject
{
/**
* @brief Produces a Dali::Shader for the input materialDefinition and meshDefinition.
+ *
* Returns a cached Dali::Shader if the requested Dali::Shader has already been created once.
* (Although the input materialDefinition and meshDefinition are not identical to those used to create the cached Dali::Shader, they share the cached one.)
+ * @SINCE_2_2.34
* @param[in] materialDefinition MaterialDefinition that includes information of material to create Shader.
* @param[in] meshDefinition meshDefinition that includes information of mesh to create Shader.
* @return ShaderOption for the materialDefinition and meshDefinition.
ShaderOption ProduceShaderOption(const MaterialDefinition& materialDefinition, const MeshDefinition& meshDefinition);
/**
- * @brief Produces a Dali::Shader for the input ShaderOption
+ * @brief Produces a Dali::Shader for the input ShaderOption.
+ *
* Returns a cached Dali::Shader if the requested Dali::Shader has already been created once.
+ * @SINCE_2_2.34
* @param[in] shaderOption shader option to create Shader.
* @return Dali::Shader of the shader option
*/
/**
* @brief Returns RendererState of the input materialDefinition.
+ * @SINCE_2_2.34
* @param[in] materialDefinition MaterialDefinition to get RendererState
* @return RendererState of the materialDefinition.
*/
/**
* @brief Adds new lights for each of shaders.
+ * @SINCE_2_2.34
* @param[in] light Light object to be newly added.
* @return True when the new light object is added successfully.
*/
/**
* @brief Removes light from each of shaders.
+ * @SINCE_2_2.34
* @param[in] light Light object to be removed.
*/
void RemoveLight(Scene3D::Light light);
/**
* @brief Retrieves added light counts.
+ * @SINCE_2_2.34
* @return The number of added light count.
*/
uint32_t GetLightCount() const;
/**
* @brief Set a shadow to this scene by input light.
- *
+ * @SINCE_2_2.34
* @param[in] light Light object to make shadow.
*/
void SetShadow(Scene3D::Light light);
/**
* @brief Removes Shadow from this SceneView.
+ * @SINCE_2_2.34
*/
void RemoveShadow();
/**
* @brief Update uniform properties of shadow for the input light.
+ * @SINCE_2_2.34
* @param[in] light Light object to update shadow uniform.
*/
void UpdateShadowUniform(Scene3D::Light light);
private:
+ /// @cond internal
/**
* @brief Sets constraint to the shaders with light of light index.
* @param[in] lightIndex index of light that will be connected with shaders by constraint.
*/
DALI_INTERNAL void SetShadowConstraintToShader(Dali::Shader shader);
+ /// @endcond
private:
struct Impl;
const std::unique_ptr<Impl> mImpl;
AddMacroDefinition(ADD_EXTRA_SKINNING_ATTRIBUTES, attributes.str());
AddMacroDefinition(ADD_EXTRA_WEIGHTS, weights.str());
}
+ else
+ {
+ AddMacroDefinition(ADD_EXTRA_SKINNING_ATTRIBUTES, std::string{});
+ AddMacroDefinition(ADD_EXTRA_WEIGHTS, std::string{});
+ }
}
void ShaderOption::AddMacroDefinition(std::string macro, std::string definition)
public:
/**
* @brief Sets transparency option.
+ * @SINCE_2_2.33
*/
void SetTransparency();
/**
* @brief Adds new shader definition option.
- * If the option is already added, nothin is changed.
*
+ * If the option is already added, nothin is changed.
+ * @SINCE_2_2.33
* @param[in] shaderOptionType Option to be added,
*/
void AddOption(Type shaderOptionType);
/**
- * Adds macro definitions for joints based on the number of joint sets.
+ * @brief Adds macro definitions for joints based on the number of joint sets.
+ * @SINCE_2_2.52
*/
void AddJointMacros(size_t numberOfJointSets);
/**
- * Enables empty preprocessor definitions to be defined to a value
+ * @brief Enables empty preprocessor definitions to be defined to a value.
+ * @SINCE_2_2.52
*/
void AddMacroDefinition(std::string macro, std::string definition);
/**
* @brief Retrieves current shader option hash
*
+ * @SINCE_2_2.33
* @return Hash value of currently added options.
*/
HashType GetOptionHash() const;
/**
* @brief Retrieves a list of define keywords.
*
+ * @SINCE_2_2.33
* @param[out] defines A list of define keywords those are used in this option.
*/
void GetDefines(std::vector<std::string>& defines) const;
/**
* @brief Retrieves a single shader define keyword of input type.
*
+ * @SINCE_2_2.33
* @param[in] shaderOptionType Shader definition option type to know its keyword.
* @return string keyword of shader define.
*/
static std::string_view GetDefineKeyword(Type shaderOptionType);
/**
- * Get any macro definitions
+ * @brief Get any macro definitions.
+ * @SINCE_2_2.52
*/
const std::vector<MacroDefinition>& GetMacroDefinitions() const;
namespace Dali::Scene3D::Loader
{
-/*
+/**
* @brief A set of joints (stored as node indices), and an optional root node index.
+ * @SINCE_2_0.7
* @note The list of joints must not be empty and must not contain INVALID_INDEX.
* @note Client code should not change the order of joints, as they are indexed by mesh vertex data.
* @note Client code should make no assumption about the relation of the joint IDs.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/rendering/shader.h>
#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/rendering/shader.h>
#include <string>
// INTERNAL INCLUDES
Matrix inverseMatrix;
};
- /*
+ /**
* @brief Upper limit on the number of joints supported.
+ * @SINCE_2_0.7
*/
static const uint32_t MAX_JOINTS;
- /*
+ /**
* @brief Name of bone matrix uniform (array).
+ * @SINCE_2_0.7
*/
static const char* BONE_UNIFORM_NAME;
namespace Dali::Scene3D::Loader
{
-/*
+/**
* @brief A callback to post strings to.
+ * @SINCE_2_0.7
*/
using StringCallback = std::function<void(const std::string&)>;
-/*
+/**
* @brief Simply passes the formatted message to LOGE().
+ * @SINCE_2_0.7
*/
DALI_SCENE3D_API void DefaultErrorCallback(const std::string& message);
namespace Dali::Scene3D::Loader
{
-/*
- * @brief Fixed size backing buffer to use with std::ostreams where control over
- * allocations (which this does not make), is required.
- * @note All stream insertions that would overflow the buffer that StreamBuffer
- * was created with, will fail.
+/**
+ * @brief Fixed size backing buffer to use with std::ostreams where control over allocations (which this does not make), is required.
+ * @SINCE_2_0.7
+ * @note All stream insertions that would overflow the buffer that StreamBuffer was created with, will fail.
*/
class DALI_SCENE3D_API StreamBuffer : public std::basic_streambuf<char>
{
StreamBuffer(char* buffer, size_t size) noexcept(true);
};
-/*
- * @brief Wraps an ostream with a pre-allocated, fixed size backing buffer
- * which a message can be formatted into. Upon destruction, it throws a
- * DaliException with the message.
+/**
+ * @brief Wraps an ostream with a pre-allocated, fixed size backing buffer which a message can be formatted into.
+ *
+ * Upon destruction, it throws a DaliException with the message.
+ * @SINCE_2_0.7
*/
class DALI_SCENE3D_API ExceptionFlinger
{
std::ostream mStream;
};
-/*
+/**
* @brief Formats the given printf-style varargs into a std::string.
+ * @SINCE_2_0.7
*/
DALI_SCENE3D_API std::string FormatString(const char* format, ...);
-/*
- * @return The @n th bit in a bitmask.
+/**
+ * @brief The @n th bit in a bitmask.
+ * @SINCE_2_0.7
+ * @return The @n th bit in a bitmask
*/
DALI_SCENE3D_API constexpr size_t NthBit(size_t n)
{
return 1u << n;
}
-/*
- * @return Whether all of @a mask 's bits are set on @a value.
+/**
+ * @brief Whether all of @a mask 's bits are set on @a value.
+ * @SINCE_2_0.7
+ * @return Whether all of @a mask 's bits are set on @a value
*/
inline DALI_SCENE3D_API bool MaskMatch(uint32_t value, uint32_t mask)
{
return (value & mask) == mask;
}
-/*
+/**
* @brief Convert a four-letter(, null-terminated) string literal into a uint32_t.
+ * @SINCE_2_0.7
*/
inline DALI_SCENE3D_API constexpr uint32_t FourCC(const char (&fourCC)[5])
{
return (fourCC[3] << 24) | (fourCC[2] << 16) | (fourCC[1] << 8) | fourCC[0];
}
-/*
+/**
* @brief Insensitive case compare function.
- * @param[in] a, compare string
- * @param[in] b, compare string
+ * @SINCE_2_0.7
+ * @param[in] a compare string
+ * @param[in] b compare string
* @return true if strings are equal
*/
inline DALI_SCENE3D_API bool CaseInsensitiveCharacterCompare(unsigned char a, unsigned char b)
return std::tolower(a) == std::tolower(b);
}
-/*
+/**
* @return true if the lower cased ASCII strings are equal.
- * @param[in] a, compare string
- * @param[in] b, compare string
+ * @SINCE_2_0.7
+ * @param[in] a compare string
+ * @param[in] b compare string
*/
inline DALI_SCENE3D_API bool CaseInsensitiveStringCompare(const std::string& a, const std::string& b)
{
return result;
}
-/*
- * @brief Attempts to load the contents of a text file; returns empty string on
- * failure. A pointer to a boolean may be passed in @a fail; this will be set
- * to true in case of failure (should only be checked if the returned string
- * was empty()).
+/**
+ * @brief Attempts to load the contents of a text file; returns empty string on failure.
+ *
+ * A pointer to a boolean may be passed in @a fail; this will be set to true in case of failure
+ * (should only be checked if the returned string was empty()).
+ * @SINCE_2_0.7
*/
DALI_SCENE3D_API std::string LoadTextFile(const char* path, bool* fail = nullptr);
-/*
- * @brief Makes a number of calls to @a fn, passing to each one the given
- * @a actor then each of its children, in depth-first traversal.
+/**
+ * @brief Makes a number of calls to @a fn, passing to each one the given @a actor then each of its children, in depth-first traversal.
+ *
+ * @SINCE_2_0.7
* @note @a fn must not change the actor hierarchy during traversal.
* @note Use of a @a fn that is itself recursing in @a is also discouraged
* for performance and stability reasons.
}
}
-/*
- * @brief Convenience function to set the given actor @a 's anchor point
- * and parent origin to center.
+/**
+ * @brief Convenience function to set the given actor @a 's anchor point and parent origin to center.
+ * @SINCE_2_0.7
*/
inline DALI_SCENE3D_API void SetActorCentered(Actor a)
{
};
} // namespace TexturedQuadOptions
-/*
+/**
* @brief Makes... geometry for a textured quad.
+ * @SINCE_2_0.7
*/
DALI_SCENE3D_API Geometry MakeTexturedQuadGeometry(TexturedQuadOptions::Type options = TexturedQuadOptions::NONE);
-/*
+/**
* @brief Fixes the path of a file. Replaces the '\\' separator by the '/' one.
+ * @SINCE_2_0.7
* @param[in,out] path The path to be fixed.
*/
DALI_SCENE3D_API void ToUnixFileSeparators(std::string& path);
namespace Dali::Scene3D::Loader
{
/**
- * @brief Contains view and projection matrices, also caching the view-projection
- * and inverse projection matrices.
+ * @brief Contains view and projection matrices, also caching the view-projection and inverse projection matrices.
+ * @SINCE_2_0.7
*/
class ViewProjection
{
return mProjection;
}
- /*
+ /**
* @brief Updates the cached view projection and inverse projection matrices.
+ * @SINCE_2_0.7
*/
void Update();
#endif
#endif
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE) || defined(IS_REQUIRED_BLUR)
+// Be used when we calculate anti-alias range near 1 pixel.
+uniform highp vec3 uScale;
+#endif
+
uniform lowp vec4 uColor;
uniform lowp vec3 mixColor;
#ifdef IS_REQUIRED_BLUR
uniform lowp vec4 uActorColor;
#endif
-
#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE) || defined(IS_REQUIRED_BLUR)
// Global values both rounded corner and borderline use
void setupMinMaxPotential()
{
- // Set soft anti-alias range at most 2% of visual size
- gPotentialRange = min(1.0, max(vRectSize.x, vRectSize.y) * 0.02);
+ // Set soft anti-alias range at most 10% of visual size.
+ // The range should be inverse proportion with scale of view.
+ // To avoid divid-by-zero, let we allow minimum scale value is 0.001 (0.1%)
+ gPotentialRange = min(1.0, max(vRectSize.x, vRectSize.y) * 0.2) / max(0.001, max(uScale.x, uScale.y));
gMaxOutlinePotential = gRadius + gPotentialRange;
gMinOutlinePotential = gRadius - gPotentialRange;
#endif
// reduce defect near edge of rounded corner.
- gMaxOutlinePotential += clamp(-min(gDiff.x, gDiff.y)/ max(1.0, gRadius) , 0.0, 1.0);
- gMinOutlinePotential += clamp(-min(gDiff.x, gDiff.y)/ max(1.0, gRadius) , 0.0, 1.0);
+ gMaxOutlinePotential += clamp(-min(gDiff.x, gDiff.y) / max(1.0, gRadius), 0.0, 1.0);
+ gMinOutlinePotential += clamp(-min(gDiff.x, gDiff.y) / max(1.0, gRadius), 0.0, 1.0);
}
void PreprocessPotential()
// scale factor to fit start and end position of gradient.
uniform mediump float uTextureCoordinateScaleFactor;
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
+// Be used when we calculate anti-alias range near 1 pixel.
+uniform highp vec3 uScale;
+#endif
+
uniform sampler2D sTexture; // sampler1D?
uniform lowp vec4 uColor;
uniform lowp vec3 mixColor;
void setupMinMaxPotential()
{
- // Set soft anti-alias range at most 2% of visual size
- gPotentialRange = min(1.0, max(vRectSize.x, vRectSize.y) * 0.02);
+ // Set soft anti-alias range at most 10% of visual size.
+ // The range should be inverse proportion with scale of view.
+ // To avoid divid-by-zero, let we allow minimum scale value is 0.001 (0.1%)
+ gPotentialRange = min(1.0, max(vRectSize.x, vRectSize.y) * 0.2) / max(0.001, max(uScale.x, uScale.y));
gMaxOutlinePotential = gRadius + gPotentialRange;
gMinOutlinePotential = gRadius - gPotentialRange;
#endif
// reduce defect near edge of rounded corner.
- gMaxOutlinePotential += clamp(-min(gDiff.x, gDiff.y)/ max(1.0, gRadius) , 0.0, 1.0);
- gMinOutlinePotential += clamp(-min(gDiff.x, gDiff.y)/ max(1.0, gRadius) , 0.0, 1.0);
+ gMaxOutlinePotential += clamp(-min(gDiff.x, gDiff.y) / max(1.0, gRadius), 0.0, 1.0);
+ gMinOutlinePotential += clamp(-min(gDiff.x, gDiff.y) / max(1.0, gRadius), 0.0, 1.0);
}
void PreprocessPotential()
uniform lowp vec2 wrapMode;
#endif
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
+// Be used when we calculate anti-alias range near 1 pixel.
+uniform highp vec3 uScale;
+#endif
+
uniform lowp vec4 uColor;
uniform lowp vec3 mixColor;
uniform lowp float preMultipliedAlpha;
void setupMinMaxPotential()
{
- // Set soft anti-alias range at most 2% of visual size
- gPotentialRange = min(1.0, max(vRectSize.x, vRectSize.y) * 0.02);
+ // Set soft anti-alias range at most 10% of visual size.
+ // The range should be inverse proportion with scale of view.
+ // To avoid divid-by-zero, let we allow minimum scale value is 0.001 (0.1%)
+ gPotentialRange = min(1.0, max(vRectSize.x, vRectSize.y) * 0.2) / max(0.001, max(uScale.x, uScale.y));
gMaxOutlinePotential = gRadius + gPotentialRange;
gMinOutlinePotential = gRadius - gPotentialRange;
#endif
// reduce defect near edge of rounded corner.
- gMaxOutlinePotential += clamp(-min(gDiff.x, gDiff.y)/ max(1.0, gRadius) , 0.0, 1.0);
- gMinOutlinePotential += clamp(-min(gDiff.x, gDiff.y)/ max(1.0, gRadius) , 0.0, 1.0);
+ gMaxOutlinePotential += clamp(-min(gDiff.x, gDiff.y) / max(1.0, gRadius), 0.0, 1.0);
+ gMinOutlinePotential += clamp(-min(gDiff.x, gDiff.y) / max(1.0, gRadius), 0.0, 1.0);
}
void PreprocessPotential()
: bufferId(bufferId),
bufferHash(bufferHash),
encodedImageBuffer(encodedImageBuffer),
- referenceCount(1u)
+ referenceCount(1)
{
}
TextureCacheManager::TextureId bufferId;
TextureCacheManager::TextureHash bufferHash;
EncodedImageBuffer encodedImageBuffer;
- uint32_t referenceCount;
+ int32_t referenceCount;
};
typedef Dali::FreeList TextureIdConverterType; ///< The converter type from TextureId to index of TextureInfoContainer.
maskTextureId(maskTextureId),
hash(hash),
scaleFactor(scaleFactor),
- referenceCount(1u),
+ referenceCount(1),
loadState(LoadState::NOT_STARTED),
fittingMode(fittingMode),
samplingMode(samplingMode),
TextureId maskTextureId; ///< The mask TextureId to be applied on load
TextureHash hash; ///< The hash used to cache this Texture
float scaleFactor; ///< The scale factor to apply to the Texture when masking
- uint32_t referenceCount; ///< The reference count of clients using this Texture
+ int32_t referenceCount; ///< The reference count of clients using this Texture
LoadState loadState; ///< The load state showing the load progress of the Texture
Dali::FittingMode::Type fittingMode : 3; ///< The requested FittingMode
Dali::SamplingMode::Type samplingMode : 3; ///< The requested SamplingMode
const bool preMultiplied)
: textureId(textureId),
textureSet(textureSet),
- referenceCount(1u),
+ referenceCount(1),
preMultiplied(preMultiplied)
{
}
TextureId textureId; ///< The TextureId associated with this ExternalTexture
TextureSet textureSet; ///< The external texture
- uint32_t referenceCount; ///< The reference count of clients using this ExternalTexture
+ int32_t referenceCount; ///< The reference count of clients using this ExternalTexture
bool preMultiplied : 1; ///< True if the image's color was multiplied by it's alpha
};