/*---------------------------------------------------------------------------* Project: NintendoWare File: gfx_ResGraphicsFile.cpp Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo and/or its licensed developers and are protected by national and international copyright laws. 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. The content herein is highly confidential and should be handled accordingly. $Revision: $ *---------------------------------------------------------------------------*/ #include "../precompiled.h" #include #include #include #include #include #include #include #include #include namespace nw { namespace gfx { namespace res { //---------------------------------------------------------------------------- Result ResGraphicsFile::Setup(os::IAllocator* allocator, ResGraphicsFile graphicsFile) { Result result = RESOURCE_RESULT_OK; NW_ASSERT( this->IsValid() ); NW_ASSERT( internal::ResCheckRevision( *this ) ); NW_ASSERT( internal::ResCheckRevision( graphicsFile ) ); s32 lutSetsNum = this->GetLutSetsCount(); for ( int i = 0; i < lutSetsNum; ++i ) { result |= this->GetLutSets( i ).Setup(allocator, graphicsFile); } s32 lightNum = this->GetLightsCount(); for ( int i = 0; i < lightNum; ++i ) { result |= this->GetLights( i ).Setup(allocator, graphicsFile); } s32 fogNum = this->GetFogsCount(); for ( int i = 0; i < fogNum; ++i ) { result |= this->GetFogs( i ).Setup(allocator, graphicsFile); } s32 shaderNum = this->GetShadersCount(); for ( int i = 0; i < shaderNum; ++i ) { result |= this->GetShaders( i ).Setup(allocator, graphicsFile); } s32 textureNum = this->GetTexturesCount(); for ( int i = 0; i < textureNum; ++i ) { result |= this->GetTextures( i ).Setup(allocator, graphicsFile); } s32 skeletalAnimNum = this->GetSkeletalAnimsCount(); for ( int i = 0; i < skeletalAnimNum; ++i ) { result |= this->GetSkeletalAnims( i ).Setup(allocator, graphicsFile); } s32 materialAnimNum = this->GetMaterialAnimsCount(); for ( int i = 0; i < materialAnimNum; ++i ) { result |= this->GetMaterialAnims( i ).Setup(allocator, graphicsFile); } s32 visibilityAnimNum = this->GetVisibilityAnimsCount(); for ( int i = 0; i < visibilityAnimNum; ++i ) { result |= this->GetVisibilityAnims( i ).Setup(allocator, graphicsFile); } s32 cameraAnimNum = this->GetCameraAnimsCount(); for ( int i = 0; i < cameraAnimNum; ++i ) { result |= this->GetCameraAnims( i ).Setup(allocator, graphicsFile); } s32 lightAnimNum = this->GetLightAnimsCount(); for ( int i = 0; i < lightAnimNum; ++i ) { result |= this->GetLightAnims( i ).Setup(allocator, graphicsFile); } s32 modelNum = this->GetModelsCount(); for ( int i = 0; i < modelNum; ++i ) { result |= this->GetModels( i ).Setup(allocator, graphicsFile); } return result; } //---------------------------------------------------------------------------- void ResGraphicsFile::Cleanup() { NW_ASSERT( this->IsValid() ); ut::SafeCleanupAll(this->GetModels()); ut::SafeCleanupAll(this->GetLightAnims()); ut::SafeCleanupAll(this->GetCameraAnims()); ut::SafeCleanupAll(this->GetVisibilityAnims()); ut::SafeCleanupAll(this->GetMaterialAnims()); ut::SafeCleanupAll(this->GetSkeletalAnims()); ut::SafeCleanupAll(this->GetTextures()); ut::SafeCleanupAll(this->GetShaders()); ut::SafeCleanupAll(this->GetFogs()); ut::SafeCleanupAll(this->GetLights()); ut::SafeCleanupAll(this->GetLutSets()); } } /* namespace res */ } /* namespace gfx */ } /* namespace nw */