1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     SmModel.h
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: 1 $
14  *---------------------------------------------------------------------------*/
15 #ifndef SM_MODEL_H_
16 #define SM_MODEL_H_
17 
18 #include <nw/gfx.h>
19 #include "../include/SmBase.h"
20 
21 //------------------------------------------------------------------------------
22 // NW4C ���f���e�@�\�ւ̃A�N�Z�T�N���X
23 class SmModel : public SmBase
24 {
25     friend class GfxCtrl;
26 
27     // �A�j���[�V�����z��
28     #define ANIM_COUNT (32)
29     typedef nw::ut::FixedSizeArray<nw::gfx::TransformAnimEvaluator*, ANIM_COUNT> AnimEvaluatorArray;
30 
31 
32 private:
33     // �R���X�g���N�^
34     SmModel();
35 
36     // �R���X�g���N�^
37     ~SmModel();
38 
39 public:
40     // �m�[�h���Z�b�g����
41     void SetSceneNode( nw::gfx::SceneNode* pParentNode, nw::gfx::SceneNode* pSceneNode );
42 
43     // �m�[�h���擾����
GetSceneNode()44     nw::gfx::SceneNode* GetSceneNode() const { return m_pSceneNode; }
45 
46     // ���f�����Z�b�g����
47     void SetModel( nw::gfx::Model* pModel, nw::gfx::SkeletalModel* pSkelModel );
48 
49     // �A�b�v�f�[�g
50     void Update();
51 
52     /*
53         �z�u�@�\
54     */
55     // �ʒu
56     void SetPosition( f32 x, f32 y, f32 z );
57 
58     // �g�k
59     void SetScale( f32 x, f32 y, f32 z );
60 
61     // ��]
62     void SetRotate( f32 x, f32 y, f32 z );
63 
64     // �}�g���N�X
65     void SetMatrix( const nw::math::MTX34* matrix );
66     void SetWorldMatrix( const nw::math::MTX34* matrix );
67 
68 
69     // �\��/��\��
70     void SetVisible( bool visible );
71     void SwapVisible();
72     bool IsVisible();
73 
74     // ��������
75     SmModel* Duplicate();
76 
77     /*
78         �A�j���[�V�����@�\
79     */
80     // �A�j���[�V������lj�����
81     void AddAnimEvaluator( nw::gfx::TransformAnimEvaluator* animEvaluator );
82 
83     // �A�j���[�V���������擾����
84     uint GetAnimEvaluatorNum() const;
85 
86     // �A�j���[�V������ݒ肷��
87     bool SetAnimEvaluatorNo( uint animEvaluatorNo );
88 
89     // �A�j���[�V�����t���[����ݒ肷��
90     void SetAnimationFrame( f32 setFrame );
91 
92     // �A�j���[�V�����t���[����i�߂�
93     bool AddAnimationFrame( f32 addFrame, bool loop = true );
94 
95     // �A�j���[�V�����t���[�����擾����
96     f32 GetAnimationFrame() const;
97 
98     // �ݒ肳��Ă���A�j���[�V�����̍ő�t���[�����擾����
99     f32 GetAnimationMaxFrame() const;
100 
101 
102     /*
103         �}�e���A���A�j���[�V�����@�\
104     */
105     // �}�e���A���A�j���[�V������ݒ肷��
106     bool SetMaterialAnim( nw::gfx::AnimEvaluator* animEvaluator );
107 
108 
109     /*
110         �e�q�p������������@�\
111     */
112     void SetConstrainId( s32 nodeId );
113 
114     /*
115         �e�X�g�@�\
116     */
117     void SetVisibleZone( f32 term );
SetLayerId(u8 id)118     void SetLayerId( u8 id )
119     {
120          if ( m_SkeletalModel )
121         {
122             m_SkeletalModel->SetLayerId( id );
123         }
124     }
GetLayerId()125     u8 GetLayerId() const
126     {
127          if ( m_SkeletalModel )
128         {
129             return m_SkeletalModel->GetLayerId();
130         }
131 
132         return 0;
133     }
134 
135 private:
136     // �e�q�p��������
137     void updateConstrain();
138 
139 private:
140     nw::gfx::SceneNode*         m_pParentNode;
141     nw::gfx::SceneNode*         m_pSceneNode;
142 
143     nw::gfx::Model*             m_Model;
144     nw::gfx::SkeletalModel*     m_SkeletalModel;
145 
146     AnimEvaluatorArray          m_AnimEvaluatorArray;
147     f32                         m_AnimationFrame;
148     s32                         m_CurrentAnimEvNo;
149 
150     s32                         m_CostrainId;
151 
152     bool                        m_Duplicated;
153 };
154 
155 #endif  // SM_MODEL_H_
156