OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
cm_terrain.h
1/*
2===========================================================================
3Copyright (C) 2008 Leszek Godlewski
4
5This file is part of OpenMoHAA source code.
6
7OpenMoHAA source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12OpenMoHAA source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OpenMoHAA source code; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20===========================================================================
21*/
22
23/*
24This file does not reference any globals, and has these entry points:
25
26struct terPatchCollide_s *CM_GenerateTerPatchCollide(vec3_t origin, byte heightmap[9][9]);
27void CM_TraceThroughTerPatchCollide(traceWork_t *tw, const struct terPatchCollide_s *tc);
28qboolean CM_PositionTestInTerPatchCollide(traceWork_t *tw, const struct terPatchCollide_s *tc);
29*/
30
31#pragma once
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#define TER_QUADS_PER_ROW 8
38#define TER_TRIS_PER_PATCH (TER_QUADS_PER_ROW * TER_QUADS_PER_ROW * 2)
39#define TER_PLANES_PER_TRI 5
40
41 typedef struct terTriangle_s {
42 cplane_t planes
43 [TER_PLANES_PER_TRI]; // 0 is the surface plane, 3 border planes follow and a cap to give it some finite volume
45
46 typedef struct terPatchCollide_s {
47 vec3_t bounds[2];
48
49 baseshader_t *shader;
50
51 terTriangle_t tris[TER_TRIS_PER_PATCH];
53
54 typedef struct terrainCollideSquare_s {
55 vec4_t plane[2];
56 int eMode;
58
59 typedef struct terrainCollide_s {
60 vec3_t vBounds[2];
61 terrainCollideSquare_t squares[8][8];
63
64 void CM_PrepareGenerateTerrainCollide(void);
65 void CM_GenerateTerrainCollide(cTerraPatch_t *patch, terrainCollide_t *tc);
66 int CM_TerrainSquareType(int iTerrainPatch, int i, int j);
67 void CM_SwapTerraPatch(cTerraPatch_t* pPatch);
68
69#ifdef __cplusplus
70}
71#endif
Definition cm_terrain.h:46
Definition navigation_bsp.h:238
Definition cm_terrain.h:41
Definition navigation_bsp.h:233
Definition cm_terrain.h:54
Definition navigation_bsp.h:246
Definition cm_terrain.h:59
Definition navigation_bsp.h:256