Free Electron
ScalarShaderI.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __spatial_ScalarShaderI_h__
8 #define __spatial_ScalarShaderI_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /** Shader for DrawScalarField
16  */
17 class FE_DL_EXPORT ScalarShaderI : virtual public Component
18 {
19  public:
20 virtual void shade(Real a_value, U8 *a_pixel) = 0;
21 };
22 
23 /** A simple greyscale scalar field shader
24  */
25 class GreyShader : virtual public ScalarShaderI
26 {
27  public:
28  GreyShader(void) { }
29 virtual ~GreyShader(void) { }
30 virtual void shade(Real a_value, U8 *a_pixel)
31  {
32  a_pixel[0] = (U8)(a_value/2.0 + 50.0);
33  a_pixel[1] = a_pixel[0];
34  a_pixel[2] = a_pixel[0];
35  a_pixel[3] = 255;
36  }
37 };
38 
39 
40 } /* namespace ext */
41 } /* namespace fe */
42 
43 
44 #endif /* __spatial_ScalarShaderI_h__ */
45 
46 
kernel
Definition: namespace.dox:3
Shader for DrawScalarField.
Definition: ScalarShaderI.h:17
Base for all interfacable components.
Definition: Component.h:20
A simple greyscale scalar field shader.
Definition: ScalarShaderI.h:25