Skip to content

Commit 9ecbbfe

Browse files
committed
VTXNORMS chunk (on 'normals' branch without other changes)
1 parent c444911 commit 9ecbbfe

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Exporters/ExportPsk.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static void ExportCommonMeshData
8080
guard(ExportCommonMeshData);
8181

8282
// using 'static' here to avoid zero-filling unused fields
83-
static VChunkHeader MainHdr, PtsHdr, WedgHdr, FacesHdr, MatrHdr;
83+
static VChunkHeader MainHdr, PtsHdr, WedgHdr, FacesHdr, MatrHdr, NormHdr;
8484
int i;
8585

8686
#define SECT(n) (Sections + n)
@@ -247,6 +247,22 @@ static void ExportCommonMeshData
247247
}
248248
unguard;
249249

250+
guard(Normals);
251+
NormHdr.DataCount = Share.Normals.Num();
252+
NormHdr.DataSize = sizeof(CVec3);
253+
SAVE_CHUNK(NormHdr, "VTXNORMS");
254+
for (i = 0; i < Share.Normals.Num(); i++)
255+
{
256+
CVec3 Normal;
257+
Unpack(Normal, Share.Normals[i]);
258+
Normal.Normalize();
259+
#if MIRROR_MESH
260+
Normal.Y = -Normal.Y;
261+
#endif
262+
Ar << Normal.X << Normal.Y << Normal.Z;
263+
}
264+
unguard;
265+
250266
unguard;
251267
}
252268

Exporters/Psk.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define __PSK_H__
33

44

5-
#define PSK_VERSION 20100422
5+
#define PSK_VERSION 20210917 // VTXNORMS chunk
66
#define PSA_VERSION 20100422
77

88
/******************************************************************************

0 commit comments

Comments
 (0)