/*---------------------------------------------------------------------------* Project: NintendoWare File: gfx_ParticleContext.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: 31311 $ *---------------------------------------------------------------------------*/ #include "precompiled.h" #include namespace nw { namespace gfx { //---------------------------------------- ParticleContext* ParticleContext::Builder::Create( os::IAllocator* allocator ) { NW_NULL_ASSERT(allocator); VEC3Array emissionPositions(allocator); U16Array emissionParents(allocator); F32Array particleWorkF32(allocator); VEC3Array prevTranslate(allocator); if (m_IsFixedSizeMemory) { emissionPositions = VEC3Array(this->m_MaxEmission, allocator); emissionParents = U16Array(this->m_MaxEmission, allocator); particleWorkF32 = F32Array(this->m_MaxStreamLength, allocator); if (this->m_UseDoubleBuffer) { prevTranslate = VEC3Array(this->m_MaxStreamLength, allocator); } } else { #ifndef NW_MOVE_ARRAY_VARIABILITY_ENABLED NW_FATAL_ERROR("Can't disable IsFixedSizeMemory without NW_MOVE_ARRAY_VARIABILITY_ENABLED"); #endif } void* memory = allocator->Alloc(sizeof(ParticleContext)); NW_NULL_ASSERT(memory); ParticleContext* context = new(memory) ParticleContext( allocator, emissionPositions, emissionParents, particleWorkF32, prevTranslate); return context; } } // namespace gfx } // namespace nw