1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
/*
* Copyright (C) 2002 Terence M. Welsh
* Ported to Linux by Tugrul Galatali <tugrul@galatali.com>
*
* Implicit is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Implicit is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef IMPCUBETABLE_H
#define IMPCUBETABLE_H
/****************************************
OpenGL coordinate system
Y
|
|
|
|
|
/--------X
/
/
Z
Indices for vertices and edge on cube
2-----6-----6
/| /|
3 | 11 |
/ 1 / 9
3-----7-----7 |
| | | |
| 0-----4-|---4
2 / 10 /
| 0 | 8
|/ |/
1-----5-----5
*****************************************/
// corners
// left-right-bottom-top-far-near notation
#define LBF 0x01
#define LBN 0x02
#define LTF 0x04
#define LTN 0x08
#define RBF 0x10
#define RBN 0x20
#define RTF 0x40
#define RTN 0x80
class impCubeTable {
public:
// This table describes the sequence of edges to visit
// in order to build triangle strips in a cube There are
// a maximum of 16 integers that can result from a cube
// configuration. We have 17 integers in each row so that
// each row can end with a 0. The zero signifies the end
// of the data in each row.
int **cubetable;
// 256 x 6 array of true/false values. For each of the 256
// entries in the cubetable, this table indicates which
// neighboring cubes will also contain parts of the surface.
bool **crawltable;
impCubeTable ();
~impCubeTable () {
};
private:
// edge connectivity
// This array defines which vertices are connected by each edge.
int ec[12][2];
// vertex connectivity
// This array defines which edges extend from each vertex.
int vc[8][3];
int nextedge (int vertex, int edge);
void addtotable (int row, int edgecount, int *edgelist);
void makecubetable ();
void makecrawltable ();
};
#endif
|