terrain.h 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1999-2005 Id Software, Inc.
  4. This file is part of Quake III Arena source code.
  5. Quake III Arena source code is free software; you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the License,
  8. or (at your option) any later version.
  9. Quake III Arena source code is distributed in the hope that it will be
  10. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with Foobar; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. #ifndef __TERRAIN_H__
  19. #define __TERRAIN_H__
  20. void Terrain_SetEpair( terrainMesh_t *p, const char *pKey, const char *pValue );
  21. const char* Terrain_GetKeyValue( terrainMesh_t *p, const char *pKey );
  22. int Terrain_MemorySize( terrainMesh_t *p );
  23. void Terrain_Delete( terrainMesh_t *p );
  24. terrainMesh_t *MakeNewTerrain( int width, int height, qtexture_t *texture = NULL );
  25. brush_t *AddBrushForTerrain( terrainMesh_t *pm, bool bLinkToWorld = true );
  26. terrainMesh_t *Terrain_Duplicate( terrainMesh_t *pFrom );
  27. void Terrain_BrushToMesh( void );
  28. brush_t *Terrain_Parse( void );
  29. void Terrain_Write( terrainMesh_t *p, CMemFile *file );
  30. void Terrain_Write( terrainMesh_t *p, FILE *file );
  31. void Terrain_Select( terrainMesh_t *p );
  32. void Terrain_Deselect( terrainMesh_t *p );
  33. void Terrain_Move( terrainMesh_t *pm, const vec3_t vMove, bool bRebuild = false );
  34. void UpdateTerrainInspector( void );
  35. void Terrain_CalcBounds( terrainMesh_t *p, vec3_t &vMin, vec3_t &vMax );
  36. void CalcTriNormal( const vec3_t a, const vec3_t b, const vec3_t c, vec3_t o );
  37. void Terrain_CalcVertPos( terrainMesh_t *p, int x, int y, vec3_t vert );
  38. void Terrain_CalcNormals( terrainMesh_t *p );
  39. void Terrain_FindReplaceTexture( terrainMesh_t *p, const char *pFind, const char *pReplace, bool bForce );
  40. bool Terrain_HasTexture( terrainMesh_t *p, const char *name );
  41. void Terrain_ReplaceQTexture( terrainMesh_t *p, qtexture_t *pOld, qtexture_t *pNew );
  42. void Terrain_SetTexture( terrainMesh_t *p, texdef_t *tex_def );
  43. void Terrain_Scale( terrainMesh_t *p, const vec3_t vOrigin, const vec3_t vAmt, bool bRebuild = true );
  44. bool Terrain_DragScale( terrainMesh_t *p, vec3_t vAmt, vec3_t vMove );
  45. void Terrain_ApplyMatrix( terrainMesh_t *p, const vec3_t vOrigin, const vec3_t vMatrix[ 3 ], bool bSnap );
  46. void Terrain_DrawFace( brush_t *brush, terrainFace_t *terraface );
  47. void DrawTerrain( terrainMesh_t *pm, bool bPoints, bool bShade = false );
  48. void Terrain_DrawCam( terrainMesh_t *pm );
  49. void Terrain_DrawXY( terrainMesh_t *pm, entity_t *owner );
  50. bool OnlyTerrainSelected( void );
  51. bool AnyTerrainSelected( void );
  52. terrainMesh_t *SingleTerrainSelected( void );
  53. void Terrain_Edit( void );
  54. void Terrain_SelectPointByRay ( vec3_t org, vec3_t dir, int buttons );
  55. void Terrain_AddMovePoint( vec3_t v, bool bMulti, bool bFull, int buttons );
  56. void Terrain_UpdateSelected( vec3_t vMove );
  57. int Terrain_PointInMoveList( terrainVert_t *pf );
  58. void Terrain_AddPoint( terrainMesh_t *p, terrainVert_t *v );
  59. void Terrain_RemovePointFromMoveList( terrainVert_t *v );
  60. void Terrain_SelectAreaPoints( void );
  61. bool RayTriangleIntersect( vec3_t orig, vec3_t dir, vec3_t vert1, vec3_t vert2, vec3_t vert3, float *t );
  62. terrainFace_t *Terrain_Ray( vec3_t origin, vec3_t dir, brush_t *b, float *dist );
  63. void Select_TerrainFacesFromBrush( brush_t *brush );
  64. void SetTerrainTexdef( brush_t *brush, terrainFace_t *vert, texdef_t *texdef );
  65. void RotateTerrainFaceTexture( terrainFace_t *vert, int nAxis, float fDeg );
  66. void TerrainFace_FitTexture( terrainFace_t *vert );
  67. void Select_TerrainFace( brush_t * brush, terrainFace_t *terraface );
  68. void Terrain_Init( void );
  69. #endif