Addded .ive and .osg support for new GL_EXT_blend_equation_separate properties in osg::BlendEquation
This commit is contained in:
@@ -33,7 +33,15 @@ void BlendEquation::write(DataOutputStream* out){
|
||||
// Write BlendEquation's properties.
|
||||
|
||||
// Write source
|
||||
out->writeInt(getEquation());
|
||||
if ( out->getVersion() >= VERSION_0040 )
|
||||
{
|
||||
out->writeInt(getEquationRGB());
|
||||
out->writeInt(getEquationAlpha());
|
||||
}
|
||||
else
|
||||
{
|
||||
out->writeInt(getEquation());
|
||||
}
|
||||
}
|
||||
|
||||
void BlendEquation::read(DataInputStream* in){
|
||||
@@ -52,8 +60,15 @@ void BlendEquation::read(DataInputStream* in){
|
||||
// Read BlendEquation's properties
|
||||
|
||||
// Read source
|
||||
setEquation(osg::BlendEquation::Equation(in->readInt()));
|
||||
|
||||
if ( in->getVersion() >= VERSION_0040 )
|
||||
{
|
||||
setEquationRGB(osg::BlendEquation::Equation(in->readInt()));
|
||||
setEquationAlpha(osg::BlendEquation::Equation(in->readInt()));
|
||||
}
|
||||
else
|
||||
{
|
||||
setEquation(osg::BlendEquation::Equation(in->readInt()));
|
||||
}
|
||||
}
|
||||
else{
|
||||
throw Exception("BlendEquation::read(): Expected BlendEquation identification.");
|
||||
|
||||
@@ -48,8 +48,9 @@
|
||||
#define VERSION_0037 37
|
||||
#define VERSION_0038 38
|
||||
#define VERSION_0039 39
|
||||
#define VERSION_0040 40
|
||||
|
||||
#define VERSION VERSION_0039
|
||||
#define VERSION VERSION_0040
|
||||
|
||||
/* The BYTE_SEX tag is used to check the endian
|
||||
of the IVE file being read in. The IVE format
|
||||
|
||||
@@ -30,12 +30,26 @@ bool BlendEquation_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
BlendEquation& transparency = static_cast<BlendEquation&>(obj);
|
||||
BlendEquation& blendeq = static_cast<BlendEquation&>(obj);
|
||||
|
||||
int mode;
|
||||
if (fr[0].matchWord("equation") && BlendEquation_matchModeStr(fr[1].getStr(),mode))
|
||||
{
|
||||
transparency.setEquation(osg::BlendEquation::Equation(mode));
|
||||
blendeq.setEquation(osg::BlendEquation::Equation(mode));
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("equationRGB") && BlendEquation_matchModeStr(fr[1].getStr(),mode))
|
||||
{
|
||||
blendeq.setEquationRGB(osg::BlendEquation::Equation(mode));
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("equationAlpha") && BlendEquation_matchModeStr(fr[1].getStr(),mode))
|
||||
{
|
||||
blendeq.setEquationAlpha(osg::BlendEquation::Equation(mode));
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
@@ -45,9 +59,17 @@ bool BlendEquation_readLocalData(Object& obj, Input& fr)
|
||||
|
||||
bool BlendEquation_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const BlendEquation& transparency = static_cast<const BlendEquation&>(obj);
|
||||
const BlendEquation& blendeq = static_cast<const BlendEquation&>(obj);
|
||||
|
||||
fw.indent() << "equation " << BlendEquation_getModeStr(transparency.getEquation()) << std::endl;
|
||||
if (blendeq.getEquationRGB()==blendeq.getEquationAlpha())
|
||||
{
|
||||
fw.indent() << "equation " << BlendEquation_getModeStr(blendeq.getEquation()) << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
fw.indent() << "equationRGB " << BlendEquation_getModeStr(blendeq.getEquationRGB()) << std::endl;
|
||||
fw.indent() << "equationAlpha " << BlendEquation_getModeStr(blendeq.getEquationAlpha()) << std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user