-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.h
80 lines (63 loc) · 2.13 KB
/
Program.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef __PROGRAM__
#define __PROGRAM__
#include <omega.h>
#include "Dataset.h"
using namespace omega;
///////////////////////////////////////////////////////////////////////////////
class ProgramParams : public ReferenceType
{
public:
ProgramParams();
float pointScale;
Vector3f focusPosition;
float filterMax;
float filterMin;
bool normalizedFilterBounds;
Color color;
int decimation;
};
///////////////////////////////////////////////////////////////////////////////
class Program: public ReferenceType
{
public:
typedef List< Ref<Program> > List;
public:
Program(const String& name);
String getName() { return myName; }
void setVertexShader(const String& filename);
void setFragmentShader(const String& filename);
void setGeometryShader(const String& filename);
bool prepare(const DrawContext& context);
void setParams(const DrawContext& context, ProgramParams* p);
GpuProgram* getGpuProgram(const DrawContext& context);
Uniform* getMVPMatrix(const DrawContext& c) { return myMVPMatrix(c); }
Uniform* getMVMatrix(const DrawContext& c) { return myMVMatrix(c); }
Uniform* getPMatrix(const DrawContext& c) { return myPMatrix(c); }
Uniform* getDataBounds(const DrawContext& c) { return myDataBounds(c); }
Uniform* getFilterBounds(const DrawContext& c) { return myFilterBounds(c); }
void reload() { myDirty = true; }
void define(const String& name, const String& value);
void clearDefines();
private:
String myName;
String myVertexShaderFilename;
String myFragmentShaderFilename;
String myGeometryShaderFilename;
Dictionary<String, String> myDefines;
GpuRef<GpuProgram> myProgram;
GpuRef<Uniform> myVMatrix;
GpuRef<Uniform> myMVPMatrix;
GpuRef<Uniform> myMVMatrix;
GpuRef<Uniform> myPMatrix;
GpuRef<Uniform> myPointScale;
GpuRef<Uniform> myFocusPosition;
GpuRef<Uniform> mySliceBounds;
GpuRef<Uniform> myDataBounds;
GpuRef<Uniform> myFilterBounds;
GpuRef<Uniform> myColor;
GpuRef<Uniform> myDecimation;
// Program Parameters & Uniforms
Ref<ProgramParams> myParams;
bool myDirty;
};
#endif