VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtLightScreenSpaceData.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2023 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
11 #pragma warning( push )
12 #pragma warning( disable : 4251 )
13 
15 
17 
18 #include <vrvMath/DtVector3.h>
19 #include <vrvMath/DtMath.h>
20 #include <vrvMath/DtScreenRect.h>
21 #include <vrvMath/DtCamera.h>
22 
23 namespace makVrv
24 {
25  class DtLight;
26 
30  {
31  DtLightScreenSpacePerViewData(const std::vector< Matrix4_64 >& viewProjectionMatrix,
32  const Vector3_64& worldEye,
33  const Vector3_64& worldCenter,
34  const Vector3_64& worldUp,
35  const Vector2_uint32& viewportSize,
36  const Vector2_uint32& tileSize) :
37  myViewProjectionMatrix(viewProjectionMatrix)
38  , myWorldEye(worldEye)
39  , myWorldCenter(worldCenter)
40  , myWorldUp(worldUp)
41  , myViewportSize(viewportSize)
42  , myTileSize(tileSize)
43  { }
44 
45  const std::vector< Matrix4_64 >& myViewProjectionMatrix;
51  };
52 
57  {
58  public:
60  : myRadiusSquared(0, 0)
61  , myArea(0)
62  , myLight(0)
63  , mySpotAngleMin(0.0f)
64  , mySpotEllipseProjection(false)
65  { }
66 
70  void calculate(const DtLight&,
71  const DtLightScreenSpacePerViewData& perView,
72  int viewMatrix);
73 
75  bool intersect(const DtScreenRect& rect) const;
76 
78  uint32 area() const { return myArea; }
80  const DtScreenRect& screenRect() const { return myScreenRect; }
81 
82  protected:
84  bool insideEllipse(float xDiff, float yDiff) const;
86  bool insideSpot(const Vector2_32& relPos) const;
87 
88  DtScreenRect myScreenRect; // screen space bounding rectangle
89  Vector2_32 myPositionUnclipped; // screen space light position, unclipped by frustum
90  Vector2_32 myRadiusSquared; // screen space x & y radius for point lights
91  Vector3_32 mySpotCenterProj; // screen space projection of spot light center
92  float mySpotAngleMin; // min angle relative to center angle
93  bool mySpotEllipseProjection; // true if spotlight projection is an ellipse.
94  uint32 myArea; // cache myScreenRect.area()
95  const DtLight* myLight; // light
96  };
97 
98  typedef std::vector<DtLightScreenSpaceData> DtLightScreenSpaceDataVector;
99 
100 } //namespace makVrv
101 
102 #pragma warning( pop )
DtScreenRect myScreenRect
Definition: DtLightScreenSpaceData.h:88
const Vector3_64 & myWorldCenter
Definition: DtLightScreenSpaceData.h:47
Dll export defines.
bool mySpotEllipseProjection
Definition: DtLightScreenSpaceData.h:93
Screen space light data, set up per frame and re-used multiple times while adding lights to light buc...
Definition: DtLightScreenSpaceData.h:56
Per-view data used to calculate the DtLightScreenSpaceData below.
Definition: DtLightScreenSpaceData.h:29
const DtLight * myLight
Definition: DtLightScreenSpaceData.h:95
Vector2_32 myPositionUnclipped
Definition: DtLightScreenSpaceData.h:89
const Vector3_64 & myWorldEye
Definition: DtLightScreenSpaceData.h:46
Screen Space Rectangle class.
const DtScreenRect & screenRect() const
Return screenspace bounding rectangle.
Definition: DtLightScreenSpaceData.h:80
DtLightScreenSpaceData()
Definition: DtLightScreenSpaceData.h:59
3 dimensional vector
DtLightScreenSpacePerViewData(const std::vector< Matrix4_64 > &viewProjectionMatrix, const Vector3_64 &worldEye, const Vector3_64 &worldCenter, const Vector3_64 &worldUp, const Vector2_uint32 &viewportSize, const Vector2_uint32 &tileSize)
Definition: DtLightScreenSpaceData.h:31
uint32 area() const
Return screenspace area.
Definition: DtLightScreenSpaceData.h:78
const Vector2_uint32 & myTileSize
Definition: DtLightScreenSpaceData.h:50
const Vector2_uint32 & myViewportSize
Definition: DtLightScreenSpaceData.h:49
std::vector< DtLightScreenSpaceData > DtLightScreenSpaceDataVector
Definition: DtLightScreenSpaceData.h:98
Math utilities.
Vector3_32 mySpotCenterProj
Definition: DtLightScreenSpaceData.h:91
uint32 myArea
Definition: DtLightScreenSpaceData.h:94
float mySpotAngleMin
Definition: DtLightScreenSpaceData.h:92
const std::vector< Matrix4_64 > & myViewProjectionMatrix
Definition: DtLightScreenSpaceData.h:45
Class for generic lights This holds per-light data such as range, attenuation factors, colors, etc.
Definition: DtLight.h:49
unsigned int uint32
Definition: DtCommonTypes.h:28
Camera class.
#define DT_DLL_VRVGRAPHICSUTILS
Definition: vrvGraphicsUtils.h:18
Screen Space Rectangle class.
Definition: DtScreenRect.h:21
Helpers to easily define forward declarations.
const Vector3_64 & myWorldUp
Definition: DtLightScreenSpaceData.h:48
Vector2_32 myRadiusSquared
Definition: DtLightScreenSpaceData.h:90

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)