| 41 | | #if 0 |
| 42 | | osg::Node* createModel(osg::Node* loadedModel, osgParticle::PrecipitationParameters& parameters) |
| 43 | | { |
| 44 | | osg::Group* group = new osg::Group; |
| 45 | | |
| 46 | | osg::BoundingBox bb(0.0, 0.0, 0.0, 100.0, 100.0, 100.0); |
| 47 | | |
| 48 | | if (loadedModel) |
| 49 | | { |
| 50 | | group->addChild(loadedModel); |
| 51 | | |
| 52 | | osg::BoundingSphere bs = loadedModel->getBound(); |
| 53 | | |
| 54 | | bb.set( -500, -500, 0, +500, +500, 10); |
| 55 | | |
| 56 | | parameters.boundingBox = bb; |
| 57 | | |
| 58 | | osg::StateSet* stateset = loadedModel->getOrCreateStateSet(); |
| 59 | | |
| 60 | | osg::Fog* fog = new osg::Fog; |
| 61 | | |
| 62 | | if (parameters.fogExponent<1.0) |
| 63 | | { |
| 64 | | fog->setMode(osg::Fog::LINEAR); |
| 65 | | } |
| 66 | | else if (parameters.fogExponent<2.0) |
| 67 | | { |
| 68 | | fog->setMode(osg::Fog::EXP); |
| 69 | | } |
| 70 | | else |
| 71 | | { |
| 72 | | fog->setMode(osg::Fog::EXP2); |
| 73 | | } |
| 74 | | |
| 75 | | fog->setDensity(parameters.fogDensity); |
| 76 | | fog->setStart(0.0f); |
| 77 | | fog->setEnd(parameters.fogEnd); |
| 78 | | fog->setColor(parameters.fogColour); |
| 79 | | stateset->setAttributeAndModes(fog, osg::StateAttribute::ON); |
| 80 | | |
| 81 | | osg::LightSource* lightSource = new osg::LightSource; |
| 82 | | group->addChild(lightSource); |
| 83 | | |
| 84 | | osg::Light* light = lightSource->getLight(); |
| 85 | | light->setLightNum(0); |
| 86 | | light->setPosition(osg::Vec4(0.0f,0.0f,1.0f,0.0f)); // directional light from above |
| 87 | | light->setAmbient(osg::Vec4(0.8f,0.8f,0.8f,1.0f)); |
| 88 | | light->setDiffuse(osg::Vec4(0.2f,0.2f,0.2f,1.0f)); |
| 89 | | light->setSpecular(osg::Vec4(0.2f,0.2f,0.2f,1.0f)); |
| 90 | | |
| 91 | | |
| 92 | | } |
| 93 | | |
| 94 | | group->addChild(createCellRainEffect(parameters)); |
| 95 | | |
| 96 | | return group; |
| 97 | | } |
| 98 | | #endif |