VR-Forces 4.8 Class Documentation
 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) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
11 #pragma warning( push )
12 #pragma warning( disable : 4251 )
13 
19 
20 namespace makVrv
21 {
22  class DtLight;
23 
27  {
28  DtLightScreenSpacePerViewData(const std::vector< Matrix4_64 >& viewProjectionMatrix,
29  const Vector3_64& worldEye,
30  const Vector3_64& worldCenter,
31  const Vector3_64& worldUp,
32  const Vector2_uint32& viewportSize,
33  const Vector2_uint32& tileSize) :
34  myViewProjectionMatrix(viewProjectionMatrix)
35  , myWorldEye(worldEye)
36  , myWorldCenter(worldCenter)
37  , myWorldUp(worldUp)
38  , myViewportSize(viewportSize)
39  , myTileSize(tileSize)
40  { }
41 
42  const std::vector< Matrix4_64 >& myViewProjectionMatrix;
48  };
49 
54  {
55  public:
57  : myRadiusSquared(0, 0)
58  , myArea(0)
59  , myLight(0)
60  , mySpotAngleMin(0.0f)
61  , mySpotEllipseProjection(false)
62  { }
63 
67  void calculate(const DtLight&,
68  const DtLightScreenSpacePerViewData& perView,
69  int viewMatrix);
70 
72  bool intersect(const DtScreenRect& rect) const;
73 
75  uint32 area() const { return myArea; }
77  const DtScreenRect& screenRect() const { return myScreenRect; }
78 
79  protected:
81  bool insideEllipse(float xDiff, float yDiff) const;
83  bool insideSpot(const Vector2_32& relPos) const;
84 
85  DtScreenRect myScreenRect; // screen space bounding rectangle
86  Vector2_32 myPositionUnclipped; // screen space light position, unclipped by frustum
87  Vector2_32 myRadiusSquared; // screen space x & y radius for point lights
88  Vector3_32 mySpotCenterProj; // screen space projection of spot light center
89  float mySpotAngleMin; // min angle relative to center angle
90  bool mySpotEllipseProjection; // true if spotlight projection is an ellipse.
91  uint32 myArea; // cache myScreenRect.area()
92  const DtLight* myLight; // light
93  };
94 
95  typedef std::vector<DtLightScreenSpaceData> DtLightScreenSpaceDataVector;
96 
97 } //namespace makVrv
98 
99 #pragma warning( pop )
DtScreenRect myScreenRect
Definition: DtLightScreenSpaceData.h:85
const Vector3_64 & myWorldCenter
Definition: DtLightScreenSpaceData.h:44
bool mySpotEllipseProjection
Definition: DtLightScreenSpaceData.h:90
Screen space light data, set up per frame and re-used multiple times while adding lights to light buc...
Definition: DtLightScreenSpaceData.h:53
Per-view data used to calculate the DtLightScreenSpaceData below.
Definition: DtLightScreenSpaceData.h:26
const DtLight * myLight
Definition: DtLightScreenSpaceData.h:92
Vector2_32 myPositionUnclipped
Definition: DtLightScreenSpaceData.h:86
const Vector3_64 & myWorldEye
Definition: DtLightScreenSpaceData.h:43
Screen Space Rectangle class.
const DtScreenRect & screenRect() const
Return screenspace bounding rectangle.
Definition: DtLightScreenSpaceData.h:77
DtLightScreenSpaceData()
Definition: DtLightScreenSpaceData.h:56
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:28
Forward declarations for Vectors.
uint32 area() const
Return screenspace area.
Definition: DtLightScreenSpaceData.h:75
const Vector2_uint32 & myTileSize
Definition: DtLightScreenSpaceData.h:47
const Vector2_uint32 & myViewportSize
Definition: DtLightScreenSpaceData.h:46
std::vector< DtLightScreenSpaceData > DtLightScreenSpaceDataVector
Definition: DtLightScreenSpaceData.h:95
Math utilities.
Vector3_32 mySpotCenterProj
Definition: DtLightScreenSpaceData.h:88
uint32 myArea
Definition: DtLightScreenSpaceData.h:91
float mySpotAngleMin
Definition: DtLightScreenSpaceData.h:89
const std::vector< Matrix4_64 > & myViewProjectionMatrix
Definition: DtLightScreenSpaceData.h:42
Class for generic lights.
Definition: DtLight.h:48
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:45
Vector2_32 myRadiusSquared
Definition: DtLightScreenSpaceData.h:87

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)