List of all members.
Public Member Functions |
| PatchSet () |
| PatchSet (const osgEarth::Drivers::SeamlessOptions &options, PatchOptions *poptionsPrototype=0) |
| PatchSet (const PatchSet &rhs, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY) |
| META_Object (seamless, PatchSet) |
int | getResolution () const |
void | setPrecisionFactor (double factor) |
double | getPrecisionFactor () const |
double | calcPrecisionFactor (int pixelError, double horiz_fov_deg=60.0, int screenRes=1280, int dpi=90) |
void | setPrecisionFactor (int pixelError, double horiz_fov_deg=60.0, int screenRes=1280, int dpi=90) |
void | setPatchOptionsPrototype (PatchOptions *proto) |
PatchOptions * | getPatchOptionsPrototype () const |
void | setMaxLevel (int maxLevel) |
int | getMaxLevel () const |
void | setVerticalScale (float scale) |
float | getVerticalScale () const |
void | setMap (const osgEarth::Map *map) |
const osgEarth::Map * | getMap () const |
osgEarth::MapFrame & | getMapFrame () const |
virtual osg::Node * | createPatchGroup (const std::string &filename, PatchOptions *poptions) |
virtual osg::Transform * | createPatch (const std::string &filename, PatchOptions *poptions) |
virtual osg::Node * | createPatchSetGraph (const std::string &filename) |
virtual osg::Node * | createChild (const PatchOptions *parentOptions, int childNum) |
unsigned short | makeIndex (int x, int y) |
unsigned short | rotateIndex (unsigned short index) |
Protected Member Functions |
virtual | ~PatchSet () |
void | initPrimitiveSets () |
osg::ref_ptr
< osg::DrawElementsUShort > | makeBasicTrile (int delta) |
osg::ref_ptr
< osg::DrawElementsUShort > | makeSingleStrip (int delta) |
osg::ref_ptr
< osg::DrawElementsUShort > | makeDualStrip () |
Protected Attributes |
double | _precisionFactor |
int | _resolution |
int | _maxLevel |
float | _verticalScale |
osg::ref_ptr< PatchOptions > | _patchOptionsPrototype |
osg::ref_ptr
< osg::DrawElementsUShort > | trilePset [2][4] |
osg::ref_ptr
< osg::DrawElementsUShort > | stripPset [4][4] |
osg::ref_ptr< const osgEarth::Map > | _map |
osgEarth::MapFrame * | _mapf |
osgEarth::Drivers::SeamlessOptions | _options |
Friends |
class | Patch |
Detailed Description
Definition at line 38 of file PatchSet.
Constructor & Destructor Documentation
seamless::PatchSet::PatchSet |
( |
| ) |
|
seamless::PatchSet::PatchSet |
( |
const PatchSet & |
rhs, |
|
|
const osg::CopyOp & |
copyop = osg::CopyOp::SHALLOW_COPY |
|
) |
| |
seamless::PatchSet::~PatchSet |
( |
| ) |
[protected, virtual] |
Member Function Documentation
double seamless::PatchSet::calcPrecisionFactor |
( |
int |
pixelError, |
|
|
double |
horiz_fov_deg = 60.0 , |
|
|
int |
screenRes = 1280 , |
|
|
int |
dpi = 90 |
|
) |
| |
Definition at line 155 of file PatchSet.cpp.
{
const double pixelsPerMeter = dpi / .0254;
const double halfScreen = .5 * screenRes / pixelsPerMeter;
const double dNear = halfScreen / tan(DegreesToRadians(horiz_fov_deg / 2));
return dNear * pixelsPerMeter / (pixelError * _resolution);
}
osg::Node * seamless::PatchSet::createChild |
( |
const PatchOptions * |
parentOptions, |
|
|
int |
childNum |
|
) |
| [virtual] |
Reimplemented in seamless::Geographic.
Definition at line 328 of file PatchSet.cpp.
{
Vec2d lowerLeft(0.0, 1.0);
Vec2d upperRight(1.0, 1.0);
parentOptions->getPatchExtents(lowerLeft, upperRight);
Vec2d range = upperRight - lowerLeft;
Vec2d newRange = range * .5;
double x = (childNum % 2) * .5;
double y = (childNum / 2) * .5;
PatchOptions* pgroupOptions = osg::clone(parentOptions);
Vec2d ll = lowerLeft + componentMultiply(Vec2d(x, y), range);
pgroupOptions->setPatchExtents(ll, ll + newRange);
pgroupOptions->setPatchLevel(parentOptions->getPatchLevel() + 1);
Node* pgroup = createPatchGroup("foobies.osgearth_engine_seamless_patch",
pgroupOptions);
return pgroup;
}
Transform * seamless::PatchSet::createPatch |
( |
const std::string & |
filename, |
|
|
PatchOptions * |
poptions |
|
) |
| [virtual] |
Reimplemented in seamless::Geographic, and seamless::Projected.
Definition at line 114 of file PatchSet.cpp.
{
Patch* patch = new Patch;
patch->setPatchSet(this);
Vec2d ll, ur;
poptions->getPatchExtents(ll, ur);
Vec2d range = (ur - ll);
ref_ptr<Patch::Data> data = new Patch::Data;
int patchDim = _resolution + 1;
Vec3Array* verts = new Vec3Array(patchDim * patchDim);
for (int j = 0; j < patchDim; ++j)
for (int i = 0; i < patchDim; ++i)
(*verts)[patchDim * j + i]
= Vec3((ll.x() + i * range.x()
/ static_cast<float>(_resolution)) * 81920.0,
(ll.y() + j * range.y()
/ static_cast<float>(_resolution)) * 81920.0,
0.0);
data->vertexData.array = verts;
data->vertexData.binding = Geometry::BIND_PER_VERTEX;
Vec3Array* norms = new Vec3Array(1);
(*norms)[0] = Vec3d(0.0, 0.0, 1.0);
data->normalData.array = norms;
data->normalData.binding = Geometry::BIND_OVERALL;
Vec4Array* colors = new Vec4Array(1);
(*colors)[0] = Vec4(1.0, 1.0, 1.0, 1.0);
data->colorData.array = colors;
data->colorData.binding = Geometry::BIND_OVERALL;
patch->setData(data);
MatrixTransform* transform = new MatrixTransform;
transform->addChild(patch);
return transform;
}
Node * seamless::PatchSet::createPatchGroup |
( |
const std::string & |
filename, |
|
|
PatchOptions * |
poptions |
|
) |
| [virtual] |
Node * seamless::PatchSet::createPatchSetGraph |
( |
const std::string & |
filename | ) |
[virtual] |
const osgEarth::Map* seamless::PatchSet::getMap |
( |
| ) |
const [inline] |
int seamless::PatchSet::getMaxLevel |
( |
| ) |
const [inline] |
PatchOptions* seamless::PatchSet::getPatchOptionsPrototype |
( |
| ) |
const [inline] |
double seamless::PatchSet::getPrecisionFactor |
( |
| ) |
const [inline] |
int seamless::PatchSet::getResolution |
( |
| ) |
const [inline] |
float seamless::PatchSet::getVerticalScale |
( |
| ) |
const [inline] |
void seamless::PatchSet::initPrimitiveSets |
( |
| ) |
[protected] |
ref_ptr< DrawElementsUShort > seamless::PatchSet::makeBasicTrile |
( |
int |
delta | ) |
[protected] |
Definition at line 174 of file PatchSet.cpp.
{
ref_ptr<DrawElementsUShort> pset = new DrawElementsUShort(GL_TRIANGLES);
int xBegin = delta;
int xEnd = _resolution - delta;
for (int j = 0; j < _resolution / 2 - delta; j += delta)
{
for (int i = xBegin; i < xEnd; i += 2 * delta)
{
pset->push_back(makeIndex(i, j));
pset->push_back(makeIndex(i + delta, j));
pset->push_back(makeIndex(i + delta, j + delta));
pset->push_back(makeIndex(i + delta, j + delta));
pset->push_back(makeIndex(i + delta, j));
pset->push_back(makeIndex(i + 2 * delta, j));
if (i + 2 * delta == xEnd)
break;
pset->push_back(makeIndex(i + delta, j + delta));
pset->push_back(makeIndex(i + 2 * delta, j));
pset->push_back(makeIndex(i + 2 * delta, j + delta));
pset->push_back(makeIndex(i + 2 * delta, j + delta));
pset->push_back(makeIndex(i + 2 * delta, j));
pset->push_back(makeIndex(i + 3 * delta, j + delta));
}
xBegin += delta;
xEnd -= delta;
}
return pset;
}
ref_ptr< DrawElementsUShort > seamless::PatchSet::makeDualStrip |
( |
| ) |
[protected] |
Definition at line 251 of file PatchSet.cpp.
{
ref_ptr<DrawElementsUShort> pset = new DrawElementsUShort(GL_TRIANGLES);
for (int i = 0, j = 2; j <= _resolution / 2; i += 2, j += 2)
{
pset->push_back(makeIndex(i, j));
if (i == 0)
pset->push_back(makeIndex(0, 0));
else
pset->push_back(makeIndex(i - 2, j -2));
pset->push_back(makeIndex(i + 1, j - 2));
pset->push_back(makeIndex(i, j));
pset->push_back(makeIndex(i + 1, j - 2));
pset->push_back(makeIndex(i + 2, j - 1));
pset->push_back(makeIndex(i, j));
pset->push_back(makeIndex(i + 2, j - 1));
pset->push_back(makeIndex(i + 3, j));
}
return pset;
}
unsigned short seamless::PatchSet::makeIndex |
( |
int |
x, |
|
|
int |
y |
|
) |
| [inline] |
Get the index (into attribute array) for vertex.
- Parameters:
-
x | x grid coordinate |
y | y grid coordinate |
Definition at line 84 of file PatchSet.
{
return static_cast<unsigned short>(y * (_resolution + 1) + x);
}
ref_ptr< DrawElementsUShort > seamless::PatchSet::makeSingleStrip |
( |
int |
delta | ) |
[protected] |
Definition at line 222 of file PatchSet.cpp.
{
ref_ptr<DrawElementsUShort> pset = new DrawElementsUShort(GL_TRIANGLES);
for (int i = 0; i < _resolution / 2; i += delta)
{
if (i > 0)
{
pset->push_back(makeIndex(i - delta, i));
pset->push_back(makeIndex(i, i));
pset->push_back(makeIndex(i, i + delta));
}
pset->push_back(makeIndex(i, i));
pset->push_back(makeIndex(i + delta, i + delta));
pset->push_back(makeIndex(i, i + delta));
pset->push_back(makeIndex(i, i));
pset->push_back(makeIndex(i + delta, i));
pset->push_back(makeIndex(i + delta, i + delta));
if (i < _resolution / 2 - delta)
{
pset->push_back(makeIndex(i + delta, i + delta));
pset->push_back(makeIndex(i + delta, i));
pset->push_back(makeIndex(i + 2 * delta, i + delta));
}
}
return pset;
}
seamless::PatchSet::META_Object |
( |
seamless |
, |
|
|
PatchSet |
|
|
) |
| |
unsigned short seamless::PatchSet::rotateIndex |
( |
unsigned short |
index | ) |
|
Rotate grid indices 90 deg counter-clockwise.
Definition at line 206 of file PatchSet.cpp.
{
int x, y;
int psRes = _resolution;
getGridCoords(psRes, index, x, y);
x -= psRes / 2;
y -= psRes / 2;
int newx = -y;
int newy = x;
newx += psRes / 2;
newy += psRes / 2;
return makeIndex(newx, newy);
}
void seamless::PatchSet::setMaxLevel |
( |
int |
maxLevel | ) |
[inline] |
void seamless::PatchSet::setPatchOptionsPrototype |
( |
PatchOptions * |
proto | ) |
[inline] |
void seamless::PatchSet::setPrecisionFactor |
( |
int |
pixelError, |
|
|
double |
horiz_fov_deg = 60.0 , |
|
|
int |
screenRes = 1280 , |
|
|
int |
dpi = 90 |
|
) |
| [inline] |
void seamless::PatchSet::setPrecisionFactor |
( |
double |
factor | ) |
[inline] |
void seamless::PatchSet::setVerticalScale |
( |
float |
scale | ) |
[inline] |
Friends And Related Function Documentation
friend class Patch [friend] |
Member Data Documentation
The documentation for this class was generated from the following files:
- /home/cube/sources/osgearth/src/osgEarthDrivers/engine_seamless/PatchSet
- /home/cube/sources/osgearth/src/osgEarthDrivers/engine_seamless/Geographic.cpp
- /home/cube/sources/osgearth/src/osgEarthDrivers/engine_seamless/PatchSet.cpp