diff --git a/include/osg/AnimationPath b/include/osg/AnimationPath index 75aeb61dd..852c4a8b3 100644 --- a/include/osg/AnimationPath +++ b/include/osg/AnimationPath @@ -164,6 +164,8 @@ class SG_EXPORT AnimationPath : public virtual osg::Object typedef std::map 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: diff --git a/include/osg/ApplicationUsage b/include/osg/ApplicationUsage index dac4cefd9..1bea7882f 100644 --- a/include/osg/ApplicationUsage +++ b/include/osg/ApplicationUsage @@ -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; } diff --git a/include/osg/Billboard b/include/osg/Billboard index 12fdeedc6..61036f795 100644 --- a/include/osg/Billboard +++ b/include/osg/Billboard @@ -72,6 +72,9 @@ class SG_EXPORT Billboard : public Geode /** Type definition for pivot point position list. */ typedef std::vector 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; } diff --git a/include/osg/CollectOccludersVisitor b/include/osg/CollectOccludersVisitor index 8a1f55782..ecefd9eb1 100644 --- a/include/osg/CollectOccludersVisitor +++ b/include/osg/CollectOccludersVisitor @@ -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; } diff --git a/include/osg/FragmentProgram b/include/osg/FragmentProgram index fc3efa65b..299faf711 100644 --- a/include/osg/FragmentProgram +++ b/include/osg/FragmentProgram @@ -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 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 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 MatrixList; - MatrixList _matrixList; + MatrixList _matrixList; }; diff --git a/include/osg/Texture2D b/include/osg/Texture2D index cc01a504d..d066fe0cb 100644 --- a/include/osg/Texture2D +++ b/include/osg/Texture2D @@ -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. */ diff --git a/include/osg/VertexProgram b/include/osg/VertexProgram index 4c19ffdee..b6c90f73e 100644 --- a/include/osg/VertexProgram +++ b/include/osg/VertexProgram @@ -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 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 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 MatrixList; MatrixList _matrixList; }; diff --git a/src/osgPlugins/ive/FragmentProgram.cpp b/src/osgPlugins/ive/FragmentProgram.cpp index 94d254f94..2a2829bba 100644 --- a/src/osgPlugins/ive/FragmentProgram.cpp +++ b/src/osgPlugins/ive/FragmentProgram.cpp @@ -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) { diff --git a/src/osgPlugins/osg/FragmentProgram.cpp b/src/osgPlugins/osg/FragmentProgram.cpp index b65cdef31..24d19895c 100644 --- a/src/osgPlugins/osg/FragmentProgram.cpp +++ b/src/osgPlugins/osg/FragmentProgram.cpp @@ -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(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 lines; std::istringstream iss(fragmentProgram.getFragmentProgram()); std::string line; diff --git a/src/osgPlugins/osg/VertexProgram.cpp b/src/osgPlugins/osg/VertexProgram.cpp index 8090bf834..9b0a39730 100644 --- a/src/osgPlugins/osg/VertexProgram.cpp +++ b/src/osgPlugins/osg/VertexProgram.cpp @@ -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(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 lines; std::istringstream iss(vertexProgram.getVertexProgram());