// Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto.  Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//

#include "OgnTestBundleAttributeInterpolationDatabase.h"

#include <omni/graph/core/BundlePrims.h>

namespace omni
{
namespace graph
{
namespace test
{

class OgnTestBundleAttributeInterpolation
{
public:
    static bool compute(OgnTestBundleAttributeInterpolationDatabase& db)
    {
        auto& inputPrims = db.inputs.prims();

        ConstBundlePrims bundlePrims(db.abi_context(), inputPrims.abi_bundleHandle());
        CARB_ASSERT(bundlePrims.getPrimCount() == 1);

        ConstBundlePrim* bundlePrim = bundlePrims.getPrim(0);
        CARB_ASSERT(bundlePrim != nullptr);
        if (!bundlePrim)
            return false;

        BundleAttrib const* bundleAttrib = bundlePrim->getConstAttr(db.inputs.attribute());
        CARB_ASSERT(bundleAttrib != nullptr);
        if (!bundleAttrib)
            return false;

        db.outputs.interpolation() = bundleAttrib->interpolation();

        return true;
    }
};

REGISTER_OGN_NODE()

}
}
}
