Last change
on this file since 2892 was
2882,
checked in by ldelgass, 13 years ago
|
Assume baseline requirement of NV40 GPU, which translates to Cg profiles vp40
and fp40, which in turn require NV_vertex_program3 and NV_fragment_program2
assembly shader extensions. Add explicit check for these extensions.
|
-
Property svn:eol-style set to
native
|
File size:
1.3 KB
|
Line | |
---|
1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | #ifndef POINTSHADER_H |
---|
3 | #define POINTSHADER_H |
---|
4 | |
---|
5 | #include "NvShader.h" |
---|
6 | #include "Texture3D.h" |
---|
7 | |
---|
8 | class PointShader : public NvShader |
---|
9 | { |
---|
10 | public: |
---|
11 | PointShader(); |
---|
12 | |
---|
13 | ~PointShader(); |
---|
14 | |
---|
15 | void setScale(float scale) |
---|
16 | { |
---|
17 | cgGLSetParameter4f(_scaleVP, scale, 1.0f, 1.0f, 1.0f); |
---|
18 | } |
---|
19 | |
---|
20 | void setNormalTexture(Texture3D *n) |
---|
21 | { |
---|
22 | _normal = n; |
---|
23 | } |
---|
24 | |
---|
25 | void bind() |
---|
26 | { |
---|
27 | setParameters(); |
---|
28 | |
---|
29 | if (_cgVP) { |
---|
30 | cgGLBindProgram(_cgVP); |
---|
31 | cgGLEnableProfile((CGprofile) CG_PROFILE_VP40); |
---|
32 | } |
---|
33 | if (_cgFP) { |
---|
34 | cgGLBindProgram(_cgFP); |
---|
35 | cgGLEnableProfile((CGprofile) CG_PROFILE_FP40); |
---|
36 | } |
---|
37 | } |
---|
38 | |
---|
39 | void unbind() |
---|
40 | { |
---|
41 | if (_cgVP) { |
---|
42 | cgGLDisableProfile((CGprofile)CG_PROFILE_VP40); |
---|
43 | } |
---|
44 | if (_cgFP) { |
---|
45 | cgGLDisableProfile((CGprofile)CG_PROFILE_FP40); |
---|
46 | } |
---|
47 | |
---|
48 | resetParameters(); |
---|
49 | } |
---|
50 | |
---|
51 | protected: |
---|
52 | virtual void setParameters(); |
---|
53 | virtual void resetParameters(); |
---|
54 | |
---|
55 | private: |
---|
56 | CGparameter _modelviewVP; |
---|
57 | CGparameter _projectionVP; |
---|
58 | |
---|
59 | CGparameter _attenVP; |
---|
60 | CGparameter _posoffsetVP; |
---|
61 | CGparameter _baseposVP; |
---|
62 | CGparameter _scaleVP; |
---|
63 | CGparameter _normalParam; |
---|
64 | |
---|
65 | Texture3D *_normal; |
---|
66 | }; |
---|
67 | |
---|
68 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.