osgEarth 2.1.1
|
Namespaces | |
namespace | anonymous_namespace{Euler.cpp} |
namespace | anonymous_namespace{Geographic.cpp} |
namespace | anonymous_namespace{Patch.cpp} |
namespace | anonymous_namespace{PatchSet.cpp} |
namespace | anonymous_namespace{Projected.cpp} |
namespace | anonymous_namespace{QSC.cpp} |
namespace | euler |
namespace | qsc |
Classes | |
class | AutoBuffer |
class | EulerFaceLocator |
class | EulerSpatialReference |
class | EulerProfile |
class | CacheInitializer |
class | Geographic |
struct | GridEdge |
struct | KeyIndex |
struct | ShareResult |
class | TileUpdater |
class | GeoPatch |
class | SubArraySimple |
class | SubArray |
class | Reference |
class | Reference< ElementType, Store, 1 > |
class | multi_array_ref |
class | vector_ref |
class | Patch |
class | MyNodeAcceptOp |
class | PatchGroup |
class | PatchOptions |
struct | NodePathProxy |
class | PatchInfo |
class | PatchSet |
class | Projected |
class | ProjectedOptions |
class | QscFaceLocator |
class | QscSpatialReference |
class | QscProfile |
class | SeamlessEngineNode |
struct | SeamlessMapProxy |
class | SeamlessPlugin |
Typedefs | |
typedef multi_array_ref< Vec3f, Vec3Array, 2 > | PatchArray |
typedef vector_ref< Vec3f, Vec3Array > | EdgeRef |
Functions | |
void | expandHeights (Geographic *gpatchset, const TileKey &key, const GeoHeightField &hf, Vec3Array *verts, Vec3Array *normals) |
void | installHeightField (GeoPatch *patch, const TileKey &key, const GeoHeightField &hf) |
MatrixTransform * | createPatchAux (Geographic *gpatchset, const TileKey &key, const GeoHeightField &hf) |
bool | containsTile (const KeyIndex &parent, const KeyIndex &child) |
bool | isNeighborTile (const KeyIndex &tile, const KeyIndex &neighbor) |
bool | adjoinsTile (const KeyIndex &tile, const KeyIndex &neighbor) |
PatchGroup * | findFaceRoot (GeoPatch *patch, NodePath &pathList) |
EdgeRef | makeEdgeRef (GeoPatch *gpatch, int edgeno, int mult) |
ShareResult | tilesShareEdges (const KeyIndex &tile1, const KeyIndex &tile2) |
void | transferEdges (GeoPatch *toPatch, const Matrixd &toMat, const KeyIndex &toIdx, GeoPatch *fromPatch, const Matrixd &fromMat, const KeyIndex &fromIdx, const ShareResult &shared) |
void | safeCopy (Vec3f &dest, const Vec3f &src, const Matrixd &mat) |
osg::Vec3 | closestPointOnSegment (const osg::Vec3 &p1, const osg::Vec3 &p2, const osg::Vec3 &p3) |
float | distanceToSegment (const osg::Vec3 &p1, const osg::Vec3 &p2, const osg::Vec3 &p3) |
Vec3 | closestPointOnSegment (const Vec3 &p1, const Vec3 &p2, const Vec3 &p3) |
float | distanceToSegment (const Vec3 &p1, const Vec3 &p2, const Vec3 &p3) |
Variables | |
const double | PiOver12 = PI / 12.0 |
const double | PiOver12Inv = 12.0 / PI |
const double | sqrt2 = 1.41421356237309504880 |
const double | sqrt33 = .5773502691896258 |
typedef vector_ref<Vec3f, Vec3Array> seamless::EdgeRef |
Definition at line 677 of file Geographic.cpp.
typedef multi_array_ref<Vec3f, Vec3Array, 2> seamless::PatchArray |
Definition at line 32 of file Geographic.cpp.
bool seamless::adjoinsTile | ( | const KeyIndex & | tile, |
const KeyIndex & | neighbor | ||
) |
Definition at line 633 of file Geographic.cpp.
{
osg::Vec3 seamless::closestPointOnSegment | ( | const osg::Vec3 & | p1, |
const osg::Vec3 & | p2, | ||
const osg::Vec3 & | p3 | ||
) |
Vec3 seamless::closestPointOnSegment | ( | const Vec3 & | p1, |
const Vec3 & | p2, | ||
const Vec3 & | p3 | ||
) |
bool seamless::containsTile | ( | const KeyIndex & | parent, |
const KeyIndex & | child | ||
) |
Definition at line 604 of file Geographic.cpp.
{
MatrixTransform* seamless::createPatchAux | ( | Geographic * | gpatchset, |
const TileKey & | key, | ||
const GeoHeightField & | hf | ||
) |
Definition at line 292 of file Geographic.cpp.
{ GeoPatch* patch = new GeoPatch(key); patch->setGeographic(gpatchset); const GeoExtent& patchExtent = key.getExtent(); double centx, centy; patchExtent.getCentroid(centx, centy); Vec3d patchCenter = gpatchset->toModel(centx, centy, 0); Matrixd patchMat = Matrixd::translate(patchCenter); installHeightField(patch, key, hf); MatrixTransform* result = new MatrixTransform; result->addChild(patch); result->setMatrix(patchMat); return result; } namespace
float seamless::distanceToSegment | ( | const osg::Vec3 & | p1, |
const osg::Vec3 & | p2, | ||
const osg::Vec3 & | p3 | ||
) |
float seamless::distanceToSegment | ( | const Vec3 & | p1, |
const Vec3 & | p2, | ||
const Vec3 & | p3 | ||
) |
Definition at line 177 of file Patch.cpp.
{ Vec3 pt = closestPointOnSegment(p1, p2, p3); return (p3 - pt).length(); }
void seamless::expandHeights | ( | Geographic * | gpatchset, |
const TileKey & | key, | ||
const GeoHeightField & | hf, | ||
Vec3Array * | verts, | ||
Vec3Array * | normals | ||
) |
Definition at line 170 of file Geographic.cpp.
{ int resolution = gpatchset->getResolution(); const GeoExtent& patchExtent = key.getExtent(); double centx, centy; patchExtent.getCentroid(centx, centy); Vec3d patchCenter = gpatchset->toModel(centx, centy, 0); const SpatialReference* srs = key.getProfile()->getSRS(); const SpatialReference* geoSrs = srs->getGeographicSRS(); // Populate cell ref_ptr<Patch::Data> data = new Patch::Data; int patchDim = resolution + 1; double xInc = (patchExtent.xMax() - patchExtent.xMin()) / resolution; double yInc = (patchExtent.yMax() - patchExtent.yMin()) / resolution; const EllipsoidModel* eModel = gpatchset->getEllipsoidModel(); const float verticalScale = gpatchset->getVerticalScale(); PatchArray mverts(*verts, patchDim); for (int j = 0; j < patchDim; ++j) { for (int i = 0; i < patchDim; i++) { Vec2d cubeCoord(patchExtent.xMin() + i * xInc, patchExtent.yMin() + j * yInc); double lon, lat; srs->transform(cubeCoord.x(), cubeCoord.y(), geoSrs, lon, lat); float elevation; bool found = hf.getElevation(srs, cubeCoord.x(), cubeCoord.y(), INTERP_BILINEAR, 0, elevation); // Into ec coordinates if (!found) { OE_WARN << "Couldn't find height sample for cube coordinates " << cubeCoord.x() << ", " << cubeCoord.y() << " (lon lat " << lon << ", " << lat << ")\n"; continue; } elevation *= verticalScale; Vec3d coord; eModel->convertLatLongHeightToXYZ( DegreesToRadians(lat), DegreesToRadians(lon), elevation, coord.x(), coord.y(), coord.z()); mverts[j][i] = coord - patchCenter; if (fabs(mverts[j][i].z()) > 6000000) OE_WARN << "found huge coordinate.\n"; } } // Normals. Average the normals of the triangles around the sample // point. We're not following the actual tessallation of the grid. for (int j = 0; j < patchDim; ++j) { for (int i = 0; i < patchDim; i++) { const Vec3& pt = (*verts)[j * patchDim + i]; // A cross of points. Vec3 delta[4]; // Initialized to zero vectors for (int k = 0; k < 2; ++k) { int gridx = i + 2 * k - 1; if (gridx < patchDim && gridx >= 0) delta[2 * k] = (*verts)[j * patchDim + gridx] - pt; } for (int k = 0; k < 2; ++k) { int gridy = j + 2 * k - 1; if (gridy < patchDim && gridy >= 0) delta[2 * k + 1] = (*verts)[gridy * patchDim + i] - pt; } Vec3 normal; for (int k = 1; k <= 4; ++k) { int v1 = k - 1, v2 = k % 4; // If One or both of the deltas are 0, then the cross // product is 0 and won't contribute to the average. normal += delta[v1] ^ delta[v2]; } normal.normalize(); (*normals)[j * patchDim + i] = normal; } } } void installHeightField(GeoPatch* patch, const TileKey& key, const GeoHeightField& hf)
PatchGroup* seamless::findFaceRoot | ( | GeoPatch * | patch, |
NodePath & | pathList | ||
) |
Definition at line 645 of file Geographic.cpp.
{ PatchGroup* pg = dynamic_cast<PatchGroup*>(*itr); if (pg) { PatchOptions* poptions = pg->getOptions(); if (poptions) { TileKey key = poptions->getTileKey(); if (key.getLevelOfDetail() == 2 && x == key.getTileX() && y == key.getTileY()) return pg; } } } return 0; } typedef vector_ref<Vec3f, Vec3Array> EdgeRef;
void seamless::installHeightField | ( | GeoPatch * | patch, |
const TileKey & | key, | ||
const GeoHeightField & | hf | ||
) |
Definition at line 254 of file Geographic.cpp.
{ for (int i = 0; i < patchDim; i++) { (*texCoords)[j * patchDim +i] = Vec2(i * resinv, j * resinv); } } // Construct the patch and its transform. ref_ptr<Patch::Data> data = new Patch::Data; data->vertexData.array = verts; data->vertexData.binding = Geometry::BIND_PER_VERTEX; data->normalData.array = normals; data->normalData.binding = Geometry::BIND_PER_VERTEX; 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; data->texCoordList .push_back(Geometry::ArrayData(texCoords, Geometry::BIND_PER_VERTEX)); patch->setData(data); } // Create a patch and the transform that places it in the // world. Install a height field if one is given.
bool seamless::isNeighborTile | ( | const KeyIndex & | tile, |
const KeyIndex & | neighbor | ||
) |
Definition at line 618 of file Geographic.cpp.
{
EdgeRef seamless::makeEdgeRef | ( | GeoPatch * | gpatch, |
int | edgeno, | ||
int | mult | ||
) |
Definition at line 679 of file Geographic.cpp.
{ case 0: return EdgeRef(*verts, mult, shape, 0); case 1: return EdgeRef(*verts, patchDim * mult, shape, patchDim - 1); case 2: return EdgeRef(*verts, mult, shape, (patchDim - 1) * patchDim); case 3: return EdgeRef(*verts, patchDim * mult, shape, 0); default: return EdgeRef(*verts, 0, 0, 0); // shouldn't happen } } struct ShareResult {
void seamless::safeCopy | ( | Vec3f & | dest, |
const Vec3f & | src, | ||
const Matrixd & | mat | ||
) |
Definition at line 787 of file Geographic.cpp.
: public NodeVisitor
{
ShareResult seamless::tilesShareEdges | ( | const KeyIndex & | tile1, |
const KeyIndex & | tile2 | ||
) |
Definition at line 714 of file Geographic.cpp.
{ // tile1 contains tile2; do they share edges? if (x == tile2.x) { result.tile1[0] = 3; result.tile2[0] = 3; result.numEdges = 1; } else if (xleft == tile2.x + 1) { result.tile1[0] = 1; result.tile2[0] = 1; result.numEdges = 1; } if (y == tile2.y) { result.tile1[result.numEdges] = 2; result.tile2[result.numEdges] = 2; result.numEdges++; } else if (ybottom == tile2.y + 1) { result.tile1[result.numEdges] = 0; result.tile2[result.numEdges] = 0; result.numEdges++; } } else { // Tiles can share 1 edge. if (x == tile2.x + 1) { result.tile1[0] = 3; result.tile2[0] = 1; result.numEdges = 1; } else if (xleft == tile2.x) { result.tile1[0] = 1; result.tile2[0] = 3; result.numEdges = 1; } else if (y == tile2.y + 1) { result.tile1[0] = 2; result.tile2[0] = 0; result.numEdges = 1; } else if (ybottom == tile2.y) { result.tile1[0] = 0; result.tile2[0] = 2; result.numEdges = 1; } } return result; } void transferEdges( GeoPatch* toPatch, const Matrixd& toMat, const KeyIndex& toIdx,
void seamless::transferEdges | ( | GeoPatch * | toPatch, |
const Matrixd & | toMat, | ||
const KeyIndex & | toIdx, | ||
GeoPatch * | fromPatch, | ||
const Matrixd & | fromMat, | ||
const KeyIndex & | fromIdx, | ||
const ShareResult & | shared | ||
) |
Definition at line 894 of file Geographic.cpp.
{ int resolution = toPatch->getPatchSet()->getResolution(); int patchDim = resolution + 1; int lodDiff = fromIdx.lod - toIdx.lod; int detailMult = 1 << lodDiff; Matrixd transferMat = fromMat * Matrixd::inverse(toMat); for (int i = 0; i < shared.numEdges; ++i) { EdgeRef toEdge = makeEdgeRef(toPatch, shared.tile1[i], 1); EdgeRef fromEdge = makeEdgeRef(fromPatch, shared.tile2[i], detailMult); int toStart; if (shared.tile1[i] == 0 || shared.tile1[i] == 2) toStart = (fromIdx.x - (toIdx.x * detailMult)) * resolution / detailMult; else toStart = (detailMult - 1 - (fromIdx.y - (toIdx.y * detailMult))) * resolution / detailMult; for (int jt = toStart, jf = 0; jf < fromEdge.shape(); ++jt, ++jf) { #if 0 Vec3d vtx = Vec3d(fromEdge[jf]); vtx = vtx * transferMat; toEdge[jt] = Vec3f(vtx); #endif safeCopy(toEdge[jt], fromEdge[jf], transferMat); } } } void GeoPatchUpdateCallback::operator()(Node* node, NodeVisitor* nv) {
const double seamless::PiOver12 = PI / 12.0 |
const double seamless::PiOver12Inv = 12.0 / PI |
const double seamless::sqrt2 = 1.41421356237309504880 |
const double seamless::sqrt33 = .5773502691896258 |