WhirlyGlobe  1.1
A 3D interactive globe toolkit for ios
WhirlyGlobe::BasicDrawable Class Reference

#include <Drawable.h>

Inheritance diagram for WhirlyGlobe::BasicDrawable:
WhirlyGlobe::Drawable WhirlyGlobe::Identifiable

List of all members.

Classes

class  Triangle
 Simple triangle. Can obviously only have 2^16 vertices. More...

Public Member Functions

 BasicDrawable ()
 Construct empty.
 BasicDrawable (unsigned int numVert, unsigned int numTri)
 You can violate this, but it will reserve space.
virtual void setupGL (float minZres)
 Set up the VBOs.
virtual void teardownGL ()
 Clean up the VBOs.
virtual void draw (GlobeScene *scene) const
 Fill this in to draw the basic drawable.
virtual unsigned int getDrawPriority () const
 Draw priority.
virtual bool isOn (WhirlyGlobeView *view) const
 We use the on/off flag as well as a visibility check.
void setOnOff (bool onOff)
 True to turn it on, false to turn it off.
virtual bool hasAlpha () const
 Used for alpha sorting.
void setAlpha (bool onOff)
 Set the alpha sorting on or off.
virtual GeoMbr getGeoMbr () const
 Extents used for display culling.
void setGeoMbr (GeoMbr mbr)
 Set extents (don't forget this)
void setDrawPriority (unsigned int newPriority)
 Set the draw priority. We sort by draw priority before rendering.
unsigned int getDrawPriority ()
void setDrawOffset (unsigned int newOffset)
unsigned int getDrawOffset ()
void setType (GLenum inType)
 Set the geometry type. Probably triangles.
GLenum getType () const
void setTexId (SimpleIdentity inId)
 Set the texture ID. You get this from the Texture object.
void setColor (RGBAColor inColor)
 Set the color as an RGB color.
void setColor (unsigned char inColor[])
 Set the color as an array.
RGBAColor getColor () const
void setVisibleRange (float minVis, float maxVis)
void getVisibleRange (float &minVis, float &maxVis)
 Retrieve the visibile range.
unsigned int addPoint (Point3f pt)
 Add a point when building up geometry. Returns the index.
void addTexCoord (TexCoord coord)
 Add a texture coordinate.
void addNormal (Point3f norm)
 Add a normal.
void addTriangle (Triangle tri)
 Add a triangle. Should point to the vertex IDs.
unsigned int getNumPoints () const
 Return the number of points added so far.
unsigned int getNumTris () const
 Return the number of triangles added so far.
unsigned int getNumNorms () const
 Return the number of normals added so far.
unsigned int getNumTexCoords () const
 Return the number of texture coordinates added so far.
void addRect (const Point3f &l0, const Vector3f &ln0, const Point3f &l1, const Vector3f &ln1, float width)

Protected Member Functions

void drawReg (GlobeScene *scene) const
void drawVBO (GlobeScene *scene) const

Protected Attributes

bool on
unsigned int drawPriority
unsigned int drawOffset
bool isAlpha
GeoMbr geoMbr
GLenum type
SimpleIdentity texId
RGBAColor color
float minVisible
float maxVisible
unsigned int numPoints
unsigned int numTris
std::vector< Vector3f > points
std::vector< Vector2f > texCoords
std::vector< Vector3f > norms
std::vector< Triangletris
GLuint pointBuffer
GLuint texCoordBuffer
GLuint normBuffer
GLuint triBuffer

Detailed Description

The Basic Drawable is the one we use the most. It's a general purpose container for static geometry which may or may not be textured.


Constructor & Destructor Documentation

WhirlyGlobe::BasicDrawable::BasicDrawable ( unsigned int  numVert,
unsigned int  numTri 
)

You can violate this, but it will reserve space.

Construct with some idea how big things are.


Member Function Documentation

void WhirlyGlobe::BasicDrawable::setDrawOffset ( unsigned int  newOffset) [inline]

Set the draw offset. This is an integer offset from the base terrain. Geometry is moved upward by a certain number of units.

void WhirlyGlobe::BasicDrawable::setVisibleRange ( float  minVis,
float  maxVis 
) [inline]

Set what range we can see this drawable within. The units are in distance from the center of the globe and the surface of the globe as at 1.0


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