1 /*---------------------------------------------------------------------------*
2 Project: NintendoWare
3 File: gfx_LightSet.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: 17657 $
14 *---------------------------------------------------------------------------*/
15
16 #include "precompiled.h"
17 #include <nw/gfx/gfx_LightSet.h>
18
19 namespace nw
20 {
21 namespace gfx
22 {
23
24 NW_UT_RUNTIME_TYPEINFO_ROOT_DEFINITION(LightSet);
25
26 //----------------------------------------
27 LightSet*
Create(os::IAllocator * allocator)28 LightSet::DynamicBuilder::Create(
29 os::IAllocator* allocator
30 )
31 {
32 NW_NULL_ASSERT(allocator);
33
34 void* memory = allocator->Alloc(sizeof(LightSet));
35 NW_NULL_ASSERT(memory);
36 LightSet* lightSet = new(memory) LightSet(
37 allocator,
38 ResLightSet(NULL),
39 m_Description);
40
41 return lightSet;
42 }
43
44 //----------------------------------------
45 LightSet*
Create(ResLightSet resource,os::IAllocator * allocator)46 LightSet::Create(
47 ResLightSet resource,
48 os::IAllocator* allocator
49 )
50 {
51 NW_NULL_ASSERT(allocator);
52 NW_ASSERT(resource.IsValid());
53
54 void* memory = allocator->Alloc(sizeof(LightSet));
55 NW_NULL_ASSERT(memory);
56
57 LightSet::Description description;
58 description.maxVertexLights = resource.GetLightsCount();
59
60 LightSet* lightSet = new(memory) LightSet(
61 allocator,
62 resource,
63 description);
64
65 return lightSet;
66 }
67
68 } // namespace gfx
69 } // namespace nw
70