Teaks to API to make it easier to generate wrappers automatically

This commit is contained in:
Robert Osfield 2004-12-13 01:07:24 +00:00
parent 1c4f615d1a
commit 66396e9452
10 changed files with 117 additions and 28 deletions

View File

@ -164,6 +164,8 @@ class SG_EXPORT AnimationPath : public virtual osg::Object
typedef std::map<double,ControlPoint> TimeControlPointMap;
void setTimeControlPointMap(TimeControlPointMap& tcpm) { _timeControlPointMap=tcpm; }
TimeControlPointMap& getTimeControlPointMap() { return _timeControlPointMap; }
const TimeControlPointMap& getTimeControlPointMap() const { return _timeControlPointMap; }
@ -247,6 +249,7 @@ class SG_EXPORT AnimationPathCallback : public NodeCallback
void reset();
void setPause(bool pause);
bool getPause() const { return _pause; }
/** Get the animation time that is used to specify the position along
* the AnimationPath. Animation time is computed from the formula:

View File

@ -51,26 +51,30 @@ class SG_EXPORT ApplicationUsage
void addUsageExplanation(Type type,const std::string& option,const std::string& explanation);
void setCommandLineUsage(const std::string& explanation) { _commandLineUsage=explanation; }
const std::string& getCommandLineUsage() const { return _commandLineUsage; }
void addCommandLineOption(const std::string& option,const std::string& explanation, const std::string &defaultValue = "");
void setCommandLineOptions(const UsageMap& usageMap) { _commandLineOptions=usageMap; }
const UsageMap& getCommandLineOptions() const { return _commandLineOptions; }
void setCommandLineOptionsDefaults(const UsageMap& usageMap) { _commandLineOptionsDefaults=usageMap; }
const UsageMap& getCommandLineOptionsDefaults() const { return _commandLineOptionsDefaults; }
void addEnvironmentalVariable(const std::string& option,const std::string& explanation, const std::string& defaultValue = "");
void setEnvironmentalVariables(const UsageMap& usageMap) { _environmentalVariables=usageMap; }
const UsageMap& getEnvironmentalVariables() const { return _environmentalVariables; }
void setEnvironmentalVariablesDefaults(const UsageMap& usageMap) { _environmentalVariablesDefaults=usageMap; }
const UsageMap& getEnvironmentalVariablesDefaults() const { return _environmentalVariablesDefaults; }
void addKeyboardMouseBinding(const std::string& option,const std::string& explanation);
void setKeyboardMouseBindings(const UsageMap& usageMap) { _keyboardMouse=usageMap; }
const UsageMap& getKeyboardMouseBindings() const { return _keyboardMouse; }

View File

@ -72,6 +72,9 @@ class SG_EXPORT Billboard : public Geode
/** Type definition for pivot point position list. */
typedef std::vector<Vec3> PositionList;
/** Set the list of pivot point positions. */
inline void setPositionList(PositionList& pl) { _positionList=pl; }
/** Get the list of pivot point positions. */
inline PositionList& getPositionList() { return _positionList; }

View File

@ -60,7 +60,7 @@ class SG_EXPORT CollectOccludersVisitor : public osg::NodeVisitor, public osg::C
void setCreateDrawablesOnOccludeNodes(bool flag) { _createDrawables=flag; }
bool getCreateDrawablesOnOccludeNodes() const { return _createDrawables; }
void setCollectedOcculderList(const ShadowVolumeOccluderSet& svol) { _occluderSet = svol; }
void setCollectedOcculderSet(const ShadowVolumeOccluderSet& svol) { _occluderSet = svol; }
ShadowVolumeOccluderSet& getCollectedOccluderSet() { return _occluderSet; }
const ShadowVolumeOccluderSet& getCollectedOccluderSet() const { return _occluderSet; }

View File

@ -150,12 +150,6 @@ class SG_EXPORT FragmentProgram : public StateAttribute
return _fragmentProgramIDList[contextID];
}
/** Set the fragment program using C++ style string.*/
inline void setFragmentProgram( const std::string& program )
{
_fragmentProgram = program;
dirtyFragmentProgramObject();
}
/** Set the fragment program using a C style string.*/
inline void setFragmentProgram( const char* program )
@ -163,6 +157,14 @@ class SG_EXPORT FragmentProgram : public StateAttribute
_fragmentProgram = program;
dirtyFragmentProgramObject();
}
/** Set the fragment program using C++ style string.*/
inline void setFragmentProgram( const std::string& program )
{
_fragmentProgram = program;
dirtyFragmentProgramObject();
}
/** Get the fragment program.*/
inline const std::string& getFragmentProgram() const { return _fragmentProgram; }
@ -174,11 +176,14 @@ class SG_EXPORT FragmentProgram : public StateAttribute
typedef std::map<GLuint,Vec4> LocalParamList;
/** Set list of Program Parameters */
inline void setLocalParameters(LocalParamList& lpl) { _programLocalParameters = lpl; }
/** Get list of Program Parameters */
inline LocalParamList& getLocalParamList() { return _programLocalParameters; }
inline LocalParamList& getLocalParameters() { return _programLocalParameters; }
/** Get const list of Program Parameters */
inline const LocalParamList& getLocalParamList() const { return _programLocalParameters; }
inline const LocalParamList& getLocalParameters() const { return _programLocalParameters; }
/** Matrix */
inline void setMatrix(const GLenum mode, const Matrix& matrix)
@ -186,6 +191,18 @@ class SG_EXPORT FragmentProgram : public StateAttribute
_matrixList[mode] = matrix;
}
typedef std::map<GLenum,Matrix> MatrixList;
/** Set list of Matrices */
inline void setMatrices(MatrixList& matrices) { _matrixList = matrices; }
/** Get list of Matrices */
inline MatrixList& getMatrices() { return _matrixList; }
/** Get list of Matrices */
inline const MatrixList& getMatrices() const { return _matrixList; }
/** Force a recompile on next apply() of associated OpenGL vertex program objects.*/
void dirtyFragmentProgramObject();
@ -269,9 +286,7 @@ class SG_EXPORT FragmentProgram : public StateAttribute
std::string _fragmentProgram;
LocalParamList _programLocalParameters;
typedef std::map<GLenum,Matrix> MatrixList;
MatrixList _matrixList;
MatrixList _matrixList;
};

View File

@ -81,7 +81,10 @@ class SG_EXPORT Texture2D : public Texture
_textureHeight = height;
}
void setTextureWidth(int width) { _textureWidth=width; }
int getTextureWidth() const { return _textureWidth; }
void setTextureHeight(int height) { _textureHeight=height; }
int getTextureHeight() const { return _textureHeight; }
/** Deprecated. */

View File

@ -150,12 +150,6 @@ class SG_EXPORT VertexProgram : public StateAttribute
return _vertexProgramIDList[contextID];
}
/** Set the vertex program using C++ style string. */
inline void setVertexProgram( const std::string& program )
{
_vertexProgram = program;
dirtyVertexProgramObject();
}
/** Set the vertex program using a C style string. */
inline void setVertexProgram( const char* program )
@ -163,10 +157,18 @@ class SG_EXPORT VertexProgram : public StateAttribute
_vertexProgram = program;
dirtyVertexProgramObject();
}
/** Set the vertex program using C++ style string. */
inline void setVertexProgram( const std::string& program )
{
_vertexProgram = program;
dirtyVertexProgramObject();
}
/** Get the vertex program. */
inline const std::string& getVertexProgram() const { return _vertexProgram; }
/** Set program parameters. */
/** Set Program Parameters */
inline void setProgramLocalParameter(const GLuint index, const Vec4& p)
{
_programLocalParameters[index] = p;
@ -174,19 +176,32 @@ class SG_EXPORT VertexProgram : public StateAttribute
typedef std::map<GLuint,Vec4> LocalParamList;
/** Set list of Program Parameters */
inline void setLocalParameters(LocalParamList& lpl) { _programLocalParameters = lpl; }
/** Get list of Program Parameters */
inline LocalParamList& getLocalParamList() { return _programLocalParameters; }
inline LocalParamList& getLocalParameters() { return _programLocalParameters; }
/** Get const list of Program Parameters */
inline const LocalParamList& getLocalParamList() const { return _programLocalParameters; }
inline const LocalParamList& getLocalParameters() const { return _programLocalParameters; }
/** Set matrix. */
/** Matrix */
inline void setMatrix(const GLenum mode, const Matrix& matrix)
{
_matrixList[mode] = matrix;
}
typedef std::map<GLenum,Matrix> MatrixList;
/** Set list of Matrices */
inline void setMatrices(MatrixList& matrices) { _matrixList = matrices; }
/** Get list of Matrices */
inline MatrixList& getMatrices() { return _matrixList; }
/** Get list of Matrices */
inline const MatrixList& getMatrices() const { return _matrixList; }
/** Force a recompile on next apply() of associated OpenGL vertex program objects. */
void dirtyVertexProgramObject();
@ -278,7 +293,6 @@ class SG_EXPORT VertexProgram : public StateAttribute
LocalParamList _programLocalParameters;
typedef std::map<GLenum,Matrix> MatrixList;
MatrixList _matrixList;
};

View File

@ -34,7 +34,7 @@ void FragmentProgram::write( DataOutputStream* out )
}
// Write FragmentProgram properties.
FragmentProgram::LocalParamList lpl = getLocalParamList();
FragmentProgram::LocalParamList lpl = getLocalParameters();
out->writeInt(lpl.size());
for(FragmentProgram::LocalParamList::iterator i=lpl.begin(); i!=lpl.end(); ++i)
{

View File

@ -6,6 +6,8 @@
#include "osgDB/Input"
#include "osgDB/Output"
#include "Matrix.h"
using namespace osg;
using namespace osgDB;
using namespace std;
@ -45,6 +47,19 @@ bool FragmentProgram_readLocalData(Object& obj, Input& fr)
fragmentProgram.setProgramLocalParameter(index, vec);
}
if (fr[0].matchWord("Matrix"))
{
int index;
fr[1].getInt(index);
fr += 2;
osg::Matrix matrix;
if (readMatrix(matrix,fr))
{
fragmentProgram.setMatrix(index, matrix);
}
iteratorAdvanced = true;
}
if (fr.matchSequence("code {"))
{
std::string code;
@ -88,12 +103,21 @@ bool FragmentProgram_writeLocalData(const Object& obj,Output& fw)
{
const FragmentProgram& fragmentProgram = static_cast<const FragmentProgram&>(obj);
const FragmentProgram::LocalParamList& lpl = fragmentProgram.getLocalParamList();
const FragmentProgram::LocalParamList& lpl = fragmentProgram.getLocalParameters();
FragmentProgram::LocalParamList::const_iterator i;
for(i=lpl.begin(); i!=lpl.end(); i++)
{
fw.indent() << "ProgramLocalParameter " << (*i).first << " " << (*i).second << std::endl;
}
const FragmentProgram::MatrixList& mpl = fragmentProgram.getMatrices();
FragmentProgram::MatrixList::const_iterator mi;
for(mi=mpl.begin(); mi!=mpl.end(); mi++)
{
fw.indent() << "Matrix " << (*mi).first << " ";
writeMatrix((*mi).second,fw);
}
std::vector<std::string> lines;
std::istringstream iss(fragmentProgram.getFragmentProgram());
std::string line;

View File

@ -6,6 +6,8 @@
#include "osgDB/Input"
#include "osgDB/Output"
#include "Matrix.h"
using namespace osg;
using namespace osgDB;
using namespace std;
@ -45,6 +47,19 @@ bool VertexProgram_readLocalData(Object& obj, Input& fr)
vertexProgram.setProgramLocalParameter(index, vec);
}
if (fr[0].matchWord("Matrix"))
{
int index;
fr[1].getInt(index);
fr += 2;
osg::Matrix matrix;
if (readMatrix(matrix,fr))
{
vertexProgram.setMatrix(index, matrix);
}
iteratorAdvanced = true;
}
if (fr.matchSequence("code {")) {
std::string code;
fr += 2;
@ -88,13 +103,21 @@ bool VertexProgram_writeLocalData(const Object& obj,Output& fw)
{
const VertexProgram& vertexProgram = static_cast<const VertexProgram&>(obj);
const VertexProgram::LocalParamList& lpl = vertexProgram.getLocalParamList();
const VertexProgram::LocalParamList& lpl = vertexProgram.getLocalParameters();
VertexProgram::LocalParamList::const_iterator i;
for(i=lpl.begin(); i!=lpl.end(); i++)
{
fw.indent() << "ProgramLocalParameter " << (*i).first << " " << (*i).second << std::endl;
}
const VertexProgram::MatrixList& mpl = vertexProgram.getMatrices();
VertexProgram::MatrixList::const_iterator mi;
for(mi=mpl.begin(); mi!=mpl.end(); mi++)
{
fw.indent() << "Matrix " << (*mi).first << " ";
writeMatrix((*mi).second,fw);
}
std::vector<std::string> lines;
std::istringstream iss(vertexProgram.getVertexProgram());