/src/assimp/code/AssetLib/MDL/HalfLife/HL1MeshTrivert.h
Line | Count | Source |
1 | | /* |
2 | | --------------------------------------------------------------------------- |
3 | | Open Asset Import Library (assimp) |
4 | | --------------------------------------------------------------------------- |
5 | | |
6 | | Copyright (c) 2006-2026, 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 { |
58 | | HL1MeshTrivert() : |
59 | 402 | vertindex(-1), |
60 | 402 | normindex(-1), |
61 | 402 | s(0), |
62 | 402 | t(0), |
63 | 402 | localindex(-1) { |
64 | 402 | } |
65 | | |
66 | | HL1MeshTrivert(short vertindex, short normindex, short s, short t, short localindex) : |
67 | | vertindex(vertindex), |
68 | | normindex(normindex), |
69 | | s(s), |
70 | | t(t), |
71 | 0 | localindex(localindex) { |
72 | 0 | } |
73 | | |
74 | | HL1MeshTrivert(const Trivert &a) : |
75 | 206 | vertindex(a.vertindex), |
76 | 206 | normindex(a.normindex), |
77 | 206 | s(a.s), |
78 | 206 | t(a.t), |
79 | 206 | localindex(-1) { |
80 | 206 | } |
81 | | |
82 | 672 | inline bool operator==(const Trivert &a) const { |
83 | 672 | return vertindex == a.vertindex && |
84 | 672 | normindex == a.normindex && |
85 | 458 | s == a.s && |
86 | 458 | t == a.t; |
87 | 672 | } |
88 | | |
89 | 0 | inline bool operator!=(const Trivert &a) const { |
90 | 0 | return !(*this == a); |
91 | 0 | } |
92 | | |
93 | 0 | inline bool operator==(const HL1MeshTrivert &a) const { |
94 | 0 | return localindex == a.localindex && |
95 | 0 | vertindex == a.vertindex && |
96 | 0 | normindex == a.normindex && |
97 | 0 | s == a.s && |
98 | 0 | t == a.t; |
99 | 0 | } |
100 | | |
101 | 0 | inline bool operator!=(const HL1MeshTrivert &a) const { |
102 | 0 | return !(*this == a); |
103 | 0 | } |
104 | | |
105 | 402 | inline HL1MeshTrivert &operator=(const Trivert &other) { |
106 | 402 | vertindex = other.vertindex; |
107 | 402 | normindex = other.normindex; |
108 | 402 | s = other.s; |
109 | 402 | t = other.t; |
110 | 402 | return *this; |
111 | 402 | } |
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 |