OBJParser
OBJ File Parser Powered by Boost Spirit
 All Classes Functions Variables Enumerations Enumerator Pages
OBJFreeFormState.hpp
1 /*
2  * Copyright 2016 Steven T Sell (ssell@vertexfragment.com)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __H__OBJ_PARSER_FREE_FORM_STATE__H__
18 #define __H__OBJ_PARSER_FREE_FORM_STATE__H__
19 
20 #include "OBJStructs.hpp"
21 #include "OBJFreeFormAttributeState.hpp"
22 
23 //------------------------------------------------------------------------------------------
24 
29 {
30  enum class FreeFormType
31  {
32  None = 0,
33  Curve,
34  Curve2D,
35  Surface
36  };
37 
38 public:
39 
42 
43  void addCurve(uint32_t state, float startParam, float endParam, std::vector<OBJVertexGroup> const& controlPoints);
44  void addCurve2D(uint32_t state, std::vector<int32_t> const& controlPoints);
45  void addSurface(uint32_t state, float startU, float endU, float startV, float endV, std::vector<OBJVertexGroup> const& controlPoints);
46 
47  void addParameterU(std::vector<float> const& parameters);
48  void addParameterV(std::vector<float> const& parameters);
49  void addTrim(OBJSimpleCurve const& trim);
50  void addHole(OBJSimpleCurve const& hole);
51  void addSpecialCurve(OBJSimpleCurve const& scurve);
52  void addSpecialPoints(std::vector<int32_t> const& points);
53 
54  //--------------------------------------------------------------------
55 
56  std::vector<OBJFreeFormAttributeState> attributeStates;
57 
58  std::vector<OBJVector3> vertexParameterData;
59 
60  std::vector<OBJCurve> curves;
61  std::vector<OBJCurve2D> curves2D;
62  std::vector<OBJSurface> surfaces;
63 
64  std::vector<OBJSurfaceConnection> connections;
65 
66 protected:
67 
68  OBJFreeForm* getLatestFreeForm();
69 
70  //--------------------------------------------------------------------
71 
72  FreeFormType m_LatestFreeForm;
73 
74 private:
75 };
76 
77 //------------------------------------------------------------------------------------------
78 
79 #endif
80 
std::vector< OBJCurve2D > curves2D
Collection of all Curve2Ds specified by 'curv2' statements.
Definition: OBJFreeFormState.hpp:61
std::vector< OBJSurface > surfaces
Collection of all Surfaces specified by 'surf' statements.
Definition: OBJFreeFormState.hpp:62
std::vector< OBJCurve > curves
Collection of all Curves specified by 'curv' statements.
Definition: OBJFreeFormState.hpp:60
std::vector< OBJVector3 > vertexParameterData
Collection of all data specified by 'vp' statements. These are referenced by OBJCurve2D::parameterVer...
Definition: OBJFreeFormState.hpp:58
Individual curve definition comprising a larger free-form object.
Definition: OBJStructs.hpp:181
Definition: OBJFreeFormState.hpp:28
std::vector< OBJSurfaceConnection > connections
Collection of all Surface connections specified by 'con' statements.
Definition: OBJFreeFormState.hpp:64
std::vector< OBJFreeFormAttributeState > attributeStates
Collection of all attribute states. Each state represents a 'ctype' statement and the following state...
Definition: OBJFreeFormState.hpp:56
A free-form object in the form of a curve or surface.
Definition: OBJStructs.hpp:191