Stellarium 0.12.1
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
SphericalTexturedConvexPolygon Class Reference

Extension of SphericalConvexPolygon for textured polygon. More...

#include <StelSphereGeometry.hpp>

Public Member Functions

 SphericalTexturedConvexPolygon ()
 Default constructor. More...
 
 SphericalTexturedConvexPolygon (const QVector< Vec3d > &contour, const QVector< Vec2f > &texCoord)
 Constructor from one contour. More...
 
 SphericalTexturedConvexPolygon (const Vec3d &e0, const Vec3d &e1, const Vec3d &e2, const Vec3d &e3)
 Special constructor for quads. More...
 
virtual void setContour (const QVector< Vec3d > &acontour, const QVector< Vec2f > &texCoord)
 Set a single contour defining the SphericalPolygon. More...
 
virtual QVariantList toQVariant () const
 Serialize the region into a QVariant map matching the JSON format. More...
 
virtual void serialize (QDataStream &out) const
 Serialize the region. This method must allow as fast as possible serialization and work with deserialize(). More...
 
- Public Member Functions inherited from SphericalConvexPolygon
 SphericalConvexPolygon ()
 Default constructor. More...
 
 SphericalConvexPolygon (const QVector< QVector< Vec3d > > &contours)
 Constructor from a list of contours. More...
 
 SphericalConvexPolygon (const QVector< Vec3d > &contour)
 Constructor from one contour. More...
 
 SphericalConvexPolygon (const Vec3d &e0, const Vec3d &e1, const Vec3d &e2)
 Special constructor for triangle. More...
 
 SphericalConvexPolygon (const Vec3d &e0, const Vec3d &e1, const Vec3d &e2, const Vec3d &e3)
 Special constructor for quads. More...
 
virtual SphericalRegionType getType () const
 
virtual OctahedronPolygon getOctahedronPolygon () const
 Return the octahedron contour representation of the polygon. More...
 
virtual const QVector< Vec3d > & getFillVertexPositions () const
 Get a vector of vertex positions forming the region. More...
 
virtual PrimitiveType getFillPrimitiveType () const
 Get primitive type determining how vertices in vector returned by getFillVertexPositions() form triangles. More...
 
virtual const QVector< Vec3d > & getOutlineVertexPositions () const
 Get the outline of the contours defining the SphericalPolygon. More...
 
virtual PrimitiveType getOutlinePrimitiveType () const
 Get primitive type determining how vertices in vector returned by getOutlinePrimitiveType() form lines. More...
 
virtual double getArea () const
 Return the area of the region in steradians. More...
 
virtual bool isEmpty () const
 Return true if the region is empty. More...
 
virtual Vec3d getPointInside () const
 Return a point located inside the region. More...
 
virtual SphericalCap getBoundingCap () const
 Return a bounding SphericalCap. More...
 
QVector< SphericalCapgetBoundingSphericalCaps () const
 Return the list of SphericalCap bounding the ConvexPolygon. More...
 
virtual bool contains (const Vec3d &p) const
 
virtual bool contains (const SphericalPolygon &r) const
 
virtual bool contains (const SphericalConvexPolygon &r) const
 
virtual bool contains (const SphericalCap &r) const
 
virtual bool contains (const SphericalPoint &r) const
 
virtual bool contains (const AllSkySphericalRegion &) const
 
virtual bool intersects (const SphericalCap &r) const
 
virtual bool intersects (const SphericalPolygon &r) const
 
virtual bool intersects (const SphericalConvexPolygon &r) const
 
virtual bool intersects (const SphericalPoint &r) const
 
virtual bool intersects (const AllSkySphericalRegion &) const
 
void setContour (const QVector< Vec3d > &acontour)
 Set a single contour defining the SphericalPolygon. More...
 
const QVector< Vec3d > & getConvexContour () const
 Get the single contour defining the SphericalConvexPolygon. More...
 
bool checkValid () const
 Check if the polygon is valid, i.e. it has no side >180. More...
 
- Public Member Functions inherited from SphericalRegion
 SphericalRegion ()
 Default constructor. Inializes with no vertex buffers. More...
 
virtual ~SphericalRegion ()
 Destructor. Cleans up vertex buffers, if any. More...
 
virtual SphericalRegionP getEnlarged (double margin) const
 Return an enlarged version of this SphericalRegion so that any point distant of more than the given margin now lays within the region. More...
 
virtual QVector< QVector< Vec3d > > getSimplifiedContours () const
 Get the contours defining the SphericalPolygon when combined using a positive winding rule. More...
 
QByteArray toJSON () const
 Output a JSON string representing the polygon. More...
 
bool contains (const SphericalRegion *r) const
 Returns whether a SphericalRegion is contained into this region. More...
 
bool contains (const SphericalRegionP r) const
 
bool contains (const EmptySphericalRegion &) const
 
bool intersects (const SphericalRegion *r) const
 Returns whether a SphericalRegion intersects with this region. More...
 
bool intersects (const SphericalRegionP r) const
 
bool intersects (const Vec3d &p) const
 
bool intersects (const EmptySphericalRegion &) const
 
SphericalRegionP getIntersection (const SphericalRegion *r) const
 Return a new SphericalRegion consisting of the intersection of this and the given region. More...
 
SphericalRegionP getIntersection (const SphericalRegionP r) const
 
virtual SphericalRegionP getIntersection (const SphericalPolygon &r) const
 
virtual SphericalRegionP getIntersection (const SphericalConvexPolygon &r) const
 
virtual SphericalRegionP getIntersection (const SphericalCap &r) const
 
virtual SphericalRegionP getIntersection (const SphericalPoint &r) const
 
virtual SphericalRegionP getIntersection (const AllSkySphericalRegion &r) const
 
SphericalRegionP getIntersection (const EmptySphericalRegion &r) const
 
SphericalRegionP getUnion (const SphericalRegion *r) const
 Return a new SphericalRegion consisting of the union of this and the given region. More...
 
SphericalRegionP getUnion (const SphericalRegionP r) const
 
virtual SphericalRegionP getUnion (const SphericalPolygon &r) const
 
virtual SphericalRegionP getUnion (const SphericalConvexPolygon &r) const
 
virtual SphericalRegionP getUnion (const SphericalCap &r) const
 
virtual SphericalRegionP getUnion (const SphericalPoint &r) const
 
SphericalRegionP getUnion (const AllSkySphericalRegion &r) const
 
virtual SphericalRegionP getUnion (const EmptySphericalRegion &r) const
 
SphericalRegionP getSubtraction (const SphericalRegion *r) const
 Return a new SphericalRegion consisting of the subtraction of the given region from this. More...
 
SphericalRegionP getSubtraction (const SphericalRegionP r) const
 
virtual SphericalRegionP getSubtraction (const SphericalPolygon &r) const
 
virtual SphericalRegionP getSubtraction (const SphericalConvexPolygon &r) const
 
virtual SphericalRegionP getSubtraction (const SphericalCap &r) const
 
virtual SphericalRegionP getSubtraction (const SphericalPoint &r) const
 
SphericalRegionP getSubtraction (const AllSkySphericalRegion &r) const
 
virtual SphericalRegionP getSubtraction (const EmptySphericalRegion &r) const
 
virtual void drawFill (class StelRenderer *renderer, const DrawParams &params)
 Draw the region as triangles (i.e. More...
 
virtual void drawOutline (class StelRenderer *renderer, const DrawParams &params)
 Draw the outline of the region. More...
 

Protected Member Functions

virtual void updateFillVertexBuffer (class StelRenderer *renderer, const DrawParams &params, bool handleDiscontinuity)
 Update the vertex buffer used by drawFill(). More...
 
virtual void drawFillVertexBuffer (class StelRenderer *renderer, class StelProjector *projector)
 Drawing part of drawFill() - assumes the buffer/s is/are generated. More...
 
- Protected Member Functions inherited from SphericalConvexPolygon
void updateBoundingCap ()
 Update the bounding cap from the vertex list. More...
 
virtual bool needToUpdateFillVertexBuffers () const
 Do we need to update vertex buffer/s used by drawFill()? More...
 
virtual void fillVertexBuffersUpdated ()
 Called after updating vertex buffer/s used by drawFill(). More...
 
bool areAllPointsOutsideOneSide (const QVector< Vec3d > &points) const
 Computes whether the passed points are all outside of at least one SphericalCap defining the polygon boundary. More...
 
bool containsConvexContour (const Vec3d *vertice, int nbVertex) const
 

Protected Attributes

QVector< Vec2ftextureCoords
 A list of uv texture coordinates corresponding to the triangle vertices. More...
 
StelVertexBuffer
< TexturedVertex > * 
fillTexturedVertexBuffer
 Vertex buffer used in our override of drawFill() (using vertices with texcoords). More...
 
- Protected Attributes inherited from SphericalConvexPolygon
QVector< Vec3dcontour
 A list of vertices of the convex contour. More...
 
SphericalCap cachedBoundingCap
 Cache the bounding cap. More...
 
bool fillVertexBufferNeedsUpdate
 Does the drawFill() vertex buffer need an update? More...
 
- Protected Attributes inherited from SphericalRegion
StelVertexBuffer< PlainVertex > * fillPlainVertexBuffer
 Cached plain vertex buffer for drawing. More...
 
bool useProjector
 Should Renderer draw calls specify a projector? More...
 

Additional Inherited Members

- Public Types inherited from SphericalRegion
enum  SphericalRegionType {
  Point = 0, Cap = 1, AllSky = 2, Polygon = 3,
  ConvexPolygon = 4, Empty = 5, Invalid = 6
}
 define types for all supported regions. More...
 
- Static Public Member Functions inherited from SphericalConvexPolygon
static bool checkValidContour (const QVector< Vec3d > &contour)
 Check if the passed contour is convex and valid, i.e. it has no side >180. More...
 
static SphericalRegionP deserialize (QDataStream &in)
 Deserialize the region. This method must allow as fast as possible deserialization. More...
 
- Static Protected Member Functions inherited from SphericalConvexPolygon
static bool areAllPointsOutsideOneSide (const Vec3d *thisContour, int nbThisContour, const Vec3d *points, int nbPoints)
 Computes whether the passed points are all outside of at least one SphericalCap defining the polygon boundary. More...
 

Detailed Description

Extension of SphericalConvexPolygon for textured polygon.

Definition at line 1116 of file StelSphereGeometry.hpp.

Constructor & Destructor Documentation

SphericalTexturedConvexPolygon::SphericalTexturedConvexPolygon ( )
inline

Default constructor.

Definition at line 1120 of file StelSphereGeometry.hpp.

SphericalTexturedConvexPolygon::SphericalTexturedConvexPolygon ( const QVector< Vec3d > &  contour,
const QVector< Vec2f > &  texCoord 
)
inline

Constructor from one contour.

Definition at line 1126 of file StelSphereGeometry.hpp.

SphericalTexturedConvexPolygon::SphericalTexturedConvexPolygon ( const Vec3d e0,
const Vec3d e1,
const Vec3d e2,
const Vec3d e3 
)
inline

Special constructor for quads.

Use the 4 textures corners for the 4 vertices.

Definition at line 1135 of file StelSphereGeometry.hpp.

Member Function Documentation

virtual void SphericalTexturedConvexPolygon::drawFillVertexBuffer ( class StelRenderer renderer,
class StelProjector projector 
)
protectedvirtual

Drawing part of drawFill() - assumes the buffer/s is/are generated.

Parameters
rendererRenderer used for drawing.
projectorProjector to project the vertices (NULL if subdivision is enabled, as in that case the projection is done during buffer generation)

Reimplemented from SphericalConvexPolygon.

virtual void SphericalTexturedConvexPolygon::serialize ( QDataStream &  out) const
inlinevirtual

Serialize the region. This method must allow as fast as possible serialization and work with deserialize().

Reimplemented from SphericalConvexPolygon.

Definition at line 1169 of file StelSphereGeometry.hpp.

virtual void SphericalTexturedConvexPolygon::setContour ( const QVector< Vec3d > &  acontour,
const QVector< Vec2f > &  texCoord 
)
inlinevirtual

Set a single contour defining the SphericalPolygon.

Parameters
acontoura contour defining the polygon area.
texCoorda list of texture coordinates matching the vertices of the contour.

Definition at line 1154 of file StelSphereGeometry.hpp.

virtual QVariantList SphericalTexturedConvexPolygon::toQVariant ( ) const
virtual

Serialize the region into a QVariant map matching the JSON format.

The format is:

["TEXTURED_CONVEX_POLYGON", [[ra,dec], [ra,dec], [ra,dec], [ra,dec]], [[u,v],[u,v],[u,v],[u,v]]]

where the two lists are a closed convex contours, with each points defined by ra dec in degree in the ICRS frame followed by a list of texture coordinates in the u,v texture space (between 0 and 1). There must be one texture coordinate for each vertex.

Reimplemented from SphericalConvexPolygon.

virtual void SphericalTexturedConvexPolygon::updateFillVertexBuffer ( class StelRenderer renderer,
const DrawParams params,
bool  handleDiscontinuity 
)
protectedvirtual

Update the vertex buffer used by drawFill().

Called when drawing parameters have changed, or when we cannot cache vertices (e.g. when subdividing and this projecting outside Renderer).

Parameters
rendererRenderer to create vertex buffer.
paramsParameters used for drawing (which also affect vertex generation).
handleDiscontinuityDo we need to ensure that no triangles cross a projection discontinuity?

Reimplemented from SphericalConvexPolygon.

Member Data Documentation

StelVertexBuffer<TexturedVertex>* SphericalTexturedConvexPolygon::fillTexturedVertexBuffer
protected

Vertex buffer used in our override of drawFill() (using vertices with texcoords).

Definition at line 1177 of file StelSphereGeometry.hpp.

QVector<Vec2f> SphericalTexturedConvexPolygon::textureCoords
protected

A list of uv texture coordinates corresponding to the triangle vertices.

There should be 1 uv position per vertex.

Definition at line 1174 of file StelSphereGeometry.hpp.


The documentation for this class was generated from the following file: