Moved colour space conversion of volumes from the osgvolume example into osg/ImageUtils and added support for colorSpaceConversion="MODULATE_ALPHA_BY_LUMINANCE","MODULATE_ALPHA_BY_COLOUR","REPLACE_ALPHA_WITH_LUMINANCE" and "REPLACE_RGB_WITH_LUMINANCE" to .p3d <volume> tag
This commit is contained in:
@@ -179,6 +179,8 @@ class OSG_EXPORT Image : public BufferData
|
||||
*/
|
||||
virtual void readImageFromCurrentTexture(unsigned int contextID, bool copyMipMapsIfAvailable, GLenum type = GL_UNSIGNED_BYTE, unsigned int face = 0);
|
||||
|
||||
/** swap the data and settings between two image objects.*/
|
||||
void swap(osg::Image& rhs);
|
||||
|
||||
/** Scale image to specified size. */
|
||||
void scaleImage(int s,int t,int r) { scaleImage(s,t,r, getDataType()); }
|
||||
@@ -471,7 +473,6 @@ class OSG_EXPORT Image : public BufferData
|
||||
std::string _fileName;
|
||||
WriteHint _writeHint;
|
||||
|
||||
|
||||
Origin _origin;
|
||||
|
||||
int _s, _t, _r;
|
||||
|
||||
@@ -153,10 +153,27 @@ extern OSG_EXPORT osg::Image* createImage3DWithAlpha(const ImageList& imageList,
|
||||
int r_maximumImageSize = 1024,
|
||||
bool resizeToPowerOfTwo = false);
|
||||
|
||||
|
||||
|
||||
|
||||
/** create a 2D osg::Image that provides a point at the center of the image.
|
||||
* The colour across th image is computed from a balance between the center color and the background color controlled by the power of the radius from the center.*/
|
||||
extern OSG_EXPORT osg::Image* createSpotLightImage(const osg::Vec4& centerColour, const osg::Vec4& backgroudColour, unsigned int size, float power);
|
||||
|
||||
|
||||
enum ColorSpaceOperation
|
||||
{
|
||||
NO_COLOUR_SPACE_OPERATION,
|
||||
MODULATE_ALPHA_BY_LUMINANCE,
|
||||
MODULATE_ALPHA_BY_COLOUR,
|
||||
REPLACE_ALPHA_WITH_LUMINANCE,
|
||||
REPLACE_RGB_WITH_LUMINANCE
|
||||
};
|
||||
|
||||
/** Convert the RGBA values in a Image based on a ColorSpaceOperation defined scheme.*/
|
||||
extern osg::Image* colorSpaceConversion(ColorSpaceOperation op, osg::Image* image, const osg::Vec4& colour);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/ImageUtils>
|
||||
#include <osg/Group>
|
||||
#include <osg/ClearNode>
|
||||
#include <osg/Switch>
|
||||
@@ -291,7 +292,9 @@ public:
|
||||
alphaValue(1.0),
|
||||
cutoffValue(0.1),
|
||||
sampleDensityValue(0.005),
|
||||
sampleDensityWhenMovingValue(0.0)
|
||||
sampleDensityWhenMovingValue(0.0),
|
||||
colorSpaceOperation(osg::NO_COLOUR_SPACE_OPERATION),
|
||||
colorModulate(1.0f,1.0f,1.0f,1.0f)
|
||||
{
|
||||
region[0] = region[1] = region[2] = 0.0f;
|
||||
region[3] = region[4] = region[5] = 1.0f;
|
||||
@@ -308,6 +311,9 @@ public:
|
||||
float cutoffValue;
|
||||
float sampleDensityValue;
|
||||
float sampleDensityWhenMovingValue;
|
||||
|
||||
osg::ColorSpaceOperation colorSpaceOperation;
|
||||
osg::Vec4 colorModulate;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user