Merge branch 'master' of gitlab.com:seichter/pixwerx

This commit is contained in:
Hartmut Seichter 2019-01-17 14:20:12 +01:00
commit 1e8b91474e
2 changed files with 9 additions and 5 deletions

View file

@ -51,12 +51,17 @@ public:
const indexarray_t& indices() const { return _indices; }
const vertex3array_t& vertices() const { return _vertices; }
void set_topology(topology_type t) { _topology = t; }
topology_type topology() { return _topology; }
void apply(const matrix4x4& m);
void reset();
protected:
topology_type _topology;
indexarray_t _indices; //!< indices according to topology type
vertex3array_t _vertices; //!< geometry data
vertex3array_t _normals; //!< normal data

View file

@ -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_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;
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) );
z = cos ( deg_to_rad(_longitude) * cos ( deg_to_rad(_latitude + _division_lat) ) );
// geom.
// assign the second normal and vertex
// res->addVertexNormal(tpVec3r(x * radius,y * radius,z * radius),
// tpVec3r(x,y,z)