omni/avreality/rain/WetnessController.h
File members: omni/avreality/rain/WetnessController.h
// 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.
//
#pragma once
#include "IWetnessController.h"
#include <carb/Defines.h>
#include <carb/InterfaceUtils.h>
// clang-format off
#include <omni/usd/UsdContextIncludes.h>
#include <omni/usd/UsdContext.h>
// clang-format on
namespace omni::avreality::rain
{
class WetnessController
{
IWetnessController* m_wetnessController = nullptr;
omni::usd::UsdContext* m_usdContext = nullptr;
public:
CARB_ALWAYS_INLINE WetnessController(omni::usd::UsdContext* usdContext = nullptr)
: m_wetnessController(carb::getCachedInterface<IWetnessController>()),
m_usdContext(usdContext ? usdContext : omni::usd::UsdContext::getContext())
{
}
CARB_ALWAYS_INLINE ~WetnessController()
{
m_wetnessController = nullptr;
}
CARB_ALWAYS_INLINE void applyGlobalWetnessState(bool state)
{
m_wetnessController->applyGlobalWetnessState(state, m_usdContext->getName().c_str());
}
CARB_ALWAYS_INLINE void applyGlobalWetness(float wetness)
{
m_wetnessController->applyGlobalWetness(wetness, m_usdContext->getName().c_str());
}
CARB_ALWAYS_INLINE void applyGlobalPorosity(float porosity)
{
m_wetnessController->applyGlobalPorosity(porosity, m_usdContext->getName().c_str());
}
CARB_ALWAYS_INLINE void applyGlobalPorosityScale(float porosityScale)
{
m_wetnessController->applyGlobalPorosityScale(porosityScale, m_usdContext->getName().c_str());
}
CARB_ALWAYS_INLINE void applyGlobalWaterAlbedo(carb::ColorRgb waterAlbedo)
{
m_wetnessController->applyGlobalWaterAlbedo(waterAlbedo, m_usdContext->getName().c_str());
}
CARB_ALWAYS_INLINE void applyGlobalWaterTransparency(float waterTransparency)
{
m_wetnessController->applyGlobalWaterTransparency(waterTransparency, m_usdContext->getName().c_str());
}
CARB_ALWAYS_INLINE void applyGlobalWaterAccumulation(float waterAccumulation)
{
m_wetnessController->applyGlobalWaterAccumulation(waterAccumulation, m_usdContext->getName().c_str());
}
CARB_ALWAYS_INLINE void applyGlobalWaterAccumulationScale(float accumulationScale)
{
m_wetnessController->applyGlobalWaterAccumulationScale(accumulationScale, m_usdContext->getName().c_str());
}
CARB_ALWAYS_INLINE static void loadShadersParameters(omni::usd::UsdContext* usdContext = nullptr)
{
std::string usdContextName = usdContext ? usdContext->getName() : "";
carb::getCachedInterface<IWetnessController>()->loadShadersParameters(usdContextName.c_str());
}
};
} // namespace omni::avreality::rain