Line | |
---|
1 | #ifndef __NV_PARTICLE_ADV_SHADER_H__ |
---|
2 | #define __NV_PARTICLE_ADV_SHADER_H__ |
---|
3 | |
---|
4 | #include "Vector3.h" |
---|
5 | #include "NvShader.h" |
---|
6 | |
---|
7 | class NvParticleAdvectionShader : public NvShader { |
---|
8 | CGparameter _posTimestepParam; |
---|
9 | CGparameter _velTexParam; |
---|
10 | CGparameter _posTexParam; |
---|
11 | CGparameter _scaleParam; |
---|
12 | |
---|
13 | public : |
---|
14 | NvParticleAdvectionShader(const Vector3& scale); |
---|
15 | ~NvParticleAdvectionShader(); |
---|
16 | |
---|
17 | private : |
---|
18 | void init(const Vector3& scale); |
---|
19 | |
---|
20 | public : |
---|
21 | void bind(unsigned int texID); |
---|
22 | void unbind(); |
---|
23 | }; |
---|
24 | |
---|
25 | inline void NvParticleAdvectionShader::bind(unsigned int texID) |
---|
26 | { |
---|
27 | cgGLBindProgram(_cgFP); |
---|
28 | cgGLSetParameter1f(_posTimestepParam, 0.05); |
---|
29 | cgGLEnableTextureParameter(_velTexParam); |
---|
30 | cgGLSetTextureParameter(_posTexParam, texID); |
---|
31 | cgGLEnableTextureParameter(_posTexParam); |
---|
32 | |
---|
33 | cgGLEnableProfile(CG_PROFILE_FP30); |
---|
34 | } |
---|
35 | |
---|
36 | inline void NvParticleAdvectionShader::unbind() |
---|
37 | { |
---|
38 | cgGLDisableProfile(CG_PROFILE_FP30); |
---|
39 | |
---|
40 | cgGLDisableTextureParameter(_velTexParam); |
---|
41 | cgGLDisableTextureParameter(_posTexParam); |
---|
42 | } |
---|
43 | |
---|
44 | #endif //__NV_PARTICLE_ADV_SHADER_H__ |
---|
Note: See
TracBrowser
for help on using the repository browser.