/*
- * 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
-#include "dali-scene3d/public-api/loader/node-definition.h"
-#include "dali-scene3d/public-api/loader/renderer-state.h"
-#include "dali-scene3d/public-api/loader/utils.h"
+// CLASS HEADER
+#include <dali-scene3d/public-api/loader/node-definition.h>
+
+// INTERNAL INCLUDES
+#include <dali-scene3d/public-api/loader/renderer-state.h>
+#include <dali-scene3d/public-api/loader/utils.h>
namespace Dali
{
{
constexpr std::string_view IBL_INTENSITY_STRING("uIblIntensity");
constexpr std::string_view IBL_Y_DIRECTION("uYDirection");
+constexpr std::string_view IBL_MAXLOD("uMaxLOD");
} // namespace
namespace Scene3D
actor.AddRenderer(renderer);
}
-const std::string NodeDefinition::ORIGINAL_MATRIX_PROPERTY_NAME = "originalMatrix";
+const char* NodeDefinition::ORIGINAL_MATRIX_PROPERTY_NAME = "originalMatrix";
-Actor NodeDefinition::CreateActor(CreateParams& params) const
+Actor NodeDefinition::CreateActor(CreateParams& params)
{
Actor actor = Actor::New();
+ mNodeId = actor.GetProperty<int32_t>(Dali::Actor::Property::ID);
+
SetActorCentered(actor);
actor.SetProperty(Actor::Property::NAME, mName);
actor.RegisterProperty(ORIGINAL_MATRIX_PROPERTY_NAME, GetLocalSpace(), Property::AccessMode::READ_ONLY);
+ actor.SetProperty(Actor::Property::COLOR_MODE, ColorMode::USE_OWN_MULTIPLY_PARENT_COLOR);
+
for(auto& renderable : mRenderables)
{
renderable->OnCreate(*this, params, actor);
return IBL_Y_DIRECTION;
}
+std::string_view NodeDefinition::GetIblMaxLodUniformName()
+{
+ return IBL_MAXLOD;
+}
+
bool NodeDefinition::GetExtents(const ResourceBundle& resources, Vector3& min, Vector3& max) const
{
if(mRenderables.empty())
actor.RegisterProperty("uSpecularFactor", matDef.mSpecularFactor);
actor.RegisterProperty("uSpecularColorFactor", matDef.mSpecularColorFactor);
actor.RegisterProperty("uNormalScale", matDef.mNormalScale);
+ actor.RegisterProperty("uEmissiveFactor", matDef.mEmissiveFactor);
if(matDef.mFlags & MaterialDefinition::OCCLUSION)
{
renderer.RegisterProperty("uOcclusionStrength", matDef.mOcclusionStrength);
}
- if(matDef.mFlags & MaterialDefinition::EMISSIVE)
- {
- renderer.RegisterProperty("uEmissiveFactor", matDef.mEmissiveFactor);
- }
Index envIdx = matDef.mEnvironmentIdx;
renderer.RegisterProperty(IBL_INTENSITY_STRING.data(), resources.mEnvironmentMaps[envIdx].first.mIblIntensity);
renderer.RegisterProperty(IBL_Y_DIRECTION.data(), resources.mEnvironmentMaps[envIdx].first.mYDirection);
- float opaque = 0.0f;
- float mask = 0.0f;
+ float opaque = matDef.mIsOpaque ? 1.0f : 0.0f;
+ float mask = matDef.mIsMask ? 1.0f : 0.0f;
float alphaCutoff = matDef.GetAlphaCutoff();
- if(!MaskMatch(matDef.mFlags, MaterialDefinition::TRANSPARENCY))
- {
- opaque = 1.0f;
- }
- else
- {
- if(alphaCutoff > 0.f)
- {
- mask = 1.0f;
- }
- }
+
renderer.RegisterProperty("uOpaque", opaque);
renderer.RegisterProperty("uMask", mask);
renderer.RegisterProperty("uAlphaThreshold", alphaCutoff);
renderer.SetTextures(textures);
+ uint32_t specularMipmap = resources.mEnvironmentMaps[envIdx].second.mSpecularMipmapLevels;
actor.SetProperty(Actor::Property::COLOR, mColor);
+ actor.RegisterProperty(IBL_MAXLOD.data(), static_cast<float>(specularMipmap));
}
void ArcRenderable::OnCreate(const NodeDefinition& node, NodeDefinition::CreateParams& params, Actor& actor) const