diff options
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/object_viewer_cpp-source.html | 896 |
1 files changed, 896 insertions, 0 deletions
diff --git a/docs/doxygen/nel/object_viewer_cpp-source.html b/docs/doxygen/nel/object_viewer_cpp-source.html new file mode 100644 index 00000000..af990629 --- /dev/null +++ b/docs/doxygen/nel/object_viewer_cpp-source.html @@ -0,0 +1,896 @@ +<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + <TITLE>nevrax.org : docs</TITLE> + <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css"> + <link href="doxygen.css" rel="stylesheet" type="text/css"> +</HEAD> +<BODY MARGINHEIGHT="0" MARGINWIDTH="0"> + +<!-- uplinks --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </TD> + </TR> +</TABLE> + +<!-- banner Nevrax --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%> + <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR> +</TABLE> + +<!-- main table --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + + <!------ Begin Box ------> + <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black> + <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF> + <TABLE cellspacing=0 cellpadding=1 border=0> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr> + </TABLE> + </TD></TR></TABLE></TD></TR></TABLE> + <!------ End Box ------> + + </TD> + <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + +<!-- title --> +<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td> +<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A> +</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""> +</td></tr></table> + + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>Documentation</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<!-- Generated by Doxygen 1.2.2 on Mon Jul 2 22:01:38 2001 --> +<center> +<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> </center> +<hr><h1>object_viewer.cpp</h1><a href="object_viewer_cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 +00007 <font class="comment">/* Copyright, 2000 Nevrax Ltd. +</font>00008 <font class="comment"> * +</font>00009 <font class="comment"> * This file is part of NEVRAX NEL. +</font>00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify +</font>00011 <font class="comment"> * it under the terms of the GNU General Public License as published by +</font>00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option) +</font>00013 <font class="comment"> * any later version. +</font>00014 <font class="comment"> +</font>00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but +</font>00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of +</font>00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +</font>00018 <font class="comment"> * General Public License for more details. +</font>00019 <font class="comment"> +</font>00020 <font class="comment"> * You should have received a copy of the GNU General Public License +</font>00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the +</font>00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +</font>00023 <font class="comment"> * MA 02111-1307, USA. +</font>00024 <font class="comment"> */</font> +00025 +00026 <font class="preprocessor">#include "<a class="code" href="plugin_max_nel_export_std_afx_h.html">std_afx.h</a>"</font> +00027 +<a name="l00028"></a><a class="code" href="object_viewer_cpp.html#a0">00028</a> <font class="preprocessor">#define OBJECT_VIEWER_EXPORT __declspec( dllexport ) +</font>00029 <font class="preprocessor"></font> +00030 <font class="preprocessor">#include "<a class="code" href="object_viewer_h.html">object_viewer.h</a>"</font> +00031 <font class="preprocessor">#include <<a class="code" href="nelu_h.html">3d/nelu.h</a>></font> +00032 <font class="preprocessor">#include <<a class="code" href="mesh_h.html">3d/mesh.h</a>></font> +00033 <font class="preprocessor">#include <<a class="code" href="transform_shape_h.html">3d/transform_shape.h</a>></font> +00034 <font class="preprocessor">#include <<a class="code" href="mesh_instance_h.html">3d/mesh_instance.h</a>></font> +00035 <font class="preprocessor">#include <<a class="code" href="skeleton_model_h.html">3d/skeleton_model.h</a>></font> +00036 <font class="preprocessor">#include <<a class="code" href="file_h.html">nel/misc/file.h</a>></font> +00037 <font class="preprocessor">#include <<a class="code" href="path_h.html">nel/misc/path.h</a>></font> +00038 <font class="preprocessor">#include <<a class="code" href="time_nl_h.html">nel/misc/time_nl.h</a>></font> +00039 +00040 <font class="preprocessor">#include "<a class="code" href="editable_range_h.html">editable_range.h</a>"</font> +00041 <font class="preprocessor">#include "<a class="code" href="located_properties_h.html">located_properties.h</a>"</font> +00042 <font class="preprocessor">#include "<a class="code" href="color_button_h.html">color_button.h</a>"</font> +00043 +00044 <font class="preprocessor">#ifdef _DEBUG +</font>00045 <font class="preprocessor"></font><font class="preprocessor">#define new DEBUG_NEW +</font>00046 <font class="preprocessor"></font><font class="preprocessor">#undef THIS_FILE +</font>00047 <font class="preprocessor"></font><font class="keyword">static</font> <font class="keywordtype">char</font> THIS_FILE[] = __FILE__; +00048 <font class="preprocessor">#endif +</font>00049 <font class="preprocessor"></font> +00050 <font class="keyword">using</font> <font class="keyword">namespace</font> NL3D; +00051 <font class="keyword">using</font> <font class="keyword">namespace</font> NLMISC; +00052 +00053 <font class="comment">//</font> +00054 <font class="comment">// Note!</font> +00055 <font class="comment">//</font> +00056 <font class="comment">// If this DLL is dynamically linked against the MFC</font> +00057 <font class="comment">// DLLs, any functions exported from this DLL which</font> +00058 <font class="comment">// call into MFC must have the AFX_MANAGE_STATE macro</font> +00059 <font class="comment">// added at the very beginning of the function.</font> +00060 <font class="comment">//</font> +00061 <font class="comment">// For example:</font> +00062 <font class="comment">//</font> +00063 <font class="comment">// extern "C" BOOL PASCAL EXPORT ExportedFunction()</font> +00064 <font class="comment">// {</font> +00065 <font class="comment">// AFX_MANAGE_STATE(AfxGetStaticModuleState());</font> +00066 <font class="comment">// // normal function body here</font> +00067 <font class="comment">// }</font> +00068 <font class="comment">//</font> +00069 <font class="comment">// It is very important that this macro appear in each</font> +00070 <font class="comment">// function, prior to any calls into MFC. This means that</font> +00071 <font class="comment">// it must appear as the first statement within the </font> +00072 <font class="comment">// function, even before any object variable declarations</font> +00073 <font class="comment">// as their constructors may generate calls into the MFC</font> +00074 <font class="comment">// DLL.</font> +00075 <font class="comment">//</font> +00076 <font class="comment">// Please see MFC Technical Notes 33 and 58 for additional</font> +00077 <font class="comment">// details.</font> +00078 <font class="comment">//</font> +00079 +00081 <font class="comment">// CObject_viewerApp</font> +00082 +00083 <a class="code" href="ViewColumn_cpp.html#a1">BEGIN_MESSAGE_MAP</a>(<a class="code" href="class_CObject_viewerApp.html">CObject_viewerApp</a>, <a class="code" href="class_CWinApp.html">CWinApp</a>) +00084 <font class="comment">//{{AFX_MSG_MAP(CObject_viewerApp)</font> +00085 <font class="comment">// NOTE - the ClassWizard will add and remove mapping macros here.</font> +00086 <font class="comment">// DO NOT EDIT what you see in these blocks of generated code!</font> +00087 <font class="comment">//}}AFX_MSG_MAP</font> +00088 END_MESSAGE_MAP() +00089 +00091 <font class="comment">// CObject_viewerApp construction</font> +00092 +00093 <a class="code" href="class_CObject_viewerApp.html#a0">CObject_viewerApp::CObject_viewerApp</a>()<font class="keyword"> +</font>00094 <font class="keyword"></font>{ +00095 <font class="comment">// TODO: add construction code here,</font> +00096 <font class="comment">// Place all significant initialization in InitInstance</font> +00097 } +00098 +00100 <font class="comment">// The one and only CObject_viewerApp object</font> +00101 +00102 <a class="code" href="class_CObject_viewerApp.html">CObject_viewerApp</a> theApp; +00103 +00104 <font class="comment">// ***************************************************************************</font> +00105 +<a name="l00106"></a><a class="code" href="class_CObjectViewer.html#a0">00106</a> <a class="code" href="class_CObjectViewer.html#a0">CObjectViewer::CObjectViewer</a> ()<font class="keyword"> +</font>00107 <font class="keyword"></font>{ +00108 AFX_MANAGE_STATE(AfxGetStaticModuleState()); +00109 _SlotDlg=NULL; +00110 _AnimationSetDlg=NULL; +00111 _AnimationDlg=NULL; +00112 _SceneDlg=NULL; +00113 _ParticleDlg = NULL ; +00114 +00115 <font class="comment">// Setup animation set</font> +00116 _ChannelMixer.<a class="code" href="class_NL3D__CChannelMixer.html#a1">setAnimationSet</a> (&_AnimationSet); +00117 +00118 <font class="comment">// Hotspot color</font> +00119 _HotSpotColor.R=255; +00120 _HotSpotColor.G=255; +00121 _HotSpotColor.B=0; +00122 _HotSpotColor.A=255; +00123 +00124 <font class="comment">// Hotspot size</font> +00125 _HotSpotSize=10.f; +00126 } +00127 +00128 <font class="comment">// ***************************************************************************</font> +00129 +<a name="l00130"></a><a class="code" href="class_CObjectViewer.html#a1">00130</a> <a class="code" href="class_CObjectViewer.html#a1">CObjectViewer::~CObjectViewer</a> ()<font class="keyword"> +</font>00131 <font class="keyword"></font>{ +00132 AFX_MANAGE_STATE(AfxGetStaticModuleState()); +00133 <font class="keywordflow">if</font> (_SlotDlg) +00134 <font class="keyword">delete</font> _SlotDlg; +00135 <font class="keywordflow">if</font> (_AnimationSetDlg) +00136 <font class="keyword">delete</font> _AnimationSetDlg; +00137 <font class="keywordflow">if</font> (_AnimationDlg) +00138 <font class="keyword">delete</font> _AnimationDlg; +00139 <font class="keywordflow">if</font> (_SceneDlg) +00140 <font class="keyword">delete</font> _SceneDlg; +00141 <font class="keywordflow">if</font> (_ParticleDlg) +00142 <font class="keyword">delete</font> _ParticleDlg ; +00143 } +00144 +00145 <font class="comment">// ***************************************************************************</font> +00146 +<a name="l00147"></a><a class="code" href="class_CObjectViewer.html#a2">00147</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a2">CObjectViewer::initUI</a> ()<font class="keyword"> +</font>00148 <font class="keyword"></font>{ +00149 AFX_MANAGE_STATE(AfxGetStaticModuleState()); +00150 +00151 <font class="comment">// The viewport</font> +00152 CViewport viewport; +00153 +00154 <font class="comment">// Init NELU</font> +00155 <a class="code" href="nel_3dsmax_shared_cpp.html#a2">CNELU::init</a> (640, 480, viewport); +00156 +00157 <font class="comment">// Create a cwnd</font> +00158 <a class="code" href="class_CWnd.html">CWnd</a> driverWnd; +00159 driverWnd.Attach((HWND)CNELU::Driver->getDisplay()); +00160 <a class="code" href="object_viewer_cpp.html#a3">getRegisterWindowState</a> (&driverWnd, REGKEY_OBJ_VIEW_OPENGL_WND, <font class="keyword">true</font>); +00161 +00162 <font class="comment">// Camera</font> +00163 CFrustum frustrum; +00164 frustrum.initPerspective( 75.f*(<font class="keywordtype">float</font>)Pi/180.f, 1.33f, 0.1f, 1000.f); +00165 CNELU::Camera->setFrustum (frustrum); +00166 +00167 +00168 <font class="comment">// Hide the main window</font> +00169 <font class="comment">//driverWnd.ShowWindow (SW_HIDE);</font> +00170 +00171 <font class="comment">// Create animation set dialog</font> +00172 _AnimationDlg=<font class="keyword">new</font> CAnimationDlg (<font class="keyword">this</font>, &driverWnd); +00173 _AnimationDlg->Create (IDD_ANIMATION); +00174 <a class="code" href="object_viewer_cpp.html#a3">getRegisterWindowState</a> (_AnimationDlg, REGKEY_OBJ_VIEW_ANIMATION_DLG, <font class="keyword">false</font>); +00175 +00176 <font class="comment">// Create animation set dialog</font> +00177 _AnimationSetDlg=<font class="keyword">new</font> <a class="code" href="class_CObjectViewer.html#l1">CAnimationSetDlg</a> (<font class="keyword">this</font>, &driverWnd); +00178 _AnimationSetDlg->Create (IDD_ANIMATION_SET); +00179 <a class="code" href="object_viewer_cpp.html#a3">getRegisterWindowState</a> (_AnimationSetDlg, REGKEY_OBJ_VIEW_ANIMATION_SET_DLG, <font class="keyword">false</font>); +00180 +00181 <font class="comment">// Create the main dialog</font> +00182 _SlotDlg=<font class="keyword">new</font> CMainDlg (<font class="keyword">this</font>, &driverWnd); +00183 _SlotDlg-><a class="code" href="class_CMainDlg.html#a1">init</a> (&_AnimationSet); +00184 _SlotDlg->Create (IDD_MAIN_DLG); +00185 <a class="code" href="object_viewer_cpp.html#a3">getRegisterWindowState</a> (_SlotDlg, REGKEY_OBJ_VIEW_SLOT_DLG, <font class="keyword">false</font>); +00186 +00187 <font class="comment">// Create animation set dialog</font> +00188 _SceneDlg=<font class="keyword">new</font> <a class="code" href="class_CObjectViewer.html#l0">CSceneDlg</a> (<font class="keyword">this</font>, &driverWnd); +00189 _SceneDlg->Create (IDD_SCENE); +00190 _SceneDlg->ShowWindow (TRUE); +00191 <a class="code" href="object_viewer_cpp.html#a3">getRegisterWindowState</a> (_SceneDlg, REGKEY_OBJ_VIEW_SCENE_DLG, <font class="keyword">false</font>); +00192 +00193 <font class="comment">// Create particle dialog</font> +00194 _ParticleDlg=<font class="keyword">new</font> CParticleDlg (&driverWnd, _SceneDlg); +00195 _ParticleDlg->Create (IDD_PARTICLE); +00196 <a class="code" href="object_viewer_cpp.html#a3">getRegisterWindowState</a> (_ParticleDlg, REGKEY_OBJ_PARTICLE_DLG, <font class="keyword">false</font>); +00197 +00198 +00199 <font class="comment">// Show the windows</font> +00200 <font class="comment">//driverWnd.ShowWindow (SW_SHOW);</font> +00201 +00202 <font class="comment">// Set current frame</font> +00203 <a class="code" href="class_CObjectViewer.html#a18">setAnimTime</a> (0.f, 100.f); +00204 +00205 <font class="comment">// Register this as listener</font> +00206 CNELU::EventServer.addListener (EventDestroyWindowId, <font class="keyword">this</font>); +00207 +00208 <font class="comment">// Add mouse listener to event server</font> +00209 _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a16">addToServer</a>(CNELU::EventServer); +00210 +00211 <font class="comment">// Detach the hwnd</font> +00212 driverWnd.Detach (); +00213 +00214 CNELU::Driver->activate (); +00215 } +00216 +00217 <font class="comment">// ***************************************************************************</font> +00218 +<a name="l00219"></a><a class="code" href="class_CObjectViewer.html#a13">00219</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a13">CObjectViewer::operator ()</a>(<font class="keyword">const</font> CEvent& event)<font class="keyword"> +</font>00220 <font class="keyword"></font>{ +00221 <font class="comment">// Destro window ?</font> +00222 <font class="keywordflow">if</font> (event==EventDestroyWindowId) +00223 { +00224 } +00225 } +00226 +00227 <font class="comment">// ***************************************************************************</font> +00228 +<a name="l00229"></a><a class="code" href="class_CObjectViewer.html#a3">00229</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a3">CObjectViewer::go</a> ()<font class="keyword"> +</font>00230 <font class="keyword"></font>{ +00231 AFX_MANAGE_STATE(AfxGetStaticModuleState()); +00232 +00233 <font class="keywordflow">do</font> +00234 { +00235 CNELU::Driver->activate (); +00236 +00237 <font class="comment">// Handle animation</font> +00238 _AnimationDlg-><a class="code" href="class_CAnimationDlg.html#a1">handle</a> (); +00239 +00240 <font class="comment">// Update the playlist</font> +00241 _SlotDlg-><a class="code" href="class_CMainDlg.html#a3">getSlot</a> (); +00242 +00243 <font class="comment">// Setup the channel mixer</font> +00244 _SlotDlg->Playlist.setupMixer (_ChannelMixer, _AnimationDlg-><a class="code" href="class_CAnimationDlg.html#a4">getTime</a>()); +00245 +00246 <font class="comment">// Animate the automatic animation in the scene</font> +00247 CNELU::Scene.animate( NLMISC::CTime::ticksToSecond( NLMISC::CTime::getPerformanceTime() ) ); +00248 +00249 <font class="comment">// Eval channel mixer for transform</font> +00250 _ChannelMixer.<a class="code" href="class_NL3D__CChannelMixer.html#a3">eval</a> (<font class="keyword">false</font>); +00251 +00252 <font class="comment">// Mouse listener</font> +00253 _SceneDlg->UpdateData(); +00254 +00255 +00256 +00257 <font class="comment">// Clear the buffers</font> +00258 <font class="comment">// CNELU::clearBuffers(CRGBA(120,120,120));</font> +00259 +00260 CNELU::clearBuffers(CRGBA(0,0,0)); +00261 +00262 <font class="comment">// Draw the scene</font> +00263 CNELU::Scene.render(); +00264 +00265 <font class="comment">// Draw the hotSpot</font> +00266 <font class="keywordflow">if</font> (_SceneDlg->ObjectMode) +00267 { +00268 <font class="keywordtype">float</font> radius=_HotSpotSize/2.f; +00269 CNELU::Driver->setupModelMatrix (CMatrix::Identity); +00270 CDRU::drawLine (_MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a15">getHotSpot</a>()+CVector (radius, 0, 0), _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a15">getHotSpot</a>()+CVector (-radius, 0, 0), _HotSpotColor, *CNELU::Driver); +00271 CDRU::drawLine (_MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a15">getHotSpot</a>()+CVector (0, radius, 0), _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a15">getHotSpot</a>()+CVector (0, -radius, 0), _HotSpotColor, *CNELU::Driver); +00272 CDRU::drawLine (_MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a15">getHotSpot</a>()+CVector (0, 0, radius), _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a15">getHotSpot</a>()+CVector (0, 0, -radius), _HotSpotColor, *CNELU::Driver); +00273 } +00274 +00275 <font class="comment">// Swap the buffers</font> +00276 CNELU::swapBuffers(); +00277 +00278 +00279 <font class="keywordflow">if</font> (_SceneDlg->ObjectMode) +00280 _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a6">setMouseMode</a> (CEvent3dMouseListener::edit3d); +00281 <font class="keywordflow">else</font> +00282 { +00283 _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a6">setMouseMode</a> (CEvent3dMouseListener::firstPerson); +00284 _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a12">setSpeed</a> (_SceneDlg->MoveSpeed); +00285 } +00286 +00287 +00288 <font class="comment">// Pump message from the server</font> +00289 CNELU::EventServer.pump(); +00290 +00291 <font class="keywordflow">if</font> (!_SceneDlg->MoveElement) +00292 { +00293 <font class="comment">// New matrix from camera</font> +00294 CNELU::Camera->setTransformMode (ITransformable::DirectMatrix); +00295 CNELU::Camera->setMatrix (_MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a13">getViewMatrix</a>()); +00296 } +00297 <font class="keywordflow">else</font> +00298 { +00299 <font class="comment">// for now we apply a transform on the selected object in the particle system </font> +00300 _ParticleDlg-><a class="code" href="class_CParticleDlg.html#a8">moveElement</a>(_MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a14">getModelMatrix</a>()) ; +00301 } +00302 +00303 <font class="comment">// Pump others message for the windows</font> +00304 MSG msg; +00305 <font class="keywordflow">while</font> ( PeekMessage(&msg, NULL,0,0,PM_REMOVE) ) +00306 { +00307 TranslateMessage(&msg); +00308 DispatchMessage(&msg); +00309 } +00310 } +00311 <font class="keywordflow">while</font> (!CNELU::AsyncListener.isKeyPushed(KeyESCAPE)&&CNELU::Driver->isActive()); +00312 } +00313 +00314 <font class="comment">// ***************************************************************************</font> +00315 +<a name="l00316"></a><a class="code" href="class_CObjectViewer.html#a4">00316</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a4">CObjectViewer::releaseUI</a> ()<font class="keyword"> +</font>00317 <font class="keyword"></font>{ +00318 AFX_MANAGE_STATE(AfxGetStaticModuleState()); +00319 +00320 <font class="keywordflow">if</font> (CNELU::Driver->isActive()) +00321 { +00322 <font class="comment">// register window position</font> +00323 <font class="keywordflow">if</font> (CNELU::Driver->getDisplay()) +00324 { +00325 <a class="code" href="class_CWnd.html">CWnd</a> driverWnd; +00326 driverWnd.Attach((HWND)CNELU::Driver->getDisplay()); +00327 <a class="code" href="object_viewer_cpp.html#a2">setRegisterWindowState</a> (&driverWnd, REGKEY_OBJ_VIEW_OPENGL_WND); +00328 driverWnd.Detach (); +00329 } +00330 } +00331 +00332 <font class="comment">// Release the emitter from the server</font> +00333 _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a17">removeFromServer</a> (CNELU::EventServer); +00334 +00335 <font class="comment">// Remove this as listener</font> +00336 CNELU::EventServer.removeListener (EventDestroyWindowId, <font class="keyword">this</font>); +00337 +00338 <font class="comment">// exit</font> +00339 CNELU::release(); +00340 } +00341 +00342 <font class="comment">// ***************************************************************************</font> +00343 +<a name="l00344"></a><a class="code" href="object_viewer_cpp.html#a2">00344</a> <font class="keywordtype">void</font> <a class="code" href="object_viewer_cpp.html#a2">setRegisterWindowState</a> (<font class="keyword">const</font> <a class="code" href="class_CWnd.html">CWnd</a> *pWnd, <font class="keyword">const</font> <font class="keywordtype">char</font>* keyName)<font class="keyword"> +</font>00345 <font class="keyword"></font>{ +00346 HKEY hKey; +00347 <font class="keywordflow">if</font> (RegCreateKey(HKEY_CURRENT_USER, keyName, &hKey)==ERROR_SUCCESS) +00348 { +00349 RECT rect; +00350 pWnd->GetWindowRect (&rect); +00351 RegSetValueEx(hKey, <font class="stringliteral">"Left"</font>, 0, REG_DWORD, (LPBYTE)&rect.left, 4); +00352 RegSetValueEx(hKey, <font class="stringliteral">"Right"</font>, 0, REG_DWORD, (LPBYTE)&rect.right, 4); +00353 RegSetValueEx(hKey, <font class="stringliteral">"Top"</font>, 0, REG_DWORD, (LPBYTE)&rect.top, 4); +00354 RegSetValueEx(hKey, <font class="stringliteral">"Bottom"</font>, 0, REG_DWORD, (LPBYTE)&rect.bottom, 4); +00355 } +00356 } +00357 +00358 <font class="comment">// ***************************************************************************</font> +00359 +<a name="l00360"></a><a class="code" href="object_viewer_cpp.html#a3">00360</a> <font class="keywordtype">void</font> <a class="code" href="object_viewer_cpp.html#a3">getRegisterWindowState</a> (<a class="code" href="class_CWnd.html">CWnd</a> *pWnd, <font class="keyword">const</font> <font class="keywordtype">char</font>* keyName, <font class="keywordtype">bool</font> resize)<font class="keyword"> +</font>00361 <font class="keyword"></font>{ +00362 HKEY hKey; +00363 <font class="keywordflow">if</font> (RegOpenKeyEx(HKEY_CURRENT_USER, keyName, 0, KEY_READ, &hKey)==ERROR_SUCCESS) +00364 { +00365 DWORD len=4; +00366 DWORD type; +00367 RECT rect; +00368 RegQueryValueEx (hKey, <font class="stringliteral">"Left"</font>, 0, &type, (LPBYTE)&rect.left, &len); +00369 RegQueryValueEx (hKey, <font class="stringliteral">"Right"</font>, 0, &type, (LPBYTE)&rect.right, &len); +00370 RegQueryValueEx (hKey, <font class="stringliteral">"Top"</font>, 0, &type, (LPBYTE)&rect.top, &len); +00371 RegQueryValueEx (hKey, <font class="stringliteral">"Bottom"</font>, 0, &type, (LPBYTE)&rect.bottom, &len); +00372 +00373 <font class="comment">// Set window pos</font> +00374 pWnd->SetWindowPos (NULL, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, SWP_NOOWNERZORDER|SWP_NOZORDER| +00375 (resize?0:SWP_NOSIZE)); +00376 } +00377 } +00378 +00379 <font class="comment">// ***************************************************************************</font> +00380 +<a name="l00381"></a><a class="code" href="class_CObjectViewer.html#a18">00381</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a18">CObjectViewer::setAnimTime</a> (<font class="keywordtype">float</font> animStart, <font class="keywordtype">float</font> animEnd)<font class="keyword"> +</font>00382 <font class="keyword"></font>{ +00383 <font class="comment">// Dispatch the command</font> +00384 _SlotDlg-><a class="code" href="class_CMainDlg.html#a2">setAnimTime</a> (animStart, animEnd); +00385 _AnimationDlg-><a class="code" href="class_CAnimationDlg.html#a2">setAnimTime</a> (animStart, animEnd); +00386 } +00387 +00388 <font class="comment">// ***************************************************************************</font> +00389 +00390 +<a name="l00391"></a><a class="code" href="class_CObjectViewer.html#a19">00391</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a19">CObjectViewer::resetSlots</a> ()<font class="keyword"> +</font>00392 <font class="keyword"></font>{ +00393 <font class="comment">// Reset the animation set</font> +00394 _AnimationSet.<a class="code" href="class_NL3D__CAnimationSet.html#a15">reset</a> (); +00395 +00396 <font class="comment">// Set no animation in slot UI</font> +00397 <font class="keywordflow">for</font> (uint i=0; i<NL3D::CChannelMixer::NumAnimationSlot; i++) +00398 _SlotDlg->Slots[i].setAnimation (0xffffffff, NULL, NULL); +00399 } +00400 +00401 <font class="comment">// ***************************************************************************</font> +00402 +<a name="l00403"></a><a class="code" href="class_CObjectViewer.html#a20">00403</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a20">CObjectViewer::reinitChannels</a> ()<font class="keyword"> +</font>00404 <font class="keyword"></font>{ +00405 <font class="comment">// Reset the channels</font> +00406 _ChannelMixer.<a class="code" href="class_NL3D__CChannelMixer.html#a5">resetChannels</a> (); +00407 +00408 <font class="comment">// Add all the instance in the channel mixer</font> +00409 <font class="keywordflow">for</font> (uint i=0; i<_ListTransformShape.size(); i++) +00410 _ListTransformShape[i]-><a class="code" href="class_NL3D__CTransform.html#a6">registerToChannelMixer</a> (&_ChannelMixer, _ListShapeBaseName[i]); +00411 } +00412 +00413 <font class="comment">// ***************************************************************************</font> +00414 +<a name="l00415"></a><a class="code" href="class_CObjectViewer.html#a21">00415</a> <font class="keywordtype">float</font> <a class="code" href="class_CObjectViewer.html#a21">CObjectViewer::getFrameRate</a> ()<font class="keyword"> +</font>00416 <font class="keyword"></font>{ +00417 <font class="keywordflow">return</font> _AnimationDlg->Speed; +00418 } +00419 +00420 <font class="comment">// ***************************************************************************</font> +00421 +<a name="l00422"></a><a class="code" href="class_CObjectViewer.html#a22">00422</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a22">CObjectViewer::serial</a> (<a class="code" href="class_NLMISC__IStream.html">NLMISC::IStream</a>& f)<font class="keyword"> +</font>00423 <font class="keyword"></font>{ +00424 <font class="comment">// serial "OBJV_CFG"</font> +00425 f.<a class="code" href="class_NLMISC__IStream.html#a52">serialCheck</a> ((uint32)'VJBO'); +00426 f.<a class="code" href="class_NLMISC__IStream.html#a52">serialCheck</a> ((uint32)'GFC_'); +00427 +00428 <font class="comment">// serial the version</font> +00429 <font class="keywordtype">int</font> ver=f.<a class="code" href="class_NLMISC__IStream.html#a51">serialVersion</a> (0); +00430 +00431 <font class="comment">// update data</font> +00432 _AnimationDlg->UpdateData (); +00433 _SceneDlg->UpdateData (); +00434 +00435 <font class="comment">// serial animation data</font> +00436 f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (_AnimationDlg->Start); +00437 f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (_AnimationDlg->End); +00438 f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (_AnimationDlg->Speed); +00439 <font class="keywordtype">bool</font> loop=_AnimationDlg->Loop!=0; +00440 f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (loop); +00441 _AnimationDlg->Loop=loop; +00442 <font class="keywordtype">bool</font> euler=_SceneDlg->Euler!=0; +00443 f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (euler); +00444 _SceneDlg->Euler=euler; +00445 sint32 ui=_AnimationDlg->UICurrentFrame; +00446 f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (ui); +00447 _AnimationDlg->UICurrentFrame=ui; +00448 f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (_AnimationDlg->CurrentFrame); +00449 +00450 <font class="comment">// update data</font> +00451 _AnimationDlg->UpdateData (FALSE); +00452 _SceneDlg->UpdateData (FALSE); +00453 +00454 <font class="comment">// For each slot</font> +00455 <font class="keywordflow">for</font> (uint i=0; i<NL3D::CChannelMixer::NumAnimationSlot; i++) +00456 { +00457 <font class="comment">// Update values</font> +00458 _SlotDlg->Slots[i].UpdateData(); +00459 +00460 <font class="comment">// Serial the slot state</font> +00461 <font class="keywordtype">bool</font> slotState=_SlotDlg->Slots[i].enable!=0; +00462 f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (slotState); +00463 _SlotDlg->Slots[i].enable=slotState; +00464 +00465 <font class="comment">// Update values</font> +00466 _SlotDlg->Slots[i].UpdateData(FALSE); +00467 } +00468 +00469 +00470 <font class="comment">// view matrix</font> +00471 CMatrix mt=_MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a13">getViewMatrix</a>(); +00472 f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (mt); +00473 _MouseListener.<a class="code" href="class_NL3D__CEvent3dMouseListener.html#a1">setMatrix</a> (mt); +00474 +00475 <font class="comment">// serial list of shape</font> +00476 std::vector<CMeshDesc> meshArray=_ListMeshes; +00477 +00478 <font class="comment">// serial list of shape</font> +00479 f.<a class="code" href="class_NLMISC__IStream.html#a29">serialCont</a> (meshArray); +00480 +00481 <font class="comment">// If reading, read shapes</font> +00482 <font class="keywordflow">if</font> (f.<a class="code" href="class_NLMISC__IStream.html#a4">isReading</a> ()) +00483 { +00484 <font class="comment">// Load each shape</font> +00485 <font class="keywordflow">for</font> (uint s=0; s<meshArray.size(); s++) +00486 <a class="code" href="class_CObjectViewer.html#a9">loadMesh</a> (meshArray[s].MeshName.c_str(), meshArray[s].SkeletonName.c_str()); +00487 } +00488 +00489 <font class="comment">// List of animation</font> +00490 std::vector<std::string> stringArray=_AnimationSetDlg->_ListAnimation; +00491 +00492 <font class="comment">// Serial the list</font> +00493 f.<a class="code" href="class_NLMISC__IStream.html#a29">serialCont</a> (stringArray); +00494 +00495 <font class="comment">// Serial the list of animation</font> +00496 <font class="keywordflow">if</font> (f.<a class="code" href="class_NLMISC__IStream.html#a4">isReading</a> ()) +00497 { +00498 <font class="comment">// Load animation file</font> +00499 <font class="keywordflow">for</font> (uint s=0; s<stringArray.size(); s++) +00500 _AnimationSetDlg-><a class="code" href="class_CAnimationSetDlg.html#b1">loadAnimation</a> (stringArray[s].c_str()); +00501 } +00502 +00503 <font class="comment">// List of skeleton</font> +00504 stringArray=_AnimationSetDlg->_ListSkeleton; +00505 +00506 <font class="comment">// Serial the list</font> +00507 f.<a class="code" href="class_NLMISC__IStream.html#a29">serialCont</a> (stringArray); +00508 +00509 <font class="comment">// Serial the list of animation</font> +00510 <font class="keywordflow">if</font> (f.<a class="code" href="class_NLMISC__IStream.html#a4">isReading</a> ()) +00511 { +00512 <font class="comment">// Load animation file</font> +00513 <font class="keywordflow">for</font> (uint s=0; s<stringArray.size(); s++) +00514 _AnimationSetDlg-><a class="code" href="class_CAnimationSetDlg.html#b3">loadSkeleton</a> (stringArray[s].c_str()); +00515 } +00516 +00517 <font class="comment">// Serial the play list</font> +00518 <font class="keywordflow">if</font> (f.<a class="code" href="class_NLMISC__IStream.html#a4">isReading</a> ()) +00519 { +00520 <font class="comment">// Serial the play list</font> +00521 f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (_SlotDlg->Playlist); +00522 +00523 <font class="comment">// Set the play list</font> +00524 _SlotDlg-><a class="code" href="class_CMainDlg.html#a4">setSlot</a> (); +00525 } +00526 <font class="keywordflow">else</font> +00527 { +00528 <font class="comment">// Set the play list</font> +00529 _SlotDlg-><a class="code" href="class_CMainDlg.html#a3">getSlot</a> (); +00530 +00531 <font class="comment">// Serial the play list</font> +00532 f.<a class="code" href="class_NLMISC__IStream.html#a5">serial</a> (_SlotDlg->Playlist); +00533 } +00534 +00535 <font class="comment">// Some init</font> +00536 <font class="keywordflow">if</font> (f.<a class="code" href="class_NLMISC__IStream.html#a4">isReading</a> ()) +00537 { +00538 <font class="comment">// Init start and end time</font> +00539 <a class="code" href="class_CObjectViewer.html#a18">setAnimTime</a> (_AnimationDlg->Start, _AnimationDlg->End); +00540 +00541 <font class="comment">// Touch the channel mixer</font> +00542 <a class="code" href="class_CObjectViewer.html#a20">reinitChannels</a> (); +00543 } +00544 } +00545 +00546 <font class="comment">// ***************************************************************************</font> +00547 +<a name="l00548"></a><a class="code" href="class_CObjectViewer.html#a9">00548</a> <font class="keywordtype">bool</font> <a class="code" href="class_CObjectViewer.html#a9">CObjectViewer::loadMesh</a> (<font class="keyword">const</font> <font class="keywordtype">char</font>* meshFilename, <font class="keyword">const</font> <font class="keywordtype">char</font>* skeleton)<font class="keyword"> +</font>00549 <font class="keyword"></font>{ +00550 AFX_MANAGE_STATE(AfxGetStaticModuleState()); +00551 +00552 <font class="comment">// Add to the path</font> +00553 <font class="keywordtype">char</font> drive[256]; +00554 <font class="keywordtype">char</font> dir[256]; +00555 <font class="keywordtype">char</font> path[256]; +00556 +00557 <font class="comment">// Add search path for the mesh</font> +00558 _splitpath (meshFilename, drive, dir, NULL, NULL); +00559 _makepath (path, drive, dir, NULL, NULL); +00560 CPath::addSearchPath (path); +00561 +00562 <font class="comment">// Add search path for the skeleton</font> +00563 <font class="keywordflow">if</font> (skeleton) +00564 { +00565 _splitpath (skeleton, drive, dir, NULL, NULL); +00566 _makepath (path, drive, dir, NULL, NULL); +00567 CPath::addSearchPath (path); +00568 } +00569 +00570 <font class="comment">// Shape pointer</font> +00571 IShape *shapeMesh=NULL; +00572 IShape *shapeSkel=NULL; +00573 +00574 <font class="comment">// Open a file</font> +00575 CIFile file; +00576 <font class="keywordflow">if</font> (file.open (meshFilename)) +00577 { +00578 <font class="comment">// Sream a shape</font> +00579 CShapeStream streamShape; +00580 <font class="keywordflow">try</font> +00581 { +00582 <font class="comment">// Stream it</font> +00583 streamShape.serial (file); +00584 +00585 <font class="comment">// Add the shape</font> +00586 shapeMesh=streamShape.getShapePointer(); +00587 } +00588 <font class="keywordflow">catch</font> (Exception& e) +00589 { +00590 _SceneDlg->MessageBox (e.what(), <font class="stringliteral">"NeL object viewer"</font>, MB_OK|MB_ICONEXCLAMATION); +00591 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00592 } +00593 } +00594 <font class="keywordflow">else</font> +00595 { +00596 <font class="comment">// Create a message</font> +00597 <font class="keywordtype">char</font> msg[512]; +00598 _snprintf (msg, 512, <font class="stringliteral">"Can't open the file %s for reading."</font>, meshFilename); +00599 _SceneDlg->MessageBox (msg, <font class="stringliteral">"NeL object viewer"</font>, MB_OK|MB_ICONEXCLAMATION); +00600 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00601 } +00602 +00603 <font class="comment">// Continue ?</font> +00604 <font class="keywordflow">if</font> (skeleton&&(strcmp (skeleton, <font class="stringliteral">""</font>)!=0)) +00605 { +00606 <font class="comment">// Skel error ?</font> +00607 <font class="keywordtype">bool</font> skelError=<font class="keyword">false</font>; +00608 +00609 <font class="keywordflow">if</font> (skeleton) +00610 { +00611 <font class="comment">// Open a file</font> +00612 <font class="keywordflow">if</font> (file.open (skeleton)) +00613 { +00614 <font class="comment">// Sream a shape</font> +00615 CShapeStream streamShape; +00616 <font class="keywordflow">try</font> +00617 { +00618 <font class="comment">// Stream it</font> +00619 streamShape.serial (file); +00620 +00621 <font class="comment">// Add the shape</font> +00622 shapeSkel=streamShape.getShapePointer(); +00623 } +00624 <font class="keywordflow">catch</font> (Exception& e) +00625 { +00626 _SceneDlg->MessageBox (e.what(), <font class="stringliteral">"NeL object viewer"</font>, MB_OK|MB_ICONEXCLAMATION); +00627 +00628 <font class="comment">// error</font> +00629 skelError=<font class="keyword">true</font>; +00630 } +00631 } +00632 <font class="keywordflow">else</font> +00633 { +00634 <font class="comment">// Create a message</font> +00635 <font class="keywordtype">char</font> msg[512]; +00636 _snprintf (msg, 512, <font class="stringliteral">"Can't open the file %s for reading."</font>, meshFilename); +00637 _SceneDlg->MessageBox (msg, <font class="stringliteral">"NeL object viewer"</font>, MB_OK|MB_ICONEXCLAMATION); +00638 +00639 <font class="comment">// error</font> +00640 skelError=<font class="keyword">true</font>; +00641 } +00642 } +00643 +00644 <font class="comment">// Remove the mesh shape ?</font> +00645 <font class="keywordflow">if</font> (skelError) +00646 { +00647 <font class="keywordflow">if</font> (shapeMesh) +00648 <font class="keyword">delete</font> shapeMesh; +00649 shapeMesh=NULL; +00650 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00651 } +00652 } +00653 +00654 <font class="comment">// Add the skel shape</font> +00655 <a class="code" href="class_NL3D__CSkeletonModel.html">NL3D::CSkeletonModel</a> *transformSkel=NULL; +00656 <font class="keywordflow">if</font> (shapeSkel) +00657 transformSkel=<a class="code" href="class_CObjectViewer.html#a8">addSkel</a> (shapeSkel, skeleton, <font class="stringliteral">""</font>); +00658 +00659 <font class="comment">// Add the skel shape</font> +00660 <font class="keywordflow">if</font> (shapeMesh) +00661 <a class="code" href="class_CObjectViewer.html#a7">addMesh</a> (shapeMesh, meshFilename, <font class="stringliteral">""</font>, transformSkel); +00662 +00663 <font class="comment">// Add an entry for config</font> +00664 _ListMeshes.push_back (<a class="code" href="class_CMeshDesc.html">CMeshDesc</a> (meshFilename, skeleton)); +00665 +00666 <font class="keywordflow">return</font> <font class="keyword">true</font>; +00667 } +00668 +00669 <font class="comment">// ***************************************************************************</font> +00670 +<a name="l00671"></a><a class="code" href="class_CObjectViewer.html#a12">00671</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a12">CObjectViewer::resetCamera</a> ()<font class="keyword"> +</font>00672 <font class="keyword"></font>{ +00673 AFX_MANAGE_STATE(AfxGetStaticModuleState()); +00674 +00675 _SceneDlg-><a class="code" href="class_CSceneDlg.html#b10">OnResetCamera</a>(); +00676 } +00677 +00678 <font class="comment">// ***************************************************************************</font> +00679 +<a name="l00680"></a><a class="code" href="class_CObjectViewer.html#a7">00680</a> CTransformShape *<a class="code" href="class_CObjectViewer.html#a7">CObjectViewer::addMesh</a> (<a class="code" href="class_NL3D__IShape.html">NL3D::IShape</a>* pMeshShape, <font class="keyword">const</font> <font class="keywordtype">char</font>* meshName, <font class="keyword">const</font> <font class="keywordtype">char</font> *meshBaseName, CSkeletonModel* pSkel)<font class="keyword"> +</font>00681 <font class="keyword"></font>{ +00682 AFX_MANAGE_STATE(AfxGetStaticModuleState()); +00683 +00684 <font class="comment">// *** Add the shape</font> +00685 +00686 <font class="comment">// Store the shape pointer</font> +00687 CNELU::ShapeBank->add (meshName, CSmartPtr<IShape> (pMeshShape)); +00688 +00689 <font class="comment">// Store the name of the shape</font> +00690 _ListShapeBaseName.push_back (meshBaseName); +00691 +00692 <font class="comment">// Create a model and add it to the scene</font> +00693 CTransformShape *pTrShape=CNELU::Scene.createInstance (meshName); +00694 <a class="code" href="debug_h.html#a6">nlassert</a> (pTrShape); +00695 +00696 <font class="comment">// Set the rot model</font> +00697 <font class="keywordflow">if</font> (_SceneDlg->Euler) +00698 pTrShape->setTransformMode (ITransformable::RotEuler); +00699 <font class="keywordflow">else</font> +00700 pTrShape->setTransformMode (ITransformable::RotQuat); +00701 +00702 <font class="comment">// Store the transform shape pointer</font> +00703 _ListTransformShape.push_back (pTrShape); +00704 +00705 <font class="comment">// *** Bind to the skeleton</font> +00706 +00707 <font class="comment">// Get a mesh instance</font> +00708 CMeshInstance *meshInstance=dynamic_cast<CMeshInstance*>(pTrShape); +00709 +00710 <font class="comment">// Bind the mesh</font> +00711 <font class="keywordflow">if</font> (pSkel) +00712 pSkel->bindSkin (meshInstance); +00713 +00714 <font class="comment">// Return the instance</font> +00715 <font class="keywordflow">return</font> pTrShape; +00716 } +00717 +00718 <font class="comment">// ***************************************************************************</font> +00719 +<a name="l00720"></a><a class="code" href="class_CObjectViewer.html#a8">00720</a> CSkeletonModel *<a class="code" href="class_CObjectViewer.html#a8">CObjectViewer::addSkel</a> (<a class="code" href="class_NL3D__IShape.html">NL3D::IShape</a>* pSkelShape, <font class="keyword">const</font> <font class="keywordtype">char</font>* skelName, <font class="keyword">const</font> <font class="keywordtype">char</font> *skelBaseName)<font class="keyword"> +</font>00721 <font class="keyword"></font>{ +00722 AFX_MANAGE_STATE(AfxGetStaticModuleState()); +00723 +00724 <font class="comment">// *** Add the shape</font> +00725 +00726 <font class="comment">// Store the shape pointer</font> +00727 CNELU::ShapeBank->add (skelName, CSmartPtr<IShape> (pSkelShape)); +00728 +00729 <font class="comment">// Create a model and add it to the scene</font> +00730 CTransformShape *pTrShape=CNELU::Scene.createInstance (skelName); +00731 <a class="code" href="debug_h.html#a6">nlassert</a> (pTrShape); +00732 +00733 <font class="comment">// Get a skeleton model</font> +00734 CSkeletonModel *skelModel=dynamic_cast<CSkeletonModel*>(pTrShape); +00735 +00736 <font class="comment">// Is a skel ?</font> +00737 <font class="keywordflow">if</font> (skelModel) +00738 { +00739 <font class="comment">// Set the rot model</font> +00740 <font class="keywordflow">if</font> (_SceneDlg->Euler) +00741 pTrShape->setTransformMode (ITransformable::RotEuler); +00742 <font class="keywordflow">else</font> +00743 pTrShape->setTransformMode (ITransformable::RotQuat); +00744 +00745 <font class="comment">// Store the name of the shape</font> +00746 _ListShapeBaseName.push_back (skelBaseName); +00747 +00748 <font class="comment">// Store the transform shape pointer</font> +00749 _ListTransformShape.push_back (skelModel); +00750 } +00751 +00752 <font class="comment">// Return the instance</font> +00753 <font class="keywordflow">return</font> skelModel; +00754 } +00755 +00756 <font class="comment">// ***************************************************************************</font> +00757 +<a name="l00758"></a><a class="code" href="class_IObjectViewer.html#d0">00758</a> <a class="code" href="class_IObjectViewer.html">IObjectViewer</a>* <a class="code" href="class_IObjectViewer.html#d0">IObjectViewer::getInterface</a> (<font class="keywordtype">int</font> version)<font class="keyword"> +</font>00759 <font class="keyword"></font>{ +00760 AFX_MANAGE_STATE(AfxGetStaticModuleState()); +00761 +00762 <font class="comment">// Check version number</font> +00763 <font class="keywordflow">if</font> (version!=OBJECT_VIEWER_VERSION) +00764 { +00765 MessageBox (NULL, <font class="stringliteral">"Bad version of object_viewer.dll."</font>, <font class="stringliteral">"NeL object viewer"</font>, MB_ICONEXCLAMATION|MB_OK); +00766 <font class="keywordflow">return</font> NULL; +00767 } +00768 <font class="keywordflow">else</font> +00769 <font class="keywordflow">return</font> <font class="keyword">new</font> <a class="code" href="class_CObjectViewer.html">CObjectViewer</a>; +00770 } +00771 +00772 <font class="comment">// ***************************************************************************</font> +00773 +<a name="l00774"></a><a class="code" href="class_IObjectViewer.html#d1">00774</a> <font class="keywordtype">void</font> <a class="code" href="class_IObjectViewer.html#d1">IObjectViewer::releaseInterface</a> (<a class="code" href="class_IObjectViewer.html">IObjectViewer</a>* view)<font class="keyword"> +</font>00775 <font class="keyword"></font>{ +00776 AFX_MANAGE_STATE(AfxGetStaticModuleState()); +00777 +00778 <font class="keyword">delete</font> view; +00779 } +00780 +00781 <font class="comment">// ***************************************************************************</font> +00782 +<a name="l00783"></a><a class="code" href="class_CObjectViewer.html#a5">00783</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a5">CObjectViewer::setSingleAnimation</a> (<a class="code" href="class_NL3D__CAnimation.html">NL3D::CAnimation</a>* pAnim, <font class="keyword">const</font> <font class="keywordtype">char</font>* name)<font class="keyword"> +</font>00784 <font class="keyword"></font>{ +00785 AFX_MANAGE_STATE(AfxGetStaticModuleState()); +00786 +00787 <font class="comment">// Add the animation to the animationSet</font> +00788 _AnimationSetDlg->UpdateData (TRUE); +00789 _AnimationSetDlg-><a class="code" href="class_CAnimationSetDlg.html#b2">addAnimation</a> (pAnim, name); +00790 _AnimationSetDlg->UpdateData (FALSE); +00791 +00792 <font class="comment">// Set time</font> +00793 <a class="code" href="class_CObjectViewer.html#a18">setAnimTime</a> (pAnim-><a class="code" href="class_NL3D__CAnimation.html#a5">getBeginTime</a>()*_AnimationDlg->Speed, pAnim-><a class="code" href="class_NL3D__CAnimation.html#a6">getEndTime</a>()*_AnimationDlg->Speed); +00794 +00795 <font class="comment">// Set the animation in the first slot</font> +00796 _SlotDlg->UpdateData (); +00797 _SlotDlg->Slots[0].setAnimation (_AnimationSet.<a class="code" href="class_NL3D__CAnimationSet.html#a3">getAnimationIdByName</a>(name), pAnim, name); +00798 _SlotDlg->Slots[0].StartBlend=1.f; +00799 _SlotDlg->Slots[0].EndBlend=1.f; +00800 _SlotDlg->Slots[0].Offset=0; +00801 _SlotDlg->Slots[0].enable=TRUE; +00802 _SlotDlg->UpdateData (FALSE); +00803 +00804 <font class="comment">// Reinit</font> +00805 <a class="code" href="class_CObjectViewer.html#a20">reinitChannels</a> (); +00806 } +00807 +00808 <font class="comment">// ***************************************************************************</font> +00809 +<a name="l00810"></a><a class="code" href="class_CObjectViewer.html#a6">00810</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a6">CObjectViewer::setAutoAnimation</a> (<a class="code" href="class_NL3D__CAnimation.html">NL3D::CAnimation</a>* pAnim)<font class="keyword"> +</font>00811 <font class="keyword"></font>{ +00812 CNELU::Scene.setAutoAnim (pAnim); +00813 } +00814 +00815 <font class="comment">// ***************************************************************************</font> +00816 +<a name="l00817"></a><a class="code" href="class_CObjectViewer.html#a10">00817</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a10">CObjectViewer::setAmbientColor</a> (<font class="keyword">const</font> <a class="code" href="class_NLMISC__CRGBA.html">NLMISC::CRGBA</a>& color)<font class="keyword"> +</font>00818 <font class="keyword"></font>{ +00819 CNELU::Driver->setAmbientColor (color); +00820 } +00821 +00822 <font class="comment">// ***************************************************************************</font> +00823 +<a name="l00824"></a><a class="code" href="class_CObjectViewer.html#a11">00824</a> <font class="keywordtype">void</font> <a class="code" href="class_CObjectViewer.html#a11">CObjectViewer::setLight</a> (<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> id, <font class="keyword">const</font> <a class="code" href="class_NL3D__CLight.html">NL3D::CLight</a>& light)<font class="keyword"> +</font>00825 <font class="keyword"></font>{ +00826 CNELU::Driver->enableLight (id); +00827 CNELU::Driver->setLight (id, light); +00828 } +00829 +00830 <font class="comment">// ***************************************************************************</font> +</div></pre> + +<!-- footer --> +<BR><FONT Size=+5> </FONT> +</TD> +<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD> +</TR> +</TABLE> +</BODY> +</HTML> |