mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-01 03:21:41 +00:00
Add configurable color and offset
This commit is contained in:
parent
080c909c28
commit
d7352ded36
@ -22,11 +22,11 @@ CellBorder::CellBorder(Terrain::World *world, osg::Group *root, int borderMask,
|
||||
{
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Geode> CellBorder::createBorderGeometry(float x, float y, float size, Terrain::Storage* terrain, Resource::SceneManager* sceneManager, int mask)
|
||||
osg::ref_ptr<osg::Geode> CellBorder::createBorderGeometry(float x, float y, float size, Terrain::Storage* terrain, Resource::SceneManager* sceneManager, int mask,
|
||||
float offset, osg::Vec4f color)
|
||||
{
|
||||
const int cellSize = ESM::Land::REAL_SIZE;
|
||||
const int borderSegments = 40;
|
||||
const float offset = 10.0;
|
||||
|
||||
osg::Vec3 cellCorner = osg::Vec3(x * cellSize,y * cellSize,0);
|
||||
size *= cellSize;
|
||||
@ -52,7 +52,7 @@ osg::ref_ptr<osg::Geode> CellBorder::createBorderGeometry(float x, float y, floa
|
||||
|
||||
osg::Vec4f col = i % 2 == 0 ?
|
||||
osg::Vec4f(0,0,0,1) :
|
||||
osg::Vec4f(1,1,0,1);
|
||||
color;
|
||||
|
||||
colors->push_back(col);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace Terrain
|
||||
*/
|
||||
void destroyCellBorderGeometry();
|
||||
|
||||
static osg::ref_ptr<osg::Geode> createBorderGeometry(float x, float y, float size, Storage* terrain, Resource::SceneManager* sceneManager, int mask);
|
||||
static osg::ref_ptr<osg::Geode> createBorderGeometry(float x, float y, float size, Storage* terrain, Resource::SceneManager* sceneManager, int mask, float offset = 10.0, osg::Vec4f color = { 1,1,0,0 });
|
||||
|
||||
protected:
|
||||
Terrain::World *mWorld;
|
||||
|
@ -242,7 +242,7 @@ osg::ref_ptr<osg::Node> ChunkManager::createChunk(float chunkSize, const osg::Ve
|
||||
{
|
||||
osg::ref_ptr<osg::Group> result(new osg::Group);
|
||||
result->addChild(geometry);
|
||||
auto chunkBorder = CellBorder::createBorderGeometry(chunkCenter.x() - chunkSize / 2.f, chunkCenter.y() - chunkSize / 2.f, chunkSize, mStorage, mSceneManager, getNodeMask());
|
||||
auto chunkBorder = CellBorder::createBorderGeometry(chunkCenter.x() - chunkSize / 2.f, chunkCenter.y() - chunkSize / 2.f, chunkSize, mStorage, mSceneManager, getNodeMask(), 5.f, { 1, 0, 0, 0 });
|
||||
osg::Vec3f center = { chunkCenter.x(), chunkCenter.y(), 0 };
|
||||
osg::ref_ptr<osg::MatrixTransform> trans = new osg::MatrixTransform(osg::Matrixf::translate(-center*Constants::CellSizeInUnits));
|
||||
trans->setDataVariance(osg::Object::STATIC);
|
||||
|
Loading…
Reference in New Issue
Block a user