#include <math.h>
+#include <simgear/structure/OSGVersion.hxx>
#include <osg/AlphaFunc>
#include <osg/BlendFunc>
#include <osg/CullFace>
#include <osg/TextureCubeMap>
#include <osg/TexMat>
#include <osg/Fog>
+#if SG_OSG_MIN_VERSION_REQUIRED(2,9,5)
+#include <osgDB/Options>
+#endif
#include <simgear/math/sg_random.h>
#include <simgear/misc/PathOptions.hxx>
layer_states[SG_CLOUD_CLEAR] = 0;
layer_states2[SG_CLOUD_CLEAR] = 0;
+#if 1
+ // experimental optimization that may not make any difference
+ // at all :/
osg::CopyOp copyOp;
for (int i = 0; i < SG_MAX_CLOUD_COVERAGES; ++i) {
StateAttributeFactory *saf = StateAttributeFactory::instance();
layer_states2[i]->setAttribute(saf ->getCullFaceBack());
}
}
- // OSGFIXME
-// SGNewCloud::loadTextures(texture_path.str());
-// layer3D->buildTestLayer();
+#endif
}
scale = 4000.0;
// repaint the cloud layer colors
bool SGCloudLayer::repaint( const SGVec3f& fog_color ) {
- osg::Vec4f combineColor(fog_color.osg(), cloud_alpha);
+ osg::Vec4f combineColor(toOsg(fog_color), cloud_alpha);
osg::TexEnvCombine* combiner
= dynamic_cast<osg::TexEnvCombine*>(layer_root->getStateSet()
->getTextureAttribute(1, osg::StateAttribute::TEXENV));
double alt, double dt )
{
// combine p and asl (meters) to get translation offset
- osg::Vec3 asl_offset(up.osg());
+ osg::Vec3 asl_offset(toOsg(up));
asl_offset.normalize();
if ( alt <= layer_asl ) {
asl_offset *= layer_asl;
// cout << "asl_offset = " << asl_offset[0] << "," << asl_offset[1]
// << "," << asl_offset[2] << endl;
- asl_offset += p.osg();
+ asl_offset += toOsg(p);
// cout << " asl_offset = " << asl_offset[0] << "," << asl_offset[1]
// << "," << asl_offset[2] << endl;
double xoff = (ax + bx) / (2 * scale);
double yoff = (ay + by) / (2 * scale);
- const float layer_scale = layer_span / scale;
+// const float layer_scale = layer_span / scale;
// cout << "xoff = " << xoff << ", yoff = " << yoff << endl;
base[0] += xoff;