1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     gfx_AnimHelper.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: 19657 $
14  *---------------------------------------------------------------------------*/
15 
16 #include "precompiled.h"
17 
18 #include <nw/gfx/gfx_AnimHelper.h>
19 #include <nw/gfx/res/gfx_ResMaterial.h>
20 
21 namespace nw {
22 namespace gfx {
23 
24 //-----------------------------------------------------------------------------
25 void*
GetBaseObject(nw::gfx::ResMaterial resMat,const char * name)26 GetBaseObject(nw::gfx::ResMaterial resMat, const char* name)
27 {
28     // TODO: 仮実装。辞書を使用した処理の最適化が必要。
29 
30     if (std::strcmp(name, "MaterialColor") == 0)
31     {
32         return resMat.GetMaterialColor().ptr();
33     }
34     else if (std::strcmp(name, "TextureCoordinators[0]") == 0)
35     {
36         return resMat.GetTextureCoordinators(0).ptr();
37     }
38     else if (std::strcmp(name, "TextureCoordinators[1]") == 0)
39     {
40         return resMat.GetTextureCoordinators(1).ptr();
41     }
42     else if (std::strcmp(name, "TextureCoordinators[2]") == 0)
43     {
44         return resMat.GetTextureCoordinators(2).ptr();
45     }
46     else if (std::strcmp(name, "TextureMappers[0]") == 0)
47     {
48         return resMat.GetTextureMappers(0).ptr();
49     }
50     else if (std::strcmp(name, "TextureMappers[1]") == 0)
51     {
52         return resMat.GetTextureMappers(1).ptr();
53     }
54     else if (std::strcmp(name, "TextureMappers[2]") == 0)
55     {
56         return resMat.GetTextureMappers(2).ptr();
57     }
58     else if (std::strcmp(name, "TextureMappers[0].Sampler") == 0)
59     {
60         return reinterpret_cast<ResTextureSamplerData*>(resMat.GetTextureMappers(0).ref().toSampler.to_ptr());
61     }
62     else if (std::strcmp(name, "TextureMappers[1].Sampler") == 0)
63     {
64         return reinterpret_cast<ResTextureSamplerData*>(resMat.GetTextureMappers(1).ref().toSampler.to_ptr());
65     }
66     else if (std::strcmp(name, "TextureMappers[2].Sampler") == 0)
67     {
68         return reinterpret_cast<ResTextureSamplerData*>(resMat.GetTextureMappers(2).ref().toSampler.to_ptr());
69     }
70     else if (std::strcmp(name, "FragmentOperation.BlendOperation") == 0)
71     {
72         return resMat.GetFragmentOperation().GetBlendOperation().ptr();
73     }
74     else
75     {
76         NW_ASSERT(false);
77         return NULL;
78     }
79 }
80 
81 
82 
83 } // namespace gfx
84 } // namespace nw
85