MCPcopy Create free account
hub / github.com/OpenMW/openmw / Object

Method Object

apps/opencs/view/render/object.cpp:183–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183CSVRender::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
231CSVRender::Object::~Object()
232{

Callers

nothing calls this directly

Calls 10

Vec4fClass · 0.85
setNodeMaskMethod · 0.80
addUniformMethod · 0.80
setAttributeAndModesMethod · 0.80
getStateSetMethod · 0.80
getSceneManagerMethod · 0.80
getMethod · 0.45
getResourceSystemMethod · 0.45
getProgramMethod · 0.45
addChildMethod · 0.45

Tested by

no test coverage detected