1 #ifndef __GNUC__
2 #pragma once
3 #endif
4 #ifndef __XR_MOTION_H__
5 #define __XR_MOTION_H__
6 
7 #include <string>
8 #include <vector>
9 #include "xr_types.h"
10 
11 namespace xray_re {
12 
13 enum {
14 	EOBJ_CHUNK_OMOTION	= 0x1100,	// .anm
15 	EOBJ_CHUNK_SMOTION	= 0x1200,	// .skl
16 };
17 
18 class xr_reader;
19 class xr_writer;
20 class xr_envelope;
21 
22 class xr_motion {
23 public:
24 	virtual 	~xr_motion();
25 	virtual void	load(xr_reader& r);
26 	virtual void	save(xr_writer& w) const;
27 
28 	int32_t&		frame_start();
29 	int32_t			frame_start() const;
30 	int32_t&		frame_end();
31 	int32_t			frame_end() const;
32 	float&			fps();
33 	float			fps() const;
34 	std::string&		name();
35 	const std::string&	name() const;
36 
37 	void			set_frame_range(int32_t start, int32_t end);
38 
39 	enum motion_type {
40 		MT_OBJECT,
41 		MT_SKELETON,
42 	};
43 
44 protected:
45 			xr_motion(motion_type type);
46 
47 	int32_t		m_frame_start;
48 	int32_t		m_frame_end;
49 	float		m_fps;
50 	std::string	m_name;
51 
52 private:
53 	uint32_t	m_type;
54 };
55 
name()56 inline std::string& xr_motion::name() { return m_name; }
name()57 inline const std::string& xr_motion::name() const { return m_name; }
frame_start()58 inline int32_t& xr_motion::frame_start() { return m_frame_start; }
frame_start()59 inline int32_t xr_motion::frame_start() const { return m_frame_start; }
frame_end()60 inline int32_t& xr_motion::frame_end() { return m_frame_end; }
frame_end()61 inline int32_t xr_motion::frame_end() const { return m_frame_end; }
fps()62 inline float& xr_motion::fps() { return m_fps; }
fps()63 inline float xr_motion::fps() const { return m_fps; }
64 
set_frame_range(int32_t start,int32_t end)65 inline void xr_motion::set_frame_range(int32_t start, int32_t end)
66 {
67 	m_frame_start = start;
68 	m_frame_end = end;
69 }
70 
71 } // end of namespace xray_re
72 
73 #endif
74