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 | |
---|
9 | CGparameter _posTimestepParam; |
---|
10 | CGparameter _velTexParam; |
---|
11 | //CGparameter _tfTexParam; |
---|
12 | CGparameter _posTexParam; |
---|
13 | CGparameter _initPosTexParam; |
---|
14 | CGparameter _scaleParam; |
---|
15 | CGparameter _maxParam; |
---|
16 | CGparameter _modeParam; |
---|
17 | unsigned int _velocityVolumeID; |
---|
18 | Vector3 _scale; |
---|
19 | float _max; |
---|
20 | float _timeStep; |
---|
21 | |
---|
22 | int _mode; |
---|
23 | |
---|
24 | public : |
---|
25 | NvParticleAdvectionShader(); |
---|
26 | ~NvParticleAdvectionShader(); |
---|
27 | |
---|
28 | private : |
---|
29 | void init(); |
---|
30 | public : |
---|
31 | //void bind(unsigned int texID, unsigned int tfTexID, unsigned int initPosTexID); |
---|
32 | void bind(unsigned int texID, unsigned int initPosTexID); |
---|
33 | void unbind(); |
---|
34 | void setScale(const Vector3& scale); |
---|
35 | void setVelocityVolume(unsigned int texID, float max); |
---|
36 | void setTimeStep(float timeStep); |
---|
37 | void setRenderMode(int mode); |
---|
38 | }; |
---|
39 | |
---|
40 | inline void NvParticleAdvectionShader::setTimeStep(float timeStep) |
---|
41 | { |
---|
42 | _timeStep = timeStep; |
---|
43 | } |
---|
44 | |
---|
45 | inline void NvParticleAdvectionShader::unbind() |
---|
46 | { |
---|
47 | cgGLDisableProfile(CG_PROFILE_FP30); |
---|
48 | |
---|
49 | cgGLDisableTextureParameter(_velTexParam); |
---|
50 | cgGLDisableTextureParameter(_posTexParam); |
---|
51 | //cgGLDisableTextureParameter(_tfTexParam); |
---|
52 | cgGLDisableTextureParameter(_initPosTexParam); |
---|
53 | } |
---|
54 | |
---|
55 | inline void NvParticleAdvectionShader::setScale(const Vector3& scale) |
---|
56 | { |
---|
57 | _scale = scale; |
---|
58 | } |
---|
59 | |
---|
60 | inline void NvParticleAdvectionShader::setVelocityVolume(unsigned int texID, float max) |
---|
61 | { |
---|
62 | _velocityVolumeID = texID; |
---|
63 | _max = max; |
---|
64 | } |
---|
65 | |
---|
66 | inline void NvParticleAdvectionShader::setRenderMode(int mode) |
---|
67 | { |
---|
68 | _mode = mode; |
---|
69 | } |
---|
70 | |
---|
71 | #endif //__NV_PARTICLE_ADV_SHADER_H__ |
---|