GLS.RenderContextInfo.pas 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //
  2. // The graphics engine GLScene
  3. //
  4. unit GLS.RenderContextInfo;
  5. (* Stores contextual info useful during rendering methods *)
  6. interface
  7. {$I Stage.Defines.inc}
  8. uses
  9. GLS.PersistentClasses,
  10. Stage.VectorTypes,
  11. Stage.VectorGeometry,
  12. GLS.State,
  13. Stage.PipelineTransform,
  14. GLS.Color;
  15. type
  16. TGLDrawState = (dsRendering, dsPicking, dsPrinting);
  17. TGLSize = record
  18. cx: Longint;
  19. cy: Longint;
  20. end;
  21. (* Determines if objects are sorted, and how. Sorting is done level by level (and not for all entities), values are :
  22. osInherited : use inherited sorting mode, defaults to osRenderFarthestFirst
  23. osNone : do not sort objects.
  24. osRenderFarthestFirst : render objects whose Position is the farthest from the camera first.
  25. osRenderBlendedLast : opaque objects are not sorted and rendered first, blended ones are rendered afterwards and depth sorted.
  26. osRenderNearestFirst : render objects whose Position is the nearest to the camera first. *)
  27. TGLObjectsSorting = (osInherited, osNone, osRenderFarthestFirst, osRenderBlendedLast, osRenderNearestFirst);
  28. (* Determines the visibility culling mode.
  29. Culling is done level by level, allowed values are:
  30. vcInherited : use inherited culling value, if selected for the root level, defaults to vcNone
  31. vcNone : no visibility culling is performed
  32. vcObjectBased : culling is done on a per-object basis, each object may
  33. or may not be culled base on its own AxisAlignedDimensions,
  34. culling has no impact on the visibility of its children
  35. vcHierarchical : culling is performed hierarchically, using hierarchical
  36. bounding boxes, if a parent is culled, all of its children, whatever their
  37. culling options are invisible.
  38. Depending on the structure of your scene the most efficient culling
  39. method will be either vcObjectBased or vcHierarchical. Also note that if
  40. you use many objects with "static" geometry and have a T&L graphics
  41. board, it may be faster not to cull at all (ie. leave this to the hardware). *)
  42. TGLVisibilityCulling = (vcInherited, vcNone, vcObjectBased, vcHierarchical);
  43. TGLRenderContextClippingInfo = record
  44. Origin: TGLVector;
  45. ClippingDirection: TGLVector;
  46. ViewPortRadius: Single; // viewport bounding radius per distance unit
  47. NearClippingDistance: Single;
  48. FarClippingDistance: Single;
  49. Frustum: TFrustum;
  50. end;
  51. // Stores contextual info useful during rendering methods.
  52. TGLRenderContextInfo = record
  53. Scene: TObject; //usually TGLScene
  54. Buffer: TObject; //usually TGLSceneBuffer
  55. CameraPosition: TGLVector;
  56. CameraDirection, CameraUp: TGLVector;
  57. ViewPortSize: TGLSize;
  58. RenderDPI: Integer;
  59. MaterialLibrary: TObject; //usually TGLMaterialLibrary;
  60. LightMapLibrary: TObject; //usually TGLMaterialLibrary;
  61. FogDisabledCounter: Integer;
  62. DrawState: TGLDrawState;
  63. ObjectsSorting: TGLObjectsSorting;
  64. VisibilityCulling: TGLVisibilityCulling;
  65. GLStates: TGLStateCache;
  66. PipelineTransformation: TGTransformation;
  67. Rcci: TGLRenderContextClippingInfo;
  68. SceneAmbientColor: TGLColorVector;
  69. BufferFaceCull: Boolean;
  70. BufferLighting: Boolean;
  71. BufferFog: Boolean;
  72. BufferDepthTest: Boolean;
  73. ProxySubObject: Boolean;
  74. IgnoreMaterials: Boolean;
  75. IgnoreBlendingRequests: Boolean;
  76. IgnoreDepthRequests: Boolean;
  77. Amalgamating: Boolean;
  78. Lights: TGLPersistentObjectList;
  79. AfterRenderEffects: TGLPersistentObjectList;
  80. CurrentMaterialLevel: TGLMaterialLevel;
  81. PrimitiveMask: TGLMeshPrimitives;
  82. OrderCounter: Integer;
  83. end;
  84. PGLRenderContextInfo = ^TGLRenderContextInfo;
  85. implementation //-------------------------------------------------------------
  86. end.