vrshoot
view libs/assimp/ConvertToLHProcess.h @ 2:334d17aed7de
visual studio project files
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 02 Feb 2014 18:36:38 +0200 |
parents | |
children |
line source
1 /*
2 Open Asset Import Library (assimp)
3 ----------------------------------------------------------------------
5 Copyright (c) 2006-2012, assimp team
6 All rights reserved.
8 Redistribution and use of this software in source and binary forms,
9 with or without modification, are permitted provided that the
10 following conditions are met:
12 * Redistributions of source code must retain the above
13 copyright notice, this list of conditions and the
14 following disclaimer.
16 * Redistributions in binary form must reproduce the above
17 copyright notice, this list of conditions and the
18 following disclaimer in the documentation and/or other
19 materials provided with the distribution.
21 * Neither the name of the assimp team, nor the names of its
22 contributors may be used to endorse or promote products
23 derived from this software without specific prior
24 written permission of the assimp team.
26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 ----------------------------------------------------------------------
39 */
41 /** @file MakeLeftHandedProcess.h
42 * @brief Defines a bunch of post-processing steps to handle
43 * coordinate system conversions.
44 *
45 * - LH to RH
46 * - UV origin upper-left to lower-left
47 * - face order cw to ccw
48 */
49 #ifndef AI_CONVERTTOLHPROCESS_H_INC
50 #define AI_CONVERTTOLHPROCESS_H_INC
52 #include "assimp/types.h"
53 #include "BaseProcess.h"
55 struct aiMesh;
56 struct aiNodeAnim;
58 namespace Assimp {
60 // -----------------------------------------------------------------------------------
61 /** @brief The MakeLeftHandedProcess converts all imported data to a left-handed
62 * coordinate system.
63 *
64 * This implies a mirroring of the Z axis of the coordinate system. But to keep
65 * transformation matrices free from reflections we shift the reflection to other
66 * places. We mirror the meshes and adapt the rotations.
67 *
68 * @note RH-LH and LH-RH is the same, so this class can be used for both
69 */
70 class MakeLeftHandedProcess : public BaseProcess
71 {
74 public:
75 MakeLeftHandedProcess();
76 ~MakeLeftHandedProcess();
78 // -------------------------------------------------------------------
79 bool IsActive( unsigned int pFlags) const;
81 // -------------------------------------------------------------------
82 void Execute( aiScene* pScene);
84 protected:
86 // -------------------------------------------------------------------
87 /** Recursively converts a node and all of its children
88 */
89 void ProcessNode( aiNode* pNode, const aiMatrix4x4& pParentGlobalRotation);
91 // -------------------------------------------------------------------
92 /** Converts a single mesh to left handed coordinates.
93 * This means that positions, normals and tangents are mirrored at
94 * the local Z axis and the order of all faces are inverted.
95 * @param pMesh The mesh to convert.
96 */
97 void ProcessMesh( aiMesh* pMesh);
99 // -------------------------------------------------------------------
100 /** Converts a single material to left-handed coordinates
101 * @param pMat Material to convert
102 */
103 void ProcessMaterial( aiMaterial* pMat);
105 // -------------------------------------------------------------------
106 /** Converts the given animation to LH coordinates.
107 * The rotation and translation keys are transformed, the scale keys
108 * work in local space and can therefore be left untouched.
109 * @param pAnim The bone animation to transform
110 */
111 void ProcessAnimation( aiNodeAnim* pAnim);
112 };
115 // ---------------------------------------------------------------------------
116 /** Postprocessing step to flip the face order of the imported data
117 */
118 class FlipWindingOrderProcess : public BaseProcess
119 {
120 friend class Importer;
122 public:
123 /** Constructor to be privately used by Importer */
124 FlipWindingOrderProcess();
126 /** Destructor, private as well */
127 ~FlipWindingOrderProcess();
129 // -------------------------------------------------------------------
130 bool IsActive( unsigned int pFlags) const;
132 // -------------------------------------------------------------------
133 void Execute( aiScene* pScene);
135 protected:
136 void ProcessMesh( aiMesh* pMesh);
137 };
139 // ---------------------------------------------------------------------------
140 /** Postprocessing step to flip the UV coordinate system of the import data
141 */
142 class FlipUVsProcess : public BaseProcess
143 {
144 friend class Importer;
146 public:
147 /** Constructor to be privately used by Importer */
148 FlipUVsProcess();
150 /** Destructor, private as well */
151 ~FlipUVsProcess();
153 // -------------------------------------------------------------------
154 bool IsActive( unsigned int pFlags) const;
156 // -------------------------------------------------------------------
157 void Execute( aiScene* pScene);
159 protected:
160 void ProcessMesh( aiMesh* pMesh);
161 void ProcessMaterial( aiMaterial* mat);
162 };
164 } // end of namespace Assimp
166 #endif // AI_CONVERTTOLHPROCESS_H_INC