GLS.RenderContextInfo.pas 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //
  2. // The multimedia graphics platform GLScene https://github.com/glscene
  3. //
  4. unit GLS.RenderContextInfo;
  5. (* Stores contextual info useful during rendering methods *)
  6. interface
  7. {$I GLScene.inc}
  8. uses
  9. GLS.PersistentClasses,
  10. GLS.VectorTypes,
  11. GLS.VectorGeometry,
  12. GLS.State,
  13. GLS.PipelineTransformation,
  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,
  28. osRenderBlendedLast, osRenderNearestFirst);
  29. (* Determines the visibility culling mode.
  30. Culling is done level by level, allowed values are:
  31. vcInherited : use inherited culling value, if selected for the root level, defaults to vcNone
  32. vcNone : no visibility culling is performed
  33. vcObjectBased : culling is done on a per-object basis, each object may
  34. or may not be culled base on its own AxisAlignedDimensions,
  35. culling has no impact on the visibility of its children
  36. vcHierarchical : culling is performed hierarchically, using hierarchical
  37. bounding boxes, if a parent is culled, all of its children, whatever their
  38. culling options are invisible.
  39. Depending on the structure of your scene the most efficient culling
  40. method will be either vcObjectBased or vcHierarchical. Also note that if
  41. you use many objects with "static" geometry and have a T&L graphics
  42. board, it may be faster not to cull at all (ie. leave this to the hardware). *)
  43. TGLVisibilityCulling = (vcInherited, vcNone, vcObjectBased, vcHierarchical);
  44. TGLRenderContextClippingInfo = record
  45. Origin: TGLVector;
  46. ClippingDirection: TGLVector;
  47. ViewPortRadius: Single; // viewport bounding radius per distance unit
  48. NearClippingDistance: Single;
  49. FarClippingDistance: Single;
  50. Frustum: TFrustum;
  51. end;
  52. // Stores contextual info useful during rendering methods.
  53. TGLRenderContextInfo = record
  54. Scene: TObject; //usually TGLScene
  55. Buffer: TObject; //usually TGLSceneBuffer
  56. CameraPosition: TGLVector;
  57. CameraDirection, CameraUp: TGLVector;
  58. ViewPortSize: TGLSize;
  59. RenderDPI: Integer;
  60. MaterialLibrary: TObject; //usually TGLMaterialLibrary;
  61. LightMapLibrary: TObject; //usually TGLMaterialLibrary;
  62. FogDisabledCounter: Integer;
  63. DrawState: TGLDrawState;
  64. ObjectsSorting: TGLObjectsSorting;
  65. VisibilityCulling: TGLVisibilityCulling;
  66. GLStates: TGLStateCache;
  67. PipelineTransformation: TGLTransformation;
  68. Rcci: TGLRenderContextClippingInfo;
  69. SceneAmbientColor: TGLColorVector;
  70. BufferFaceCull: Boolean;
  71. BufferLighting: Boolean;
  72. BufferFog: Boolean;
  73. BufferDepthTest: Boolean;
  74. ProxySubObject: Boolean;
  75. IgnoreMaterials: Boolean;
  76. IgnoreBlendingRequests: Boolean;
  77. IgnoreDepthRequests: Boolean;
  78. Amalgamating: Boolean;
  79. Lights: TGLPersistentObjectList;
  80. AfterRenderEffects: TGLPersistentObjectList;
  81. CurrentMaterialLevel: TGLMaterialLevel;
  82. PrimitiveMask: TGLMeshPrimitives;
  83. OrderCounter: Integer;
  84. end;
  85. PGLRenderContextInfo = ^TGLRenderContextInfo;
  86. //====================================================================
  87. implementation
  88. //====================================================================
  89. end.