Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoTransferFunction.h
Go to the documentation of this file.
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-2021 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
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
48
49
444
446
447 SO_PIMPL_BASE_PUBLIC_HEADER(SoTransferFunction);
448
449 public:
496
506
512
526
535
547
560
572
623
653
663
680
708
719
724
730
745 virtual SbBool loadColormap(const SbString& filename);
746
747 private:
748 virtual void doAction( SoAction *action );
749 virtual void callback( SoCallbackAction *action );
750 virtual void GLRender( SoGLRenderAction *action );
751 virtual void pick(SoPickAction *action) ;
752 virtual void write(SoWriteAction *action);
753
754 //------------------------------------------------------------------------------
755 private:
756
760 enum MappingMethod
761 {
769 MAP_TO_CENTER = SoConversion::MAP_TO_CENTER,
770
778 MAP_TO_BORDER = SoConversion::MAP_TO_BORDER
779 };
780
787 SoSFEnum mappingMethod;
788
789 typedef float OpacityCorrectionFunction(float alpha, void* userData);
790
794 virtual void notify(SoNotList *list);
795
800 virtual bool affectsPath() const;
801
802 static void initClass();
803 static void exitClass();
804
805 int getPackedColorMap(unsigned int * &, int);
806 static unsigned int getDefaultPackedColor(unsigned int);
807 enum GLColorMapType {
808 NO_COLORMAP = 0,
809 TEX_FRAGMENT_PROGRAM = 2
810 };
811
812 GLColorMapType installColorMap(SoState*, int alphaUse);
813
817 GLColorMapType installColorMap(SoState*, int, OpacityCorrectionFunction* f, void* userData);
818 int m_colorMapMin;
819 int m_colorMapMax;
820
824 void applyOpacityCorrection(unsigned int* allRgba, size_t numRgba,
825 OpacityCorrectionFunction* f, void* userData);
826
830 SbBool isFullyTransparent(int64_t min, int64_t max, int alphaUse = 0);
831
832 //for cluster command, list of method to sync
833 enum Cmd{
834 REMAP = 0
835 };
836
837 void getCMBuffer( int alphaUse, int nrgba, unsigned int *rgba );
838
843 bool isTransparent(const float min, const float max, const float materialTransparency) const;
844
848 SoRef<SoTexture> getTexture() const;
849
853 SbVec2i32 getTextureSize() const;
854
859 unsigned int getNumColors() const;
860
864 bool isBinary() const;
865
869 static void createPreIntegratedTexture(SoState* state, SoGroup* placeHolder);
870
874 size_t getNumComponents() const;
875
880 int getTransferFunctionPosInTexture(int maxTfId);
881
882private :
883
884 // Function to factorise constructors code
885 void construct();
886
887 friend class SoVolumeState;
888};
889
890#if defined(_WIN32)
891#pragma warning( pop )
892#endif
893
894#endif // _SO_TRANSFER_FUNCTION_
895
896
SO_PIMPL_BASE_PUBLIC_DECLARATION(SoImageDataAdapter)
#define SO_NODE_HEADER(className)
Definition SoSubNode.h:151
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
void notify(SoNotList *list)