| 181 | } |
| 182 | |
| 183 | CSVRender::Object::Object( |
| 184 | CSMWorld::Data& data, osg::Group* parentNode, const std::string& id, bool referenceable, bool forceBaseToZero) |
| 185 | : mData(data) |
| 186 | , mParentNode(parentNode) |
| 187 | , mResourceSystem(data.getResourceSystem().get()) |
| 188 | , mForceBaseToZero(forceBaseToZero) |
| 189 | { |
| 190 | mRootNode = new osg::PositionAttitudeTransform; |
| 191 | |
| 192 | mBaseNode = new osg::PositionAttitudeTransform; |
| 193 | mBaseNode->addCullCallback(new SceneUtil::LightListCallback); |
| 194 | |
| 195 | mOutline = new osg::Group; |
| 196 | mOutline->setNodeMask(0); |
| 197 | osg::ref_ptr<osg::PolygonOffset> offset = new osg::PolygonOffset(1, 1); |
| 198 | osg::ref_ptr<osg::PolygonMode> mode |
| 199 | = new osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE); |
| 200 | mOutline->getOrCreateStateSet()->addUniform(new osg::Uniform("color", osg::Vec4f(1, 1, 1, 1))); |
| 201 | mOutline->getStateSet()->setAttributeAndModes(mode); |
| 202 | mOutline->getStateSet()->setAttributeAndModes(offset); |
| 203 | mOutline->getStateSet()->setAttributeAndModes( |
| 204 | mResourceSystem->getSceneManager()->getShaderManager().getProgram("outline"), |
| 205 | osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE | osg::StateAttribute::PROTECTED); |
| 206 | mOutline->addChild(mBaseNode); |
| 207 | |
| 208 | mBaseNode->setUserData(new ObjectTag(this)); |
| 209 | |
| 210 | mRootNode->addChild(mBaseNode); |
| 211 | mRootNode->addChild(mOutline); |
| 212 | |
| 213 | parentNode->addChild(mRootNode); |
| 214 | |
| 215 | mRootNode->setNodeMask(Mask_Reference); |
| 216 | ESM::RefId refId = ESM::RefId::stringRefId(id); |
| 217 | if (referenceable) |
| 218 | { |
| 219 | mReferenceableId = refId; |
| 220 | } |
| 221 | else |
| 222 | { |
| 223 | mReferenceId = refId; |
| 224 | mReferenceableId = getReference().mRefID; |
| 225 | } |
| 226 | |
| 227 | adjustTransform(); |
| 228 | update(); |
| 229 | } |
| 230 | |
| 231 | CSVRender::Object::~Object() |
| 232 | { |
nothing calls this directly
no test coverage detected