Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
TScalarPixelTexture2D.h
Go to the documentation of this file.
1#pragma once
2
5
6#include <cstddef>
7
8namespace ph
9{
10
11template<typename T>
13{
14public:
16 const std::shared_ptr<PixelBuffer2D>& pixelBuffer,
17 pixel_texture::EPixelLayout alphaLayout);
18
20 const std::shared_ptr<PixelBuffer2D>& pixelBuffer,
21 std::size_t pixelElementIndex);
22
24 const std::shared_ptr<PixelBuffer2D>& pixelBuffer,
28 pixel_texture::EWrapMode wrapModeT);
29
31 const std::shared_ptr<PixelBuffer2D>& pixelBuffer,
32 std::size_t pixelElementIndex,
35 pixel_texture::EWrapMode wrapModeT);
36
37 T sampleScalar(const SampleLocation& sampleLocation) const;
38};
39
40// In-header Implementations:
41
42template<typename T>
44 const std::shared_ptr<PixelBuffer2D>& pixelBuffer,
45 const pixel_texture::EPixelLayout alphaLayout) :
46
48 pixelBuffer,
49 pixel_texture::alpha_channel_index(alphaLayout))
50{}
51
52template<typename T>
54 const std::shared_ptr<PixelBuffer2D>& pixelBuffer,
55 const std::size_t pixelElementIndex) :
56
58 pixelBuffer,
59 pixelElementIndex,
60 pixel_texture::ESampleMode::Bilinear,
61 pixel_texture::EWrapMode::Repeat,
62 pixel_texture::EWrapMode::Repeat)
63{}
64
65template<typename T>
67 const std::shared_ptr<PixelBuffer2D>& pixelBuffer,
68 const pixel_texture::EPixelLayout alphaLayout,
69 const pixel_texture::ESampleMode sampleMode,
70 const pixel_texture::EWrapMode wrapModeS,
71 const pixel_texture::EWrapMode wrapModeT) :
72
74 pixelBuffer,
75 pixel_texture::alpha_channel_index(alphaLayout),
76 sampleMode,
77 wrapModeS,
78 wrapModeT)
79{}
80
81template<typename T>
83 const std::shared_ptr<PixelBuffer2D>& pixelBuffer,
84 const std::size_t pixelElementIndex,
85 const pixel_texture::ESampleMode sampleMode,
86 const pixel_texture::EWrapMode wrapModeS,
87 const pixel_texture::EWrapMode wrapModeT) :
88
90 pixelBuffer,
91 sampleMode,
92 wrapModeS,
93 wrapModeT,
94 pixelElementIndex)
95{}
96
97template<typename T>
98inline T TScalarPixelTexture2D<T>::sampleScalar(const SampleLocation& sampleLocation) const
99{
101 this->sample(sampleLocation, &arrValue);
102
103 return arrValue[0];
104}
105
106}// end namespace ph
Definition SampleLocation.h:22
Definition TNumericPixelTexture2D.h:18
Definition TScalarPixelTexture2D.h:13
T sampleScalar(const SampleLocation &sampleLocation) const
Definition TScalarPixelTexture2D.h:98
TScalarPixelTexture2D(const std::shared_ptr< PixelBuffer2D > &pixelBuffer, pixel_texture::EPixelLayout alphaLayout)
Definition TScalarPixelTexture2D.h:43
Definition TArithmeticArray.h:13
EPixelLayout
Pixel layout of pixel texture. Represent the ordering of pixel components with respect to a color spa...
Definition pixel_texture_basics.h:40
EWrapMode
Definition pixel_texture_basics.h:21
ESampleMode
Definition pixel_texture_basics.h:28
The root for all renderer implementations.
Definition EEngineProject.h:6