OpenPolygon  1.0.0
OpenPolygon is a Rendering Engine
bvhloader.h
1 /*
2  Copyright (C) 2014 - 2016 Mutzii
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 */
18 #ifndef BVHLOADER_H
19 #define BVHLOADER_H
20 
21 #include "index.h"
22 #include "animationmanager.h"
23 
24 namespace Engine
25 {
30  class BvhLoader : public AnimationLoader
31  {
32  public:
33 
38  struct StoreState
39  {
43  std::vector< NodeAnim * > stack;
44  std::string line;
46  bool ignore;
47  bool end_site;
48  };
49  using HMStateStore = struct StoreState;
50 
51  public:
52 
57  BvhLoader();
58 
59  ~BvhLoader(){}
60 
67  void ReadFile(const string &motion_file, NodeAnimScene * node_anim_scene );
68 
74  void ReadHierachy( NodeAnimScene * node_anim_scene );
75 
81  void ReadMotion ( NodeAnimScene * node_anim_scene );
82 
88  void prepareByFlags( NodeAnimScene * node_anim_scene );
89 
96  void bvh_string_split(const std::string &line, char delim, Strings &items);
97 
104  std::string getNodeName(const std::string & line );
105 
112  std::string getFirst( const std::string & line );
113 
120  Vector3f getOffset( const std::string & line );
121 
128  int getFrames( const std::string & line );
129 
137  NodeAnim * getNode( const Vector3f & offset , NodeAnimScene * scene );
138 
143  void PrintError( const Vector3f & offset ) throw( std::runtime_error );
144 
150  float getNumber( const std::string & item );
151 
152  private:
153 
154  HMStateStore * mStateStore;
155  };
156 
157 
158 }
159 
160 #endif // BVHLOADER_H
NodeAnim * getNode(const Vector3f &offset, NodeAnimScene *scene)
getNode
Definition: BvhLoader.cpp:296
The BvhLoader - BVH File Loader ( .bvh )
Definition: bvhloader.h:30
void ReadMotion(NodeAnimScene *node_anim_scene)
ReadMotion.
Definition: BvhLoader.cpp:198
bool end_site
Definition: bvhloader.h:47
std::string getNodeName(const std::string &line)
getNodeName
Definition: BvhLoader.cpp:332
Definition: element.h:23
The StoreState struct.
Definition: bvhloader.h:38
float getNumber(const std::string &item)
Definition: BvhLoader.cpp:271
std::vector< NodeAnim * > stack
Definition: bvhloader.h:43
The AnimationLoader is a interface class for custom Loader specifically for Animations.
Definition: animationmanager.h:40
int getFrames(const std::string &line)
getFrames
Definition: BvhLoader.cpp:308
std::string line
Definition: bvhloader.h:44
The NodeAnim class.
Definition: nodeanim.h:32
void ReadHierachy(NodeAnimScene *node_anim_scene)
ReadHierachy.
Definition: BvhLoader.cpp:131
void PrintError(const Vector3f &offset)
PrintError.
Definition: BvhLoader.cpp:282
Vector3f getOffset(const std::string &line)
getOffset
Definition: BvhLoader.cpp:344
std::string getFirst(const std::string &line)
getFirst
Definition: BvhLoader.cpp:321
NodeAnim * current
Definition: bvhloader.h:41
NodeAnim * root
Definition: bvhloader.h:40
bool ignore
Definition: bvhloader.h:46
void prepareByFlags(NodeAnimScene *node_anim_scene)
prepareByFlags
Definition: BvhLoader.cpp:71
void ReadFile(const string &motion_file, NodeAnimScene *node_anim_scene)
ReadFile.
Definition: BvhLoader.cpp:28
void bvh_string_split(const std::string &line, char delim, Strings &items)
bvh_string_split
Definition: BvhLoader.cpp:360
The NodeAnimScene class.
Definition: nodeanimscene.h:36
BvhLoader()
BvhLoader.
Definition: BvhLoader.cpp:22