Last change
on this file since 2720 was
2096,
checked in by ldelgass, 14 years ago
|
Normalize line endings, set eol-style to native on *.cpp, *.h files
|
-
Property svn:eol-style set to
native
|
File size:
1.6 KB
|
Line | |
---|
1 | #ifndef __NV_SHADER_H__ |
---|
2 | #define __NV_SHADER_H__ |
---|
3 | |
---|
4 | #include <Cg/cg.h> |
---|
5 | #include <Cg/cgGL.h> |
---|
6 | |
---|
7 | typedef void NvCgCallbackFunction(void); |
---|
8 | |
---|
9 | class NvShader { |
---|
10 | protected : |
---|
11 | CGprogram _cgVP; |
---|
12 | CGprogram _cgFP; |
---|
13 | |
---|
14 | public : |
---|
15 | NvShader(); |
---|
16 | |
---|
17 | public : |
---|
18 | virtual ~NvShader(); |
---|
19 | |
---|
20 | protected : |
---|
21 | void resetPrograms(); |
---|
22 | |
---|
23 | public : |
---|
24 | static void setErrorCallback(NvCgCallbackFunction callback); |
---|
25 | public : |
---|
26 | /** |
---|
27 | * @brief create a Cg vertex program and load it |
---|
28 | * @param fileName the name of Cg program file |
---|
29 | * @param entryPoint a entry point of the Cg program |
---|
30 | */ |
---|
31 | void loadVertexProgram(const char* fileName, const char* entryPoint); |
---|
32 | |
---|
33 | /** |
---|
34 | * @brief create a Cg fragment program and load it |
---|
35 | * @param fileName the name of Cg program file |
---|
36 | * @param entryPoint a entry point of the Cg program |
---|
37 | */ |
---|
38 | void loadFragmentProgram(const char* fileName, const char* entryPoint); |
---|
39 | |
---|
40 | CGparameter getNamedParameterFromFP(const char* paramName); |
---|
41 | CGparameter getNamedParameterFromVP(const char* paramName); |
---|
42 | |
---|
43 | CGprogram getVP() const; |
---|
44 | CGprogram getFP() const; |
---|
45 | }; |
---|
46 | |
---|
47 | extern CGcontext g_context; |
---|
48 | |
---|
49 | inline CGparameter NvShader::getNamedParameterFromFP(const char* paramName) |
---|
50 | { |
---|
51 | if (_cgFP) |
---|
52 | { |
---|
53 | return cgGetNamedParameter(_cgFP, paramName); |
---|
54 | } |
---|
55 | |
---|
56 | return 0; |
---|
57 | } |
---|
58 | |
---|
59 | inline CGparameter NvShader::getNamedParameterFromVP(const char* paramName) |
---|
60 | { |
---|
61 | if (_cgVP) |
---|
62 | { |
---|
63 | return cgGetNamedParameter(_cgVP, paramName); |
---|
64 | } |
---|
65 | |
---|
66 | return 0; |
---|
67 | } |
---|
68 | |
---|
69 | inline CGprogram NvShader::getVP() const |
---|
70 | { |
---|
71 | return _cgVP; |
---|
72 | } |
---|
73 | |
---|
74 | inline CGprogram NvShader::getFP() const |
---|
75 | { |
---|
76 | return _cgFP; |
---|
77 | } |
---|
78 | |
---|
79 | #endif // |
---|
80 | |
---|
Note: See
TracBrowser
for help on using the repository browser.