// Copyright (c) 2021, 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 <OgnTutorialOverrideTypeDatabase.h>

// The include files required by the type definition override is in the database definition so it does not have to
// be directly included here.

namespace omni
{
namespace graph
{
namespace core
{
namespace tutorial
{

class OgnTutorialOverrideType
{
public:
    static bool compute(OgnTutorialOverrideTypeDatabase& db)
    {
        // Usually you would use an "auto" declaration. The type is explicit here to show how the override has
        // changed the generated type.
        const carb::Float3& inputTypedData = db.inputs.typedData();
        carb::Float3& outputTypedData = db.outputs.typedData();

        const pxr::GfVec3d& inputStandardData = db.inputs.data();
        pxr::GfVec3d& outputStandardData = db.outputs.data();

        // Rearrange the components as a simple way to verify that compute happened
        outputTypedData.x = inputTypedData.y;
        outputTypedData.y = inputTypedData.z;
        outputTypedData.z = inputTypedData.x;

        outputStandardData.Set(inputStandardData[1], inputStandardData[2], inputStandardData[0]);

        return true;
    }
};

// namespaces are closed after the registration macro, to ensure the correct class is registered
REGISTER_OGN_NODE()

} // namespace tutorial
} // namespace core
} // namespace graph
} // namespace omni
