Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pathgrid rendering v2 #933

Merged
merged 13 commits into from
May 8, 2016
Prev Previous commit
Remove now unnecessary factory class.
It was originally used for storing normals, but that functionality
was removed.
  • Loading branch information
Aesylwinn committed May 3, 2016
commit 14ae232938fd18d41e5773bf1d26fc774c555499
3 changes: 1 addition & 2 deletions apps/opencs/view/render/cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ void CSVRender::Cell::recreatePathgrid()
if (pathgridIndex != -1)
{
mPathgridGeode->removeDrawable(mPathgridGeometry);
mPathgridGeometry = SceneUtil::PathgridGeometryFactory::get().create(
pathgrids.getRecord(pathgridIndex).get());
mPathgridGeometry = SceneUtil::createPathgridGeometry(pathgrids.getRecord(pathgridIndex).get());
mPathgridGeode->addDrawable(mPathgridGeometry);
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/openmw/mwrender/pathgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void Pathgrid::enableCellPathgrid(const MWWorld::CellStore *store)
osg::ref_ptr<osg::PositionAttitudeTransform> cellPathGrid = new osg::PositionAttitudeTransform;
cellPathGrid->setPosition(cellPathGridPos);

osg::ref_ptr<osg::Geometry> geometry = SceneUtil::PathgridGeometryFactory::get().create(*pathgrid);
osg::ref_ptr<osg::Geometry> geometry = SceneUtil::createPathgridGeometry(*pathgrid);

cellPathGrid->addChild(geometry);

Expand Down
12 changes: 1 addition & 11 deletions components/sceneutil/pathgridutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace SceneUtil

const osg::Vec4f DiamondEdgeColor = osg::Vec4f(0.5f, 1.f, 1.f, 1.f);

osg::ref_ptr<osg::Geometry> PathgridGeometryFactory::create(const ESM::Pathgrid& pathgrid)
osg::ref_ptr<osg::Geometry> createPathgridGeometry(const ESM::Pathgrid& pathgrid)
{
const unsigned short PointCount = static_cast<unsigned short>(pathgrid.mPoints.size());
const size_t EdgeCount = pathgrid.mEdges.size();
Expand Down Expand Up @@ -155,14 +155,4 @@ namespace SceneUtil

return gridGeometry;
}

PathgridGeometryFactory& PathgridGeometryFactory::get()
{
static PathgridGeometryFactory instance;
return instance;
}

PathgridGeometryFactory::PathgridGeometryFactory()
{
}
}
17 changes: 1 addition & 16 deletions components/sceneutil/pathgridutil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,7 @@ namespace ESM

namespace SceneUtil
{

class PathgridGeometryFactory
{
public:

osg::ref_ptr<osg::Geometry> create(const ESM::Pathgrid& pathgrid);
static PathgridGeometryFactory& get();

private:

PathgridGeometryFactory();

// Not implemented
PathgridGeometryFactory(const PathgridGeometryFactory&);
PathgridGeometryFactory& operator=(const PathgridGeometryFactory&);
};
osg::ref_ptr<osg::Geometry> createPathgridGeometry(const ESM::Pathgrid& pathgrid);
}

#endif