Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Nebula Class Reference

#include <nebula.h>

Inheritance diagram for Nebula:

Inheritance graph
Collaboration diagram for Nebula:

Collaboration graph
List of all members.

Public Types

enum  NebulaType {
  Emissive = 0, Reflective = 1, Dark = 2, Planetary = 3,
  Galactic = 4, SupernovaRemnant = 5, Bright_HII_Region = 6, NotDefined = 7
}

Public Member Functions

virtual size_t getDescription (char *buf, size_t bufLength) const
virtual unsigned int getLabelMask () const
ResourceHandle getModel () const
virtual unsigned int getRenderMask () const
virtual const char * getType () const
virtual bool load (AssociativeArray *, const std::string &)
 Nebula ()
virtual void render (const GLContext &context, const Vec3f &offset, const Quatf &viewerOrientation, float brightness, float pixelSize)
void setModel (ResourceHandle)
virtual void setType (const std::string &)

Private Attributes

ResourceHandle model

Member Enumeration Documentation

enum Nebula::NebulaType
 

Enumeration values:
Emissive 
Reflective 
Dark 
Planetary 
Galactic 
SupernovaRemnant 
Bright_HII_Region 
NotDefined 

Definition at line 45 of file nebula.h.

00046     {
00047         Emissive           = 0,
00048         Reflective         = 1,
00049         Dark               = 2,
00050         Planetary          = 3,
00051         Galactic           = 4,
00052         SupernovaRemnant   = 5,
00053         Bright_HII_Region  = 6,
00054         NotDefined         = 7
00055     };


Constructor & Destructor Documentation

Nebula::Nebula  ) 
 

Definition at line 27 of file nebula.cpp.

References InvalidResource.

00027                :
00028     model(InvalidResource)
00029 {
00030 }


Member Function Documentation

size_t Nebula::getDescription char *  buf,
size_t  bufLength
const [virtual]
 

Reimplemented from DeepSkyObject.

Definition at line 44 of file nebula.cpp.

References _, and getType().

00045 {
00046     // Should use snprintf, but it's not available on Windows
00047     return sprintf(buf, _("%s"), getType());
00048 }

unsigned int Nebula::getLabelMask  )  const [virtual]
 

Reimplemented from DeepSkyObject.

Definition at line 114 of file nebula.cpp.

00115 {
00116     return Renderer::NebulaLabels;
00117 }

ResourceHandle Nebula::getModel  )  const
 

Definition at line 51 of file nebula.cpp.

References model.

00052 {
00053     return model;
00054 }

unsigned int Nebula::getRenderMask  )  const [virtual]
 

Reimplemented from DeepSkyObject.

Definition at line 108 of file nebula.cpp.

00109 {
00110     return Renderer::ShowNebulae;
00111 }

const char * Nebula::getType  )  const [virtual]
 

Implements DeepSkyObject.

Definition at line 33 of file nebula.cpp.

Referenced by getDescription().

00034 {
00035     return "Nebula";
00036 }

bool Nebula::load AssociativeArray ,
const std::string
[virtual]
 

Reimplemented from DeepSkyObject.

Definition at line 62 of file nebula.cpp.

References ResourceManager< T >::getHandle(), GetModelManager(), DeepSkyObject::load(), model, and setModel().

00063 {
00064     string model;
00065     if (params->getString("Mesh", model))
00066     {
00067         ResourceHandle modelHandle =
00068             GetModelManager()->getHandle(ModelInfo(model, resPath));
00069         setModel(modelHandle);
00070     }
00071     
00072     return DeepSkyObject::load(params, resPath);
00073 }

void Nebula::render const GLContext context,
const Vec3f offset,
const Quatf viewerOrientation,
float  brightness,
float  pixelSize
[virtual]
 

Implements DeepSkyObject.

Definition at line 76 of file nebula.cpp.

References ResourceManager< T >::find(), GetModelManager(), DeepSkyObject::getOrientation(), DeepSkyObject::getRadius(), glRotate(), InvalidResource, model, and Model::render().

00081 {
00082     Model* m = NULL;
00083     if (model != InvalidResource)
00084         m = GetModelManager()->find(model);
00085     if (m == NULL)
00086         return;
00087 
00088     glDisable(GL_LIGHTING);
00089     glEnable(GL_TEXTURE_2D);
00090     glScalef(getRadius(), getRadius(), getRadius());
00091     glRotate(getOrientation());
00092 
00093     FixedFunctionRenderContext rc;
00094     m->render(rc);
00095 
00096     // Reset the material
00097     float black[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
00098     float zero = 0.0f;
00099     glColor4fv(black);
00100     glMaterialfv(GL_FRONT, GL_EMISSION, black);
00101     glMaterialfv(GL_FRONT, GL_SPECULAR, black);
00102     glMaterialfv(GL_FRONT, GL_SHININESS, &zero);
00103 
00104     glEnable(GL_BLEND);
00105 }

void Nebula::setModel ResourceHandle   ) 
 

Definition at line 56 of file nebula.cpp.

References model.

Referenced by load().

00057 {
00058     model = _model;
00059 }

void Nebula::setType const std::string  )  [virtual]
 

Implements DeepSkyObject.

Definition at line 39 of file nebula.cpp.

00040 {
00041 }


Member Data Documentation

ResourceHandle Nebula::model [private]
 

Definition at line 58 of file nebula.h.

Referenced by getModel(), load(), render(), and setModel().


The documentation for this class was generated from the following files:
Generated on Sat Jan 14 22:33:29 2006 for Celestia by  doxygen 1.4.1