Coverted tabs to space in core libraries.
This commit is contained in:
@@ -308,11 +308,11 @@ unsigned int Image::getTotalSizeInBytesIncludingMipmaps() const
|
||||
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT):
|
||||
sizeOfLastMipMap = maximum(sizeOfLastMipMap, 8u); // block size of 8
|
||||
break;
|
||||
break;
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
|
||||
sizeOfLastMipMap = maximum(sizeOfLastMipMap, 16u); // block size of 16
|
||||
break;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,11 +55,11 @@ void LightModel::apply(State&) const
|
||||
{
|
||||
if (_colorControl==SEPARATE_SPECULAR_COLOR)
|
||||
{
|
||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SEPARATE_SPECULAR_COLOR);
|
||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SEPARATE_SPECULAR_COLOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SINGLE_COLOR);
|
||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SINGLE_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,45 +59,45 @@ class MatrixdTestFixture
|
||||
{
|
||||
public:
|
||||
|
||||
MatrixdTestFixture();
|
||||
MatrixdTestFixture();
|
||||
|
||||
void testMatrixToQuat(const osgUtx::TestContext& ctx);
|
||||
void testMatrixToQuat(const osgUtx::TestContext& ctx);
|
||||
|
||||
private:
|
||||
|
||||
// Some convenience variables for use in the tests
|
||||
Matrixd m1_, m2_;
|
||||
double l1_, l2_;
|
||||
// Some convenience variables for use in the tests
|
||||
Matrixd m1_, m2_;
|
||||
double l1_, l2_;
|
||||
|
||||
};
|
||||
|
||||
MatrixdTestFixture::MatrixdTestFixture():
|
||||
m1_(0.3583681546368404100000000000000, -0.933580347769909500000000000000, 3.006977197034146200000000000000e-011, 000000000000000,
|
||||
-0.933580347769909500000000000000, -0.3583681546368404100000000000000, -1.275368738108216700000000000000e-010, 000000000000000,
|
||||
1.298419676971558500000000000000e-010, 1.763260594230249800000000000000e-011, -0.9999999999999997800000000000000, 000000000000000,
|
||||
-4.134153519264493800000000000000e-005, 8.473552245044272300000000000000e-008, 0.9999996934706840700000000000000, 100000000000000.0 ),
|
||||
m1_(0.3583681546368404100000000000000, -0.933580347769909500000000000000, 3.006977197034146200000000000000e-011, 000000000000000,
|
||||
-0.933580347769909500000000000000, -0.3583681546368404100000000000000, -1.275368738108216700000000000000e-010, 000000000000000,
|
||||
1.298419676971558500000000000000e-010, 1.763260594230249800000000000000e-011, -0.9999999999999997800000000000000, 000000000000000,
|
||||
-4.134153519264493800000000000000e-005, 8.473552245044272300000000000000e-008, 0.9999996934706840700000000000000, 100000000000000.0 ),
|
||||
|
||||
m2_( 0.3583681546368407400000000000000, -0.9335803477699099500000000000000, 3.007582030796253300000000000000e-011, 000000000000000,
|
||||
-0.9335803477699099500000000000000, -0.3583681546368407400000000000000, -1.265511449721884600000000000000e-010, 000000000000000,
|
||||
1.289238781567697100000000000000e-010, 1.727370550828948600000000000000e-011, -1.000000000000000400000000000000, 000000000000000,
|
||||
-4.134153473360120600000000000000e-005, 8.473570190103158800000000000000e-008, 0.999999693471385400000000000000, 100000000000000.0),
|
||||
l1_(1),
|
||||
l2_(1)
|
||||
m2_( 0.3583681546368407400000000000000, -0.9335803477699099500000000000000, 3.007582030796253300000000000000e-011, 000000000000000,
|
||||
-0.9335803477699099500000000000000, -0.3583681546368407400000000000000, -1.265511449721884600000000000000e-010, 000000000000000,
|
||||
1.289238781567697100000000000000e-010, 1.727370550828948600000000000000e-011, -1.000000000000000400000000000000, 000000000000000,
|
||||
-4.134153473360120600000000000000e-005, 8.473570190103158800000000000000e-008, 0.999999693471385400000000000000, 100000000000000.0),
|
||||
l1_(1),
|
||||
l2_(1)
|
||||
{
|
||||
}
|
||||
|
||||
void MatrixdTestFixture::testMatrixToQuat(const osgUtx::TestContext&)
|
||||
{
|
||||
Quat q1,q2;
|
||||
q1.set(m1_);
|
||||
q2.set(m2_);
|
||||
OSGUTX_TEST_F( q1.length() == l1_ )
|
||||
OSGUTX_TEST_F( q2.length() == l2_ )
|
||||
Quat q1,q2;
|
||||
q1.set(m1_);
|
||||
q2.set(m2_);
|
||||
OSGUTX_TEST_F( q1.length() == l1_ )
|
||||
OSGUTX_TEST_F( q2.length() == l2_ )
|
||||
}
|
||||
|
||||
|
||||
OSGUTX_BEGIN_TESTSUITE(Matrixd)
|
||||
OSGUTX_ADD_TESTCASE(MatrixdTestFixture, testMatrixToQuat)
|
||||
OSGUTX_ADD_TESTCASE(MatrixdTestFixture, testMatrixToQuat)
|
||||
OSGUTX_END_TESTSUITE
|
||||
|
||||
OSGUTX_AUTOREGISTER_TESTSUITE_AT(Matrixd, root.osg)
|
||||
|
||||
@@ -28,7 +28,7 @@ void HeightField::allocate(unsigned int numColumns,unsigned int numRows)
|
||||
{
|
||||
if (_columns!=numColumns || _rows!=numRows)
|
||||
{
|
||||
_heights.resize(numColumns*numRows);
|
||||
_heights.resize(numColumns*numRows);
|
||||
}
|
||||
_columns=numColumns;
|
||||
_rows=numRows;
|
||||
@@ -40,29 +40,29 @@ Vec3 HeightField::getNormal(unsigned int c,unsigned int r) const
|
||||
float dz_dx;
|
||||
if (c==0)
|
||||
{
|
||||
dz_dx = (getHeight(c+1,r)-getHeight(c,r))/getXInterval();
|
||||
dz_dx = (getHeight(c+1,r)-getHeight(c,r))/getXInterval();
|
||||
}
|
||||
else if (c==getNumColumns()-1)
|
||||
{
|
||||
dz_dx = (getHeight(c,r)-getHeight(c-1,r))/getXInterval();
|
||||
dz_dx = (getHeight(c,r)-getHeight(c-1,r))/getXInterval();
|
||||
}
|
||||
else // assume 0<c<_numColumns-1
|
||||
{
|
||||
dz_dx = 0.5f*(getHeight(c+1,r)-getHeight(c-1,r))/getXInterval();
|
||||
dz_dx = 0.5f*(getHeight(c+1,r)-getHeight(c-1,r))/getXInterval();
|
||||
}
|
||||
|
||||
float dz_dy;
|
||||
if (r==0)
|
||||
{
|
||||
dz_dy = (getHeight(c,r+1)-getHeight(c,r))/getYInterval();
|
||||
dz_dy = (getHeight(c,r+1)-getHeight(c,r))/getYInterval();
|
||||
}
|
||||
else if (r==getNumRows()-1)
|
||||
{
|
||||
dz_dy = (getHeight(c,r)-getHeight(c,r-1))/getYInterval();
|
||||
dz_dy = (getHeight(c,r)-getHeight(c,r-1))/getYInterval();
|
||||
}
|
||||
else // assume 0<r<_numRows-1
|
||||
{
|
||||
dz_dy = 0.5f*(getHeight(c,r+1)-getHeight(c,r-1))/getYInterval();
|
||||
dz_dy = 0.5f*(getHeight(c,r+1)-getHeight(c,r-1))/getYInterval();
|
||||
}
|
||||
|
||||
Vec3 normal(-dz_dx,-dz_dy,1.0f);
|
||||
@@ -77,28 +77,28 @@ Vec2 HeightField::getHeightDelta(unsigned int c,unsigned int r) const
|
||||
Vec2 heightDelta;
|
||||
if (c==0)
|
||||
{
|
||||
heightDelta.x() = (getHeight(c+1,r)-getHeight(c,r));
|
||||
heightDelta.x() = (getHeight(c+1,r)-getHeight(c,r));
|
||||
}
|
||||
else if (c==getNumColumns()-1)
|
||||
{
|
||||
heightDelta.x() = (getHeight(c,r)-getHeight(c-1,r));
|
||||
heightDelta.x() = (getHeight(c,r)-getHeight(c-1,r));
|
||||
}
|
||||
else // assume 0<c<_numColumns-1
|
||||
{
|
||||
heightDelta.x() = 0.5f*(getHeight(c+1,r)-getHeight(c-1,r));
|
||||
heightDelta.x() = 0.5f*(getHeight(c+1,r)-getHeight(c-1,r));
|
||||
}
|
||||
|
||||
if (r==0)
|
||||
{
|
||||
heightDelta.y() = (getHeight(c,r+1)-getHeight(c,r));
|
||||
heightDelta.y() = (getHeight(c,r+1)-getHeight(c,r));
|
||||
}
|
||||
else if (r==getNumRows()-1)
|
||||
{
|
||||
heightDelta.y() = (getHeight(c,r)-getHeight(c,r-1));
|
||||
heightDelta.y() = (getHeight(c,r)-getHeight(c,r-1));
|
||||
}
|
||||
else // assume 0<r<_numRows-1
|
||||
{
|
||||
heightDelta.y() = 0.5f*(getHeight(c,r+1)-getHeight(c,r-1));
|
||||
heightDelta.y() = 0.5f*(getHeight(c,r+1)-getHeight(c,r-1));
|
||||
}
|
||||
|
||||
return heightDelta;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -117,7 +117,7 @@ TestSuite* TestGraph::suite(const std::string& path, TestSuite* tsuite, bool cre
|
||||
}
|
||||
|
||||
TestSuite* TestGraph::suite(
|
||||
std::list<std::string>::iterator it,
|
||||
std::list<std::string>::iterator it,
|
||||
std::list<std::string>::iterator end,
|
||||
TestSuite* tsuite, bool createIfNecessary)
|
||||
{
|
||||
|
||||
@@ -27,52 +27,52 @@ class Vec3TestFixture
|
||||
{
|
||||
public:
|
||||
|
||||
Vec3TestFixture();
|
||||
Vec3TestFixture();
|
||||
|
||||
void testAddition(const osgUtx::TestContext& ctx);
|
||||
void testSubtraction(const osgUtx::TestContext& ctx);
|
||||
void testScalarMultiplication(const osgUtx::TestContext& ctx);
|
||||
void testDotProduct(const osgUtx::TestContext& ctx);
|
||||
void testAddition(const osgUtx::TestContext& ctx);
|
||||
void testSubtraction(const osgUtx::TestContext& ctx);
|
||||
void testScalarMultiplication(const osgUtx::TestContext& ctx);
|
||||
void testDotProduct(const osgUtx::TestContext& ctx);
|
||||
|
||||
private:
|
||||
|
||||
// Some convenience variables for use in the tests
|
||||
Vec3 v1_, v2_, v3_;
|
||||
// Some convenience variables for use in the tests
|
||||
Vec3 v1_, v2_, v3_;
|
||||
|
||||
};
|
||||
|
||||
Vec3TestFixture::Vec3TestFixture():
|
||||
v1_(1.0f, 1.0f, 1.0f),
|
||||
v2_(2.0f, 2.0f, 2.0f),
|
||||
v3_(3.0f, 3.0f, 3.0f)
|
||||
v1_(1.0f, 1.0f, 1.0f),
|
||||
v2_(2.0f, 2.0f, 2.0f),
|
||||
v3_(3.0f, 3.0f, 3.0f)
|
||||
{
|
||||
}
|
||||
|
||||
void Vec3TestFixture::testAddition(const osgUtx::TestContext&)
|
||||
{
|
||||
OSGUTX_TEST_F( v1_ + v2_ == v3_ )
|
||||
OSGUTX_TEST_F( v1_ + v2_ == v3_ )
|
||||
}
|
||||
|
||||
void Vec3TestFixture::testSubtraction(const osgUtx::TestContext&)
|
||||
{
|
||||
OSGUTX_TEST_F( v3_ - v1_ == v2_ )
|
||||
OSGUTX_TEST_F( v3_ - v1_ == v2_ )
|
||||
}
|
||||
|
||||
void Vec3TestFixture::testScalarMultiplication(const osgUtx::TestContext&)
|
||||
{
|
||||
OSGUTX_TEST_F( v1_ * 3 == v3_ )
|
||||
OSGUTX_TEST_F( v1_ * 3 == v3_ )
|
||||
}
|
||||
|
||||
void Vec3TestFixture::testDotProduct(const osgUtx::TestContext&)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
OSGUTX_BEGIN_TESTSUITE(Vec3)
|
||||
OSGUTX_ADD_TESTCASE(Vec3TestFixture, testAddition)
|
||||
OSGUTX_ADD_TESTCASE(Vec3TestFixture, testSubtraction)
|
||||
OSGUTX_ADD_TESTCASE(Vec3TestFixture, testScalarMultiplication)
|
||||
OSGUTX_ADD_TESTCASE(Vec3TestFixture, testDotProduct)
|
||||
OSGUTX_ADD_TESTCASE(Vec3TestFixture, testAddition)
|
||||
OSGUTX_ADD_TESTCASE(Vec3TestFixture, testSubtraction)
|
||||
OSGUTX_ADD_TESTCASE(Vec3TestFixture, testScalarMultiplication)
|
||||
OSGUTX_ADD_TESTCASE(Vec3TestFixture, testDotProduct)
|
||||
OSGUTX_END_TESTSUITE
|
||||
|
||||
OSGUTX_AUTOREGISTER_TESTSUITE_AT(Vec3, root.osg)
|
||||
|
||||
@@ -122,7 +122,7 @@ DynamicLibrary::PROC_ADDRESS DynamicLibrary::getProcAddress(const std::string& p
|
||||
#elif defined(__APPLE__)
|
||||
std::string temp("_");
|
||||
NSSymbol symbol;
|
||||
temp += procName; // Mac OS X prepends an underscore on function names
|
||||
temp += procName; // Mac OS X prepends an underscore on function names
|
||||
symbol = NSLookupSymbolInModule(static_cast<NSModule>(_handle), temp.c_str());
|
||||
return NSAddressOfSymbol(symbol);
|
||||
#elif defined(__hpux__)
|
||||
|
||||
@@ -174,7 +174,7 @@ bool FieldReader::_readField(Field* fieldPtr)
|
||||
}
|
||||
_fin->ignore(1);
|
||||
char c;
|
||||
bool escape = false; // use the escape character sequence \" to allow " to included in strings.
|
||||
bool escape = false; // use the escape character sequence \" to allow " to included in strings.
|
||||
while (true)
|
||||
{
|
||||
ch = _fin->peek();
|
||||
@@ -183,34 +183,34 @@ bool FieldReader::_readField(Field* fieldPtr)
|
||||
_eof = true;
|
||||
return fieldPtr && fieldPtr->getNoCharacters()!=0;
|
||||
}
|
||||
c = ch;
|
||||
if (ch=='\\' && !escape)
|
||||
{
|
||||
escape = true;
|
||||
c = ch;
|
||||
if (ch=='\\' && !escape)
|
||||
{
|
||||
escape = true;
|
||||
_fin->ignore(1);
|
||||
}
|
||||
}
|
||||
else if (ch=='"')
|
||||
{
|
||||
if (escape)
|
||||
{
|
||||
escape = false;
|
||||
_fin->get(c);
|
||||
if (fieldPtr) fieldPtr->addChar(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
_fin->ignore(1);
|
||||
//return fieldPtr && fieldPtr->getNoCharacters()!=0;
|
||||
return fieldPtr!=NULL;
|
||||
}
|
||||
if (escape)
|
||||
{
|
||||
escape = false;
|
||||
_fin->get(c);
|
||||
if (fieldPtr) fieldPtr->addChar(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
_fin->ignore(1);
|
||||
//return fieldPtr && fieldPtr->getNoCharacters()!=0;
|
||||
return fieldPtr!=NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (escape)
|
||||
{
|
||||
escape = false;
|
||||
if (escape)
|
||||
{
|
||||
escape = false;
|
||||
if (fieldPtr) fieldPtr->addChar('\\');
|
||||
}
|
||||
}
|
||||
_fin->get(c);
|
||||
if (fieldPtr) fieldPtr->addChar(c);
|
||||
}
|
||||
@@ -225,7 +225,7 @@ bool FieldReader::_readField(Field* fieldPtr)
|
||||
}
|
||||
_fin->ignore(1);
|
||||
char c;
|
||||
bool escape = false; // use the escape character sequence \' to allow ' to included in strings.
|
||||
bool escape = false; // use the escape character sequence \' to allow ' to included in strings.
|
||||
while (true)
|
||||
{
|
||||
ch = _fin->peek();
|
||||
@@ -235,33 +235,33 @@ bool FieldReader::_readField(Field* fieldPtr)
|
||||
return fieldPtr && fieldPtr->getNoCharacters()!=0;
|
||||
}
|
||||
c = ch;
|
||||
if (ch=='\\' && !escape)
|
||||
{
|
||||
escape = true;
|
||||
if (ch=='\\' && !escape)
|
||||
{
|
||||
escape = true;
|
||||
_fin->ignore(1);
|
||||
}
|
||||
}
|
||||
else if (ch=='\'')
|
||||
{
|
||||
if (escape)
|
||||
{
|
||||
escape = false;
|
||||
_fin->get(c);
|
||||
if (fieldPtr) fieldPtr->addChar(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
_fin->ignore(1);
|
||||
//return fieldPtr && fieldPtr->getNoCharacters()!=0;
|
||||
return fieldPtr!=NULL;
|
||||
}
|
||||
if (escape)
|
||||
{
|
||||
escape = false;
|
||||
_fin->get(c);
|
||||
if (fieldPtr) fieldPtr->addChar(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
_fin->ignore(1);
|
||||
//return fieldPtr && fieldPtr->getNoCharacters()!=0;
|
||||
return fieldPtr!=NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (escape)
|
||||
{
|
||||
escape = false;
|
||||
if (escape)
|
||||
{
|
||||
escape = false;
|
||||
if (fieldPtr) fieldPtr->addChar('\\');
|
||||
}
|
||||
}
|
||||
_fin->get(c);
|
||||
if (fieldPtr) fieldPtr->addChar(c);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ std::string osgDB::getSimpleFileName(const std::string& fileName)
|
||||
if (slash1==std::string::npos)
|
||||
{
|
||||
if (slash2==std::string::npos) return fileName;
|
||||
return std::string(fileName.begin()+slash2+1,fileName.end());
|
||||
return std::string(fileName.begin()+slash2+1,fileName.end());
|
||||
}
|
||||
if (slash2==std::string::npos) return std::string(fileName.begin()+slash1+1,fileName.end());
|
||||
return std::string(fileName.begin()+(slash1>slash2?slash1:slash2)+1,fileName.end());
|
||||
|
||||
@@ -92,12 +92,12 @@ std::string Output::wrapString(const std::string& str)
|
||||
newstring += '"';
|
||||
for(unsigned int i=0;i<str.size();++i)
|
||||
{
|
||||
if (str[i]=='"')
|
||||
{
|
||||
newstring += '\\';
|
||||
newstring += '"';
|
||||
}
|
||||
else newstring += (str[i]);
|
||||
if (str[i]=='"')
|
||||
{
|
||||
newstring += '\\';
|
||||
newstring += '"';
|
||||
}
|
||||
else newstring += (str[i]);
|
||||
}
|
||||
newstring += '"';
|
||||
return newstring;
|
||||
|
||||
@@ -504,8 +504,8 @@ namespace
|
||||
}
|
||||
|
||||
// second pass, self-shadowing
|
||||
bool selfShadowing = false;
|
||||
if (selfShadowing)
|
||||
bool selfShadowing = false;
|
||||
if (selfShadowing)
|
||||
{
|
||||
std::ostringstream vp_oss;
|
||||
vp_oss <<
|
||||
|
||||
@@ -177,23 +177,23 @@ namespace
|
||||
{
|
||||
// implement pass #1 (solid surfaces)
|
||||
{
|
||||
const char * vert_source =
|
||||
"const vec3 LightPosition = vec3( 0.0, 2.0, 4.0 );"
|
||||
"varying float CartoonTexCoord;"
|
||||
"void main( void )"
|
||||
"{"
|
||||
"vec3 eye_space_normal = normalize(gl_NormalMatrix * gl_Normal);"
|
||||
"CartoonTexCoord = max(0.0, dot(normalize(LightPosition), eye_space_normal));"
|
||||
"gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;"
|
||||
"}";
|
||||
const char * vert_source =
|
||||
"const vec3 LightPosition = vec3( 0.0, 2.0, 4.0 );"
|
||||
"varying float CartoonTexCoord;"
|
||||
"void main( void )"
|
||||
"{"
|
||||
"vec3 eye_space_normal = normalize(gl_NormalMatrix * gl_Normal);"
|
||||
"CartoonTexCoord = max(0.0, dot(normalize(LightPosition), eye_space_normal));"
|
||||
"gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;"
|
||||
"}";
|
||||
|
||||
const char * frag_source =
|
||||
"uniform sampler1D CartoonTexUnit;"
|
||||
"varying float CartoonTexCoord;"
|
||||
"void main( void )"
|
||||
"{"
|
||||
"gl_FragColor = texture1D( CartoonTexUnit, CartoonTexCoord );"
|
||||
"}";
|
||||
const char * frag_source =
|
||||
"uniform sampler1D CartoonTexUnit;"
|
||||
"varying float CartoonTexCoord;"
|
||||
"void main( void )"
|
||||
"{"
|
||||
"gl_FragColor = texture1D( CartoonTexUnit, CartoonTexCoord );"
|
||||
"}";
|
||||
|
||||
osg::ref_ptr<osg::StateSet> ss = new osg::StateSet;
|
||||
|
||||
@@ -202,13 +202,13 @@ namespace
|
||||
polyoffset->setUnits(1.0f);
|
||||
ss->setAttributeAndModes(polyoffset.get(), osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
|
||||
|
||||
osg::ref_ptr<osg::Program> program = new osg::Program;
|
||||
program->addShader( new osg::Shader( osg::Shader::VERTEX, vert_source ) );
|
||||
program->addShader( new osg::Shader( osg::Shader::FRAGMENT, frag_source ) );
|
||||
osg::ref_ptr<osg::Program> program = new osg::Program;
|
||||
program->addShader( new osg::Shader( osg::Shader::VERTEX, vert_source ) );
|
||||
program->addShader( new osg::Shader( osg::Shader::FRAGMENT, frag_source ) );
|
||||
|
||||
ss->addUniform( new osg::Uniform("CartoonTexUnit", 0));
|
||||
ss->setAttributeAndModes( program.get(), osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
|
||||
|
||||
ss->setAttributeAndModes( program.get(), osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
|
||||
|
||||
|
||||
ss->setTextureMode(0, GL_TEXTURE_2D, osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
using namespace osgFX;
|
||||
|
||||
Effect::Effect()
|
||||
: osg::Group(),
|
||||
: osg::Group(),
|
||||
_enabled(true),
|
||||
_global_sel_tech(AUTO_DETECT),
|
||||
_techs_defined(false)
|
||||
@@ -20,7 +20,7 @@ Effect::Effect()
|
||||
}
|
||||
|
||||
Effect::Effect(const Effect& copy, const osg::CopyOp& copyop)
|
||||
: osg::Group(copy, copyop),
|
||||
: osg::Group(copy, copyop),
|
||||
_enabled(copy._enabled),
|
||||
_global_sel_tech(copy._global_sel_tech),
|
||||
_techs_defined(false)
|
||||
@@ -30,49 +30,49 @@ Effect::Effect(const Effect& copy, const osg::CopyOp& copyop)
|
||||
|
||||
Effect::~Effect()
|
||||
{
|
||||
// disable the validator for safety, so it won't try to access us
|
||||
// even if it stays alive for some reason
|
||||
if (_dummy_for_validation.valid()) {
|
||||
osg::StateSet* ss = _dummy_for_validation->getStateSet();
|
||||
if (ss) {
|
||||
Validator *validator = dynamic_cast<Validator *>(ss->getAttribute(Validator::VALIDATOR));
|
||||
if (validator) {
|
||||
validator->disable();
|
||||
}
|
||||
}
|
||||
}
|
||||
// disable the validator for safety, so it won't try to access us
|
||||
// even if it stays alive for some reason
|
||||
if (_dummy_for_validation.valid()) {
|
||||
osg::StateSet* ss = _dummy_for_validation->getStateSet();
|
||||
if (ss) {
|
||||
Validator *validator = dynamic_cast<Validator *>(ss->getAttribute(Validator::VALIDATOR));
|
||||
if (validator) {
|
||||
validator->disable();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Effect::traverse(osg::NodeVisitor& nv)
|
||||
{
|
||||
// if this effect is not enabled, then go for default traversal
|
||||
// if this effect is not enabled, then go for default traversal
|
||||
if (!_enabled) {
|
||||
inherited_traverse(nv);
|
||||
return;
|
||||
}
|
||||
|
||||
// ensure that at least one technique is defined
|
||||
// ensure that at least one technique is defined
|
||||
if (!_techs_defined) {
|
||||
|
||||
// clear existing techniques
|
||||
_techs.clear();
|
||||
|
||||
// clear technique selection indices
|
||||
// clear technique selection indices
|
||||
_sel_tech.clear();
|
||||
|
||||
// clear technique selection flags
|
||||
// clear technique selection flags
|
||||
_tech_selected.clear();
|
||||
|
||||
// define new techniques
|
||||
_techs_defined = define_techniques();
|
||||
|
||||
// check for errors, return on failure
|
||||
// check for errors, return on failure
|
||||
if (!_techs_defined) {
|
||||
osg::notify(osg::WARN) << "Warning: osgFX::Effect: could not define techniques for effect " << className() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// ensure that at least one technique has been defined
|
||||
// ensure that at least one technique has been defined
|
||||
if (_techs.empty()) {
|
||||
osg::notify(osg::WARN) << "Warning: osgFX::Effect: no techniques defined for effect " << className() << std::endl;
|
||||
return;
|
||||
@@ -82,10 +82,10 @@ void Effect::traverse(osg::NodeVisitor& nv)
|
||||
Technique *tech = 0;
|
||||
|
||||
// if the selection mode is set to AUTO_DETECT then we have to
|
||||
// choose the active technique!
|
||||
if (_global_sel_tech == AUTO_DETECT) {
|
||||
// choose the active technique!
|
||||
if (_global_sel_tech == AUTO_DETECT) {
|
||||
|
||||
// test whether at least one technique has been selected
|
||||
// test whether at least one technique has been selected
|
||||
bool none_selected = true;
|
||||
for (unsigned i=0; i<_tech_selected.size(); ++i) {
|
||||
if (_tech_selected[i] != 0) {
|
||||
@@ -94,15 +94,15 @@ void Effect::traverse(osg::NodeVisitor& nv)
|
||||
}
|
||||
}
|
||||
|
||||
// no techniques selected, traverse a dummy node that
|
||||
// contains the Validator (it will select a technique)
|
||||
// no techniques selected, traverse a dummy node that
|
||||
// contains the Validator (it will select a technique)
|
||||
if (none_selected) {
|
||||
_dummy_for_validation->accept(nv);
|
||||
}
|
||||
|
||||
// find the highest priority technique that could be validated
|
||||
// in all active rendering contexts
|
||||
int max_index = -1;
|
||||
// in all active rendering contexts
|
||||
int max_index = -1;
|
||||
for (unsigned j=0; j<_sel_tech.size(); ++j) {
|
||||
if (_tech_selected[j] != 0) {
|
||||
if (_sel_tech[j] > max_index) {
|
||||
@@ -112,27 +112,27 @@ void Effect::traverse(osg::NodeVisitor& nv)
|
||||
}
|
||||
|
||||
// found a valid technique?
|
||||
if (max_index >= 0) {
|
||||
if (max_index >= 0) {
|
||||
tech = _techs[max_index].get();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// the active technique was selected manually
|
||||
// the active technique was selected manually
|
||||
tech = _techs[_global_sel_tech].get();
|
||||
}
|
||||
|
||||
// if we could find an active technique, then continue with traversal,
|
||||
// else go for default traversal (no effect)
|
||||
if (tech) {
|
||||
tech->traverse(nv, this);
|
||||
} else {
|
||||
if (nv.getTraversalMode() == osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {
|
||||
inherited_traverse(nv);
|
||||
}
|
||||
}
|
||||
// else go for default traversal (no effect)
|
||||
if (tech) {
|
||||
tech->traverse(nv, this);
|
||||
} else {
|
||||
if (nv.getTraversalMode() == osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {
|
||||
inherited_traverse(nv);
|
||||
}
|
||||
}
|
||||
|
||||
// wow, we're finished! :)
|
||||
// wow, we're finished! :)
|
||||
}
|
||||
|
||||
void Effect::build_dummy_node()
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
using namespace osgFX;
|
||||
|
||||
Technique::Technique()
|
||||
: osg::Referenced()
|
||||
: osg::Referenced()
|
||||
{
|
||||
}
|
||||
|
||||
void Technique::addPass(osg::StateSet* ss)
|
||||
{
|
||||
if (ss) {
|
||||
if (ss) {
|
||||
_passes.push_back(ss);
|
||||
ss->setRenderBinDetails(static_cast<int>(_passes.size()), "RenderBin");
|
||||
ss->setRenderBinDetails(static_cast<int>(_passes.size()), "RenderBin");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,29 +41,29 @@ void Technique::traverse_implementation(osg::NodeVisitor& nv, Effect* fx)
|
||||
define_passes();
|
||||
}
|
||||
|
||||
// special actions must be taken if the node visitor is actually a CullVisitor
|
||||
osgUtil::CullVisitor *cv = dynamic_cast<osgUtil::CullVisitor *>(&nv);
|
||||
// special actions must be taken if the node visitor is actually a CullVisitor
|
||||
osgUtil::CullVisitor *cv = dynamic_cast<osgUtil::CullVisitor *>(&nv);
|
||||
|
||||
// traverse all passes
|
||||
for (int i=0; i<getNumPasses(); ++i) {
|
||||
// traverse all passes
|
||||
for (int i=0; i<getNumPasses(); ++i) {
|
||||
|
||||
// push the i-th pass' StateSet if necessary
|
||||
if (cv) {
|
||||
cv->pushStateSet(_passes[i].get());
|
||||
}
|
||||
// push the i-th pass' StateSet if necessary
|
||||
if (cv) {
|
||||
cv->pushStateSet(_passes[i].get());
|
||||
}
|
||||
|
||||
// traverse the override node if defined, otherwise
|
||||
// traverse children as a Group would do
|
||||
osg::Node *override = getOverrideChild(i);
|
||||
if (override) {
|
||||
override->accept(nv);
|
||||
} else {
|
||||
fx->inherited_traverse(nv);
|
||||
}
|
||||
// traverse the override node if defined, otherwise
|
||||
// traverse children as a Group would do
|
||||
osg::Node *override = getOverrideChild(i);
|
||||
if (override) {
|
||||
override->accept(nv);
|
||||
} else {
|
||||
fx->inherited_traverse(nv);
|
||||
}
|
||||
|
||||
// pop the StateSet if necessary
|
||||
if (cv) {
|
||||
cv->popStateSet();
|
||||
}
|
||||
}
|
||||
// pop the StateSet if necessary
|
||||
if (cv) {
|
||||
cv->popStateSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using namespace osgFX;
|
||||
|
||||
Validator::Validator()
|
||||
: osg::StateAttribute(),
|
||||
_effect(0)
|
||||
_effect(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ Validator::Validator(const Validator& copy, const osg::CopyOp& copyop)
|
||||
|
||||
void Validator::compileGLObjects(osg::State& state) const
|
||||
{
|
||||
apply(state);
|
||||
apply(state);
|
||||
}
|
||||
|
||||
void Validator::apply(osg::State& state) const
|
||||
|
||||
@@ -209,7 +209,7 @@ osg::BoundingBox osgParticle::ParticleSystem::computeBound() const
|
||||
return _def_bbox;
|
||||
} else
|
||||
{
|
||||
return osg::BoundingBox(_bmin,_bmax);
|
||||
return osg::BoundingBox(_bmin,_bmax);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,11 +73,11 @@ void EventAdapter::adaptMouseScroll(double time, Producer::KeyboardMouseCallback
|
||||
_time = time;
|
||||
|
||||
if (sm == Producer::KeyboardMouseCallback::ScrollUp)
|
||||
_eventType = SCROLLUP;
|
||||
_eventType = SCROLLUP;
|
||||
else if (sm == Producer::KeyboardMouseCallback::ScrollDown)
|
||||
_eventType = SCROLLDOWN;
|
||||
_eventType = SCROLLDOWN;
|
||||
else
|
||||
_eventType = NONE;
|
||||
_eventType = NONE;
|
||||
|
||||
copyStaticVariables();
|
||||
}
|
||||
@@ -92,20 +92,17 @@ void EventAdapter::adaptButtonPress(double time,float x, float y, unsigned int b
|
||||
switch(_button)
|
||||
{
|
||||
case(0):
|
||||
_s_accumulatedButtonMask =
|
||||
_s_accumulatedButtonMask | LEFT_MOUSE_BUTTON;
|
||||
_s_button = LEFT_MOUSE_BUTTON;
|
||||
break;
|
||||
_s_accumulatedButtonMask = _s_accumulatedButtonMask | LEFT_MOUSE_BUTTON;
|
||||
_s_button = LEFT_MOUSE_BUTTON;
|
||||
break;
|
||||
case(1):
|
||||
_s_accumulatedButtonMask =
|
||||
_s_accumulatedButtonMask | MIDDLE_MOUSE_BUTTON;
|
||||
_s_button = MIDDLE_MOUSE_BUTTON;
|
||||
break;
|
||||
_s_accumulatedButtonMask = _s_accumulatedButtonMask | MIDDLE_MOUSE_BUTTON;
|
||||
_s_button = MIDDLE_MOUSE_BUTTON;
|
||||
break;
|
||||
case(2):
|
||||
_s_accumulatedButtonMask =
|
||||
_s_accumulatedButtonMask | RIGHT_MOUSE_BUTTON;
|
||||
_s_button = RIGHT_MOUSE_BUTTON;
|
||||
break;
|
||||
_s_accumulatedButtonMask = _s_accumulatedButtonMask | RIGHT_MOUSE_BUTTON;
|
||||
_s_button = RIGHT_MOUSE_BUTTON;
|
||||
break;
|
||||
}
|
||||
|
||||
_s_mx = x;
|
||||
@@ -124,20 +121,17 @@ void EventAdapter::adaptButtonRelease(double time,float x, float y, unsigned int
|
||||
switch(_button)
|
||||
{
|
||||
case(0):
|
||||
_s_accumulatedButtonMask =
|
||||
_s_accumulatedButtonMask & ~LEFT_MOUSE_BUTTON;
|
||||
_s_button = LEFT_MOUSE_BUTTON;
|
||||
break;
|
||||
_s_accumulatedButtonMask = _s_accumulatedButtonMask & ~LEFT_MOUSE_BUTTON;
|
||||
_s_button = LEFT_MOUSE_BUTTON;
|
||||
break;
|
||||
case(1):
|
||||
_s_accumulatedButtonMask =
|
||||
_s_accumulatedButtonMask & ~MIDDLE_MOUSE_BUTTON;
|
||||
_s_button = MIDDLE_MOUSE_BUTTON;
|
||||
break;
|
||||
_s_accumulatedButtonMask = _s_accumulatedButtonMask & ~MIDDLE_MOUSE_BUTTON;
|
||||
_s_button = MIDDLE_MOUSE_BUTTON;
|
||||
break;
|
||||
case(2):
|
||||
_s_accumulatedButtonMask =
|
||||
_s_accumulatedButtonMask & ~RIGHT_MOUSE_BUTTON;
|
||||
_s_button = RIGHT_MOUSE_BUTTON;
|
||||
break;
|
||||
_s_accumulatedButtonMask = _s_accumulatedButtonMask & ~RIGHT_MOUSE_BUTTON;
|
||||
_s_button = RIGHT_MOUSE_BUTTON;
|
||||
break;
|
||||
}
|
||||
|
||||
_s_mx = x;
|
||||
|
||||
@@ -134,33 +134,33 @@ class QuitImageStreamVisitor : public osg::NodeVisitor
|
||||
public:
|
||||
|
||||
QuitImageStreamVisitor():
|
||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
||||
|
||||
|
||||
/** Simply traverse using standard NodeVisitor traverse method.*/
|
||||
virtual void apply(osg::Node& node)
|
||||
{
|
||||
if (node.getStateSet())
|
||||
apply(*(node.getStateSet()));
|
||||
|
||||
traverse(node);
|
||||
}
|
||||
|
||||
virtual void apply(osg::Geode& node)
|
||||
{
|
||||
if (node.getStateSet())
|
||||
{
|
||||
if (node.getStateSet())
|
||||
apply(*(node.getStateSet()));
|
||||
|
||||
for(unsigned int i=0;i<node.getNumDrawables();++i)
|
||||
{
|
||||
osg::Drawable* drawable = node.getDrawable(i);
|
||||
if (drawable && drawable->getStateSet())
|
||||
traverse(node);
|
||||
}
|
||||
|
||||
virtual void apply(osg::Geode& node)
|
||||
{
|
||||
if (node.getStateSet())
|
||||
apply(*(node.getStateSet()));
|
||||
|
||||
for(unsigned int i=0;i<node.getNumDrawables();++i)
|
||||
{
|
||||
osg::Drawable* drawable = node.getDrawable(i);
|
||||
if (drawable && drawable->getStateSet())
|
||||
apply(*(drawable->getStateSet()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void apply(osg::StateSet& stateset)
|
||||
{
|
||||
{
|
||||
for(unsigned int i=0;i<stateset.getTextureAttributeList().size();++i)
|
||||
{
|
||||
osg::StateAttribute* texture = stateset.getTextureAttribute(i,osg::StateAttribute::TEXTURE);
|
||||
@@ -168,26 +168,26 @@ class QuitImageStreamVisitor : public osg::NodeVisitor
|
||||
{
|
||||
osg::TextureRectangle* textureRect = dynamic_cast<osg::TextureRectangle*>(texture);
|
||||
if (textureRect)
|
||||
{
|
||||
osg::ImageStream* imageStream = dynamic_cast<osg::ImageStream*>(textureRect->getImage());
|
||||
if (imageStream)
|
||||
{
|
||||
imageStream->quit();
|
||||
}
|
||||
}
|
||||
{
|
||||
osg::ImageStream* imageStream = dynamic_cast<osg::ImageStream*>(textureRect->getImage());
|
||||
if (imageStream)
|
||||
{
|
||||
imageStream->quit();
|
||||
}
|
||||
}
|
||||
|
||||
osg::Texture2D* texture2D = dynamic_cast<osg::Texture2D*>(texture);
|
||||
if (texture2D)
|
||||
{
|
||||
osg::ImageStream* imageStream = dynamic_cast<osg::ImageStream*>(texture2D->getImage());
|
||||
if (imageStream)
|
||||
{
|
||||
imageStream->quit();
|
||||
}
|
||||
}
|
||||
{
|
||||
osg::ImageStream* imageStream = dynamic_cast<osg::ImageStream*>(texture2D->getImage());
|
||||
if (imageStream)
|
||||
{
|
||||
imageStream->quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -360,8 +360,8 @@ Viewer::Viewer(osg::ArgumentParser& arguments):
|
||||
std::string pathfile;
|
||||
while (arguments.read("-p",pathfile))
|
||||
{
|
||||
osg::ref_ptr<osgGA::AnimationPathManipulator> apm = new osgGA::AnimationPathManipulator(pathfile);
|
||||
if( apm.valid() && apm->valid() )
|
||||
osg::ref_ptr<osgGA::AnimationPathManipulator> apm = new osgGA::AnimationPathManipulator(pathfile);
|
||||
if( apm.valid() && apm->valid() )
|
||||
{
|
||||
unsigned int num = addCameraManipulator(apm.get());
|
||||
selectCameraManipulator(num);
|
||||
|
||||
@@ -211,8 +211,8 @@ ImpostorSprite* Impostor::createImpostorSprite(osgUtil::CullVisitor* cv)
|
||||
osgSim::ImpostorSpriteManager* impostorSpriteManager = dynamic_cast<osgSim::ImpostorSpriteManager*>(cv->getUserData());
|
||||
if (!impostorSpriteManager)
|
||||
{
|
||||
impostorSpriteManager = new osgSim::ImpostorSpriteManager;
|
||||
cv->setUserData(impostorSpriteManager);
|
||||
impostorSpriteManager = new osgSim::ImpostorSpriteManager;
|
||||
cv->setUserData(impostorSpriteManager);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ LightPoint::LightPoint(const osg::Vec3& position,const osg::Vec4& color):
|
||||
{
|
||||
}
|
||||
|
||||
LightPoint::LightPoint(bool on,
|
||||
LightPoint::LightPoint(bool on,
|
||||
const osg::Vec3& position,
|
||||
const osg::Vec4& color,
|
||||
float intensity,
|
||||
|
||||
@@ -251,14 +251,14 @@ void LightPointNode::traverse(osg::NodeVisitor& nv)
|
||||
++itr)
|
||||
{
|
||||
const LightPoint& lp = *itr;
|
||||
|
||||
if (!lp._on) continue;
|
||||
|
||||
|
||||
if (!lp._on) continue;
|
||||
|
||||
const osg::Vec3& position = lp._position;
|
||||
|
||||
|
||||
// skip light point if it is not contianed in the view frustum.
|
||||
if (computeClipping && !clipvol.contains(position)) continue;
|
||||
|
||||
|
||||
// delta vector between eyepoint and light point.
|
||||
osg::Vec3 dv(eyePoint-position);
|
||||
|
||||
@@ -282,12 +282,12 @@ void LightPointNode::traverse(osg::NodeVisitor& nv)
|
||||
if (lp._sector.valid())
|
||||
{
|
||||
intensity *= (*lp._sector)(dv);
|
||||
|
||||
|
||||
// slip light point if it is intensity is 0.0 or negative.
|
||||
if (intensity<=minimumIntensity) continue;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// temporary accounting of intensity.
|
||||
//color *= intensity;
|
||||
|
||||
@@ -304,13 +304,13 @@ void LightPointNode::traverse(osg::NodeVisitor& nv)
|
||||
color[2] *= bs[2];
|
||||
color[3] *= bs[3];
|
||||
}
|
||||
|
||||
|
||||
// if alpha value is less than the min intentsive then skip
|
||||
if (color[3]<=minimumIntensity) continue;
|
||||
|
||||
float pixelSize = cv->pixelSize(position,lp._radius);
|
||||
|
||||
// cout << "pixelsize = "<<pixelSize<<endl;
|
||||
// cout << "pixelsize = "<<pixelSize<<endl;
|
||||
|
||||
// adjust pixel size to account for intensity.
|
||||
if (intensity!=1.0) pixelSize *= sqrt(intensity);
|
||||
|
||||
@@ -61,12 +61,12 @@ bool MultiSwitch::addChild( osg::Node *child)
|
||||
{
|
||||
ValueList& values = *itr;
|
||||
if (_children.size()>_values.size())
|
||||
{
|
||||
values.resize(_children.size(),_newChildDefaultValue);
|
||||
values[childPosition]=_newChildDefaultValue;
|
||||
}
|
||||
{
|
||||
values.resize(_children.size(),_newChildDefaultValue);
|
||||
values[childPosition]=_newChildDefaultValue;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -81,17 +81,17 @@ bool MultiSwitch::insertChild( unsigned int index, osg::Node *child)
|
||||
{
|
||||
ValueList& values = *itr;
|
||||
if (index>=_values.size())
|
||||
{
|
||||
values.push_back(_newChildDefaultValue);
|
||||
}
|
||||
{
|
||||
values.push_back(_newChildDefaultValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
values.insert(values.begin()+index, _newChildDefaultValue);
|
||||
values.insert(values.begin()+index, _newChildDefaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
|
||||
EdgeLine():_ss(0)
|
||||
{
|
||||
init();
|
||||
init();
|
||||
osg::notify(osg::WARN)<<
|
||||
"Warning: unexpected call to osgSim::SphereSegment::EdgeLine() default constructor"<<std::endl;
|
||||
}
|
||||
@@ -107,10 +107,10 @@ protected:
|
||||
|
||||
void init()
|
||||
{
|
||||
// switch off lighting.
|
||||
getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
||||
|
||||
//getOrCreateStateSet()->setAttributeAndModes(new osg::LineWidth(2.0),osg::StateAttribute::OFF);
|
||||
// switch off lighting.
|
||||
getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
||||
|
||||
//getOrCreateStateSet()->setAttributeAndModes(new osg::LineWidth(2.0),osg::StateAttribute::OFF);
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ public:
|
||||
|
||||
Spoke():_ss(0)
|
||||
{
|
||||
init();
|
||||
init();
|
||||
osg::notify(osg::WARN)<<
|
||||
"Warning: unexpected call to osgSim::SphereSegment::Spoke() default constructor"<<std::endl;
|
||||
}
|
||||
@@ -216,10 +216,10 @@ protected:
|
||||
|
||||
void init()
|
||||
{
|
||||
// switch off lighting.
|
||||
getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
||||
// switch off lighting.
|
||||
getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
||||
|
||||
//getOrCreateStateSet()->setAttributeAndModes(new osg::LineWidth(2.0),osg::StateAttribute::OFF);
|
||||
//getOrCreateStateSet()->setAttributeAndModes(new osg::LineWidth(2.0),osg::StateAttribute::OFF);
|
||||
}
|
||||
|
||||
virtual osg::BoundingBox computeBound() const;
|
||||
@@ -400,23 +400,23 @@ void SphereSegment::Surface_drawImplementation(osg::State& /* state */) const
|
||||
{
|
||||
glColor4fv(_surfaceColor.ptr());
|
||||
|
||||
bool drawBackSide = true;
|
||||
bool drawFrontSide = true;
|
||||
bool drawBackSide = true;
|
||||
bool drawFrontSide = true;
|
||||
|
||||
// draw back side.
|
||||
if (drawBackSide)
|
||||
{
|
||||
// draw back side.
|
||||
if (drawBackSide)
|
||||
{
|
||||
for(int i=0; i+1<=_density; i++)
|
||||
{
|
||||
// Because we're drawing quad strips, we need to work out
|
||||
// two azimuth values, to form each edge of the (z-vertical)
|
||||
// strips
|
||||
float az1 = _azMin + (i*azIncr);
|
||||
float az2 = _azMin + ((i+1)*azIncr);
|
||||
// Because we're drawing quad strips, we need to work out
|
||||
// two azimuth values, to form each edge of the (z-vertical)
|
||||
// strips
|
||||
float az1 = _azMin + (i*azIncr);
|
||||
float az2 = _azMin + ((i+1)*azIncr);
|
||||
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
for (int j=0; j<=_density; j++)
|
||||
{
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
for (int j=0; j<=_density; j++)
|
||||
{
|
||||
float elev = _elevMin + (j*elevIncr);
|
||||
|
||||
// QuadStrip Edge formed at az1
|
||||
@@ -444,25 +444,25 @@ void SphereSegment::Surface_drawImplementation(osg::State& /* state */) const
|
||||
glVertex3f(_centre.x() + _radius*x,
|
||||
_centre.y() + _radius*y,
|
||||
_centre.z() + _radius*z);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
|
||||
// draw front side
|
||||
if (drawFrontSide)
|
||||
{
|
||||
}
|
||||
|
||||
// draw front side
|
||||
if (drawFrontSide)
|
||||
{
|
||||
for(int i=0; i+1<=_density; i++)
|
||||
{
|
||||
// Because we're drawing quad strips, we need to work out
|
||||
// two azimuth values, to form each edge of the (z-vertical)
|
||||
// strips
|
||||
float az1 = _azMin + (i*azIncr);
|
||||
float az2 = _azMin + ((i+1)*azIncr);
|
||||
// Because we're drawing quad strips, we need to work out
|
||||
// two azimuth values, to form each edge of the (z-vertical)
|
||||
// strips
|
||||
float az1 = _azMin + (i*azIncr);
|
||||
float az2 = _azMin + ((i+1)*azIncr);
|
||||
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
for (int j=0; j<=_density; j++)
|
||||
{
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
for (int j=0; j<=_density; j++)
|
||||
{
|
||||
float elev = _elevMin + (j*elevIncr);
|
||||
|
||||
// QuadStrip Edge formed at az1
|
||||
@@ -491,10 +491,10 @@ void SphereSegment::Surface_drawImplementation(osg::State& /* state */) const
|
||||
glVertex3f(_centre.x() + _radius*x,
|
||||
_centre.y() + _radius*y,
|
||||
_centre.z() + _radius*z);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -673,154 +673,153 @@ void SphereSegment::Side_drawImplementation(osg::State& /* state */,
|
||||
// ----------------------------
|
||||
if(_drawMask & SIDES)
|
||||
{
|
||||
bool drawBackSide = true;
|
||||
bool drawFrontSide = true;
|
||||
int start, end, delta;
|
||||
bool drawBackSide = true;
|
||||
bool drawFrontSide = true;
|
||||
int start, end, delta;
|
||||
|
||||
glColor4fv(_planeColor.ptr());
|
||||
|
||||
// draw back side.
|
||||
if (drawBackSide)
|
||||
{
|
||||
// draw back side.
|
||||
if (drawBackSide)
|
||||
{
|
||||
|
||||
if(orientation == AZIM) // This is a plane at a given azimuth
|
||||
{
|
||||
const float az = (boundaryAngle==MIN?_azMin:_azMax);
|
||||
const float elevIncr = (_elevMax - _elevMin)/_density;
|
||||
const float az = (boundaryAngle==MIN?_azMin:_azMax);
|
||||
const float elevIncr = (_elevMax - _elevMin)/_density;
|
||||
|
||||
// Normal
|
||||
osg::Vec3 normal = osg::Vec3(cos(_elevMin)*sin(az), cos(_elevMin)*cos(az), sin(_elevMin))
|
||||
// Normal
|
||||
osg::Vec3 normal = osg::Vec3(cos(_elevMin)*sin(az), cos(_elevMin)*cos(az), sin(_elevMin))
|
||||
^ osg::Vec3(cos(_elevMax)*sin(az), cos(_elevMax)*cos(az), sin(_elevMax));
|
||||
|
||||
if (boundaryAngle==MIN)
|
||||
{
|
||||
start = _density;
|
||||
end = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = 0;
|
||||
end = _density;
|
||||
normal = -normal; // Make sure normals orientationint 'outwards'
|
||||
}
|
||||
delta = end>start?1:-1;
|
||||
if (boundaryAngle==MIN)
|
||||
{
|
||||
start = _density;
|
||||
end = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = 0;
|
||||
end = _density;
|
||||
normal = -normal; // Make sure normals orientationint 'outwards'
|
||||
}
|
||||
delta = end>start?1:-1;
|
||||
|
||||
if (drawBackSide)
|
||||
{
|
||||
// Tri fan
|
||||
glNormal3f(-normal.x(),-normal.y(),-normal.z());
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glVertex3fv(_centre.ptr());
|
||||
for (int j=start; j!=end+delta; j+=delta)
|
||||
{
|
||||
float elev = _elevMin + (j*elevIncr);
|
||||
glVertex3f( _centre.x() + _radius*cos(elev)*sin(az),
|
||||
_centre.y() + _radius*cos(elev)*cos(az),
|
||||
_centre.z() + _radius*sin(elev));
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
if (boundaryAngle==MIN)
|
||||
{
|
||||
start = 0;
|
||||
end = _density;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = _density;
|
||||
end = 0;
|
||||
}
|
||||
delta = end>start?1:-1;
|
||||
if (drawBackSide)
|
||||
{
|
||||
// Tri fan
|
||||
glNormal3f(-normal.x(),-normal.y(),-normal.z());
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glVertex3fv(_centre.ptr());
|
||||
for (int j=start; j!=end+delta; j+=delta)
|
||||
{
|
||||
float elev = _elevMin + (j*elevIncr);
|
||||
glVertex3f( _centre.x() + _radius*cos(elev)*sin(az),
|
||||
_centre.y() + _radius*cos(elev)*cos(az),
|
||||
_centre.z() + _radius*sin(elev));
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
if (drawFrontSide)
|
||||
{
|
||||
glNormal3fv(normal.ptr());
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glVertex3fv(_centre.ptr());
|
||||
for (int j=start; j!=end+delta; j+=delta)
|
||||
{
|
||||
float elev = _elevMin + (j*elevIncr);
|
||||
glVertex3f( _centre.x() + _radius*cos(elev)*sin(az),
|
||||
_centre.y() + _radius*cos(elev)*cos(az),
|
||||
_centre.z() + _radius*sin(elev));
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
if (boundaryAngle==MIN)
|
||||
{
|
||||
start = 0;
|
||||
end = _density;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = _density;
|
||||
end = 0;
|
||||
}
|
||||
delta = end>start?1:-1;
|
||||
|
||||
if (drawFrontSide)
|
||||
{
|
||||
glNormal3fv(normal.ptr());
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glVertex3fv(_centre.ptr());
|
||||
for (int j=start; j!=end+delta; j+=delta)
|
||||
{
|
||||
float elev = _elevMin + (j*elevIncr);
|
||||
glVertex3f( _centre.x() + _radius*cos(elev)*sin(az),
|
||||
_centre.y() + _radius*cos(elev)*cos(az),
|
||||
_centre.z() + _radius*sin(elev));
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
}
|
||||
else if(orientation == ELEV) // This is a plane at a given elevation
|
||||
{
|
||||
const float elev = (boundaryAngle==MIN?_elevMin:_elevMax);
|
||||
const float azIncr = (_azMax - _azMin)/_density;
|
||||
const float elev = (boundaryAngle==MIN?_elevMin:_elevMax);
|
||||
const float azIncr = (_azMax - _azMin)/_density;
|
||||
|
||||
// Normal
|
||||
osg::Vec3 normal = osg::Vec3(cos(elev)*sin(_azMax), cos(elev)*cos(_azMax), sin(elev))
|
||||
// Normal
|
||||
osg::Vec3 normal = osg::Vec3(cos(elev)*sin(_azMax), cos(elev)*cos(_azMax), sin(elev))
|
||||
^ osg::Vec3(cos(elev)*sin(_azMin), cos(elev)*cos(_azMin), sin(elev));
|
||||
|
||||
|
||||
if (boundaryAngle==MIN)
|
||||
{
|
||||
start = _density;
|
||||
end = 0;
|
||||
normal = -normal; // Make sure normals orientationint 'outwards'
|
||||
}
|
||||
else
|
||||
{
|
||||
start = 0;
|
||||
end = _density;
|
||||
}
|
||||
delta = end>start?1:-1;
|
||||
if (boundaryAngle==MIN)
|
||||
{
|
||||
start = _density;
|
||||
end = 0;
|
||||
normal = -normal; // Make sure normals orientationint 'outwards'
|
||||
}
|
||||
else
|
||||
{
|
||||
start = 0;
|
||||
end = _density;
|
||||
}
|
||||
delta = end>start?1:-1;
|
||||
|
||||
if (drawBackSide)
|
||||
{
|
||||
glNormal3f(-normal.x(),-normal.y(),-normal.z());
|
||||
if (drawBackSide)
|
||||
{
|
||||
glNormal3f(-normal.x(),-normal.y(),-normal.z());
|
||||
|
||||
// Tri fan
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glVertex3fv(_centre.ptr());
|
||||
for (int j=start; j!=end+delta; j+=delta)
|
||||
{
|
||||
float az = _azMin + (j*azIncr);
|
||||
glVertex3f( _centre.x() + _radius*cos(elev)*sin(az),
|
||||
_centre.y() + _radius*cos(elev)*cos(az),
|
||||
_centre.z() + _radius*sin(elev));
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
if (boundaryAngle==MIN)
|
||||
{
|
||||
start = 0;
|
||||
end = _density;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = _density;
|
||||
end = 0;
|
||||
}
|
||||
delta = end>start?1:-1;
|
||||
// Tri fan
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glVertex3fv(_centre.ptr());
|
||||
for (int j=start; j!=end+delta; j+=delta)
|
||||
{
|
||||
float az = _azMin + (j*azIncr);
|
||||
glVertex3f( _centre.x() + _radius*cos(elev)*sin(az),
|
||||
_centre.y() + _radius*cos(elev)*cos(az),
|
||||
_centre.z() + _radius*sin(elev));
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
if (drawFrontSide)
|
||||
{
|
||||
glNormal3fv(normal.ptr());
|
||||
if (boundaryAngle==MIN)
|
||||
{
|
||||
start = 0;
|
||||
end = _density;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = _density;
|
||||
end = 0;
|
||||
}
|
||||
delta = end>start?1:-1;
|
||||
|
||||
if (drawFrontSide)
|
||||
{
|
||||
glNormal3fv(normal.ptr());
|
||||
|
||||
// Tri fan
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glVertex3fv(_centre.ptr());
|
||||
for (int j=start; j!=end+delta; j+=delta)
|
||||
{
|
||||
float az = _azMin + (j*azIncr);
|
||||
glVertex3f( _centre.x() + _radius*cos(elev)*sin(az),
|
||||
_centre.y() + _radius*cos(elev)*cos(az),
|
||||
_centre.z() + _radius*sin(elev));
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
// Tri fan
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glVertex3fv(_centre.ptr());
|
||||
for (int j=start; j!=end+delta; j+=delta)
|
||||
{
|
||||
float az = _azMin + (j*azIncr);
|
||||
glVertex3f( _centre.x() + _radius*cos(elev)*sin(az),
|
||||
_centre.y() + _radius*cos(elev)*cos(az),
|
||||
_centre.z() + _radius*sin(elev));
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,13 +94,13 @@ void HeightFieldNode::computeNormalMap()
|
||||
char* ptr = (char*) image->data();
|
||||
for(unsigned int r=0;r<_heightField->getNumRows();++r)
|
||||
{
|
||||
for(unsigned int c=0;c<_heightField->getNumColumns();++c)
|
||||
{
|
||||
osg::Vec3 normal = _heightField->getNormal(c,r);
|
||||
for(unsigned int c=0;c<_heightField->getNumColumns();++c)
|
||||
{
|
||||
osg::Vec3 normal = _heightField->getNormal(c,r);
|
||||
(*ptr++) = (char)((normal.x()+1.0)*0.5*255);
|
||||
(*ptr++) = (char)((normal.y()+1.0)*0.5*255);
|
||||
(*ptr++) = (char)((normal.z()+1.0)*0.5*255);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setNormalMapImage(image);
|
||||
|
||||
@@ -352,7 +352,7 @@ String::iterator Text::computeLastCharacterOnLine(osg::Vec2& cursor, String::ite
|
||||
}
|
||||
|
||||
// => word boundary detection & wrapping
|
||||
if (outOfSpace) break;
|
||||
if (outOfSpace) break;
|
||||
|
||||
// move the cursor onto the next character.
|
||||
switch(_layout)
|
||||
@@ -377,7 +377,7 @@ String::iterator Text::computeLastCharacterOnLine(osg::Vec2& cursor, String::ite
|
||||
while (lastValidChar!=first && deliminatorSet.count(*lastValidChar)==0)
|
||||
{
|
||||
--lastValidChar;
|
||||
}
|
||||
}
|
||||
if (first!=lastValidChar)
|
||||
{
|
||||
++lastValidChar;
|
||||
@@ -427,111 +427,111 @@ void Text::computeGlyphRepresentation()
|
||||
itr!=_text.end();
|
||||
)
|
||||
{
|
||||
// record the start of the current line
|
||||
String::iterator startOfLine_itr = itr;
|
||||
// record the start of the current line
|
||||
String::iterator startOfLine_itr = itr;
|
||||
|
||||
// find the end of the current line.
|
||||
osg::Vec2 endOfLine_coords(cursor);
|
||||
String::iterator endOfLine_itr = computeLastCharacterOnLine(endOfLine_coords, itr,_text.end());
|
||||
// find the end of the current line.
|
||||
osg::Vec2 endOfLine_coords(cursor);
|
||||
String::iterator endOfLine_itr = computeLastCharacterOnLine(endOfLine_coords, itr,_text.end());
|
||||
|
||||
linelength = endOfLine_itr - startOfLine_itr;
|
||||
linelength = endOfLine_itr - startOfLine_itr;
|
||||
|
||||
// Set line position to correct alignment.
|
||||
switch(_layout)
|
||||
{
|
||||
case LEFT_TO_RIGHT:
|
||||
{
|
||||
switch(_alignment)
|
||||
// Set line position to correct alignment.
|
||||
switch(_layout)
|
||||
{
|
||||
// nothing to be done for these
|
||||
//case LEFT_TOP:
|
||||
case LEFT_TO_RIGHT:
|
||||
{
|
||||
switch(_alignment)
|
||||
{
|
||||
// nothing to be done for these
|
||||
//case LEFT_TOP:
|
||||
//case LEFT_CENTER:
|
||||
//case LEFT_BOTTOM:
|
||||
//case LEFT_BASE_LINE:
|
||||
//case LEFT_BOTTOM_BASE_LINE:
|
||||
// break;
|
||||
case CENTER_TOP:
|
||||
//case LEFT_BASE_LINE:
|
||||
//case LEFT_BOTTOM_BASE_LINE:
|
||||
// break;
|
||||
case CENTER_TOP:
|
||||
case CENTER_CENTER:
|
||||
case CENTER_BOTTOM:
|
||||
case CENTER_BASE_LINE:
|
||||
case CENTER_BOTTOM_BASE_LINE:
|
||||
cursor.x() = (cursor.x() - endOfLine_coords.x()) * 0.5f;
|
||||
break;
|
||||
case CENTER_BASE_LINE:
|
||||
case CENTER_BOTTOM_BASE_LINE:
|
||||
cursor.x() = (cursor.x() - endOfLine_coords.x()) * 0.5f;
|
||||
break;
|
||||
case RIGHT_TOP:
|
||||
case RIGHT_CENTER:
|
||||
case RIGHT_BOTTOM:
|
||||
case RIGHT_BASE_LINE:
|
||||
case RIGHT_BOTTOM_BASE_LINE:
|
||||
cursor.x() = cursor.x() - endOfLine_coords.x();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
case RIGHT_CENTER:
|
||||
case RIGHT_BOTTOM:
|
||||
case RIGHT_BASE_LINE:
|
||||
case RIGHT_BOTTOM_BASE_LINE:
|
||||
cursor.x() = cursor.x() - endOfLine_coords.x();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RIGHT_TO_LEFT:
|
||||
{
|
||||
switch(_alignment)
|
||||
{
|
||||
case LEFT_TOP:
|
||||
}
|
||||
case RIGHT_TO_LEFT:
|
||||
{
|
||||
switch(_alignment)
|
||||
{
|
||||
case LEFT_TOP:
|
||||
case LEFT_CENTER:
|
||||
case LEFT_BOTTOM:
|
||||
case LEFT_BASE_LINE:
|
||||
case LEFT_BOTTOM_BASE_LINE:
|
||||
cursor.x() = 2*cursor.x() - endOfLine_coords.x();
|
||||
break;
|
||||
case CENTER_TOP:
|
||||
case LEFT_BASE_LINE:
|
||||
case LEFT_BOTTOM_BASE_LINE:
|
||||
cursor.x() = 2*cursor.x() - endOfLine_coords.x();
|
||||
break;
|
||||
case CENTER_TOP:
|
||||
case CENTER_CENTER:
|
||||
case CENTER_BOTTOM:
|
||||
case CENTER_BASE_LINE:
|
||||
case CENTER_BOTTOM_BASE_LINE:
|
||||
cursor.x() = cursor.x() + (cursor.x() - endOfLine_coords.x()) * 0.5f;
|
||||
break;
|
||||
// nothing to be done for these
|
||||
case CENTER_BASE_LINE:
|
||||
case CENTER_BOTTOM_BASE_LINE:
|
||||
cursor.x() = cursor.x() + (cursor.x() - endOfLine_coords.x()) * 0.5f;
|
||||
break;
|
||||
// nothing to be done for these
|
||||
//case RIGHT_TOP:
|
||||
//case RIGHT_CENTER:
|
||||
//case RIGHT_BOTTOM:
|
||||
//case RIGHT_BASE_LINE:
|
||||
//case RIGHT_BOTTOM_BASE_LINE:
|
||||
// break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//case RIGHT_CENTER:
|
||||
//case RIGHT_BOTTOM:
|
||||
//case RIGHT_BASE_LINE:
|
||||
//case RIGHT_BOTTOM_BASE_LINE:
|
||||
// break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VERTICAL:
|
||||
{
|
||||
switch(_alignment)
|
||||
{
|
||||
// TODO: current behaviour top baselines lined up in both cases - need to implement
|
||||
// top of characters aligment - Question is this neccesary?
|
||||
// ... otherwise, nothing to be done for these 6 cases
|
||||
//case LEFT_TOP:
|
||||
//case CENTER_TOP:
|
||||
}
|
||||
case VERTICAL:
|
||||
{
|
||||
switch(_alignment)
|
||||
{
|
||||
// TODO: current behaviour top baselines lined up in both cases - need to implement
|
||||
// top of characters aligment - Question is this neccesary?
|
||||
// ... otherwise, nothing to be done for these 6 cases
|
||||
//case LEFT_TOP:
|
||||
//case CENTER_TOP:
|
||||
//case RIGHT_TOP:
|
||||
// break;
|
||||
//case LEFT_BASE_LINE:
|
||||
//case CENTER_BASE_LINE:
|
||||
//case RIGHT_BASE_LINE:
|
||||
// break;
|
||||
// break;
|
||||
//case LEFT_BASE_LINE:
|
||||
//case CENTER_BASE_LINE:
|
||||
//case RIGHT_BASE_LINE:
|
||||
// break;
|
||||
case LEFT_CENTER:
|
||||
case CENTER_CENTER:
|
||||
case RIGHT_CENTER:
|
||||
cursor.y() = cursor.y() + (cursor.y() - endOfLine_coords.y()) * 0.5f;
|
||||
break;
|
||||
case LEFT_BOTTOM_BASE_LINE:
|
||||
case CENTER_BOTTOM_BASE_LINE:
|
||||
case RIGHT_BOTTOM_BASE_LINE:
|
||||
cursor.y() = cursor.y() - (linelength * _characterHeight);
|
||||
break;
|
||||
case RIGHT_CENTER:
|
||||
cursor.y() = cursor.y() + (cursor.y() - endOfLine_coords.y()) * 0.5f;
|
||||
break;
|
||||
case LEFT_BOTTOM_BASE_LINE:
|
||||
case CENTER_BOTTOM_BASE_LINE:
|
||||
case RIGHT_BOTTOM_BASE_LINE:
|
||||
cursor.y() = cursor.y() - (linelength * _characterHeight);
|
||||
break;
|
||||
case LEFT_BOTTOM:
|
||||
case CENTER_BOTTOM:
|
||||
case RIGHT_BOTTOM:
|
||||
cursor.y() = 2*cursor.y() - endOfLine_coords.y();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
case RIGHT_BOTTOM:
|
||||
cursor.y() = 2*cursor.y() - endOfLine_coords.y();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -652,7 +652,7 @@ void Text::computeGlyphRepresentation()
|
||||
startOfLine_coords.y() -= _characterHeight;
|
||||
cursor = startOfLine_coords;
|
||||
previous_charcode = 0;
|
||||
_lineCount++;
|
||||
_lineCount++;
|
||||
break;
|
||||
}
|
||||
case RIGHT_TO_LEFT:
|
||||
@@ -660,7 +660,7 @@ void Text::computeGlyphRepresentation()
|
||||
startOfLine_coords.y() -= _characterHeight;
|
||||
cursor = startOfLine_coords;
|
||||
previous_charcode = 0;
|
||||
_lineCount++;
|
||||
_lineCount++;
|
||||
break;
|
||||
}
|
||||
case VERTICAL:
|
||||
@@ -668,8 +668,8 @@ void Text::computeGlyphRepresentation()
|
||||
startOfLine_coords.x() += _characterHeight/_characterAspectRatio;
|
||||
cursor = startOfLine_coords;
|
||||
previous_charcode = 0;
|
||||
// because _lineCount is the max vertical no. of characters....
|
||||
_lineCount = (_lineCount >linelength)?_lineCount:linelength;
|
||||
// because _lineCount is the max vertical no. of characters....
|
||||
_lineCount = (_lineCount >linelength)?_lineCount:linelength;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -774,7 +774,7 @@ void CullVisitor::apply(Geode& node)
|
||||
}
|
||||
|
||||
if (bb.valid()) addDrawableAndDepth(drawable,&matrix,distance(bb.center(),matrix));
|
||||
else addDrawableAndDepth(drawable,&matrix,0.0f);
|
||||
else addDrawableAndDepth(drawable,&matrix,0.0f);
|
||||
|
||||
for(unsigned int i=0;i< numPopStateSetRequired; ++i)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( disable : 4786 )
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
using namespace osgUtil;
|
||||
|
||||
HalfWayMapGenerator::HalfWayMapGenerator(const osg::Vec3 &light_direction, int texture_size)
|
||||
: CubeMapGenerator(texture_size),
|
||||
ldir_(light_direction)
|
||||
: CubeMapGenerator(texture_size),
|
||||
ldir_(light_direction)
|
||||
{
|
||||
ldir_.normalize();
|
||||
ldir_.normalize();
|
||||
}
|
||||
|
||||
HalfWayMapGenerator::HalfWayMapGenerator(const HalfWayMapGenerator ©, const osg::CopyOp ©op)
|
||||
: CubeMapGenerator(copy, copyop),
|
||||
ldir_(copy.ldir_)
|
||||
: CubeMapGenerator(copy, copyop),
|
||||
ldir_(copy.ldir_)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -615,7 +615,7 @@ void IntersectVisitor::apply(Billboard& node)
|
||||
pushMatrix(*billboard_matrix);
|
||||
|
||||
intersect(*node.getDrawable(i));
|
||||
|
||||
|
||||
popMatrix();
|
||||
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ using namespace osgUtil;
|
||||
class RenderBinPrototypeList : public osg::Referenced, public std::map< std::string, osg::ref_ptr<RenderBin> >
|
||||
{
|
||||
public:
|
||||
RenderBinPrototypeList() {}
|
||||
~RenderBinPrototypeList() {}
|
||||
RenderBinPrototypeList() {}
|
||||
~RenderBinPrototypeList() {}
|
||||
};
|
||||
|
||||
// register a RenderStage prototype with the RenderBin prototype list.
|
||||
|
||||
@@ -1069,11 +1069,11 @@ struct CollectTriangleOperator
|
||||
|
||||
EdgeCollapse::~EdgeCollapse()
|
||||
{
|
||||
std::for_each(_edgeSet.begin(),_edgeSet.end(),dereference_clear());
|
||||
std::for_each(_edgeSet.begin(),_edgeSet.end(),dereference_clear());
|
||||
|
||||
std::for_each(_triangleSet.begin(),_triangleSet.end(),dereference_clear());
|
||||
std::for_each(_pointSet.begin(),_pointSet.end(),dereference_clear());
|
||||
std::for_each(_originalPointList.begin(),_originalPointList.end(),dereference_clear());
|
||||
std::for_each(_triangleSet.begin(),_triangleSet.end(),dereference_clear());
|
||||
std::for_each(_pointSet.begin(),_pointSet.end(),dereference_clear());
|
||||
std::for_each(_originalPointList.begin(),_originalPointList.end(),dereference_clear());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user