RenderScene.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* Copyright (c) 2002-2012 Croteam Ltd.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of version 2 of the GNU General Public License as published by
  4. the Free Software Foundation
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License along
  10. with this program; if not, write to the Free Software Foundation, Inc.,
  11. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
  12. #ifndef SE_INCL_RENDERSCENE_H
  13. #define SE_INCL_RENDERSCENE_H
  14. #ifdef PRAGMA_ONCE
  15. #pragma once
  16. #endif
  17. #include <Engine/Math/TextureMapping.h>
  18. //#include <Engine/Graphics/Vertex.h>
  19. //////////////////////////////////////////////////////////////////////////////////////////////////////
  20. // WORLD RENDER CONSTANTS
  21. // scene polygon flags
  22. #define SPOF_SELECTED (1UL<< 0) // is polygon currently selected or not?
  23. #define SPOF_TRANSPARENT (1UL<< 1) // polygon has alpha keying
  24. #define SPOF_RENDERFOG (1UL<< 9) // polygon has fog
  25. #define SPOF_RENDERHAZE (1UL<<10) // polygon has haze
  26. #define SPOF_BACKLIGHT (1UL<<31) // used internaly
  27. // scene texture flags
  28. #define STXF_CLAMPU (0x01) // clamp u coordinate in texture
  29. #define STXF_CLAMPV (0x02) // clamp v coordinate in texture
  30. #define STXF_REFLECTION (0x04) // clamp v coordinate in texture
  31. #define STXF_AFTERSHADOW (0x08) // texture is to be applied after shadow
  32. #define STXF_BLEND_OPAQUE (0x00) // opaque texture (just put it on screen)
  33. #define STXF_BLEND_ALPHA (0x10) // alpha blend with screen
  34. #define STXF_BLEND_ADD (0x20) // add to screen
  35. #define STXF_BLEND_SHADE (0x30) // darken or brighten (same as used by shadow maps)
  36. #define STXF_BLEND_MASK (0x70)
  37. /*
  38. * RENDER SCENE structures (for world purposes)
  39. */
  40. // structure that holds information about a polygon that is fully on partially visible
  41. struct ScenePolygon {
  42. ScenePolygon *spo_pspoSucc; // next polygon in list
  43. INDEX spo_iVtx0; // first vertex in arrays
  44. INDEX spo_ctVtx; // number of vertices in arrays
  45. INDEX *spo_piElements; // array of triangle elements
  46. INDEX spo_ctElements; // element count
  47. // texture and shadow parameters: 0, 1, 2 are texture maps, 3 is shadow
  48. CMappingVectors spo_amvMapping[4]; // texture colors and alpha
  49. COLOR spo_acolColors[4]; // texture flags
  50. UBYTE spo_aubTextureFlags[4]; // current mip factors for each texture
  51. // textures and shadowmap
  52. class CTextureObject *spo_aptoTextures[3];
  53. class CShadowMap *spo_psmShadowMap;
  54. // internal for rendering
  55. INDEX spo_iVtx0Pass; // index of first coordinate in per-pass arrays
  56. COLOR spo_cColor; // polygon color (for flat or shadow modes)
  57. ULONG spo_ulFlags; // polygon flags (selected or not? ...)
  58. FLOAT spo_fNearestZ; // Z coord of nearest vertex to viewer
  59. void *spo_pvPolygon; // user data for high level renderer (brush polygon)
  60. };
  61. // renders whole scene (all visible polygons) to screen drawport
  62. void RenderScene( CDrawPort *pDP, ScenePolygon *pspoFirst, CAnyProjection3D &prProjection,
  63. COLOR colSelection, BOOL bTranslucent);
  64. // renders only scene z-buffer
  65. void RenderSceneZOnly( CDrawPort *pDP, ScenePolygon *pspoFirst, CAnyProjection3D &prProjection);
  66. // renders flat background of the scene
  67. void RenderSceneBackground(CDrawPort *pDP, COLOR col);
  68. #endif /* include-once check. */