1 /*---------------------------------------------------------------------------*
2 Project: NintendoWare
3 File: gfx_ParticleContext.cpp
4
5 Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved.
6
7 These coded instructions, statements, and computer programs contain
8 proprietary information of Nintendo of America Inc. and/or Nintendo
9 Company Ltd., and are protected by Federal copyright law. They may
10 not be disclosed to third parties or copied or duplicated in any form,
11 in whole or in part, without the prior written consent of Nintendo.
12
13 $Revision: 19592 $
14 *---------------------------------------------------------------------------*/
15
16 #include "precompiled.h"
17
18 #include <nw/gfx/gfx_ParticleContext.h>
19
20 namespace nw
21 {
22 namespace gfx
23 {
24
25 //----------------------------------------
26 ParticleContext*
Create(os::IAllocator * allocator)27 ParticleContext::Builder::Create(
28 os::IAllocator* allocator
29 )
30 {
31 NW_NULL_ASSERT(allocator);
32
33 VEC3Array emissionPositions(allocator);
34 U16Array emissionParents(allocator);
35 F32Array particleWorkF32(allocator);
36
37 if (m_IsFixedSizeMemory)
38 {
39 emissionPositions = VEC3Array(this->m_MaxEmission, allocator);
40 emissionParents = U16Array(this->m_MaxEmission, allocator);
41 particleWorkF32 = F32Array(this->m_MaxStreamLength, allocator);
42 }
43
44 void* memory = allocator->Alloc(sizeof(ParticleContext));
45 NW_NULL_ASSERT(memory);
46
47 ParticleContext* context = new(memory) ParticleContext(
48 allocator, emissionPositions, emissionParents, particleWorkF32);
49
50 return context;
51 }
52
53 } // namespace gfx
54 } // namespace nw
55