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

RenderContext Class Reference

#include <rendcontext.h>

Inheritance diagram for RenderContext:

Inheritance graph
Collaboration diagram for RenderContext:

Collaboration graph
List of all members.

Public Types

enum  RenderPass { PrimaryPass, EmissivePass }

Public Member Functions

virtual void drawGroup (const Mesh::PrimitiveGroup &group)
RenderPass getRenderPass () const
bool isLocked () const
void lock ()
virtual void makeCurrent (const Mesh::Material &)=0
 RenderContext ()
 RenderContext (const Mesh::Material *)
void setMaterial (const Mesh::Material *)
void setRenderPass (RenderPass rp)
virtual void setVertexArrays (const Mesh::VertexDescription &desc, void *vertexData)=0
void unlock ()

Private Attributes

bool locked
const Mesh::Materialmaterial
RenderPass renderPass

Member Enumeration Documentation

enum RenderContext::RenderPass
 

Enumeration values:
PrimaryPass 
EmissivePass 

Definition at line 71 of file rendcontext.h.

00072     {
00073         PrimaryPass,
00074         EmissivePass,
00075     };


Constructor & Destructor Documentation

RenderContext::RenderContext const Mesh::Material  ) 
 

Definition at line 69 of file rendcontext.cpp.

References defaultMaterial, and material.

00070 {
00071     if (_material == NULL)
00072         material = &defaultMaterial;
00073     else
00074         material = _material;
00075 }

RenderContext::RenderContext  ) 
 

Definition at line 61 of file rendcontext.cpp.

References defaultMaterial.

00061                              :
00062     material(&defaultMaterial),
00063     locked(false),
00064     renderPass(PrimaryPass)
00065 {
00066 }


Member Function Documentation

void RenderContext::drawGroup const Mesh::PrimitiveGroup group  )  [virtual]
 

Definition at line 113 of file rendcontext.cpp.

References EmissivePass, GLPrimitiveModes, InvalidResource, Mesh::Material::maps, material, and renderPass.

00114 {
00115     // Skip rendering if this is the emissive pass but there's no
00116     // emissive texture.
00117     if (renderPass == EmissivePass &&
00118         material->maps[Mesh::EmissiveMap] == InvalidResource)
00119     {
00120         return;
00121     }
00122 
00123     glDrawElements(GLPrimitiveModes[(int) group.prim],
00124                    group.nIndices,
00125                    GL_UNSIGNED_INT,
00126                    group.indices);
00127 }

RenderPass RenderContext::getRenderPass  )  const [inline]
 

Definition at line 77 of file rendcontext.h.

References renderPass.

Referenced by FixedFunctionRenderContext::makeCurrent().

00077 { return renderPass; }

bool RenderContext::isLocked  )  const [inline]
 

Definition at line 69 of file rendcontext.h.

References locked.

00069 { return locked; }

void RenderContext::lock  )  [inline]
 

Definition at line 67 of file rendcontext.h.

References locked.

Referenced by renderModelDefault().

00067 { locked = true; }

virtual void RenderContext::makeCurrent const Mesh::Material  )  [pure virtual]
 

Implemented in FixedFunctionRenderContext, VP_FP_RenderContext, VP_Combiner_RenderContext, and GLSL_RenderContext.

Referenced by setMaterial().

void RenderContext::setMaterial const Mesh::Material  ) 
 

Definition at line 84 of file rendcontext.cpp.

References defaultMaterial, EmissivePass, locked, makeCurrent(), Mesh::Material::maps, material, PrimaryPass, and renderPass.

Referenced by renderModelDefault().

00085 {
00086     if (!locked)
00087     {
00088         if (newMaterial == NULL)
00089             newMaterial = &defaultMaterial;
00090 
00091         if (renderPass == PrimaryPass)
00092         {
00093             if (newMaterial != material)
00094             {
00095                 material = newMaterial;
00096                 makeCurrent(*material);
00097             }
00098         }
00099         else if (renderPass == EmissivePass)
00100         {
00101             if (material->maps[Mesh::EmissiveMap] !=
00102                 newMaterial->maps[Mesh::EmissiveMap])
00103             {
00104                 material = newMaterial;
00105                 makeCurrent(*material);
00106             }
00107         }
00108     }
00109 }

void RenderContext::setRenderPass RenderPass  rp  )  [inline]
 

Definition at line 78 of file rendcontext.h.

References renderPass.

Referenced by renderModelDefault().

00078 { renderPass = rp; }

virtual void RenderContext::setVertexArrays const Mesh::VertexDescription desc,
void *  vertexData
[pure virtual]
 

Implemented in FixedFunctionRenderContext, VP_FP_RenderContext, VP_Combiner_RenderContext, and GLSL_RenderContext.

void RenderContext::unlock  )  [inline]
 

Definition at line 68 of file rendcontext.h.

References locked.

00068 { locked = false; }


Member Data Documentation

bool RenderContext::locked [private]
 

Definition at line 82 of file rendcontext.h.

Referenced by isLocked(), lock(), setMaterial(), and unlock().

const Mesh::Material* RenderContext::material [private]
 

Definition at line 81 of file rendcontext.h.

Referenced by drawGroup(), RenderContext(), and setMaterial().

RenderPass RenderContext::renderPass [private]
 

Definition at line 83 of file rendcontext.h.

Referenced by drawGroup(), getRenderPass(), setMaterial(), and setRenderPass().


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