24 #include <util/coExport.h>
28 #include <osg/Program>
29 #include <osg/Texture>
30 #include <osg/Drawable>
56 std::string textureFile;
57 std::string cubeMapFiles[6];
67 osg::Texture::WrapMode getWrapMode()
const;
108 void setValue(
const char *value);
109 void setValue(osg::Matrixd m);
110 void setValue(osg::Matrixf m);
111 void setValue(
float f);
112 void setValue(osg::Vec3 v);
113 void setValue(osg::Vec4 v);
114 void setWrapMode(std::string wm);
115 void setTexture(
const char *textureFile,
int texNum = 0);
127 coVRUniform(
const coVRShader *shader,
const std::string &name,
const std::string &type,
const std::string &value);
152 coVRAttribute(
const std::string &name,
const std::string &type,
const std::string &value);
160 std::list<osg::ref_ptr<osg::Uniform> > uniforms;
161 osg::Drawable *myDrawable;
166 void addUniform(
const osg::Uniform &u);
171 osg::Uniform *getUniform(
const std::string &name);
180 std::string fileName;
183 std::list<coVRUniform *> uniforms;
184 std::list<coVRAttribute *> attributes;
185 std::list<coVRShaderInstance *> instances;
186 osg::ref_ptr<osg::Shader> fragmentShader;
187 osg::ref_ptr<osg::Shader> geometryShader;
188 osg::ref_ptr<osg::Shader> vertexShader;
189 osg::ref_ptr<osg::Shader> tessControlShader;
190 osg::ref_ptr<osg::Shader> tessEvalShader;
191 osg::ref_ptr<osg::Program> program;
198 std::string findAsset(
const std::string &path)
const;
213 return fragmentShader;
217 return geometryShader;
225 return tessControlShader;
229 return tessEvalShader;
237 return geomParams[0];
241 return geomParams[1];
245 return geomParams[2];
251 coVRShader(
const std::string &name,
const std::string &d);
253 void setData(covise::TokenBuffer &tb);
254 void setMatrixUniform(
const std::string &name, osg::Matrixd m);
255 void setMatrixUniform(
const std::string &name, osg::Matrixf m);
256 void setFloatUniform(
const std::string &name,
float f);
257 void setVec3Uniform(
const std::string &name, osg::Vec3 v);
258 void setVec4Uniform(
const std::string &name, osg::Vec4 v);
259 void setNumVertices(
int);
260 void setInputType(
int);
261 void setOutputType(
int);
262 osg::Uniform *getUniform(
const std::string &name);
265 void apply(osg::StateSet *);
267 void setUniformesFromAttribute(
const char *uniformValues);
269 void storeMaterial();
280 void loadMaterials();
281 osg::ref_ptr<osg::Uniform> timeUniform;
282 osg::ref_ptr<osg::Uniform> timeStepUniform;
283 osg::ref_ptr<osg::Uniform> lightMatrix;
284 osg::ref_ptr<osg::Uniform> projectionMatrix;
285 osg::ref_ptr<osg::Uniform> viewMatrix;
286 osg::ref_ptr<osg::Uniform> durationUniform;
287 osg::ref_ptr<osg::Uniform> viewportWidthUniform;
288 osg::ref_ptr<osg::Uniform> viewportHeightUniform;
289 osg::ref_ptr<osg::Uniform> stereoUniform;
290 void applyParams(
coVRShader *shader, std::map<std::string, std::string> *params);
293 coVRShader *
get(
const std::string &name, std::map<std::string, std::string> *params = NULL);
294 coVRShader *getUnique(
const std::string &n, std::map<std::string, std::string> *params = NULL);
295 coVRShader *add(
const std::string &name, std::string &dirName);
297 void setData(covise::TokenBuffer &tb);
298 osg::Uniform *getTime();
299 osg::Uniform *getTimeStep();
300 osg::Uniform *getLight();
301 osg::Uniform *getProjection();
302 osg::Uniform *getView();
303 osg::Uniform *getDuration();
304 osg::Uniform *getViewportWidth();
305 osg::Uniform *getViewportHeight();
306 osg::Uniform *getStereo();
310 void remove(osg::Node *);
325 virtual void drawImplementation(osg::RenderInfo &renderInfo)
const;
328 virtual osg::Object *cloneType()
const;
332 virtual osg::Object *clone(
const osg::CopyOp &)
const;
377 void compute(osg::PrimitiveSet *pset,
378 const osg::Array *vx,
379 const osg::Array *nx,
380 int iA,
int iB,
int iC);
382 osg::ref_ptr<osg::Vec4Array>
T_;
383 osg::ref_ptr<osg::Vec4Array>
B_;
384 osg::ref_ptr<osg::Vec4Array>
N_;
static ShaderNode * theNode
Definition: coVRShader.h:324
const std::string & getMin() const
Definition: coVRShader.h:76
void setTangentArray(osg::Vec4Array *array)
Definition: coVRShader.h:360
const std::string * getCubeMapFiles() const
Definition: coVRShader.h:88
void setUnique(bool u)
Definition: coVRShader.h:104
osg::ref_ptr< osg::Shader > & getFragmentShader()
Definition: coVRShader.h:211
std::list< coVRUniform * > & getUniforms()
Definition: coVRShader.h:207
osg::ref_ptr< osg::Vec4Array > T_
Definition: coVRShader.h:382
osg::ref_ptr< osg::Vec4Array > N_
Definition: coVRShader.h:384
void generate(osg::Geometry *geo)
void setOverwrite(bool o)
Definition: coVRShader.h:100
StereoView view
Definition: coVRShader.h:333
const osg::Vec4Array * getNormalArray() const
Definition: coVRShader.h:363
const std::string & getMax() const
Definition: coVRShader.h:80
coTangentSpaceGenerator & operator=(const coTangentSpaceGenerator &)
Definition: coVRShader.h:375
const std::string & getName()
Definition: coVRShader.h:140
const std::string & getValue()
Definition: coVRShader.h:148
bool isUnique() const
Definition: coVRShader.h:120
Definition: coVRShader.h:131
Definition: coVRShader.h:174
const std::string & getTextureFileName() const
Definition: coVRShader.h:84
const osg::Vec4Array * getBinormalArray() const
Definition: coVRShader.h:367
virtual ~coTangentSpaceGenerator()
Definition: coVRShader.h:374
void setMax(const std::string &m)
Definition: coVRShader.h:96
const osg::Vec4Array * getTangentArray() const
Definition: coVRShader.h:359
Definition: MultiChannelDrawer.h:30
StereoView
Definition: coVRShader.h:317
int getInputType()
Definition: coVRShader.h:239
const std::string & getType()
Definition: coVRShader.h:144
osg::Vec4Array * getTangentArray()
Definition: coVRShader.h:358
coTangentSpaceGenerator()
osg::ref_ptr< osg::Program > & getProgram()
Definition: coVRShader.h:231
Definition: MultiChannelDrawer.h:31
osg::ref_ptr< osg::Shader > & getVertexShader()
Definition: coVRShader.h:219
osg::Vec4Array * getNormalArray()
Definition: coVRShader.h:362
const std::string & getType() const
Definition: coVRShader.h:68
void setBinormalArray(osg::Vec4Array *array)
Definition: coVRShader.h:368
std::list< osg::ref_ptr< osg::Uniform > > & getUniforms()
Definition: coVRShader.h:167
osg::ref_ptr< osg::Shader > & getTessControlShader()
Definition: coVRShader.h:223
void compute(osg::PrimitiveSet *pset, const osg::Array *vx, const osg::Array *nx, int iA, int iB, int iC)
bool isClone()
Definition: coVRShader.h:247
osg::ref_ptr< osg::Uniform > uniform
Definition: coVRShader.h:124
osg::ref_ptr< osg::Shader > & getTessEvalShader()
Definition: coVRShader.h:227
Definition: coVRShader.h:275
osg::ref_ptr< osg::Texture > texture
Definition: coVRShader.h:125
int getNumVertices()
Definition: coVRShader.h:235
osg::ref_ptr< osg::Vec4Array > B_
Definition: coVRShader.h:383
osg::ref_ptr< osg::Shader > & getGeometryShader()
Definition: coVRShader.h:215
osg::IndexArray * getIndices()
Definition: coVRShader.h:370
bool doOverwrite() const
Definition: coVRShader.h:116
osg::ref_ptr< osg::UIntArray > indices_
Definition: coVRShader.h:385
const std::string & getValue() const
Definition: coVRShader.h:72
const std::string & getName()
Definition: coVRShader.h:199
bool isTransparent()
Definition: coVRShader.h:203
void setNormalArray(osg::Vec4Array *array)
Definition: coVRShader.h:364
Definition: coVRShader.h:46
Definition: coVRShader.h:313
const std::string & getName() const
Definition: coVRShader.h:63
osg::Vec4Array * getBinormalArray()
Definition: coVRShader.h:366
Definition: coVRShader.h:351
int getOutputType()
Definition: coVRShader.h:243
Definition: coVRShader.h:156
void setMin(const std::string &m)
Definition: coVRShader.h:92