/*---------------------------------------------------------------------------* Project: NintendoWare File: gfx_ResLight.cpp Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Revision: 16154 $ *---------------------------------------------------------------------------*/ #include "../precompiled.h" #include #include #include namespace nw { namespace gfx { namespace res { //---------------------------------------- Result ResLight::Setup(os::IAllocator* allocator, ResGraphicsFile graphicsFile) { NW_UNUSED_VARIABLE(allocator); Result result = RESOURCE_RESULT_OK; ResFragmentLight fragment = ResDynamicCast(*this); if (fragment.IsValid()) { ResReferenceLookupTable referenceDistanceSampler = ResDynamicCast(fragment.GetDistanceSampler()); Result distanceResult = SetupReferenceLut(referenceDistanceSampler, graphicsFile); if ( fragment.GetDistanceSampler().IsValid() ) { if ((distanceResult.GetDescription() & nw::gfx::RESOURCE_RESULT_NOT_FOUND_LUT) == 0) { result |= fragment.GetDistanceSampler().Setup(); } } result |= distanceResult; if (fragment.GetAngleSampler().IsValid()) { ResLookupTable resLut = fragment.GetAngleSampler().GetSampler(); if (resLut.IsValid()) { ResReferenceLookupTable referenceAngleSampler = ResDynamicCast(resLut); Result angleResult = SetupReferenceLut(referenceAngleSampler, graphicsFile); if ((angleResult.GetDescription() & nw::gfx::RESOURCE_RESULT_NOT_FOUND_LUT) == 0) { result |= resLut.Setup(); } result |= angleResult; } else { result |= RESOURCE_RESULT_IRRELEVANT_LOCATION_LUT; } } } return result; } //---------------------------------------- void ResLight::Cleanup() { ResFragmentLight fragment = ResDynamicCast(*this); if (fragment.IsValid()) { ut::SafeCleanup(fragment.GetDistanceSampler()); ut::SafeCleanup(fragment.GetAngleSampler()); } } } /* namespace res */ } /* namespace gfx */ } /* namespace nw */