Property API clean to smooth the task of generating wrappers.

This commit is contained in:
Robert Osfield
2004-12-17 01:06:33 +00:00
parent 4383655fcd
commit a0ba625cb0
39 changed files with 253 additions and 229 deletions

View File

@@ -106,7 +106,7 @@ void AnimationPath::write(std::ostream& fout) const
++tcpmitr)
{
const ControlPoint& cp = tcpmitr->second;
fout<<tcpmitr->first<<" "<<cp._position<<" "<<cp._rotation<<std::endl;
fout<<tcpmitr->first<<" "<<cp.getPosition()<<" "<<cp.getRotation()<<std::endl;
}
fout.precision(prec);
@@ -139,16 +139,16 @@ class AnimationPathCallbackVisitor : public NodeVisitor
Matrix matrix;
_cp.getInverse(matrix);
pat.setPosition(matrix.getTrans());
pat.setAttitude(_cp._rotation.inverse());
pat.setScale(osg::Vec3(1.0f/_cp._scale.x(),1.0f/_cp._scale.y(),1.0f/_cp._scale.z()));
pat.setAttitude(_cp.getRotation().inverse());
pat.setScale(osg::Vec3(1.0f/_cp.getScale().x(),1.0f/_cp.getScale().y(),1.0f/_cp.getScale().z()));
pat.setPivotPoint(_pivotPoint);
}
else
{
pat.setPosition(_cp._position);
pat.setAttitude(_cp._rotation);
pat.setScale(_cp._scale);
pat.setPosition(_cp.getPosition());
pat.setAttitude(_cp.getRotation());
pat.setScale(_cp.getScale());
pat.setPivotPoint(_pivotPoint);
}
}

View File

@@ -17,10 +17,7 @@ using namespace osg;
ClipPlane::ClipPlane()
{
_clipPlane[0] = 0.0;
_clipPlane[1] = 0.0;
_clipPlane[2] = 0.0;
_clipPlane[3] = 0.0;
_clipPlane.set(0.0,0.0,0.0,0.0);
_clipPlaneNum = 0;
}
@@ -29,61 +26,6 @@ ClipPlane::~ClipPlane()
{
}
void ClipPlane::setClipPlane(const Vec4& plane)
{
_clipPlane[0] = plane[0];
_clipPlane[1] = plane[1];
_clipPlane[2] = plane[2];
_clipPlane[3] = plane[3];
}
void ClipPlane::setClipPlane(const Plane& plane)
{
_clipPlane[0] = plane[0];
_clipPlane[1] = plane[1];
_clipPlane[2] = plane[2];
_clipPlane[3] = plane[3];
}
void ClipPlane::setClipPlane(const double* plane)
{
if (plane)
{
_clipPlane[0] = plane[0];
_clipPlane[1] = plane[1];
_clipPlane[2] = plane[2];
_clipPlane[3] = plane[3];
}
else
{
notify(WARN)<<"Warning: ClipPlane::setClipPlane() passed NULL plane array, ignoring operation."<<std::endl;
}
}
void ClipPlane::getClipPlane(Vec4& plane) const
{
plane[0] = (float)_clipPlane[0];
plane[1] = (float)_clipPlane[1];
plane[2] = (float)_clipPlane[2];
plane[3] = (float)_clipPlane[3];
}
void ClipPlane::getClipPlane(Plane& plane) const
{
plane[0] = _clipPlane[0];
plane[1] = _clipPlane[1];
plane[2] = _clipPlane[2];
plane[3] = _clipPlane[3];
}
void ClipPlane::getClipPlane(double* plane) const
{
plane[0] = _clipPlane[0];
plane[1] = _clipPlane[1];
plane[2] = _clipPlane[2];
plane[3] = _clipPlane[3];
}
void ClipPlane::setClipPlaneNum(unsigned int num)
{
_clipPlaneNum = num;
@@ -96,6 +38,6 @@ unsigned int ClipPlane::getClipPlaneNum() const
void ClipPlane::apply(State&) const
{
glClipPlane((GLenum)(GL_CLIP_PLANE0+_clipPlaneNum),_clipPlane);
glClipPlane((GLenum)(GL_CLIP_PLANE0+_clipPlaneNum),_clipPlane.ptr());
}

View File

@@ -18,7 +18,6 @@ using namespace osg;
PolygonMode::PolygonMode()
{
_frontAndBack = true;
_modeFront = FILL;
_modeBack = FILL;
}
@@ -33,15 +32,12 @@ void PolygonMode::setMode(Face face,Mode mode)
switch(face)
{
case(FRONT):
_frontAndBack = false;
_modeFront = mode;
break;
case(BACK):
_frontAndBack = false;
_modeBack = mode;
break;
case(FRONT_AND_BACK):
_frontAndBack = true;
_modeFront = mode;
_modeBack = mode;
break;
@@ -65,7 +61,7 @@ PolygonMode::Mode PolygonMode::getMode(Face face) const
void PolygonMode::apply(State&) const
{
if (_frontAndBack)
if (_modeFront==_modeBack)
{
glPolygonMode(GL_FRONT_AND_BACK,(GLenum)_modeFront);
}

View File

@@ -457,7 +457,7 @@ void DrawShapeVisitor::apply(const Box& box)
if (!box.zeroRotation())
{
Matrix rotation(box.getRotationMatrix());
Matrix rotation(box.computeRotationMatrix());
glMultMatrix(rotation.ptr());
}
@@ -573,7 +573,7 @@ void DrawShapeVisitor::apply(const Cone& cone)
if (!cone.zeroRotation())
{
Matrix rotation(cone.getRotationMatrix());
Matrix rotation(cone.computeRotationMatrix());
glMultMatrix(rotation.ptr());
}
@@ -691,7 +691,7 @@ void DrawShapeVisitor::apply(const Cylinder& cylinder)
if (!cylinder.zeroRotation())
{
Matrix rotation(cylinder.getRotationMatrix());
Matrix rotation(cylinder.computeRotationMatrix());
glMultMatrix(rotation.ptr());
}
@@ -790,7 +790,7 @@ void DrawShapeVisitor::apply(const Capsule& capsule)
if (!capsule.zeroRotation())
{
Matrix rotation(capsule.getRotationMatrix());
Matrix rotation(capsule.computeRotationMatrix());
glMultMatrix(rotation.ptr());
}
@@ -876,7 +876,7 @@ void DrawShapeVisitor::apply(const HeightField& field)
if (!field.zeroRotation())
{
Matrix rotation(field.getRotationMatrix());
Matrix rotation(field.computeRotationMatrix());
glMultMatrix(rotation.ptr());
}
@@ -1087,7 +1087,7 @@ void ComputeBoundShapeVisitor::apply(const Box& box)
Vec3 top_3(Vec3(x,y,z));
Vec3 top_4(Vec3(-x,y,z));
Matrix matrix = box.getRotationMatrix();
Matrix matrix = box.computeRotationMatrix();
_bb.expandBy(box.getCenter()+base_1*matrix);
_bb.expandBy(box.getCenter()+base_2*matrix);
_bb.expandBy(box.getCenter()+base_3*matrix);
@@ -1116,7 +1116,7 @@ void ComputeBoundShapeVisitor::apply(const Cone& cone)
Vec3 base_3(Vec3(cone.getRadius(),cone.getRadius(),cone.getBaseOffset()));
Vec3 base_4(Vec3(-cone.getRadius(),cone.getRadius(),cone.getBaseOffset()));
Matrix matrix = cone.getRotationMatrix();
Matrix matrix = cone.computeRotationMatrix();
_bb.expandBy(cone.getCenter()+base_1*matrix);
_bb.expandBy(cone.getCenter()+base_2*matrix);
_bb.expandBy(cone.getCenter()+base_3*matrix);
@@ -1149,7 +1149,7 @@ void ComputeBoundShapeVisitor::apply(const Cylinder& cylinder)
Vec3 top_3(Vec3(r,r,z));
Vec3 top_4(Vec3(-r,r,z));
Matrix matrix = cylinder.getRotationMatrix();
Matrix matrix = cylinder.computeRotationMatrix();
_bb.expandBy(cylinder.getCenter()+base_1*matrix);
_bb.expandBy(cylinder.getCenter()+base_2*matrix);
_bb.expandBy(cylinder.getCenter()+base_3*matrix);
@@ -1186,7 +1186,7 @@ void ComputeBoundShapeVisitor::apply(const Capsule& capsule)
Vec3 top_3(Vec3(r,r,z));
Vec3 top_4(Vec3(-r,r,z));
Matrix matrix = capsule.getRotationMatrix();
Matrix matrix = capsule.computeRotationMatrix();
_bb.expandBy(capsule.getCenter()+base_1*matrix);
_bb.expandBy(capsule.getCenter()+base_2*matrix);
_bb.expandBy(capsule.getCenter()+base_3*matrix);
@@ -1269,7 +1269,7 @@ void ComputeBoundShapeVisitor::apply(const HeightField& field)
Vec3 top_3(Vec3(x,y,zMax));
Vec3 top_4(Vec3(0,y,zMax));
Matrix matrix = field.getRotationMatrix();
Matrix matrix = field.computeRotationMatrix();
_bb.expandBy(field.getOrigin()+base_1*matrix);
_bb.expandBy(field.getOrigin()+base_2*matrix);
_bb.expandBy(field.getOrigin()+base_3*matrix);
@@ -1424,7 +1424,7 @@ void PrimitiveShapeVisitor::apply(const Box& box)
}
else
{
Matrix matrix = box.getRotationMatrix();
Matrix matrix = box.computeRotationMatrix();
matrix.setTrans(box.getCenter());
base_1 = base_1*matrix;
@@ -1476,7 +1476,7 @@ void PrimitiveShapeVisitor::apply(const Box& box)
void PrimitiveShapeVisitor::apply(const Cone& cone)
{
Matrix matrix = cone.getRotationMatrix();
Matrix matrix = cone.computeRotationMatrix();
matrix.setTrans(cone.getCenter());
@@ -1567,7 +1567,7 @@ void PrimitiveShapeVisitor::apply(const Cone& cone)
void PrimitiveShapeVisitor::apply(const Cylinder& cylinder)
{
Matrix matrix = cylinder.getRotationMatrix();
Matrix matrix = cylinder.computeRotationMatrix();
matrix.setTrans(cylinder.getCenter());
unsigned int numSegments = 40;
@@ -1697,7 +1697,7 @@ void PrimitiveShapeVisitor::apply(const HeightField& field)
{
if (field.getNumColumns()==0 || field.getNumRows()==0) return;
Matrix matrix = field.getRotationMatrix();
Matrix matrix = field.computeRotationMatrix();
matrix.setTrans(field.getOrigin());
float dx = field.getXInterval();