SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLRaySamples2D.h
Go to the documentation of this file.
1 /**
2  * \file SLRaySamples2D.h
3  * \date July 2014
4  * \authors Marcus Hudritsch
5  * \copyright http://opensource.org/licenses/GPL-3.0
6  * \remarks Please use clangformat to format the code. See more code style on
7  * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
8 */
9 
10 #ifndef SLSAMPLES2D_H
11 #define SLSAMPLES2D_H
12 
13 #include <SL.h>
14 #include <SLVec2.h>
15 
16 //-----------------------------------------------------------------------------
17 //! Class for 2D disk sample points
19 {
20 public:
21  SLRaySamples2D() { samples(1, 1); }
23 
24  // Setters
25  void samples(SLuint x, SLuint y, SLbool evenlyDistributed = true);
27  {
28  _points[x * _samplesY + y].set(point);
29  }
30  // Getters
31  SLuint samplesX() { return _samplesX; }
32  SLuint samplesY() { return _samplesY; }
33  SLuint samples() { return _samples; }
34  SLVec2f point(SLuint x, SLuint y) { return _points[x * _samplesY + y]; }
35  SLuint sizeInBytes() { return (SLuint)(_points.size() * sizeof(SLVec2f)); }
36 
37 private:
38  void distribConcentric(SLbool evenlyDistributed);
40 
41  SLuint _samplesX; //!< No. of samples in x direction
42  SLuint _samplesY; //!< No. of samples in y direction
43  SLuint _samples; //!< No. of samples = samplesX x samplesY
44  SLVVec2f _points; //!< samplepoints for distributed tracing
45 };
46 //-----------------------------------------------------------------------------
47 #endif
float SLfloat
Definition: SL.h:173
unsigned int SLuint
Definition: SL.h:171
bool SLbool
Definition: SL.h:175
vector< SLVec2f > SLVVec2f
Definition: SLVec2.h:143
SLVec2< SLfloat > SLVec2f
Definition: SLVec2.h:141
Class for 2D disk sample points.
SLuint samples()
SLVec2f mapSquareToDisc(SLfloat x, SLfloat y)
void distribConcentric(SLbool evenlyDistributed)
SLuint sizeInBytes()
SLVVec2f _points
samplepoints for distributed tracing
SLVec2f point(SLuint x, SLuint y)
SLuint _samples
No. of samples = samplesX x samplesY.
SLuint _samplesX
No. of samples in x direction.
void point(SLuint x, SLuint y, SLVec2f point)
SLuint samplesY()
SLuint samplesX()
SLuint _samplesY
No. of samples in y direction.