Pyrogenesis trunk
weldmesh.h
Go to the documentation of this file.
1/**
2 * Copyright (C) 2011 by Morten S. Mikkelsen
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 *
8 * Permission is granted to anyone to use this software for any purpose,
9 * including commercial applications, and to alter it and redistribute it
10 * freely, subject to the following restrictions:
11 *
12 * 1. The origin of this software must not be misrepresented; you must not
13 * claim that you wrote the original software. If you use this software
14 * in a product, an acknowledgment in the product documentation would be
15 * appreciated but is not required.
16 * 2. Altered source versions must be plainly marked as such, and must not be
17 * misrepresented as being the original software.
18 * 3. This notice may not be removed or altered from any source distribution.
19 */
20
21
22#ifndef __WELDMESH_H__
23#define __WELDMESH_H__
24
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30// piRemapTable must be initialized and point to an area in memory
31// with the byte size: iNrVerticesIn * sizeof(int).
32// pfVertexDataOut must be initialized and point to an area in memory
33// with the byte size: iNrVerticesIn * iFloatsPerVert * sizeof(float).
34// At the end of the WeldMesh() call the array pfVertexDataOut will contain
35// unique vertices only. Each entry in piRemapTable contains the index to
36// the new location of the vertex in pfVertexDataOut in units of iFloatsPerVert.
37// Note that this code is suitable for welding both unindexed meshes but also
38// indexed meshes which need to have duplicates removed. In the latter case
39// one simply uses the remap table to convert the old index list to the new vertex array.
40// Finally, the return value is the number of unique vertices found.
41int WeldMesh(int * piRemapTable, float * pfVertexDataOut,
42 const float pfVertexDataIn[], const int iNrVerticesIn, const int iFloatsPerVert);
43
44#ifdef __cplusplus
45}
46#endif
47
48
49#endif
50
int WeldMesh(int *piRemapTable, float *pfVertexDataOut, const float pfVertexDataIn[], const int iNrVerticesIn, const int iFloatsPerVert)
Copyright (C) 2011 by Morten S.
Definition: weldmesh.cpp:47