Ocean
OBJScanner.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_SCENEDESCRIPTION_SDL_OBJ_SCANNER_H
9 #define META_OCEAN_SCENEDESCRIPTION_SDL_OBJ_SCANNER_H
10 
12 
13 #include "ocean/io/Scanner.h"
14 
15 namespace Ocean
16 {
17 
18 namespace SceneDescription
19 {
20 
21 namespace SDL
22 {
23 
24 namespace OBJ
25 {
26 
27 /**
28  * This class implements a scanner able to scan obj token.
29  * @ingroup scenedescriptionsdlobj
30  */
31 class OCEAN_SCENEDESCRIPTION_SDL_OBJ_EXPORT OBJScanner : public IO::Scanner
32 {
33  public:
34 
35  /**
36  * Defines different obj keywords.
37  */
38  enum Keyword
39  {
40  /// OBJ keyword 'f' identifying a face.
42  /// OBJ keyword 'g' identifying a group.
44  /// OBJ keyword 'l' identifying a line.
46  /// OBJ keyword 'mtllib' identifying a material library.
48  /// OBJ keyword
50  /// OBJ keyword
52  /// OBJ keyword 'p' identifying a point.
54  /// OBJ keyword 's' identifying a smoothing factor.
56  /// OBJ keyword 'usemtl' identifying a 'use material state'.
58  /// OBJ keyword 'v' identifying a vertex.
60  /// OBJ keyword 'vn' identifying a normal.
62  /// OBJ keyword 'vp' identifiying a parameter.
64  /// OBJ keyword 'vt' identifying a texture coordinate.
65  KEYWORD_VT
66  };
67 
68  /**
69  * Defines different obj symbols.
70  */
71  enum Symbol
72  {
73  /// OBJ symbol
74  SYMBOL_SLASH
75  };
76 
77  public:
78 
79  /**
80  * Creates a new obj scanner.
81  * @param filename Name of the file to scan
82  * @param progress Optional progress state receiving the parsing progress recurrently
83  * @param cancel Optional cancel state
84  * @see Scanner::Scanner().
85  */
86  explicit OBJScanner(const std::string& filename, float* progress = nullptr, bool* cancel = nullptr);
87 };
88 
89 }
90 
91 }
92 
93 }
94 
95 }
96 
97 #endif // META_OCEAN_SCENEDESCRIPTION_SDL_OBJ__H
This class implements a simple scanner.
Definition: Scanner.h:31
This class implements a scanner able to scan obj token.
Definition: OBJScanner.h:32
Symbol
Defines different obj symbols.
Definition: OBJScanner.h:72
OBJScanner(const std::string &filename, float *progress=nullptr, bool *cancel=nullptr)
Creates a new obj scanner.
Keyword
Defines different obj keywords.
Definition: OBJScanner.h:39
@ KEYWORD_USEMTL
OBJ keyword 'usemtl' identifying a 'use material state'.
Definition: OBJScanner.h:57
@ KEYWORD_O
OBJ keyword.
Definition: OBJScanner.h:49
@ KEYWORD_L
OBJ keyword 'l' identifying a line.
Definition: OBJScanner.h:45
@ KEYWORD_F
OBJ keyword 'f' identifying a face.
Definition: OBJScanner.h:41
@ KEYWORD_P
OBJ keyword 'p' identifying a point.
Definition: OBJScanner.h:53
@ KEYWORD_G
OBJ keyword 'g' identifying a group.
Definition: OBJScanner.h:43
@ KEYWORD_S
OBJ keyword 's' identifying a smoothing factor.
Definition: OBJScanner.h:55
@ KEYWORD_V
OBJ keyword 'v' identifying a vertex.
Definition: OBJScanner.h:59
@ KEYWORD_VN
OBJ keyword 'vn' identifying a normal.
Definition: OBJScanner.h:61
@ KEYWORD_MTLLIB
OBJ keyword 'mtllib' identifying a material library.
Definition: OBJScanner.h:47
@ KEYWORD_VP
OBJ keyword 'vp' identifiying a parameter.
Definition: OBJScanner.h:63
@ KEYWORD_OFF
OBJ keyword.
Definition: OBJScanner.h:51
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15