00001 #ifndef SO_ALGEBRAIC_SHAPE_H
00002 #define SO_ALGEBRAIC_SHAPE_H
00003
00004 #include <Inventor/nodes/SoShape.h>
00005 #include <Inventor/nodes/SoShaderObject.h>
00006 #include <Inventor/nodes/SoVertexShader.h>
00007 #include <Inventor/nodes/SoFragmentShader.h>
00008 #include <Inventor/SbBox.h>
00009 #include <Inventor/SbVec.h>
00010
00011
00012 class SoAlgebraicShapeImpl;
00013 class SoBufferedShape;
00014
00146 class SoAlgebraicShape : public SoShape
00147 {
00148 SO_NODE_HEADER(SoAlgebraicShape);
00149
00150 public:
00151
00171 SoSFNode rayIntersection;
00172
00176 enum ASWorkSpace {
00177 BOX,
00178 CAMERA,
00179 WORLD,
00180 MAX_WORK_SPACE
00181 };
00182
00196 SoSFEnum workspace;
00197
00201 enum ASShaderSlot {
00202 COMPUTE_COLOR,
00203 VERTEX_SHADER_ENTRY,
00204 MAX_SHADER_SLOT
00205 };
00206
00239 SoMFNode shaderSlots;
00240
00252 SoSFBool generateTransparency;
00253
00257 enum ASClippingPolicy
00258 {
00259 STANDARD,
00260 FULL_SHAPE,
00261 };
00262
00267 SoSFEnum clippingPolicy;
00268
00269 private:
00270
00274 SoAlgebraicShape ();
00275
00279 virtual ~SoAlgebraicShape ();
00280
00286 virtual void computeBBox ( SbBox3f &box, SbVec3f ¢er ) = 0;
00287
00294 bool solveQuadric ( const SbVec3f& abc, SbVec2f& roots ) const;
00295
00301 static SoFragmentShader* fragmentShaderFromFile ( const SbString& filename );
00302
00307 virtual void generatePrimitives(SoAction *action);
00308
00310
00313 void setCustomTransformationShaderObject( SoVertexShader* vso );
00314 void setCustomRayParametersShaderObject ( SoVertexShader* vso );
00315 void setCustomGeometryBufferedShape ( SoBufferedShape* shape );
00317
00318 private:
00319
00321
00324 virtual void GLRender ( SoGLRenderAction *action );
00325 virtual void computeBBox ( SoAction *action, SbBox3f &box, SbVec3f ¢er );
00327
00328 private:
00329
00331
00334 static void initClass ();
00335 static void exitClass ();
00337
00341 virtual void notify ( SoNotList *list );
00342
00343 private:
00344
00345
00346 void updateBBox ();
00347
00348 private:
00349
00350
00351 SoAlgebraicShapeImpl* m_impl;
00352
00353 friend class SoAlgebraicShapeImpl;
00354
00355 };
00356
00357 #endif // SO_QUADRIC_SHAPE_H
00358