source: trunk/packages/vizservers/nanovis/NvShader.h @ 2720

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
7typedef void NvCgCallbackFunction(void);
8
9class NvShader {
10protected :
11    CGprogram _cgVP;
12    CGprogram _cgFP;
13
14public :
15    NvShader();
16
17public :
18    virtual ~NvShader();
19
20protected :
21    void resetPrograms();
22
23public :
24    static void setErrorCallback(NvCgCallbackFunction callback);
25public :
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
47extern CGcontext g_context;
48
49inline CGparameter NvShader::getNamedParameterFromFP(const char* paramName)
50{
51    if (_cgFP)
52    {
53        return cgGetNamedParameter(_cgFP, paramName);
54    }
55
56    return 0;
57}
58
59inline CGparameter NvShader::getNamedParameterFromVP(const char* paramName)
60{
61    if (_cgVP)
62    {
63        return cgGetNamedParameter(_cgVP, paramName);
64    }
65
66    return 0;
67}
68
69inline CGprogram NvShader::getVP() const
70{
71    return _cgVP;
72}
73
74inline CGprogram NvShader::getFP() const
75{
76    return _cgFP;
77}
78
79#endif //
80
Note: See TracBrowser for help on using the repository browser.