1 /*
2 ---------------------------------------------------------------------------
3 Open Asset Import Library (assimp)
4 ---------------------------------------------------------------------------
5 
6 Copyright (c) 2006-2021, assimp team
7 
8 All rights reserved.
9 
10 Redistribution and use of this software in source and binary forms,
11 with or without modification, are permitted provided that the following
12 conditions are met:
13 
14 * Redistributions of source code must retain the above
15   copyright notice, this list of conditions and the
16   following disclaimer.
17 
18 * Redistributions in binary form must reproduce the above
19   copyright notice, this list of conditions and the
20   following disclaimer in the documentation and/or other
21   materials provided with the distribution.
22 
23 * Neither the name of the assimp team, nor the names of its
24   contributors may be used to endorse or promote products
25   derived from this software without specific prior
26   written permission of the assimp team.
27 
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 ---------------------------------------------------------------------------
40 */
41 
42 /** @file HL1MeshTrivert.h
43  *  @brief This file contains the class declaration for the
44  *         HL1 mesh trivert class.
45  */
46 
47 #ifndef AI_HL1MESHTRIVERT_INCLUDED
48 #define AI_HL1MESHTRIVERT_INCLUDED
49 
50 #include "HL1FileData.h"
51 
52 namespace Assimp {
53 namespace MDL {
54 namespace HalfLife {
55 
56 /* A class to help map model triverts to mesh triverts. */
57 struct HL1MeshTrivert {
HL1MeshTrivertHL1MeshTrivert58     HL1MeshTrivert() :
59             vertindex(-1),
60             normindex(-1),
61             s(0),
62             t(0),
63             localindex(-1) {
64     }
65 
HL1MeshTrivertHL1MeshTrivert66     HL1MeshTrivert(short vertindex, short normindex, short s, short t, short localindex) :
67             vertindex(vertindex),
68             normindex(normindex),
69             s(s),
70             t(t),
71             localindex(localindex) {
72     }
73 
HL1MeshTrivertHL1MeshTrivert74     HL1MeshTrivert(const Trivert &a) :
75             vertindex(a.vertindex),
76             normindex(a.normindex),
77             s(a.s),
78             t(a.t),
79             localindex(-1) {
80     }
81 
82     inline bool operator==(const Trivert &a) const {
83         return vertindex == a.vertindex &&
84                normindex == a.normindex &&
85                s == a.s &&
86                t == a.t;
87     }
88 
89     inline bool operator!=(const Trivert &a) const {
90         return !(*this == a);
91     }
92 
93     inline bool operator==(const HL1MeshTrivert &a) const {
94         return localindex == a.localindex &&
95                vertindex == a.vertindex &&
96                normindex == a.normindex &&
97                s == a.s &&
98                t == a.t;
99     }
100 
101     inline bool operator!=(const HL1MeshTrivert &a) const {
102         return !(*this == a);
103     }
104 
105     inline HL1MeshTrivert &operator=(const Trivert &other) {
106         vertindex = other.vertindex;
107         normindex = other.normindex;
108         s = other.s;
109         t = other.t;
110         return *this;
111     }
112 
113     short vertindex;
114     short normindex;
115     short s, t;
116     short localindex;
117 };
118 
119 struct HL1MeshFace {
120     short v0, v1, v2;
121 };
122 
123 } // namespace HalfLife
124 } // namespace MDL
125 } // namespace Assimp
126 
127 #endif // AI_HL1MESHTRIVERT_INCLUDED
128