source: trunk/vizservers/nanovis/NvParticleAdvectionShader.h @ 750

Last change on this file since 750 was 587, checked in by vrinside, 17 years ago
File size: 1.0 KB
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
7class NvParticleAdvectionShader : public NvShader {
8    CGparameter _posTimestepParam;
9    CGparameter _velTexParam;
10    CGparameter _posTexParam;
11    CGparameter _scaleParam;
12
13public :
14    NvParticleAdvectionShader(const Vector3& scale);
15    ~NvParticleAdvectionShader();
16
17private :
18    void init(const Vector3& scale);
19
20public :
21    void bind(unsigned int texID);
22    void unbind();
23};
24
25inline 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
36inline 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.