*** empty log message ***

This commit is contained in:
Don BURNS
2003-06-24 15:40:09 +00:00
parent 5a939f5420
commit 15f88f35b2
91 changed files with 2871 additions and 1937 deletions

View File

@@ -64,7 +64,7 @@ class SG_EXPORT CollectOccludersVisitor : public osg::NodeVisitor, public osg::C
protected:
/** prevent unwanted copy construction.*/
CollectOccludersVisitor(const CollectOccludersVisitor&):osg::NodeVisitor(),osg::CullStack() {}
//CollectOccludersVisitor(const CollectOccludersVisitor&):osg::NodeVisitor(),osg::CullStack() {}
/** prevent unwanted copy operator.*/
CollectOccludersVisitor& operator = (const CollectOccludersVisitor&) { return *this; }

View File

@@ -340,7 +340,9 @@ class SG_EXPORT Drawable : public Object
virtual ~PrimitiveFunctor() {}
virtual void setVertexArray(unsigned int count,const Vec2* vertices) = 0;
virtual void setVertexArray(unsigned int count,const Vec3* vertices) = 0;
virtual void setVertexArray(unsigned int count,const Vec4* vertices) = 0;
virtual void drawArrays(GLenum mode,GLint first,GLsizei count) = 0;
virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices) = 0;
@@ -348,8 +350,12 @@ class SG_EXPORT Drawable : public Object
virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) = 0;
virtual void begin(GLenum mode) = 0;
virtual void vertex(const Vec2& vert) = 0;
virtual void vertex(const Vec3& vert) = 0;
virtual void vertex(const Vec4& vert) = 0;
virtual void vertex(float x,float y) = 0;
virtual void vertex(float x,float y,float z) = 0;
virtual void vertex(float x,float y,float z,float w) = 0;
virtual void end() = 0;
};

View File

@@ -51,9 +51,9 @@ class SG_EXPORT Geometry : public Drawable
BIND_PER_VERTEX
};
void setVertexArray(Vec3Array* array) { _vertexArray = array; dirtyDisplayList(); dirtyBound(); }
Vec3Array* getVertexArray() { return _vertexArray.get(); }
const Vec3Array* getVertexArray() const { return _vertexArray.get(); }
void setVertexArray(Array* array) { _vertexArray = array; dirtyDisplayList(); dirtyBound(); }
Array* getVertexArray() { return _vertexArray.get(); }
const Array* getVertexArray() const { return _vertexArray.get(); }
void setVertexIndices(IndexArray* array) { _vertexIndices = array; _fastPathComputed=false; dirtyDisplayList(); dirtyBound(); }
IndexArray* getVertexIndices() { return _vertexIndices.get(); }
@@ -366,31 +366,31 @@ class SG_EXPORT Geometry : public Drawable
#ifdef COMPILE_POSSIBLE_NEW_ARRAY_METHODS
AttributeList _attributeList;
#endif
ref_ptr<Vec3Array> _vertexArray;
ref_ptr<IndexArray> _vertexIndices;
ref_ptr<Array> _vertexArray;
ref_ptr<IndexArray> _vertexIndices;
mutable AttributeBinding _normalBinding;
ref_ptr<Vec3Array> _normalArray;
ref_ptr<IndexArray> _normalIndices;
ref_ptr<Vec3Array> _normalArray;
ref_ptr<IndexArray> _normalIndices;
mutable AttributeBinding _colorBinding;
ref_ptr<Array> _colorArray;
ref_ptr<IndexArray> _colorIndices;
ref_ptr<Array> _colorArray;
ref_ptr<IndexArray> _colorIndices;
mutable AttributeBinding _secondaryColorBinding;
ref_ptr<Array> _secondaryColorArray;
ref_ptr<IndexArray> _secondaryColorIndices;
ref_ptr<Array> _secondaryColorArray;
ref_ptr<IndexArray> _secondaryColorIndices;
mutable AttributeBinding _fogCoordBinding;
ref_ptr<Array> _fogCoordArray;
ref_ptr<IndexArray> _fogCoordIndices;
ref_ptr<Array> _fogCoordArray;
ref_ptr<IndexArray> _fogCoordIndices;
TexCoordArrayList _texCoordList;
TexCoordArrayList _texCoordList;
VertexAttribArrayList _vertexAttribList;
mutable VertexAttribBindingList _vertexAttribBindingList;
VertexAttribArrayList _vertexAttribList;
mutable VertexAttribBindingList _vertexAttribBindingList;
mutable bool _fastPathComputed;
mutable bool _fastPathComputed;
mutable bool _fastPath;
};

View File

@@ -155,6 +155,9 @@ class SG_EXPORT Image : public Object
/** return the numbers of bytes the whole row/image/volume of pixels occupies.*/
inline unsigned int getTotalSizeInBytes() const { return getImageSizeInBytes()*_r; }
/** return the numbers of bytes the whole row/image/volume of pixels occupies, including all mip maps if included.*/
unsigned int getTotalSizeInBytesIncludingMipmaps() const;
/** raw image data.*/
inline unsigned char *data() { return _data; }

View File

@@ -113,6 +113,12 @@ const double PI_4 = 0.78539816339744830962;
template<typename T>
inline T absolute(T v) { return v<(T)0?-v:v; }
/** return true if float lhs and rhs are equivalent, meaning that the difference between then is less than an epsilon value which default to 1e-6.*/
inline float equivalent(float lhs,float rhs,float epsilon=1e-6) { float delta = rhs-lhs; return delta<0.0f?delta>=-epsilon:delta<=epsilon; }
/** return true if double lhs and rhs are equivalent, meaning that the difference between then is less than an epsilon value which default to 1e-6.*/
inline double equivalent(double lhs,double rhs,double epsilon=1e-6) { double delta = rhs-lhs; return delta<0.0?delta>=-epsilon:delta<=epsilon; }
/** return the minimum of two values, equivilant to std::min.
* std::min not used because of STL implementation under IRIX contains no std::min.*/
template<typename T>

View File

@@ -31,7 +31,9 @@ class SG_EXPORT Point : public StateAttribute
StateAttribute(point,copyop),
_size(point._size),
_fadeThresholdSize(point._fadeThresholdSize),
_distanceAttenuation(point._distanceAttenuation) {}
_distanceAttenuation(point._distanceAttenuation),
_minSize(point._minSize),
_maxSize(point._maxSize) {}
META_StateAttribute(osg, Point, POINT);
@@ -46,6 +48,8 @@ class SG_EXPORT Point : public StateAttribute
COMPARE_StateAttribute_Parameter(_size)
COMPARE_StateAttribute_Parameter(_fadeThresholdSize)
COMPARE_StateAttribute_Parameter(_distanceAttenuation)
COMPARE_StateAttribute_Parameter(_minSize)
COMPARE_StateAttribute_Parameter(_maxSize)
return 0; // passed all the above comparison macro's, must be equal.
}
@@ -64,6 +68,12 @@ class SG_EXPORT Point : public StateAttribute
void setDistanceAttenuation(const Vec3& distanceAttenuation);
inline const Vec3& getDistanceAttenuation() const { return _distanceAttenuation; }
void setMinSize(float minSize);
inline float getMinSize() const {return _minSize;}
void setMaxSize(float maxSize);
inline float getMaxSize() const {return _maxSize;}
virtual void apply(State& state) const;
static void init_GL_EXT();
@@ -75,6 +85,8 @@ class SG_EXPORT Point : public StateAttribute
float _size;
float _fadeThresholdSize;
Vec3 _distanceAttenuation;
float _minSize;
float _maxSize;
};

View File

@@ -21,6 +21,7 @@
#include <osg/FrameStamp>
#include <osg/DisplaySettings>
#include <osg/Polytope>
#include <osg/Viewport>
#include <vector>
#include <map>
@@ -79,6 +80,12 @@ class SG_EXPORT State : public Referenced
/** reset the state object to an empty stack.*/
void reset();
inline const Viewport* getCurrentViewport() const
{
return static_cast<const Viewport*>(getLastAppliedAttribute(osg::StateAttribute::VIEWPORT));
}
inline void applyProjectionMatrix(const osg::RefMatrix* matrix)
{

View File

@@ -84,8 +84,8 @@ class SG_EXPORT TextureRectangle : public Texture
SubloadCallback* getSubloadCallback() { return _subloadCallback.get(); }
const SubloadCallback* getSubloadCallback() const { return _subloadCallback.get(); }
/** On first apply (unless already compiled), create the minmapped
* texture and bind it, subsequent apply will simple bind to texture.*/
/** On first apply (unless already compiled), create and bind the
* texture, subsequent apply will simple bind to texture.*/
virtual void apply(State& state) const;
protected :
@@ -94,7 +94,9 @@ class SG_EXPORT TextureRectangle : public Texture
virtual void computeInternalFormat() const;
void applyTexImageRectangle(GLenum target, Image* image, State& state, GLsizei& inwidth, GLsizei& inheight) const;
void applyTexParameters(GLenum target, State& state) const;
void applyTexImage(GLenum target, Image* image, State& state, GLsizei& inwidth, GLsizei& inheight) const;
// not ideal that _image is mutable, but its required since
// Image::ensureDimensionsArePowerOfTwo() can only be called

View File

@@ -15,6 +15,7 @@
#define OSG_TRIANGLEFUNCTOR 1
#include <osg/Drawable>
#include <osg/Notify>
namespace osg {
@@ -32,12 +33,23 @@ public:
virtual ~TriangleFunctor() {}
virtual void setVertexArray(unsigned int count,const Vec2* vertices)
{
notify(WARN)<<"Triangle Functor does not support Vec2* vertex arrays"<<std::endl;
}
virtual void setVertexArray(unsigned int count,const Vec3* vertices)
{
_vertexArraySize = count;
_vertexArrayPtr = vertices;
}
virtual void setVertexArray(unsigned int count,const Vec4* vertices)
{
notify(WARN)<<"Triangle Functor does not support Vec4* vertex arrays"<<std::endl;
}
virtual void drawArrays(GLenum mode,GLint first,GLsizei count)
{
if (_vertexArrayPtr==0 && count==0) return;
@@ -311,15 +323,19 @@ public:
* non vertex array primitives to vertex array based primitives.
* this is done to simplify the implementation of primtive functor
* subclasses - users only need override drawArray and drawElements.*/
inline void begin(GLenum mode)
virtual void begin(GLenum mode)
{
_modeCache = mode;
_vertexCache.clear();
}
inline void vertex(const Vec3& vert) { _vertexCache.push_back(vert); }
inline void vertex(float x,float y,float z) { _vertexCache.push_back(osg::Vec3(x,y,z)); }
inline void end()
virtual void vertex(const Vec2& vert) { _vertexCache.push_back(osg::Vec3(vert[0],vert[1],0.0f)); }
virtual void vertex(const Vec3& vert) { _vertexCache.push_back(vert); }
virtual void vertex(const Vec4& vert) { _vertexCache.push_back(osg::Vec3(vert[0],vert[1],vert[2])/vert[3]); }
virtual void vertex(float x,float y) { _vertexCache.push_back(osg::Vec3(x,y,0.0f)); }
virtual void vertex(float x,float y,float z) { _vertexCache.push_back(osg::Vec3(x,y,z)); }
virtual void vertex(float x,float y,float z,float w) { _vertexCache.push_back(osg::Vec3(x,y,z)/w); }
virtual void end()
{
if (!_vertexCache.empty())
{

View File

@@ -106,11 +106,11 @@ public:
virtual bool removeChild(GUIEventHandler *geh);
const int getNumChildren() const { return _children.size(); }
unsigned int getNumChildren() const { return _children.size(); }
GUIEventHandler *getChild( int i) { return _children[i].get(); }
GUIEventHandler *getChild( unsigned int i) { return _children[i].get(); }
const GUIEventHandler *getChild( int i ) const { return _children[i].get(); }
const GUIEventHandler *getChild( unsigned int i ) const { return _children[i].get(); }
bool containsNode( const GUIEventHandler* node ) const
{

View File

@@ -52,7 +52,7 @@ class OSGPRODUCER_EXPORT OsgCameraGroup : public Producer::CameraGroup
const osg::ApplicationUsage* getApplicationUsage() const { return _applicationUsage; }
typedef std::vector < osg::ref_ptr<osgProducer::OsgSceneHandler> > SceneHandlerList;
typedef std::vector < Producer::ref_ptr<osgProducer::OsgSceneHandler> > SceneHandlerList;
SceneHandlerList& getSceneHandlerList() { return _shvec;}

View File

@@ -22,11 +22,20 @@
namespace osgProducer {
class OSGPRODUCER_EXPORT OsgSceneHandler : public Producer::Camera::SceneHandler, public osgUtil::SceneView
class OSGPRODUCER_EXPORT OsgSceneHandler : public Producer::Camera::SceneHandler
{
public :
OsgSceneHandler(osg::DisplaySettings *ds = NULL);
/// set the scene view to which will manage rendering of the OSG scene.
void setSceneView(osgUtil::SceneView* sceneView) { _sceneView = sceneView; }
/// get the scene view.
osgUtil::SceneView* getSceneView() { return _sceneView.get(); }
/// get the const scene view.
const osgUtil::SceneView* getSceneView() const { return _sceneView.get(); }
/// override the init method to force it be run one at a time.
virtual void init();
@@ -84,6 +93,9 @@ class OSGPRODUCER_EXPORT OsgSceneHandler : public Producer::Camera::SceneHandler
protected:
virtual ~OsgSceneHandler() {}
osg::ref_ptr<osgUtil::SceneView> _sceneView;
osg::ref_ptr<Callback> _clearCallback;
osg::ref_ptr<Callback> _cullCallback;

View File

@@ -82,7 +82,18 @@ class OSGPRODUCER_EXPORT Viewer : public OsgCameraGroup, public osgGA::GUIAction
virtual bool realize();
/** Updated the scene. Handle any queued up events, do an update traversal and set the CameraGroup's setViewByMatrix if any camera manipulators are active.*/
virtual void update();
/** set the update visitor which does the update traversal of the scene graph. Automatically called by the update() method.*/
void setUpdateVistor(osg::NodeVisitor* nv) { _updateVisitor = nv; }
/** get the update visitor.*/
osg::NodeVisitor* getUpdateVistor() { return _updateVisitor.get(); }
/** get the const update visitor.*/
const osg::NodeVisitor* getUpdateVistor() const { return _updateVisitor.get(); }
/** Dispatch the cull and draw for each of the Camera's for this frame.*/
virtual void frame();

View File

@@ -45,6 +45,9 @@ class OSGSIM_EXPORT LightPointNode : public osg::Node
virtual void traverse(osg::NodeVisitor& nv);
unsigned int getNumLightPoints() const { return _lightPointList.size(); }
unsigned int addLightPoint(const LightPoint& lp);
void removeLightPoint(unsigned int pos);

View File

@@ -100,6 +100,18 @@ public:
float getCharacterHeight() const { return _characterHeight; }
float getCharacterAspectRatio() const { return _characterAspectRatio; }
enum CharacterSizeMode
{
OBJECT_COORDS, /// default
SCREEN_COORDS, /// internally scale the characters to be constant screen size.
OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT /// text that behavaves like OBJECT_COORDS sized text when a long distance way, but has its screen sized capped automatically when the viewer gets near.
};
/** Set how the CharacterSize value relates to the final rendered character.*/
void setCharacterSizeMode(CharacterSizeMode mode) { _characterSizeMode = mode; }
/** Get the CharacterSizeMode.*/
CharacterSizeMode getCharacterSizeMode() const { return _characterSizeMode; }
/** Set the maximum width of the text box.
@@ -165,27 +177,11 @@ public:
void setAxisAlignment(AxisAlignment axis);
void setRotation(const osg::Quat& quat);
void setRotation(unsigned int contextID, const osg::Quat& quat);
const osg::Quat& getRotation(unsigned int contextID=0) const { return _rotation[contextID]; }
const osg::Quat& getRotation() const { return _rotation; }
void setScale(float scale);
void setScale(unsigned int contextID, float scale);
float getScale(unsigned int contextID=0) const { return _scale[contextID]; }
void setScaleAndRotation(unsigned int contextID, float scale,const osg::Quat& quat);
void setAutoUpdateEyeMovementTolerance(float tolerance) { _autoUpdateEyeMovementTolerance = tolerance; }
float getAutoUpdateEyeMovementTolerance() const { return _autoUpdateEyeMovementTolerance; }
void setAutoRotateToScreen(bool autoRotateToScreen);
bool getAutoRotateToScreen() const { return _autoRotateToScreen; }
void setAutoScaleToLimitScreenSizeToFontResolution(bool autoScaleToScreen);
bool getAutoScaleToLimitScreenSizeToFontResolution() const { return _autoScaleToLimitScreenSizeToFontResolution; }
enum Layout
{
LEFT_TO_RIGHT, /// default
@@ -295,35 +291,49 @@ protected:
unsigned int _fontHeight;
float _characterHeight;
float _characterAspectRatio;
CharacterSizeMode _characterSizeMode;
float _maximumWidth;
float _maximumHeight;
String _text;
osg::Vec3 _position;
AlignmentType _alignment;
mutable osg::buffered_object<osg::Quat> _rotation;
mutable osg::buffered_value<float> _scale;
float _autoUpdateEyeMovementTolerance;
osg::Quat _rotation;
bool _autoRotateToScreen;
bool _autoScaleToLimitScreenSizeToFontResolution;
Layout _layout;
osg::Vec4 _color;
unsigned int _drawMode;
// iternal map used for rendering. Set up by the computeGlyphRepresentation() method.
TextureGlyphQuadMap _textureGlyphQuadMap;
mutable TextureGlyphQuadMap _textureGlyphQuadMap;
void computeGlyphRepresentation();
// internal caches of the positioning of the text.
mutable osg::buffered_object<osg::Matrix> _matrix;
osg::Vec3 _offset;
osg::Vec3 _normal;
mutable osg::BoundingBox _textBB;
struct AutoTransformCache
{
AutoTransformCache():
_traversalNumber(-1),
_width(0),
_height(0) {}
int _traversalNumber;
int _width;
int _height;
osg::Vec3 _transformedPosition;
osg::Matrix _modelview;
osg::Matrix _projection;
osg::Matrix _matrix;
};
mutable osg::buffered_object<AutoTransformCache> _autoTransformCache;
mutable osg::Vec3 _offset;
mutable osg::Vec3 _normal;
mutable osg::BoundingBox _textBB;
void setUpAutoCallback();
void computePositions();
void computePositions(unsigned int contextID);
void computePositions(unsigned int contextID) const;
};

View File

@@ -217,8 +217,8 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
protected:
/** prevent unwanted copy construction.*/
CullVisitor(const CullVisitor&):osg::NodeVisitor(),osg::CullStack() {}
// /** prevent unwanted copy construction.*/
// CullVisitor(const CullVisitor&): osg::NodeVisitor(), osg::CullStack() {}
/** prevent unwanted copy operator.*/
CullVisitor& operator = (const CullVisitor&) { return *this; }

View File

@@ -163,13 +163,13 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
void setCullMask(const osg::Node::NodeMask nm) { _cullMask = nm; }
const osg::Node::NodeMask getCullMask() const { return _cullMask; }
osg::Node::NodeMask getCullMask() const { return _cullMask; }
void setCullMaskLeft(const osg::Node::NodeMask nm) { _cullMaskLeft = nm; }
const osg::Node::NodeMask getCullMaskLeft() const { return _cullMaskLeft; }
osg::Node::NodeMask getCullMaskLeft() const { return _cullMaskLeft; }
void setCullMaskRight(const osg::Node::NodeMask nm) { _cullMaskRight = nm; }
const osg::Node::NodeMask getCullMaskRight() const { return _cullMaskRight; }
osg::Node::NodeMask getCullMaskRight() const { return _cullMaskRight; }
/** Set the LOD bias for the CullVisitor to use.*/
void setLODScale(float bias) { _LODScale = bias; }

View File

@@ -62,8 +62,8 @@ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor
protected:
/** prevent unwanted copy construction.*/
UpdateVisitor(const UpdateVisitor&):osg::NodeVisitor() {}
// /** prevent unwanted copy construction.*/
// UpdateVisitor(const UpdateVisitor&):osg::NodeVisitor() {}
/** prevent unwanted copy operator.*/
UpdateVisitor& operator = (const UpdateVisitor&) { return *this; }