/*
- * 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.
{
static const std::map<Property::Type, Constraint (*)(Actor&, Property::Index)> sConstraintFactory = {
{Property::Type::BOOLEAN,
- [](Actor& a, Property::Index i)
- {
- return Constraint::New<bool>(a, i, [](bool& current, const PropertyInputContainer& inputs)
- { current = inputs[0]->GetBoolean(); });
+ [](Actor& a, Property::Index i) {
+ return Constraint::New<bool>(a, i, [](bool& current, const PropertyInputContainer& inputs) { current = inputs[0]->GetBoolean(); });
}},
{Property::Type::INTEGER,
- [](Actor& a, Property::Index i)
- {
- return Constraint::New<int>(a, i, [](int& current, const PropertyInputContainer& inputs)
- { current = inputs[0]->GetInteger(); });
+ [](Actor& a, Property::Index i) {
+ return Constraint::New<int>(a, i, [](int& current, const PropertyInputContainer& inputs) { current = inputs[0]->GetInteger(); });
}},
{Property::Type::FLOAT,
- [](Actor& a, Property::Index i)
- {
+ [](Actor& a, Property::Index i) {
return Constraint::New<float>(a, i, EqualToConstraint());
}},
{Property::Type::VECTOR2,
- [](Actor& a, Property::Index i)
- {
+ [](Actor& a, Property::Index i) {
return Constraint::New<Vector2>(a, i, EqualToConstraint());
}},
{Property::Type::VECTOR3,
- [](Actor& a, Property::Index i)
- {
+ [](Actor& a, Property::Index i) {
return Constraint::New<Vector3>(a, i, EqualToConstraint());
}},
{Property::Type::VECTOR4,
- [](Actor& a, Property::Index i)
- {
+ [](Actor& a, Property::Index i) {
return Constraint::New<Vector4>(a, i, EqualToConstraint());
}},
{Property::Type::MATRIX,
- [](Actor& a, Property::Index i)
- {
+ [](Actor& a, Property::Index i) {
return Constraint::New<Matrix>(a, i, EqualToConstraint());
}},
{Property::Type::MATRIX3,
- [](Actor& a, Property::Index i)
- {
+ [](Actor& a, Property::Index i) {
return Constraint::New<Matrix3>(a, i, EqualToConstraint());
}},
{Property::Type::ROTATION,
- [](Actor& a, Property::Index i)
- {
+ [](Actor& a, Property::Index i) {
return Constraint::New<Quaternion>(a, i, EqualToConstraint());
}},
};
{
if(0 == sNumScenes)
{
- sJointDebugShader = Shader::New(SHADER_SCENE3D_JOINT_DEBUG_VERT, SHADER_SCENE3D_JOINT_DEBUG_FRAG);
+ sJointDebugShader = Shader::New(SHADER_SCENE3D_JOINT_DEBUG_VERT, SHADER_SCENE3D_JOINT_DEBUG_FRAG, Shader::Hint::NONE, "SCENE3D_JOINT_DEBUG");
}
++sNumScenes;
}
++iter;
} while(true);
- requests.erase(std::remove_if(requests.begin(), requests.end(), [](const RequestType& sscr)
- { return !sscr.mShader; }),
+ requests.erase(std::remove_if(requests.begin(), requests.end(), [](const RequestType& sscr) { return !sscr.mShader; }),
requests.end());
}
void Register(ResourceType::Value type, Index id)
{
- if((!(*refCounts)[type].Empty()) && (id >= 0) && ((*refCounts)[type].Size() > id))
+ if((!(*refCounts)[type].Empty()) && ((*refCounts)[type].Size() > id))
{
++(*refCounts)[type][id];
}
auto& node = *nodePtr;
auto iNode = std::distance(mNodes.data(), nodePtr);
- DEBUG_ONLY(auto dumpNode = [](NodeDefinition const& n)
- {
+ DEBUG_ONLY(auto dumpNode = [](NodeDefinition const& n) {
std::ostringstream stream;
stream << n.mName << " (" << n.mParentIdx << "):";
for(auto i : n.mChildren)
auto& thisNodes = mNodes;
unsigned int numReset = 0;
std::function<void(std::unique_ptr<NodeDefinition>&)> resetFn =
- [&thisNodes, &resetFn, &numReset](std::unique_ptr<NodeDefinition>& nd)
- {
- LOGD(("resetting %d", &nd - thisNodes.data()));
- for(auto i : nd->mChildren)
- {
- resetFn(thisNodes[i]);
- }
- nd.reset();
- ++numReset;
- };
+ [&thisNodes, &resetFn, &numReset](std::unique_ptr<NodeDefinition>& nd) {
+ LOGD(("resetting %d", &nd - thisNodes.data()));
+ for(auto i : nd->mChildren)
+ {
+ resetFn(thisNodes[i]);
+ }
+ nd.reset();
+ ++numReset;
+ };
resetFn(*node);
{
INDEX_FOR_REMOVAL = INVALID_INDEX
};
- auto offsetter = [&offsets](Index& i)
- {
+ auto offsetter = [&offsets](Index& i) {
auto iFind = std::lower_bound(offsets.begin(), offsets.end(), i);
if(iFind != offsets.end() && *iFind == i)
{
void SceneDefinition::GetNodeModelStack(Index index, MatrixStack& model) const
{
auto& thisNodes = mNodes;
- std::function<void(int)> buildStack = [&model, &thisNodes, &buildStack](int i)
- {
+ std::function<void(int)> buildStack = [&model, &thisNodes, &buildStack](int i) {
auto node = thisNodes[i].get();
if(node->mParentIdx != INVALID_INDEX)
{
{
auto iBegin = mNodes.begin();
auto iEnd = mNodes.end();
- auto iFind = std::find_if(iBegin, iEnd, [&name](const std::unique_ptr<NodeDefinition>& nd)
- { return nd->mName == name; });
+ auto iFind = std::find_if(iBegin, iEnd, [&name](const std::unique_ptr<NodeDefinition>& nd) { return nd->mName == name; });
auto result = iFind != iEnd ? iFind->get() : nullptr;
if(result && outIndex)
{
auto iBegin = mNodes.begin();
auto iEnd = mNodes.end();
- auto iFind = std::find_if(iBegin, iEnd, [&name](const std::unique_ptr<NodeDefinition>& nd)
- { return nd->mName == name; });
+ auto iFind = std::find_if(iBegin, iEnd, [&name](const std::unique_ptr<NodeDefinition>& nd) { return nd->mName == name; });
auto result = iFind != iEnd ? iFind->get() : nullptr;
if(result && outIndex)
{
auto iBegin = mNodes.begin();
auto iEnd = mNodes.end();
- auto iFind = std::find_if(iBegin, iEnd, [&node](const std::unique_ptr<NodeDefinition>& n)
- { return n.get() == &node; });
+ auto iFind = std::find_if(iBegin, iEnd, [&node](const std::unique_ptr<NodeDefinition>& n) { return n.get() == &node; });
return iFind != iEnd ? std::distance(iBegin, iFind) : INVALID_INDEX;
}
// We're searching from the end assuming a higher probability of operations targeting
// recently added nodes. (conf.: root, which is immovable, cannot be removed, and was
// the first to be added, is index 0.)
- auto iFind = std::find_if(mNodes.rbegin(), mNodes.rend(), [&name](const std::unique_ptr<NodeDefinition>& nd)
- { return nd->mName == name; })
+ auto iFind = std::find_if(mNodes.rbegin(), mNodes.rend(), [&name](const std::unique_ptr<NodeDefinition>& nd) { return nd->mName == name; })
.base();
const bool success = iFind != mNodes.begin();