Property API clean to smooth the task of generating wrappers.
This commit is contained in:
@@ -410,7 +410,7 @@ osg::Image* ReadDDSFile(std::istream& _istream)
|
||||
|
||||
|
||||
osgImage->setImage(s,t,r, internalFormat, pixelFormat, dataType, 0, osg::Image::USE_NEW_DELETE);
|
||||
if (mipmaps.size()>0) osgImage->setMipmapData(mipmaps);
|
||||
if (mipmaps.size()>0) osgImage->setMipmapLevels(mipmaps);
|
||||
unsigned int size = osgImage->getTotalSizeInBytesIncludingMipmaps();
|
||||
|
||||
if(size <= 0)
|
||||
@@ -428,7 +428,7 @@ osg::Image* ReadDDSFile(std::istream& _istream)
|
||||
_istream.read((char*)imageData, size);
|
||||
|
||||
osgImage->setImage(s,t,r, internalFormat, pixelFormat, dataType, imageData, osg::Image::USE_NEW_DELETE);
|
||||
if (mipmaps.size()>0) osgImage->setMipmapData(mipmaps);
|
||||
if (mipmaps.size()>0) osgImage->setMipmapLevels(mipmaps);
|
||||
|
||||
|
||||
|
||||
@@ -463,10 +463,10 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout)
|
||||
// Initialize ddsd structure and its members
|
||||
DDSURFACEDESC2 ddsd;
|
||||
DDPIXELFORMAT ddpf;
|
||||
DDCOLORKEY ddckCKDestOverlay;
|
||||
DDCOLORKEY ddckCKDestBlt;
|
||||
DDCOLORKEY ddckCKSrcOverlay;
|
||||
DDCOLORKEY ddckCKSrcBlt;
|
||||
//DDCOLORKEY ddckCKDestOverlay;
|
||||
//DDCOLORKEY ddckCKDestBlt;
|
||||
//DDCOLORKEY ddckCKSrcOverlay;
|
||||
//DDCOLORKEY ddckCKSrcBlt;
|
||||
DDSCAPS2 ddsCaps;
|
||||
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
@@ -647,7 +647,7 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout)
|
||||
if(img->isMipmap())
|
||||
{
|
||||
dataPtr += imageSize;
|
||||
unsigned char *mmdPtr, *next_mmdPtr;
|
||||
const unsigned char *mmdPtr, *next_mmdPtr;
|
||||
int offset;
|
||||
unsigned int mipmaps = img->getNumMipmapLevels();
|
||||
unsigned int blockSize;
|
||||
|
||||
@@ -37,9 +37,9 @@ void AnimationPath::write(DataOutputStream* out){
|
||||
out->writeInt(tcpm.size());
|
||||
for(AnimationPath::TimeControlPointMap::iterator itr=tcpm.begin(); itr!=tcpm.end(); ++itr){
|
||||
out->writeFloat(itr->first);
|
||||
out->writeVec3(itr->second._position);
|
||||
out->writeQuat(itr->second._rotation);
|
||||
out->writeVec3(itr->second._scale);
|
||||
out->writeVec3(itr->second.getPosition());
|
||||
out->writeQuat(itr->second.getRotation());
|
||||
out->writeVec3(itr->second.getScale());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,16 +31,7 @@ void ClipPlane::write(DataOutputStream* out){
|
||||
|
||||
// write ClipPlane's properties
|
||||
|
||||
|
||||
|
||||
|
||||
double plane[4];
|
||||
getClipPlane(plane);
|
||||
|
||||
out->writeDouble(plane[0]);
|
||||
out->writeDouble(plane[1]);
|
||||
out->writeDouble(plane[2]);
|
||||
out->writeDouble(plane[3]);
|
||||
out->writeVec4d(getClipPlane());
|
||||
|
||||
out->writeUInt(getClipPlaneNum());
|
||||
|
||||
@@ -62,15 +53,7 @@ void ClipPlane::read(DataInputStream* in){
|
||||
else
|
||||
throw Exception("ClipPlane::read(): Could not cast this osg::ClipPlane to an osg::Object.");
|
||||
|
||||
// Read ClipPlane's properties
|
||||
double plane[4];
|
||||
|
||||
plane[0] = in->readDouble();
|
||||
plane[1] = in->readDouble();
|
||||
plane[2] = in->readDouble();
|
||||
plane[3] = in->readDouble();
|
||||
|
||||
setClipPlane(plane);
|
||||
setClipPlane(in->readVec4d());
|
||||
|
||||
setClipPlaneNum(in->readUInt());
|
||||
}
|
||||
|
||||
@@ -313,6 +313,39 @@ osg::Vec4 DataInputStream::readVec4(){
|
||||
|
||||
return v;
|
||||
}
|
||||
osg::Vec2d DataInputStream::readVec2d()
|
||||
{
|
||||
osg::Vec2d v;
|
||||
v.x()=readDouble();
|
||||
v.y()=readDouble();
|
||||
|
||||
if (_verboseOutput) std::cout<<"read/writeVec2d() ["<<v<<"]"<<std::endl;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
osg::Vec3d DataInputStream::readVec3d(){
|
||||
osg::Vec3d v;
|
||||
v.x()=readDouble();
|
||||
v.y()=readDouble();
|
||||
v.z()=readDouble();
|
||||
|
||||
if (_verboseOutput) std::cout<<"read/writeVec3d() ["<<v<<"]"<<std::endl;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
osg::Vec4d DataInputStream::readVec4d(){
|
||||
osg::Vec4d v;
|
||||
v.x()=readDouble();
|
||||
v.y()=readDouble();
|
||||
v.z()=readDouble();
|
||||
v.w()=readDouble();
|
||||
|
||||
if (_verboseOutput) std::cout<<"read/writeVec4d() ["<<v<<"]"<<std::endl;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
osg::Plane DataInputStream::readPlane(){
|
||||
osg::Plane v;
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include <osg/Vec2>
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/Vec2d>
|
||||
#include <osg/Vec3d>
|
||||
#include <osg/Vec4d>
|
||||
#include <osg/Quat>
|
||||
#include <osg/Array>
|
||||
#include <osg/Matrix>
|
||||
@@ -54,6 +57,9 @@ public:
|
||||
osg::Vec2 readVec2();
|
||||
osg::Vec3 readVec3();
|
||||
osg::Vec4 readVec4();
|
||||
osg::Vec2d readVec2d();
|
||||
osg::Vec3d readVec3d();
|
||||
osg::Vec4d readVec4d();
|
||||
osg::Plane readPlane();
|
||||
osg::UByte4 readUByte4();
|
||||
osg::Quat readQuat();
|
||||
|
||||
@@ -182,6 +182,30 @@ void DataOutputStream::writeVec4(const osg::Vec4& v){
|
||||
if (_verboseOutput) std::cout<<"read/writeVec4() ["<<v<<"]"<<std::endl;
|
||||
}
|
||||
|
||||
void DataOutputStream::writeVec2d(const osg::Vec2d& v){
|
||||
writeDouble(v.x());
|
||||
writeDouble(v.y());
|
||||
|
||||
if (_verboseOutput) std::cout<<"read/writeVec2() ["<<v<<"]"<<std::endl;
|
||||
}
|
||||
|
||||
void DataOutputStream::writeVec3d(const osg::Vec3d& v){
|
||||
writeDouble(v.x());
|
||||
writeDouble(v.y());
|
||||
writeDouble(v.z());
|
||||
|
||||
if (_verboseOutput) std::cout<<"read/writeVec3d() ["<<v<<"]"<<std::endl;
|
||||
}
|
||||
|
||||
void DataOutputStream::writeVec4d(const osg::Vec4d& v){
|
||||
writeDouble(v.x());
|
||||
writeDouble(v.y());
|
||||
writeDouble(v.z());
|
||||
writeDouble(v.w());
|
||||
|
||||
if (_verboseOutput) std::cout<<"read/writeVec4d() ["<<v<<"]"<<std::endl;
|
||||
}
|
||||
|
||||
void DataOutputStream::writePlane(const osg::Plane& v)
|
||||
{
|
||||
writeFloat(v[0]);
|
||||
|
||||
@@ -46,6 +46,9 @@ public:
|
||||
void writeVec2(const osg::Vec2& v);
|
||||
void writeVec3(const osg::Vec3& v);
|
||||
void writeVec4(const osg::Vec4& v);
|
||||
void writeVec2d(const osg::Vec2d& v);
|
||||
void writeVec3d(const osg::Vec3d& v);
|
||||
void writeVec4d(const osg::Vec4d& v);
|
||||
void writePlane(const osg::Plane& v);
|
||||
void writeUByte4(const osg::UByte4& v);
|
||||
void writeQuat(const osg::Quat& q);
|
||||
|
||||
@@ -86,11 +86,7 @@ bool AnimationPath_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
|
||||
|
||||
osg::AnimationPath::ControlPoint ctrlPoint;
|
||||
ctrlPoint._position = position;
|
||||
ctrlPoint._rotation = rotation;
|
||||
ctrlPoint._scale = scale;
|
||||
|
||||
osg::AnimationPath::ControlPoint ctrlPoint(position,rotation,scale);
|
||||
ap->insert(time, ctrlPoint);
|
||||
|
||||
fr+=11;
|
||||
@@ -138,7 +134,7 @@ bool AnimationPath_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
itr!=tcpm.end();
|
||||
++itr)
|
||||
{
|
||||
fw.indent() << itr->first << " " << itr->second._position << " " << itr->second._rotation << " " << itr->second._scale << std::endl;
|
||||
fw.indent() << itr->first << " " << itr->second.getPosition() << " " << itr->second.getRotation() << " " <<itr->second.getScale() << std::endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ bool ClipPlane_readLocalData(Object& obj, Input& fr)
|
||||
fr[2].getFloat(plane[1]);
|
||||
fr[3].getFloat(plane[2]);
|
||||
fr[4].getFloat(plane[3]);
|
||||
clipplane.setClipPlane(plane);
|
||||
clipplane.setClipPlane(plane[0],plane[1],plane[2],plane[3]);
|
||||
|
||||
fr+=5;
|
||||
iteratorAdvanced = true;
|
||||
@@ -66,9 +66,7 @@ bool ClipPlane_writeLocalData(const Object& obj,Output& fw)
|
||||
|
||||
fw.indent() << "clipPlaneNum " << clipplane.getClipPlaneNum() <<std::endl;
|
||||
|
||||
double plane[4];
|
||||
clipplane.getClipPlane(plane);
|
||||
fw.indent() << "plane " << plane[0] << ' ' << plane[1] << ' ' << plane[2] << ' ' << plane[3] << std::endl;
|
||||
fw.indent() << "plane " << clipplane.getClipPlane()<< std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1526,7 +1526,7 @@ osg::Texture2D* txp::getLocalTexture(trpgrImageHelper& image_helper, const trpgT
|
||||
{
|
||||
mipmaps[k-1] = tmp_tex->MipLevelOffset(k);
|
||||
}
|
||||
image->setMipmapData(mipmaps);
|
||||
image->setMipmapLevels(mipmaps);
|
||||
|
||||
}
|
||||
|
||||
@@ -1601,7 +1601,7 @@ osg::Texture2D* txp::getTemplateTexture(trpgrImageHelper& image_helper, trpgLoca
|
||||
{
|
||||
mipmaps[k-1] = tmp_tex->MipLevelOffset(k);
|
||||
}
|
||||
image->setMipmapData(mipmaps);
|
||||
image->setMipmapLevels(mipmaps);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user