fix for meshes
This commit is contained in:
parent
05dea19436
commit
f82f52a031
2 changed files with 8 additions and 4 deletions
|
@ -51,10 +51,15 @@ public:
|
||||||
const indexarray_t& indices() const { return _indices; }
|
const indexarray_t& indices() const { return _indices; }
|
||||||
const vertex3array_t& vertices() const { return _vertices; }
|
const vertex3array_t& vertices() const { return _vertices; }
|
||||||
|
|
||||||
|
void set_topology(topology_type t) { _topology = t; }
|
||||||
|
topology_type topology() { return _topology; }
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
topology_type _topology;
|
||||||
|
|
||||||
indexarray_t _indices; //!< indices according to topology type
|
indexarray_t _indices; //!< indices according to topology type
|
||||||
vertex3array_t _vertices; //!< geometry data
|
vertex3array_t _vertices; //!< geometry data
|
||||||
vertex3array_t _normals; //!< normal data
|
vertex3array_t _normals; //!< normal data
|
||||||
|
|
|
@ -46,12 +46,10 @@ mesh primitives::sphere(real_t radius,int divisions_latitude,int divisions_longi
|
||||||
const real_t _division_lat = real_t(360.0) / divisions_latitude;
|
const real_t _division_lat = real_t(360.0) / divisions_latitude;
|
||||||
const real_t _division_lon = real_t(360.0) / divisions_longitude;
|
const real_t _division_lon = real_t(360.0) / divisions_longitude;
|
||||||
|
|
||||||
// res = new tpPrimitive(tpPrimitive::kTriangleStrip);
|
mesh geom;
|
||||||
|
|
||||||
//res->setPrimitiveType(tpPrimitive::kLineStrip);
|
geom.set_topology(mesh::topology_type::triangle_strip);
|
||||||
|
|
||||||
// real_t _latitude, _longitude;
|
|
||||||
real_t dToR;
|
|
||||||
real_t x, y, z;
|
real_t x, y, z;
|
||||||
|
|
||||||
for (real_t _latitude = 0; _latitude < 360; _latitude += _division_lat)
|
for (real_t _latitude = 0; _latitude < 360; _latitude += _division_lat)
|
||||||
|
@ -62,6 +60,7 @@ mesh primitives::sphere(real_t radius,int divisions_latitude,int divisions_longi
|
||||||
y = sin ( deg_to_rad(_latitude + _division_lat) );
|
y = sin ( deg_to_rad(_latitude + _division_lat) );
|
||||||
z = cos ( deg_to_rad(_longitude) * cos ( deg_to_rad(_latitude + _division_lat) ) );
|
z = cos ( deg_to_rad(_longitude) * cos ( deg_to_rad(_latitude + _division_lat) ) );
|
||||||
|
|
||||||
|
// geom.
|
||||||
// assign the second normal and vertex
|
// assign the second normal and vertex
|
||||||
// res->addVertexNormal(tpVec3r(x * radius,y * radius,z * radius),
|
// res->addVertexNormal(tpVec3r(x * radius,y * radius,z * radius),
|
||||||
// tpVec3r(x,y,z)
|
// tpVec3r(x,y,z)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue