#ifndef DALI_SCENE_LOADER_NODE_DEFINITION_H_
#define DALI_SCENE_LOADER_NODE_DEFINITION_H_
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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-scene-loader/public-api/resource-bundle.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/math/quaternion.h"
+#include <functional>
+#include <memory>
+#include <string>
+#include "dali/public-api/actors/actor.h"
#include "dali/public-api/math/matrix.h"
+#include "dali/public-api/math/quaternion.h"
#include "dali/public-api/math/vector4.h"
-#include "dali/public-api/actors/actor.h"
-#include <string>
-#include <memory>
-#include <functional>
namespace Dali
{
namespace SceneLoader
{
-
class ViewProjection;
/**
class DALI_SCENE_LOADER_API IResourceReceiver
{
public:
- virtual ~IResourceReceiver()
- {}
+ virtual ~IResourceReceiver() = default;
virtual void Register(ResourceType::Value type, Index id) = 0;
};
class DALI_SCENE_LOADER_API IResourceReflector
{
public:
- virtual ~IResourceReflector()
- {}
+ virtual ~IResourceReflector() = default;
virtual void Reflect(ResourceType::Value type, Index& id) = 0;
};
struct DALI_SCENE_LOADER_API ConstraintDefinition
{
std::string mProperty; ///< name of the property to constrain.
- Index mSourceIdx; ///< index of the node to serve as the source of the constraint.
+ Index mSourceIdx; ///< index of the node to serve as the source of the constraint.
bool operator<(const ConstraintDefinition& other) const
{
struct DALI_SCENE_LOADER_API Transforms
{
- MatrixStack modelStack;
+ MatrixStack modelStack;
const ViewProjection& viewProjection;
};
*/
struct DALI_SCENE_LOADER_API SkinningShaderConfigurationRequest
{
- Index mSkeletonIdx;
+ Index mSkeletonIdx;
Shader mShader;
bool operator<(const SkinningShaderConfigurationRequest& other) const
struct DALI_SCENE_LOADER_API BlendshapeShaderConfigurationRequest
{
std::string mNodeName;
- Index mMeshIdx;
- Shader mShader;
+ Index mMeshIdx;
+ Shader mShader;
bool operator<(const BlendshapeShaderConfigurationRequest& other) const
{
*/
struct DALI_SCENE_LOADER_API ConstraintRequest
{
- const ConstraintDefinition* const mConstraint; ///< Definition of the constraint to create.
- Actor mTarget; ///< Target of the constraint.
+ const ConstraintDefinition* const mConstraint; ///< Definition of the constraint to create.
+ Actor mTarget; ///< Target of the constraint.
};
/**
*/
struct DALI_SCENE_LOADER_API NodeDefinition
{
-public: // TYPES
+public: // TYPES
using Vector = std::vector<NodeDefinition>;
struct CreateParams
{
public: // input
const ResourceBundle& mResources;
- Transforms& mXforms;
+ Transforms& mXforms;
public: // output
- std::vector<ConstraintRequest> mConstrainables;
- std::vector<SkinningShaderConfigurationRequest> mSkinnables;
+ std::vector<ConstraintRequest> mConstrainables;
+ std::vector<SkinningShaderConfigurationRequest> mSkinnables;
std::vector<BlendshapeShaderConfigurationRequest> mBlendshapeRequests;
};
Index mShaderIdx = INVALID_INDEX;
public: // METHODS
- virtual ~Renderable() {}
+ virtual ~Renderable() = default;
virtual void RegisterResources(IResourceReceiver& receiver) const;
virtual void ReflectResources(IResourceReflector& reflector);
{
auto choice = choices.Get(mTag);
return std::min(choice != Customization::NONE ? choice : 0,
- static_cast<Index>(node.mChildren.size() - 1));
+ static_cast<Index>(node.mChildren.size() - 1));
}
};
class IVisitor
{
public:
- virtual void Start(NodeDefinition& n) = 0;
+ virtual void Start(NodeDefinition& n) = 0;
virtual void Finish(NodeDefinition& n) = 0;
protected:
- ~IVisitor() {}
+ ~IVisitor() = default; // deliberately non-virtual these are transient objects and we don't want to pay for the vtable.
};
class IConstVisitor
{
public:
- virtual void Start(const NodeDefinition& n) = 0;
+ virtual void Start(const NodeDefinition& n) = 0;
virtual void Finish(const NodeDefinition& n) = 0;
protected:
- ~IConstVisitor() {}
+ ~IConstVisitor() = default; // deliberately non-virtual these are transient objects and we don't want to pay for the vtable.
};
struct Extra
{
- std::string mKey;
+ std::string mKey;
Property::Value mValue;
bool operator<(const Extra& other) const
}
};
-public: // METHODS
+public: // METHODS
/**
* @brief Creates a DALi Actor from this definition only.
* @note Not recursive.
std::string mName;
- Vector3 mPosition = Vector3::ZERO;
+ Vector3 mPosition = Vector3::ZERO;
Quaternion mOrientation = Quaternion::IDENTITY;
- Vector3 mScale = Vector3::ONE;
- Vector3 mSize = Vector3::ONE;
+ Vector3 mScale = Vector3::ONE;
+ Vector3 mSize = Vector3::ONE;
bool mIsVisible = true;
- std::unique_ptr<Renderable> mRenderable;
+ std::unique_ptr<Renderable> mRenderable;
std::unique_ptr<CustomizationDefinition> mCustomization;
- std::vector<Extra> mExtras;
- std::vector<ConstraintDefinition> mConstraints;
+ std::vector<Extra> mExtras;
+ std::vector<ConstraintDefinition> mConstraints;
std::vector<Index> mChildren;
- Index mParentIdx = INVALID_INDEX;
+ Index mParentIdx = INVALID_INDEX;
};
class DALI_SCENE_LOADER_API ModelNode : public NodeDefinition::Renderable
{
public: // DATA
- Vector4 mColor = Color::WHITE;
- Index mMeshIdx = INVALID_INDEX;
- Index mMaterialIdx = INVALID_INDEX;
+ Vector4 mColor = Color::WHITE;
+ Index mMeshIdx = INVALID_INDEX;
+ Index mMaterialIdx = INVALID_INDEX;
public: // METHODS
void RegisterResources(IResourceReceiver& receiver) const override;
class DALI_SCENE_LOADER_API ArcNode : public ModelNode
{
public: // DATA
- bool mAntiAliasing = true;
- int mArcCaps = 0;
+ bool mAntiAliasing = true;
+ int mArcCaps = 0;
float mStartAngleDegrees = .0f;
- float mEndAngleDegrees = .0f;
- float mRadius = .0f;
+ float mEndAngleDegrees = .0f;
+ float mRadius = .0f;
public: // METHODS
static void GetEndVectorWithDiffAngle(float startAngle, float endAngle, Vector2& endVector);
void OnCreate(const NodeDefinition& node, NodeDefinition::CreateParams& params, Actor& actor) const override;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_NODE_DEFINITION_H_