26 static const char COLOR_RED_KW[] =
"color_red";
27 static const char COLOR_GREEN_KW[] =
"color_green";
28 static const char COLOR_BLUE_KW[] =
"color_blue";
31 "ossimBumpShadeTileSource",
38 m_lightSourceElevationAngle(45.0),
39 m_lightSourceAzimuthAngle(45.0),
77 if (!
getInput(0) || !tile)
return false;
94 colorSource->
getTile(colorData.
get(), resLevel);
106 normalSource->
getTile(normalData.
get(), resLevel);
125 if ( colorData.
get() &&
145 colorBuf[1] = colorBuf[0];
153 colorBuf[2] = colorBuf[0];
158 for(
long y = 0;
y < h; ++
y)
160 for(
long x = 0;
x < w; ++
x)
162 if((*normalBuf[0] != normalNp) &&
163 (*normalBuf[1] != normalNp) &&
164 (*normalBuf[2] != normalNp) )
166 if((*colorBuf[0])||(*colorBuf[1])||(*colorBuf[2]))
193 *resultBuf[0] = *colorBuf[0];
194 *resultBuf[1] = *colorBuf[1];
195 *resultBuf[2] = *colorBuf[2];
213 <<
"ossimBumpShadeTileSource::getTile NOTICE:\n" 214 <<
"only 8-bit unsigned char is supported." << endl;
226 for(
long y = 0;
y < h; ++
y)
228 for(
long x = 0;
x < w; ++
x)
230 if((*normalBuf[0] != normalNp) &&
231 (*normalBuf[1] != normalNp) &&
232 (*normalBuf[2] != normalNp) )
315 NEWMAT::ColumnVector v(3);
346 const char* lookup = kwl.
find(prefix, COLOR_RED_KW);
352 lookup = kwl.
find(prefix, COLOR_GREEN_KW);
358 lookup = kwl.
find(prefix, COLOR_BLUE_KW);
377 const char* prefix)
const 389 kwl.
add(prefix, COLOR_RED_KW,
m_r,
true);
390 kwl.
add(prefix, COLOR_GREEN_KW,
m_g,
true);
391 kwl.
add(prefix, COLOR_BLUE_KW,
m_b,
true);
455 ( (inputIndex>=0) && inputIndex < 2)&&
483 if(name ==
"lightSourceElevationAngle")
487 else if(name ==
"lightSourceAzimuthAngle")
499 if(name ==
"lightSourceElevationAngle")
505 else if(name ==
"lightSourceAzimuthAngle")
518 propertyNames.push_back(
"lightSourceElevationAngle");
519 propertyNames.push_back(
"lightSourceAzimuthAngle");
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
virtual void setNumberOfInputs(ossim_int32 numberOfInputs)
Will set the number of inputs.
virtual ossim_uint32 getWidth() const
virtual bool isSourceEnabled() const
virtual double getAzimuthAngle() const
ossim_uint8 m_r
rgb values used when no color source (2nd layer) is present.
This uses a derivative of Blinn's bump function to compute a 3-D looking image.
virtual ossim_uint32 getNumberOfBands() const
virtual void refreshEvent(ossimRefreshEvent &event)
virtual void setImageRectangle(const ossimIrect &rect)
This will be a base for all combiners.
static long clamp(long colorValue, unsigned char min=0, unsigned char max=255)
Represents serializable keyword/value map.
ossim_uint8 toUInt8() const
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
const char * find(const char *key) const
void computeLightDirection()
Will re-compute the light direction given the elevation angle and azimuth angle.
virtual void propertyEvent(ossimPropertyEvent &event)
static ossimString toString(bool aValue)
Numeric to string methods.
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
ossimColumnVector3d unit() const
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossim_uint32 getHeight() const
virtual ossim_uint32 getNumberOfOutputBands() const
This should always return 3.
bool canConnectMyInputTo(ossim_int32 inputIndex, const ossimConnectableObject *object) const
required to be overriden by derived classes
virtual void initialize()
Initialize the data buffer.
virtual void setElevationAngle(double angle)
double m_lightSourceAzimuthAngle
Used for the light vector computation.
virtual ~ossimBumpShadeTileSource()
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
NEWMAT::ColumnVector m_lightDirection
This is computed from the elevation and azimuth angles of the light source.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual void setProperty(ossimRefPtr< ossimProperty > property)
static ossimImageDataFactory * instance()
virtual ossimScalarType getOutputScalarType() const
The output scalar type should always be 8-bit.
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
void computeColor(ossim_uint8 &r, ossim_uint8 &g, ossim_uint8 &b, ossim_float64 normalX, ossim_float64 normalY, ossim_float64 normalZ, ossim_uint8 dr, ossim_uint8 dg, ossim_uint8 db) const
RTTI_DEF1(ossimBumpShadeTileSource, "ossimBumpShadeTileSource", ossimImageCombiner)
virtual ossimDataObjectStatus validate() const
virtual void initialize()
unsigned int ossim_uint32
virtual const ossim_float64 * getNullPix() const
void getRgbColorSource(ossim_uint8 &r, ossim_uint8 &g, ossim_uint8 &b) const
Gets the red, green and blue color source values.
void setRgbColorSource(ossim_uint8 r, ossim_uint8 g, ossim_uint8 b)
Set the red, green and blue color source values.
virtual void setAzimuthAngle(double angle)
ossimString getShortName() const
virtual ossimIrect getImageRectangle() const
virtual void initialize()
static const char * AZIMUTH_ANGLE_KW
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
virtual ossimScalarType getScalarType() const
virtual void makeBlank()
Initializes data to null pixel values.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
virtual void disconnectInputEvent(ossimConnectionEvent &event)
virtual double getMaxPixelValue(ossim_uint32 band=0) const
the max pixel is 255.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
virtual const void * getBuf() const
virtual ossim_uint32 getNumberOfInputs() const
Returns the number of input objects.
virtual double getNullPixelValue() const
the null pixel is 0.0.
virtual double getMinPixelValue(ossim_uint32 band=0) const
the min pixel is 1.0.
bool theInputListIsFixedFlag
Indicates whether the theInputObjectList is fixed.
ossimBumpShadeTileSource()
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
virtual void setProperty(ossimRefPtr< ossimProperty > property)
ossimRefPtr< ossimImageData > m_tile
The result of the illumination equation is stored in here.
virtual void initialize()=0
static const char * ELEVATION_ANGLE_KW
ossimDataObjectStatus
Definitions for data object status.
bool theOutputListIsFixedFlag
Indicates whether the theOutputObjectList is fixed.
ossimRefPtr< ossimImageData > getTile(const ossimIrect &tileRect, ossim_uint32 resLevel=0)
virtual void connectInputEvent(ossimConnectionEvent &event)
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossimString getLongName() const
double m_lightSourceElevationAngle
Used for the light vector computation.
virtual double getElevationAngle() const
void setCacheRefreshBit()
static NEWMAT::Matrix createRotationMatrix(double angleX, double angleY, double angleZ, ossimCoordSysOrientMode orientationMode=OSSIM_RIGHT_HANDED)
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)