Open Inventor Release 2024.1.2
 
Loading...
Searching...
No Matches
SoTransferFunction.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2024 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : P. ESTRADE (Mar 2000)
22**=======================================================================*/
23#ifndef _SO_TRANSFER_FUNCTION_
24#define _SO_TRANSFER_FUNCTION_
25
26#include <LDM/SoLDM.h>
27
28#include <Inventor/nodes/SoNode.h>
29#include <Inventor/nodes/SoTexture2.h>
30#include <Inventor/fields/SoSFEnum.h>
31#include <Inventor/fields/SoMFFloat.h>
32#include <Inventor/fields/SoSFInt32.h>
33#include <Inventor/fields/SoSFFloat.h>
34#include <Inventor/algorithms/SoConversion.h>
35#include <Inventor/SbVec.h>
36
37#include <Inventor/SbPImpl.h>
38
39#ifdef _WIN32
40#pragma warning( push )
41#pragma warning(disable:4251)
42#endif
43
44class SoGLTexture;
45class SoVolumeState;
46
47SO_PIMPL_BASE_PUBLIC_DECLARATION(SoTransferFunction)
48
49
445
446 SO_NODE_HEADER( SoTransferFunction );
447
448 SO_PIMPL_BASE_PUBLIC_HEADER(SoTransferFunction);
449
450 public:
497
507
513
527
536
548
561
573
624
654
664
681
709
720
725
731
746 virtual SbBool loadColormap(const SbString& filename);
747
748 private:
749 virtual void doAction( SoAction *action );
750 virtual void callback( SoCallbackAction *action );
751 virtual void GLRender( SoGLRenderAction *action );
752 virtual void pick(SoPickAction *action) ;
753 virtual void write(SoWriteAction *action);
754
755 //------------------------------------------------------------------------------
756 private:
757
761 enum MappingMethod
762 {
770 MAP_TO_CENTER = SoConversion::MAP_TO_CENTER,
771
779 MAP_TO_BORDER = SoConversion::MAP_TO_BORDER
780 };
781
788 SoSFEnum mappingMethod;
789
790 typedef float OpacityCorrectionFunction(float alpha, void* userData);
791
795 virtual void notify(SoNotList *list);
796
801 virtual bool affectsPath() const;
802
803 static void initClass();
804 static void exitClass();
805
806 int getPackedColorMap(unsigned int * &, int);
807 static unsigned int getDefaultPackedColor(unsigned int);
808 enum GLColorMapType {
809 NO_COLORMAP = 0,
810 TEX_FRAGMENT_PROGRAM = 2
811 };
812
813 GLColorMapType installColorMap(SoState*, int alphaUse);
814
818 GLColorMapType installColorMap(SoState*, int, OpacityCorrectionFunction* f, void* userData);
819 int m_colorMapMin;
820 int m_colorMapMax;
821
825 void applyOpacityCorrection(unsigned int* allRgba, size_t numRgba,
826 OpacityCorrectionFunction* f, void* userData);
827
831 SbBool isFullyTransparent(int64_t min, int64_t max, int alphaUse = 0);
832
833 //for cluster command, list of method to sync
834 enum Cmd{
835 REMAP = 0
836 };
837
838 void getCMBuffer( int alphaUse, int nrgba, unsigned int *rgba );
839
844 bool isTransparent(const float min, const float max, const float materialTransparency) const;
845
849 SoRef<SoTexture> getTexture() const;
850
854 SbVec2i32 getTextureSize() const;
855
860 unsigned int getNumColors() const;
861
865 bool isBinary() const;
866
870 static void createPreIntegratedTexture(SoState* state, SoGroup* placeHolder);
871
875 size_t getNumComponents() const;
876
881 int getTransferFunctionPosInTexture(int maxTfId);
882
883private :
884
885 // Function to factorise constructors code
886 void construct();
887
888 friend class SoVolumeState;
889};
890
891#if defined(_WIN32)
892#pragma warning( pop )
893#endif
894
895#endif // _SO_TRANSFER_FUNCTION_
896
897
Class for smart character strings.
Definition SbString.h:202
2D vector class.
Definition SbVec.h:517
Abstract base class for all actions.
Definition SoAction.h:132
Performs a generic traversal of a scene graph or path.
Renders a scene graph using Open Inventor's Render Engine.
Base class for all group nodes.
Definition SoGroup.h:122
Multiple-value field containing any number of floating point values.
Definition SoMFFloat.h:90
Abstract base class for all database nodes.
Definition SoNode.h:145
Abstract base class for picking objects in a scene.
Smart pointer for any class inheriting SoRefCounter.
Definition SoRef.h:90
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a floating-point value.
Definition SoSFFloat.h:78
Field containing a int32_t integer.
Definition SoSFInt32.h:80
Traversal state.
Definition SoState.h:74
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Describe...
ColorMapType
Available color map type.
SoSFEnum colorMapType
ColorMap type (number of color components).
SoMFFloat actualColorMap
This field contains the actual color map used.
PredefColorMap
Predefined color maps.
@ VOLREN_GREEN
VolRenGreen (opacity ramp).
@ LABEL_256
256 labels (opaque).
@ TEMPERATURE
Temperature (opaque).
@ BLUE_WHITE_RED
Blue white red (opaque).
@ AIRWAY_SURFACES
Airway surfaces.
@ STANDARD
Standard (opaque).
@ INTENSITY
Intensity (opaque).
@ BLUE_RED
Blue red (opaque).
@ PHYSICS
Physics (opaque).
@ GREY
Grey (Default).
@ VOLREN_RED
VolRenRed (opacity ramp).
SoSFFloat fauxShadingLength
Controls how many color values will be affected by faux shading.
SoMFFloat colorMap
Array of floats in the range [0,1] defining a color map.
SbBool hasTransparency() const
Returns TRUE if the current color map contains alpha values less than 1.
SoSFFloat fauxShadingDarkenThreshold
Opacity threshold for darkening edges.
virtual SbBool loadColormap(const SbString &filename)
Loads a colormap from a file.
SoSFFloat fauxShadingStrength
Controls how much faux shading will darken the color values of the transfer function.
SoSFEnum predefColorMap
Predefined color map to use.
SoSFInt32 shift
Used for rescaling the input data values.
SoSFInt32 offset
Used for rescaling the input data values.
SoSFInt32 minValue
Remaps the defined color map between minValue and maxValue indices.
SoTransferFunction()
Constructor.
SoSFInt32 transferFunctionId
This field allows the use of multiple transfer functions.
SoSFInt32 maxValue
See minValue field.
Writes a scene graph to a file.
int SbBool
Boolean type.
Definition SbBase.h:87