Fixes to new flipVertical/flipHorizontal.
This commit is contained in:
@@ -141,12 +141,12 @@ SG_EXPORT extern sMStats m_getMemoryStatistics();
|
||||
|
||||
#else
|
||||
|
||||
#define osgNew new
|
||||
#define osgDelete delete
|
||||
#define osgNew new
|
||||
#define osgDelete delete
|
||||
#define osgMalloc(sz) malloc(sz)
|
||||
#define osgCalloc(sz) calloc(sz)
|
||||
#define osgRealloc(ptr,sz) realloc(sz)
|
||||
#define osgFree(ptr) free(sz)
|
||||
#define osgRealloc(ptr,sz) realloc(ptr,sz)
|
||||
#define osgFree(ptr) free(ptr)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -127,6 +127,8 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor
|
||||
/** Returns the current CullingMode.*/
|
||||
CullingMode getCullingMode() const;
|
||||
|
||||
void setSmallFeatureCullingPixelSize(float s) { _smallFeatureCullingPixelSize=s; }
|
||||
float getSmallFeatureCullingPixelSize() const { return _smallFeatureCullingPixelSize; }
|
||||
|
||||
void pushViewport(osg::Viewport* viewport);
|
||||
void popViewport();
|
||||
@@ -235,8 +237,42 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor
|
||||
return !_modelviewClippingVolumeStack.back().contains(bb,mode);
|
||||
}
|
||||
|
||||
void setSmallFeatureCullingPixelSize(float s) { _smallFeatureCullingPixelSize=s; }
|
||||
float getSmallFeatureCullingPixelSize() const { return _smallFeatureCullingPixelSize; }
|
||||
void updateCalculatedNearFar(const osg::Matrix& matrix,const osg::Drawable& drawable);
|
||||
void updateCalculatedNearFar(const osg::Vec3& pos);
|
||||
|
||||
/** Add a drawable to current render graph.*/
|
||||
inline void addDrawable(osg::Drawable* drawable,osg::Matrix* matrix)
|
||||
{
|
||||
if (_currentRenderGraph->leaves_empty())
|
||||
{
|
||||
// this is first leaf to be added to RenderGraph
|
||||
// and therefore should not already know to current render bin,
|
||||
// so need to add it.
|
||||
_currentRenderBin->addRenderGraph(_currentRenderGraph);
|
||||
}
|
||||
//_currentRenderGraph->addLeaf(new RenderLeaf(drawable,matrix));
|
||||
_currentRenderGraph->addLeaf(createOrReuseRenderLeaf(drawable,_projectionStack.back().get(),matrix));
|
||||
}
|
||||
|
||||
/** Add a drawable and depth to current render graph.*/
|
||||
inline void addDrawableAndDepth(osg::Drawable* drawable,osg::Matrix* matrix,const float depth)
|
||||
{
|
||||
if (_currentRenderGraph->leaves_empty())
|
||||
{
|
||||
// this is first leaf to be added to RenderGraph
|
||||
// and therefore should not already know to current render bin,
|
||||
// so need to add it.
|
||||
_currentRenderBin->addRenderGraph(_currentRenderGraph);
|
||||
}
|
||||
//_currentRenderGraph->addLeaf(new RenderLeaf(drawable,matrix,depth));
|
||||
_currentRenderGraph->addLeaf(createOrReuseRenderLeaf(drawable,_projectionStack.back().get(),matrix,depth));
|
||||
}
|
||||
|
||||
/** Add an attribute which is positioned related to the modelview matrix.*/
|
||||
inline void addPositionedAttribute(osg::Matrix* matrix,const osg::StateAttribute* attr)
|
||||
{
|
||||
_currentRenderBin->_stage->addPositionedAttribute(matrix,attr);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -275,42 +311,6 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor
|
||||
|
||||
|
||||
|
||||
void updateCalculatedNearFar(const osg::Matrix& matrix,const osg::Drawable& drawable);
|
||||
void updateCalculatedNearFar(const osg::Vec3& pos);
|
||||
|
||||
/** Add a drawable to current render graph.*/
|
||||
inline void addDrawable(osg::Drawable* drawable,osg::Matrix* matrix)
|
||||
{
|
||||
if (_currentRenderGraph->leaves_empty())
|
||||
{
|
||||
// this is first leaf to be added to RenderGraph
|
||||
// and therefore should not already know to current render bin,
|
||||
// so need to add it.
|
||||
_currentRenderBin->addRenderGraph(_currentRenderGraph);
|
||||
}
|
||||
//_currentRenderGraph->addLeaf(new RenderLeaf(drawable,matrix));
|
||||
_currentRenderGraph->addLeaf(createOrReuseRenderLeaf(drawable,_projectionStack.back().get(),matrix));
|
||||
}
|
||||
|
||||
/** Add a drawable and depth to current render graph.*/
|
||||
inline void addDrawableAndDepth(osg::Drawable* drawable,osg::Matrix* matrix,const float depth)
|
||||
{
|
||||
if (_currentRenderGraph->leaves_empty())
|
||||
{
|
||||
// this is first leaf to be added to RenderGraph
|
||||
// and therefore should not already know to current render bin,
|
||||
// so need to add it.
|
||||
_currentRenderBin->addRenderGraph(_currentRenderGraph);
|
||||
}
|
||||
//_currentRenderGraph->addLeaf(new RenderLeaf(drawable,matrix,depth));
|
||||
_currentRenderGraph->addLeaf(createOrReuseRenderLeaf(drawable,_projectionStack.back().get(),matrix,depth));
|
||||
}
|
||||
|
||||
/** Add an attribute which is positioned related to the modelview matrix.*/
|
||||
inline void addPositionedAttribute(osg::Matrix* matrix,const osg::StateAttribute* attr)
|
||||
{
|
||||
_currentRenderBin->_stage->addPositionedAttribute(matrix,attr);
|
||||
}
|
||||
|
||||
|
||||
/** create an impostor sprite by setting up a pre-rendering stage
|
||||
|
||||
@@ -208,7 +208,7 @@ void Image::createImage(int s,int t,int r,
|
||||
if (_data) ::free(_data);
|
||||
|
||||
if (newTotalSize)
|
||||
_data = (unsigned char *)osgMalloc (newTotalSize);
|
||||
_data = (unsigned char *)malloc (newTotalSize);
|
||||
else
|
||||
_data = 0L;
|
||||
}
|
||||
@@ -293,7 +293,7 @@ void Image::scaleImage(const int s,const int t,const int r)
|
||||
unsigned int newTotalSize = computeRowWidthInBytes(s,_pixelFormat,_dataType,_packing)*t;
|
||||
|
||||
// need to sort out what size to really use...
|
||||
unsigned char* newData = (unsigned char *)osgMalloc(newTotalSize);
|
||||
unsigned char* newData = (unsigned char *)malloc(newTotalSize);
|
||||
if (!newData)
|
||||
{
|
||||
// should we throw an exception??? Just return for time being.
|
||||
@@ -338,7 +338,7 @@ void Image::flipHorizontal(int image)
|
||||
{
|
||||
if (_data==NULL)
|
||||
{
|
||||
notify(WARN) << "Error Image::flipVertical() do not succeed : cannot flip NULL image."<<std::endl;
|
||||
notify(WARN) << "Error Image::flipHorizontal() do not succeed : cannot flip NULL image."<<std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ void Image::flipVertical(int image)
|
||||
// insert fliped image
|
||||
memcpy(imageData, tmpData, imageSizeInBytes);
|
||||
|
||||
::free(tmpData);
|
||||
osgFree(tmpData);
|
||||
++_modifiedTag;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user