1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     SmModel.h
4 
5   Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain proprietary
8   information of Nintendo and/or its licensed developers and are protected by
9   national and international copyright laws. They may not be disclosed to third
10   parties or copied or duplicated in any form, in whole or in part, without the
11   prior written consent of Nintendo.
12 
13   The content herein is highly confidential and should be handled accordingly.
14 
15   $Revision: $
16  *---------------------------------------------------------------------------*/
17 #ifndef SM_MODEL_H_
18 #define SM_MODEL_H_
19 
20 #include <nw/gfx.h>
21 #include "../include/SmBase.h"
22 
23 //------------------------------------------------------------------------------
24 // NW4C ���f���e�@�\�ւ̃A�N�Z�T�N���X
25 class SmModel : public SmBase
26 {
27     friend class GfxCtrl;
28 
29     // �A�j���[�V�����z��
30     #define ANIM_COUNT (32)
31     typedef nw::ut::FixedSizeArray<nw::gfx::TransformAnimEvaluator*, ANIM_COUNT> AnimEvaluatorArray;
32 
33 
34 private:
35     // �R���X�g���N�^
36     SmModel();
37 
38     // �R���X�g���N�^
39     ~SmModel();
40 
41 public:
42     // �m�[�h���Z�b�g����
43     void SetSceneNode( nw::gfx::SceneNode* pParentNode, nw::gfx::SceneNode* pSceneNode );
44 
45     // �m�[�h���擾����
GetSceneNode()46     nw::gfx::SceneNode* GetSceneNode() const { return m_pSceneNode; }
47 
48     // ���f�����Z�b�g����
49     void SetModel( nw::gfx::Model* pModel, nw::gfx::SkeletalModel* pSkelModel );
50 
51     // �A�b�v�f�[�g
52     void Update();
53 
54     /*
55         �z�u�@�\
56     */
57     // �ʒu
58     void SetPosition( f32 x, f32 y, f32 z );
59 
60     // �g�k
61     void SetScale( f32 x, f32 y, f32 z );
62 
63     // ��]
64     void SetRotate( f32 x, f32 y, f32 z );
65 
66     // �}�g���N�X
67     void SetMatrix( const nw::math::MTX34* matrix );
68     void SetWorldMatrix( const nw::math::MTX34* matrix );
69 
70 
71     // �\��/��\��
72     void SetVisible( bool visible );
73     void SwapVisible();
74     bool IsVisible();
75 
76     // ��������
77     SmModel* Duplicate();
78 
79     /*
80         �A�j���[�V�����@�\
81     */
82     // �A�j���[�V������lj�����
83     void AddAnimEvaluator( nw::gfx::TransformAnimEvaluator* animEvaluator );
84 
85     // �A�j���[�V���������擾����
86     uint GetAnimEvaluatorNum() const;
87 
88     // �A�j���[�V������ݒ肷��
89     bool SetAnimEvaluatorNo( uint animEvaluatorNo );
90 
91     // �A�j���[�V�����t���[����ݒ肷��
92     void SetAnimationFrame( f32 setFrame );
93 
94     // �A�j���[�V�����t���[����i�߂�
95     bool AddAnimationFrame( f32 addFrame, bool loop = true );
96 
97     // �A�j���[�V�����t���[�����擾����
98     f32 GetAnimationFrame() const;
99 
100     // �ݒ肳��Ă���A�j���[�V�����̍ő�t���[�����擾����
101     f32 GetAnimationMaxFrame() const;
102 
103 
104     /*
105         �}�e���A���A�j���[�V�����@�\
106     */
107     // �}�e���A���A�j���[�V������ݒ肷��
108     bool SetMaterialAnim( nw::gfx::AnimEvaluator* animEvaluator );
109 
110 
111     /*
112         �e�q�p������������@�\
113     */
114     void SetConstrainId( s32 nodeId );
115 
116     /*
117         �e�X�g�@�\
118     */
119     void SetVisibleZone( f32 term );
SetLayerId(u8 id)120     void SetLayerId( u8 id )
121     {
122          if ( m_SkeletalModel )
123         {
124             m_SkeletalModel->SetLayerId( id );
125         }
126     }
GetLayerId()127     u8 GetLayerId() const
128     {
129          if ( m_SkeletalModel )
130         {
131             return m_SkeletalModel->GetLayerId();
132         }
133 
134         return 0;
135     }
136 
137 private:
138     // �e�q�p��������
139     void updateConstrain();
140 
141 private:
142     nw::gfx::SceneNode*         m_pParentNode;
143     nw::gfx::SceneNode*         m_pSceneNode;
144 
145     nw::gfx::Model*             m_Model;
146     nw::gfx::SkeletalModel*     m_SkeletalModel;
147 
148     AnimEvaluatorArray          m_AnimEvaluatorArray;
149     f32                         m_AnimationFrame;
150     s32                         m_CurrentAnimEvNo;
151 
152     s32                         m_CostrainId;
153 
154     bool                        m_Duplicated;
155 };
156 
157 #endif  // SM_MODEL_H_
158