00001
00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024
00025
00026 #if !defined(AFX_OBJECT_VIEWER_H__9B22CB84_1929_11D5_9CD4_0050DAC3A412__INCLUDED_)
00027 #define AFX_OBJECT_VIEWER_H__9B22CB84_1929_11D5_9CD4_0050DAC3A412__INCLUDED_
00028
00029 #if _MSC_VER > 1000
00030 #pragma once
00031 #endif // _MSC_VER > 1000
00032
00033 #ifndef __AFXWIN_H__
00034 #error include 'stdafx.h' before including this file for PCH
00035 #endif
00036
00037 #define REGKEY_OBJ_VIEW "Software\\Nevrax\\nel\\object_viewer"
00038 #define REGKEY_OBJ_VIEW_OPENGL_WND "Software\\Nevrax\\nel\\object_viewer\\opengl_wnd"
00039 #define REGKEY_OBJ_VIEW_SCENE_DLG "Software\\Nevrax\\nel\\object_viewer\\scene_dlg"
00040 #define REGKEY_OBJ_VIEW_ANIMATION_DLG "Software\\Nevrax\\nel\\object_viewer\\animation_dlg"
00041 #define REGKEY_OBJ_VIEW_ANIMATION_SET_DLG "Software\\Nevrax\\nel\\object_viewer\\animation_set_dlg"
00042 #define REGKEY_OBJ_VIEW_SLOT_DLG "Software\\Nevrax\\nel\\object_viewer\\slot_dlg"
00043
00044 #include "resource.h"
00045 #include "object_viewer_interface.h"
00046 #include "main_dlg.h"
00047 #include "animation_set_dlg.h"
00048 #include "animation_dlg.h"
00049 #include "scene_dlg.h"
00050 #include <nel/3d/animation_set.h>
00051 #include <nel/3d/channel_mixer.h>
00052 #include <nel/3d/shape.h>
00053 #include <nel/3d/event_mouse_listener.h>
00054 #include <nel/3d/light.h>
00055 #include <nel/misc/event_listener.h>
00056 #include <nel/misc/stream.h>
00057
00059
00060
00061
00062
00063 class CObject_viewerApp : public CWinApp
00064 {
00065 public:
00066 CObject_viewerApp();
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 DECLARE_MESSAGE_MAP()
00078 };
00079
00080
00082
00083 class CMeshDesc
00084 {
00085 public:
00086 CMeshDesc () {};
00087 CMeshDesc (const char* meshName, const char* skeletonName)
00088 {
00089 MeshName=meshName;
00090 SkeletonName=skeletonName;
00091 }
00092 std::string MeshName;
00093 std::string SkeletonName;
00094 void serial (NLMISC::IStream& s)
00095 {
00096 int ver=s.serialVersion (0);
00097 s.serial (MeshName);
00098 s.serial (SkeletonName);
00099 }
00100 };
00101
00102 class CObjectViewer : public IObjectViewer, public NLMISC::IEventListener
00103 {
00104 friend class CSceneDlg;
00105 friend class CAnimationSetDlg;
00106 public:
00107 CObjectViewer ();
00108 ~CObjectViewer ();
00109
00110
00111 void initUI ();
00112
00113
00114 void go ();
00115
00116
00117 void releaseUI ();
00118
00119
00120 void setSingleAnimation (NL3D::CAnimation* pAnim, const char* name);
00121
00122
00123 NL3D::CTransformShape *addMesh (NL3D::IShape* pMeshShape, NL3D::IShape* pSkelShape, const char* meshName, const char* skelName, const char *animBaseName);
00124
00125
00126 bool loadMesh (const char* meshFilename, const char* skeleton="");
00127
00128
00129 void setAmbientColor (const NLMISC::CRGBA& color);
00130
00131
00132 void setLight (unsigned char id, const NL3D::CLight& light);
00133
00134
00135 void resetCamera ();
00136
00137
00138 virtual void operator ()(const NLMISC::CEvent& event);
00139
00140
00141 void setAnimTime (float animStart, float animEnd);
00142
00143
00144 void resetSlots ();
00145
00146
00147 void reinitChannels ();
00148
00149
00150 float getFrameRate ();
00151
00152
00153 void serial (NLMISC::IStream& f);
00154
00155 private:
00156 CAnimationDlg *_AnimationDlg;
00157 CMainDlg *_SlotDlg;
00158 CAnimationSetDlg *_AnimationSetDlg;
00159 CSceneDlg *_SceneDlg;
00160 std::vector<std::string> _ListShapeBaseName;
00161 std::vector<CMeshDesc> _ListMeshes;
00162 std::vector<class NL3D::CTransformShape*> _ListTransformShape;
00163 NL3D::CAnimationSet _AnimationSet;
00164 NL3D::CChannelMixer _ChannelMixer;
00165 NL3D::CEvent3dMouseListener _MouseListener;
00166 NLMISC::CRGBA _HotSpotColor;
00167 float _HotSpotSize;
00168 };
00169
00170 void setRegisterWindowState (const CWnd *pWnd, const char* keyName);
00171 void getRegisterWindowState (CWnd *pWnd, const char* keyName, bool resize);
00172
00173
00174
00175
00176 #endif // !defined(AFX_OBJECT_VIEWER_H__9B22CB84_1929_11D5_9CD4_0050DAC3A412__INCLUDED_)