- bool ignore = false;
- SGAnimation * animation = 0;
- const char * type = node->getStringValue("type", "none");
- if (!strcmp("none", type)) {
- animation = new SGNullAnimation(node);
- } else if (!strcmp("range", type)) {
- animation = new SGRangeAnimation(prop_root, node);
- } else if (!strcmp("billboard", type)) {
- animation = new SGBillboardAnimation(node);
- } else if (!strcmp("select", type)) {
- animation = new SGSelectAnimation(prop_root, node);
- } else if (!strcmp("spin", type)) {
- animation = new SGSpinAnimation(prop_root, node, sim_time_sec );
- } else if (!strcmp("timed", type)) {
- animation = new SGTimedAnimation(node);
- } else if (!strcmp("rotate", type)) {
- animation = new SGRotateAnimation(prop_root, node);
- } else if (!strcmp("translate", type)) {
- animation = new SGTranslateAnimation(prop_root, node);
- } else if (!strcmp("scale", type)) {
- animation = new SGScaleAnimation(prop_root, node);
- } else if (!strcmp("texrotate", type)) {
- animation = new SGTexRotateAnimation(prop_root, node);
- } else if (!strcmp("textranslate", type)) {
- animation = new SGTexTranslateAnimation(prop_root, node);
- } else if (!strcmp("texmultiple", type)) {
- animation = new SGTexMultipleAnimation(prop_root, node);
- } else if (!strcmp("blend", type)) {
- animation = new SGBlendAnimation(prop_root, node);
- ignore = true;
- } else if (!strcmp("alpha-test", type)) {
- animation = new SGAlphaTestAnimation(node);
- } else if (!strcmp("material", type)) {
- animation = new SGMaterialAnimation(prop_root, node, texture_path);
- } else if (!strcmp("flash", type)) {
- animation = new SGFlashAnimation(node);
- } else if (!strcmp("dist-scale", type)) {
- animation = new SGDistScaleAnimation(node);
- } else if (!strcmp("noshadow", type)) {
- animation = new SGShadowAnimation(prop_root, node);
- } else if (!strcmp("shader", type)) {
- animation = new SGShaderAnimation(prop_root, node);
- } else {
- animation = new SGNullAnimation(node);
- SG_LOG(SG_INPUT, SG_WARN, "Unknown animation type " << type);
- }
-
- if (name != 0)
- animation->setName((char *)name);
-
- ssgEntity * object;
- if (name_nodes.size() > 0) {
- object = find_named_node(model, name_nodes[0]->getStringValue());
- if (object == 0) {
- SG_LOG(SG_INPUT, SG_ALERT, "Object " << name_nodes[0]->getStringValue()
- << " not found");
- delete animation;
- animation = 0;
+ osg::Image* image = osgDB::readImageFile(path);
+ osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
+ texture->setImage(image);
+ if (wrapu)
+ texture->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
+ else
+ texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP);
+ if (wrapv)
+ texture->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
+ else
+ texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP);
+
+ if (image) {
+ int s = image->s();
+ int t = image->t();
+
+ if (s <= t && 32 <= s) {
+ SGSceneFeatures::instance()->setTextureCompression(texture.get());
+ } else if (t < s && 32 <= t) {
+ SGSceneFeatures::instance()->setTextureCompression(texture.get());