WIP - removing remaining users of Point3D.
This commit is contained in:
parent
e99c3d4705
commit
1b2915aa2a
@ -38,6 +38,7 @@
|
||||
|
||||
#include <simgear/bucket/newbucket.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
#include <simgear/math/SGGeometry.hxx>
|
||||
|
||||
#include "lowlevel.hxx"
|
||||
#include "sg_binobj.hxx"
|
||||
@ -115,51 +116,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// calculate the center of a list of points, by taking the halfway
|
||||
// point between the min and max points.
|
||||
Point3D sgCalcCenter( point_list& wgs84_nodes ) {
|
||||
Point3D p, min, max;
|
||||
|
||||
if ( wgs84_nodes.size() ) {
|
||||
min = max = wgs84_nodes[0];
|
||||
} else {
|
||||
min = max = Point3D( 0 );
|
||||
}
|
||||
|
||||
for ( int i = 0; i < (int)wgs84_nodes.size(); ++i ) {
|
||||
p = wgs84_nodes[i];
|
||||
|
||||
if ( p.x() < min.x() ) { min.setx( p.x() ); }
|
||||
if ( p.y() < min.y() ) { min.sety( p.y() ); }
|
||||
if ( p.z() < min.z() ) { min.setz( p.z() ); }
|
||||
|
||||
if ( p.x() > max.x() ) { max.setx( p.x() ); }
|
||||
if ( p.y() > max.y() ) { max.sety( p.y() ); }
|
||||
if ( p.z() > max.z() ) { max.setz( p.z() ); }
|
||||
}
|
||||
|
||||
return ( min + max ) / 2.0;
|
||||
}
|
||||
|
||||
// calculate the bounding sphere. Center is the center of the
|
||||
// tile and zero elevation
|
||||
double sgCalcBoundingRadius( Point3D center, point_list& wgs84_nodes ) {
|
||||
double dist_squared;
|
||||
double radius_squared = 0;
|
||||
|
||||
for ( int i = 0; i < (int)wgs84_nodes.size(); ++i ) {
|
||||
dist_squared = center.distance3Dsquared( wgs84_nodes[i] );
|
||||
if ( dist_squared > radius_squared ) {
|
||||
radius_squared = dist_squared;
|
||||
}
|
||||
}
|
||||
|
||||
return sqrt(radius_squared);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// read object properties
|
||||
static void read_object( gzFile fp,
|
||||
int obj_type,
|
||||
@ -1128,19 +1084,16 @@ bool SGBinObject::write_ascii( const string& base, const string& name,
|
||||
}
|
||||
// cout << "group = " << start << " to " << end - 1 << endl;
|
||||
|
||||
// make a list of points for the group
|
||||
point_list group_nodes;
|
||||
group_nodes.clear();
|
||||
SGVec3d bs_center;
|
||||
double bs_radius = 0;
|
||||
SGSphered d;
|
||||
for ( i = start; i < end; ++i ) {
|
||||
for ( j = 0; j < (int)tris_v[i].size(); ++j ) {
|
||||
group_nodes.push_back( Point3D::fromSGVec3(wgs84_nodes[ tris_v[i][j] ]) );
|
||||
bs_center = sgCalcCenter( group_nodes ).toSGVec3d();
|
||||
bs_radius = sgCalcBoundingRadius( Point3D::fromSGVec3(bs_center), group_nodes );
|
||||
d.expandBy(wgs84_nodes[ tris_v[i][j] ]);
|
||||
}
|
||||
}
|
||||
|
||||
SGVec3d bs_center = d.getCenter();
|
||||
double bs_radius = d.getRadius();
|
||||
|
||||
// write group headers
|
||||
fprintf(fp, "\n");
|
||||
fprintf(fp, "# usemtl %s\n", material.c_str());
|
||||
@ -1179,19 +1132,17 @@ bool SGBinObject::write_ascii( const string& base, const string& name,
|
||||
}
|
||||
// cout << "group = " << start << " to " << end - 1 << endl;
|
||||
|
||||
// make a list of points for the group
|
||||
point_list group_nodes;
|
||||
group_nodes.clear();
|
||||
SGVec3d bs_center;
|
||||
double bs_radius = 0;
|
||||
|
||||
SGSphered d;
|
||||
for ( i = start; i < end; ++i ) {
|
||||
for ( j = 0; j < (int)strips_v[i].size(); ++j ) {
|
||||
group_nodes.push_back( Point3D::fromSGVec3(wgs84_nodes[ strips_v[i][j] ]) );
|
||||
bs_center = sgCalcCenter( group_nodes ).toSGVec3d();
|
||||
bs_radius = sgCalcBoundingRadius( Point3D::fromSGVec3(bs_center), group_nodes );
|
||||
for ( j = 0; j < (int)tris_v[i].size(); ++j ) {
|
||||
d.expandBy(wgs84_nodes[ tris_v[i][j] ]);
|
||||
}
|
||||
}
|
||||
|
||||
SGVec3d bs_center = d.getCenter();
|
||||
double bs_radius = d.getRadius();
|
||||
|
||||
// write group headers
|
||||
fprintf(fp, "\n");
|
||||
fprintf(fp, "# usemtl %s\n", material.c_str());
|
||||
|
@ -45,7 +45,7 @@
|
||||
|
||||
|
||||
/** STL Structure used to store object information */
|
||||
typedef vector < int_list > group_list;
|
||||
typedef std::vector < int_list > group_list;
|
||||
typedef group_list::iterator group_list_iterator;
|
||||
typedef group_list::const_iterator const_group_list_iterator;
|
||||
|
||||
@ -126,9 +126,7 @@ public:
|
||||
|
||||
inline unsigned short get_version() const { return version; }
|
||||
|
||||
inline Point3D get_gbs_center() const { return Point3D::fromSGVec3(gbs_center); }
|
||||
inline void set_gbs_center( const Point3D& p ) { gbs_center = p.toSGVec3d(); }
|
||||
inline const SGVec3d& get_gbs_center2() const { return gbs_center; }
|
||||
inline const SGVec3d& get_gbs_center() const { return gbs_center; }
|
||||
inline void set_gbs_center( const SGVec3d& p ) { gbs_center = p; }
|
||||
|
||||
inline float get_gbs_radius() const { return gbs_radius; }
|
||||
@ -138,39 +136,15 @@ public:
|
||||
{ return wgs84_nodes; }
|
||||
inline void set_wgs84_nodes( const std::vector<SGVec3d>& n )
|
||||
{ wgs84_nodes = n; }
|
||||
inline void set_wgs84_nodes( const point_list& n )
|
||||
{
|
||||
wgs84_nodes.resize(n.size());
|
||||
for (unsigned i = 0; i < wgs84_nodes.size(); ++i)
|
||||
wgs84_nodes[i] = n[i].toSGVec3d();
|
||||
}
|
||||
|
||||
inline const std::vector<SGVec4f>& get_colors() const { return colors; }
|
||||
inline void set_colors( const std::vector<SGVec4f>& c ) { colors = c; }
|
||||
inline void set_colors( const point_list& c )
|
||||
{
|
||||
colors.resize(c.size());
|
||||
for (unsigned i = 0; i < colors.size(); ++i)
|
||||
colors[i] = SGVec4f(c[i].toSGVec3f(), 1);
|
||||
}
|
||||
|
||||
inline const std::vector<SGVec3f>& get_normals() const { return normals; }
|
||||
inline void set_normals( const std::vector<SGVec3f>& n ) { normals = n; }
|
||||
inline void set_normals( const point_list& n )
|
||||
{
|
||||
normals.resize(n.size());
|
||||
for (unsigned i = 0; i < normals.size(); ++i)
|
||||
normals[i] = n[i].toSGVec3f();
|
||||
}
|
||||
|
||||
inline const std::vector<SGVec2f>& get_texcoords() const { return texcoords; }
|
||||
inline void set_texcoords( const std::vector<SGVec2f>& t ) { texcoords = t; }
|
||||
inline void set_texcoords( const point_list& t )
|
||||
{
|
||||
texcoords.resize(t.size());
|
||||
for (unsigned i = 0; i < texcoords.size(); ++i)
|
||||
texcoords[i] = t[i].toSGVec2f();
|
||||
}
|
||||
|
||||
inline const group_list& get_pts_v() const { return pts_v; }
|
||||
inline void set_pts_v( const group_list& g ) { pts_v = g; }
|
||||
@ -249,26 +223,4 @@ public:
|
||||
const SGBucket& b );
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \relates SGBinObject
|
||||
* Calculate the center of a list of points, by taking the halfway
|
||||
* point between the min and max points.
|
||||
* @param wgs84_nodes list of points in wgs84 coordinates
|
||||
* @return center point
|
||||
*/
|
||||
Point3D sgCalcCenter( point_list& wgs84_nodes );
|
||||
|
||||
|
||||
/**
|
||||
* \relates SGBinObject
|
||||
* Calculate the bounding sphere of a set of nodes.
|
||||
* Center is the center of the tile and zero elevation.
|
||||
* @param center center of our bounding radius
|
||||
* @param wgs84_nodes list of points in wgs84 coordinates
|
||||
* @return radius
|
||||
*/
|
||||
double sgCalcBoundingRadius( Point3D center, point_list& wgs84_nodes );
|
||||
|
||||
|
||||
#endif // _SG_BINOBJ_HXX
|
||||
|
@ -38,28 +38,18 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Point3D;
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
/** STL vector list of ints */
|
||||
typedef vector < int > int_list;
|
||||
typedef std::vector < int > int_list;
|
||||
typedef int_list::iterator int_list_iterator;
|
||||
typedef int_list::const_iterator const_int_list_iterator;
|
||||
|
||||
/** STL vector list of doubles */
|
||||
typedef vector < double > double_list;
|
||||
typedef std::vector < double > double_list;
|
||||
typedef double_list::iterator double_list_iterator;
|
||||
typedef double_list::const_iterator const_double_list_iterator;
|
||||
|
||||
/** STL vector list of Point3D */
|
||||
typedef vector < Point3D > point_list;
|
||||
typedef point_list::iterator point_list_iterator;
|
||||
typedef point_list::const_iterator const_point_list_iterator;
|
||||
|
||||
/** STL vector list of strings */
|
||||
typedef vector < string > string_list;
|
||||
typedef std::vector < std::string > string_list;
|
||||
typedef string_list::iterator string_list_iterator;
|
||||
typedef string_list::const_iterator const_string_list_iterator;
|
||||
|
||||
|
@ -160,28 +160,28 @@ enter this in the official comments in case I forget again. :-)
|
||||
|
||||
|
||||
// return the basic unshifted/unmoded texture coordinate for a lat/lon
|
||||
static inline Point3D basic_tex_coord( const Point3D& p,
|
||||
static inline SGVec2f basic_tex_coord( const SGGeod& p,
|
||||
double degree_width,
|
||||
double degree_height,
|
||||
double scale )
|
||||
{
|
||||
return Point3D( p.x() * ( degree_width * scale /
|
||||
return SGVec2f( p.getLongitudeDeg() * ( degree_width * scale /
|
||||
FG_STANDARD_TEXTURE_DIMENSION ),
|
||||
p.y() * ( degree_height * scale /
|
||||
FG_STANDARD_TEXTURE_DIMENSION ),
|
||||
0.0 );
|
||||
p.getLatitudeDeg() * ( degree_height * scale /
|
||||
FG_STANDARD_TEXTURE_DIMENSION )
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// traverse the specified fan/strip/list of vertices and attempt to
|
||||
// calculate "none stretching" texture coordinates
|
||||
point_list sgCalcTexCoords( const SGBucket& b, const point_list& geod_nodes,
|
||||
std::vector<SGVec2f> sgCalcTexCoords( const SGBucket& b, const std::vector<SGGeod>& geod_nodes,
|
||||
const int_list& fan, double scale )
|
||||
{
|
||||
return sgCalcTexCoords(b.get_center_lat(), geod_nodes, fan, scale);
|
||||
}
|
||||
|
||||
point_list sgCalcTexCoords( double centerLat, const point_list& geod_nodes,
|
||||
std::vector<SGVec2f> sgCalcTexCoords( double centerLat, const std::vector<SGGeod>& geod_nodes,
|
||||
const int_list& fan, double scale )
|
||||
{
|
||||
// cout << "calculating texture coordinates for a specific fan of size = "
|
||||
@ -214,16 +214,16 @@ point_list sgCalcTexCoords( double centerLat, const point_list& geod_nodes,
|
||||
// cout << "degree_height = " << degree_height << endl;
|
||||
|
||||
// find min/max of fan
|
||||
Point3D tmin, tmax, p, t;
|
||||
SGVec2f tmin, tmax;
|
||||
bool first = true;
|
||||
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < (int)fan.size(); ++i ) {
|
||||
p = geod_nodes[ fan[i] ];
|
||||
SGGeod p = geod_nodes[ fan[i] ];
|
||||
// cout << "point p = " << p << endl;
|
||||
|
||||
t = basic_tex_coord( p, degree_width, degree_height, scale );
|
||||
SGVec2f t = basic_tex_coord( p, degree_width, degree_height, scale );
|
||||
// cout << "basic_tex_coord = " << t << endl;
|
||||
|
||||
if ( first ) {
|
||||
@ -231,16 +231,16 @@ point_list sgCalcTexCoords( double centerLat, const point_list& geod_nodes,
|
||||
first = false;
|
||||
} else {
|
||||
if ( t.x() < tmin.x() ) {
|
||||
tmin.setx( t.x() );
|
||||
tmin.x() = t.x();
|
||||
}
|
||||
if ( t.y() < tmin.y() ) {
|
||||
tmin.sety( t.y() );
|
||||
tmin.y() = t.y();
|
||||
}
|
||||
if ( t.x() > tmax.x() ) {
|
||||
tmax.setx( t.x() );
|
||||
tmax.x() = t.x();
|
||||
}
|
||||
if ( t.y() > tmax.y() ) {
|
||||
tmax.sety( t.y() );
|
||||
tmax.y() = t.y();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -256,30 +256,31 @@ point_list sgCalcTexCoords( double centerLat, const point_list& geod_nodes,
|
||||
// but is the best we can do.
|
||||
// cout << "SHIFTING" << endl;
|
||||
if ( tmin.x() < 0 ) {
|
||||
tmin.setx( (double)( (int)tmin.x() - 1 ) );
|
||||
tmin.x() = (double)( (int)tmin.x() - 1 ) ;
|
||||
} else {
|
||||
tmin.setx( (int)tmin.x() );
|
||||
tmin.x() = (int)tmin.x();
|
||||
}
|
||||
|
||||
if ( tmin.y() < 0 ) {
|
||||
tmin.sety( (double)( (int)tmin.y() - 1 ) );
|
||||
tmin.y() = (double)( (int)tmin.y() - 1 );
|
||||
} else {
|
||||
tmin.sety( (int)tmin.y() );
|
||||
tmin.y() = (int)tmin.y();
|
||||
}
|
||||
// cout << "found tmin = " << tmin << endl;
|
||||
} else {
|
||||
if ( tmin.x() < 0 ) {
|
||||
tmin.setx( ( (int)(tmin.x() / HALF_MAX_TEX_COORD) - 1 )
|
||||
* HALF_MAX_TEX_COORD );
|
||||
tmin.x() = ( (int)(tmin.x() / HALF_MAX_TEX_COORD) - 1 )
|
||||
* HALF_MAX_TEX_COORD ;
|
||||
} else {
|
||||
tmin.setx( ( (int)(tmin.x() / HALF_MAX_TEX_COORD) )
|
||||
* HALF_MAX_TEX_COORD );
|
||||
tmin.x() = ( (int)(tmin.x() / HALF_MAX_TEX_COORD) )
|
||||
* HALF_MAX_TEX_COORD ;
|
||||
}
|
||||
if ( tmin.y() < 0 ) {
|
||||
tmin.sety( ( (int)(tmin.y() / HALF_MAX_TEX_COORD) - 1 )
|
||||
* HALF_MAX_TEX_COORD );
|
||||
tmin.y() = ( (int)(tmin.y() / HALF_MAX_TEX_COORD) - 1 )
|
||||
* HALF_MAX_TEX_COORD ;
|
||||
} else {
|
||||
tmin.sety( ( (int)(tmin.y() / HALF_MAX_TEX_COORD) )
|
||||
* HALF_MAX_TEX_COORD );
|
||||
tmin.y() = ( (int)(tmin.y() / HALF_MAX_TEX_COORD) )
|
||||
* HALF_MAX_TEX_COORD ;
|
||||
}
|
||||
#if 0
|
||||
// structure is small enough ... we can mod it so we can
|
||||
@ -319,12 +320,12 @@ point_list sgCalcTexCoords( double centerLat, const point_list& geod_nodes,
|
||||
}
|
||||
|
||||
// generate tex_list
|
||||
Point3D adjusted_t;
|
||||
point_list tex;
|
||||
SGVec2f adjusted_t;
|
||||
std::vector<SGVec2f> tex;
|
||||
tex.clear();
|
||||
for ( i = 0; i < (int)fan.size(); ++i ) {
|
||||
p = geod_nodes[ fan[i] ];
|
||||
t = basic_tex_coord( p, degree_width, degree_height, scale );
|
||||
SGGeod p = geod_nodes[ fan[i] ];
|
||||
SGVec2f t = basic_tex_coord( p, degree_width, degree_height, scale );
|
||||
// cout << "second t = " << t << endl;
|
||||
|
||||
adjusted_t = t - tmin;
|
||||
@ -342,12 +343,12 @@ point_list sgCalcTexCoords( double centerLat, const point_list& geod_nodes,
|
||||
}
|
||||
#endif
|
||||
if ( adjusted_t.x() < SG_EPSILON ) {
|
||||
adjusted_t.setx( 0.0 );
|
||||
adjusted_t.x() = 0.0;
|
||||
}
|
||||
if ( adjusted_t.y() < SG_EPSILON ) {
|
||||
adjusted_t.sety( 0.0 );
|
||||
adjusted_t.y() = 0.0;
|
||||
}
|
||||
adjusted_t.setz( 0.0 );
|
||||
|
||||
// cout << "adjusted_t = " << adjusted_t << endl;
|
||||
|
||||
tex.push_back( adjusted_t );
|
||||
|
@ -36,6 +36,9 @@
|
||||
#include <simgear/bucket/newbucket.hxx>
|
||||
#include <simgear/math/sg_types.hxx>
|
||||
|
||||
#include <simgear/math/SGMathFwd.hxx>
|
||||
#include <simgear/math/SGGeod.hxx>
|
||||
#include <simgear/math/SGVec2.hxx>
|
||||
|
||||
/**
|
||||
* Traverse the specified fan/strip/list of vertices and attempt to
|
||||
@ -46,10 +49,10 @@
|
||||
* @param scale (default = 1.0) scaling factor
|
||||
* @return list of texture coordinates
|
||||
*/
|
||||
point_list sgCalcTexCoords( const SGBucket& b, const point_list& geod_nodes,
|
||||
std::vector<SGVec2f> sgCalcTexCoords( const SGBucket& b, const std::vector<SGGeod>& geod_nodes,
|
||||
const int_list& fan, double scale = 1.0 );
|
||||
|
||||
point_list sgCalcTexCoords( double centerLat, const point_list& geod_nodes,
|
||||
std::vector<SGVec2f> sgCalcTexCoords( double centerLat, const std::vector<SGGeod>& geod_nodes,
|
||||
const int_list& fan, double scale = 1.0 );
|
||||
|
||||
|
||||
|
@ -119,7 +119,7 @@ SGMaterial::read_properties(const SGReaderWriterXMLOptions* options,
|
||||
const SGPropertyNode *props)
|
||||
{
|
||||
// Gather the path(s) to the texture(s)
|
||||
vector<SGPropertyNode_ptr> textures = props->getChildren("texture");
|
||||
std::vector<SGPropertyNode_ptr> textures = props->getChildren("texture");
|
||||
for (unsigned int i = 0; i < textures.size(); i++)
|
||||
{
|
||||
string tname = textures[i]->getStringValue();
|
||||
@ -141,11 +141,11 @@ SGMaterial::read_properties(const SGReaderWriterXMLOptions* options,
|
||||
}
|
||||
}
|
||||
|
||||
vector<SGPropertyNode_ptr> texturesets = props->getChildren("texture-set");
|
||||
std::vector<SGPropertyNode_ptr> texturesets = props->getChildren("texture-set");
|
||||
for (unsigned int i = 0; i < texturesets.size(); i++)
|
||||
{
|
||||
_internal_state st( NULL, false, options );
|
||||
vector<SGPropertyNode_ptr> textures = texturesets[i]->getChildren("texture");
|
||||
std::vector<SGPropertyNode_ptr> textures = texturesets[i]->getChildren("texture");
|
||||
for (unsigned int j = 0; j < textures.size(); j++)
|
||||
{
|
||||
string tname = textures[j]->getStringValue();
|
||||
@ -229,13 +229,13 @@ SGMaterial::read_properties(const SGReaderWriterXMLOptions* options,
|
||||
if (props->hasChild("effect"))
|
||||
effect = props->getStringValue("effect");
|
||||
|
||||
vector<SGPropertyNode_ptr> object_group_nodes =
|
||||
std::vector<SGPropertyNode_ptr> object_group_nodes =
|
||||
((SGPropertyNode *)props)->getChildren("object-group");
|
||||
for (unsigned int i = 0; i < object_group_nodes.size(); i++)
|
||||
object_groups.push_back(new SGMatModelGroup(object_group_nodes[i]));
|
||||
|
||||
// read glyph table for taxi-/runway-signs
|
||||
vector<SGPropertyNode_ptr> glyph_nodes = props->getChildren("glyph");
|
||||
std::vector<SGPropertyNode_ptr> glyph_nodes = props->getChildren("glyph");
|
||||
for (unsigned int i = 0; i < glyph_nodes.size(); i++) {
|
||||
const char *name = glyph_nodes[i]->getStringValue("name");
|
||||
if (name)
|
||||
|
@ -65,7 +65,7 @@ SGMatModel::SGMatModel (const SGPropertyNode * node, double range_m)
|
||||
}
|
||||
|
||||
// Note all the model paths
|
||||
vector <SGPropertyNode_ptr> path_nodes = node->getChildren("path");
|
||||
std::vector <SGPropertyNode_ptr> path_nodes = node->getChildren("path");
|
||||
for (unsigned int i = 0; i < path_nodes.size(); i++)
|
||||
_paths.push_back(path_nodes[i]->getStringValue());
|
||||
|
||||
@ -182,7 +182,7 @@ SGMatModelGroup::SGMatModelGroup (SGPropertyNode * node)
|
||||
: _range_m(node->getDoubleValue("range-m", 2000))
|
||||
{
|
||||
// Load the object subnodes
|
||||
vector<SGPropertyNode_ptr> object_nodes =
|
||||
std::vector<SGPropertyNode_ptr> object_nodes =
|
||||
((SGPropertyNode *)node)->getChildren("object");
|
||||
for (unsigned int i = 0; i < object_nodes.size(); i++) {
|
||||
const SGPropertyNode * object_node = object_nodes[i];
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
SGVec3f normals[latPoints][lonPoints];
|
||||
SGVec3d rel[latPoints][lonPoints];
|
||||
|
||||
point_list geod_nodes;
|
||||
std::vector<SGGeod> geod_nodes;
|
||||
|
||||
osg::Vec3Array* vl;
|
||||
osg::Vec3Array* nl;
|
||||
@ -122,27 +122,31 @@ void OceanMesh::calcMesh(const SGVec3d& cartCenter, const SGQuatd& orient,
|
||||
}
|
||||
|
||||
// Calculate texture coordinates
|
||||
point_list geod_nodes(latPoints * lonPoints);
|
||||
VectorArrayAdapter<point_list> geodNodesArray(geod_nodes, lonPoints);
|
||||
typedef std::vector<SGGeod> GeodVector;
|
||||
|
||||
GeodVector geod_nodes(latPoints * lonPoints);
|
||||
VectorArrayAdapter<GeodVector> geodNodesArray(geod_nodes, lonPoints);
|
||||
int_list rectangle(latPoints * lonPoints);
|
||||
VectorArrayAdapter<int_list> rectArray(rectangle, lonPoints);
|
||||
for (int j = 0; j < latPoints; j++) {
|
||||
for (int i = 0; i < lonPoints; i++) {
|
||||
geodNodesArray(j, i) = Point3D(geod[j][i].getLongitudeDeg(),
|
||||
geod[j][i].getLatitudeDeg(),
|
||||
geod[j][i].getElevationM());
|
||||
geodNodesArray(j, i) = geod[j][i];
|
||||
rectArray(j, i) = j * 5 + i;
|
||||
}
|
||||
}
|
||||
point_list texs = sgCalcTexCoords( clat, geod_nodes, rectangle,
|
||||
|
||||
typedef std::vector<SGVec2f> Vec2Array;
|
||||
Vec2Array texs = sgCalcTexCoords( clat, geod_nodes, rectangle,
|
||||
1000.0 / tex_width );
|
||||
VectorArrayAdapter<point_list> texsArray(texs, lonPoints);
|
||||
|
||||
|
||||
VectorArrayAdapter<Vec2Array> texsArray(texs, lonPoints);
|
||||
|
||||
for (int j = 0; j < latPoints; j++) {
|
||||
for (int i = 0; i < lonPoints; ++i) {
|
||||
vlArray(j, i) = toOsg(rel[j][i]);
|
||||
nlArray(j, i) = toOsg(normals[j][i]);
|
||||
tlArray(j, i) = toOsg(texsArray(j, i).toSGVec2f());
|
||||
tlArray(j, i) = toOsg(texsArray(j, i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,9 +47,6 @@
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
namespace simgear {
|
||||
|
||||
class ModelLoadHelper;
|
||||
@ -64,10 +61,6 @@ public:
|
||||
SGBucket tile_bucket;
|
||||
std::string tileFileName;
|
||||
|
||||
typedef vector < Point3D > point_list;
|
||||
typedef point_list::iterator point_list_iterator;
|
||||
typedef point_list::const_iterator const_point_list_iterator;
|
||||
|
||||
private:
|
||||
|
||||
// pointer to ssg range selector for this tile
|
||||
|
@ -563,7 +563,7 @@ SGLoadBTG(const std::string& path, SGMaterialLib *matlib, bool calc_lights, bool
|
||||
if (!tile.read_bin(path))
|
||||
return false;
|
||||
|
||||
SGVec3d center = tile.get_gbs_center2();
|
||||
SGVec3d center = tile.get_gbs_center();
|
||||
SGGeod geodPos = SGGeod::fromCart(center);
|
||||
SGQuatd hlOr = SGQuatd::fromLonLat(geodPos)*SGQuatd::fromEulerDeg(0, 0, 180);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user