VRUT::_render Class Reference

Add comment here for your module class. More...

#include <_render.h>

Inheritance diagram for VRUT::_render:

VRUT::RenderModule VRUT::RenderModule VRUT::RenderModule VRUT::SceneModule VRUT::SceneModule VRUT::SceneModule VRUT::Module VRUT::Module VRUT::Module

List of all members.

Public Member Functions

 _render (const MODULE_ID &_id, const wxString &_name, EventHandler *msgSink)
 Class constructor - do not alter.
virtual ~_render ()
 Class destructor - deinitialize your data.
virtual wxString GetDesc () const
 Always overload method giving description for your module.
virtual void Draw ()
virtual void Deinitialize ()
 _render (const MODULE_ID &_id, const wxString &_name, EventHandler *msgSink)
 Class constructor - do not alter.
virtual ~_render ()
 Class destructor - deinitialize your data.
virtual wxString GetDesc () const
 Always overload method giving description for your module.
virtual void Draw ()
virtual void Deinitialize ()
 _render (const MODULE_ID &_id, const wxString &_name, EventHandler *msgSink)
 Class constructor - do not alter.
virtual ~_render ()
 Class destructor - deinitialize your data.
virtual wxString GetDesc () const
 Always overload method giving description for your module.
virtual void Draw ()
virtual void Deinitialize ()

Protected Member Functions

virtual void processEvent (wxCommandEvent &evt)
 Overload this to process events you need.
virtual void processEvent (wxCommandEvent &evt)
 Overload this to process events you need.
virtual void processEvent (wxCommandEvent &evt)
 Overload this to process events you need.

Protected Attributes

int var
 Add any variables.
Parameter::ParameterIdentificator varParamID
 Add var param identificator to register this as parameter.


Detailed Description

Add comment here for your module class.

Definition at line 29 of file _render.h.


Constructor & Destructor Documentation

VRUT::_render::_render ( const MODULE_ID _id,
const wxString &  _name,
EventHandler msgSink 
) [inline]

Class constructor - do not alter.

Initialize your variables Do not change other than param name when initializing param identificators

Register your params - choose GUI type or just register w/o GUI

Definition at line 54 of file _render.h.

00055                      : RenderModule(_id, _name, 0, msgSink),
00058                      varParamID(_name, wxT("var"), _id)
00059               {
00061                      REGISTER_PARAM_GUI_SLIDER(varParamID, wxT("100"), 0, 200);
00062               }

virtual VRUT::_render::~_render (  )  [inline, virtual]

Class destructor - deinitialize your data.

Definition at line 64 of file _render.h.

00065               {
00066               }

VRUT::_render::_render ( const MODULE_ID _id,
const wxString &  _name,
EventHandler msgSink 
) [inline]

Class constructor - do not alter.

Initialize your variables Do not change other than param name when initializing param identificators

Register your params - choose GUI type or just register w/o GUI

Definition at line 54 of file _render.h.

00055                      : RenderModule(_id, _name, 0, msgSink),
00058                      varParamID(_name, wxT("var"), _id)
00059               {
00061                      REGISTER_PARAM_GUI_SLIDER(varParamID, wxT("100"), 0, 200);
00062               }

virtual VRUT::_render::~_render (  )  [inline, virtual]

Class destructor - deinitialize your data.

Definition at line 64 of file _render.h.

00065               {
00066               }

VRUT::_render::_render ( const MODULE_ID _id,
const wxString &  _name,
EventHandler msgSink 
) [inline]

Class constructor - do not alter.

Initialize your variables Do not change other than param name when initializing param identificators

Register your params - choose GUI type or just register w/o GUI

Definition at line 54 of file _render.h.

00055                      : RenderModule(_id, _name, 0, msgSink),
00058                      varParamID(_name, wxT("var"), _id)
00059               {
00061                      REGISTER_PARAM_GUI_SLIDER(varParamID, wxT("100"), 0, 200);
00062               }

virtual VRUT::_render::~_render (  )  [inline, virtual]

Class destructor - deinitialize your data.

Definition at line 64 of file _render.h.

00065               {
00066               }


Member Function Documentation

virtual void VRUT::_render::processEvent ( wxCommandEvent &  evt  )  [inline, protected, virtual]

Overload this to process events you need.

Always call base method

Remember to process registered param update events

Reimplemented from VRUT::RenderModule.

Definition at line 38 of file _render.h.

00039               {
00041                      RenderModule::processEvent(evt);
00042 
00043                      switch (evt.GetEventType())
00044                      {
00046                      case Event::EVT_PARAM_SET:
00047                             UPDATE_PARAM_FROM_EVENT_INT(varParamID, var, evt);
00048                             break;
00049                      }
00050               }

virtual wxString VRUT::_render::GetDesc (  )  const [inline, virtual]

Always overload method giving description for your module.

Implements VRUT::Module.

Definition at line 69 of file _render.h.

00070               {
00071                      return wxT("This is my module");
00072               }

virtual void VRUT::_render::Draw (  )  [inline, virtual]

This is the most important method in any render module It is called by kernel with GL context properly set so any GL calls can be done here and nowhere else

These are some of the methods provided by base classes

You can use BVH that is already update for you by kernel DO NOT update BVH in module

Get associated camera, again it is associated for you already

You should lock camera for writing as it is shared

and can be modified during update that you should also do before using it

Some projection adjustments

Set view matrix

Let's draw BVH hierarchy to simply show the abilities of render module

Implements VRUT::RenderModule.

Definition at line 76 of file _render.h.

00077               {
00078                      glClearColor(0.8, 0.3, 0.2, 0.0);
00079                      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00080 
00082                      Scene * scene = GetSceneMgr()->GetScene(GetSceneID());
00083                      if (scene)
00084                      {
00087                             BVH * bvh = scene->GetBVH();
00089                             Camera * camera = (Camera *)scene->GetNode(cameraID);
00090                             if (camera && bvh)
00091                             {
00092                                    glMatrixMode(GL_PROJECTION);
00094                                    WriteLocker wrLock(*camera);
00096                                    scene->UpdateTransformation(camera->GetID());
00098                                    unsigned w, h;
00099                                    camera->GetWidthHeight(&w, &h);
00100                                    glViewport(0, 0, w, h);
00101                                    glLoadMatrixf(camera->GetProjectionMatrix()->_m);
00103                                    glMatrixMode(GL_MODELVIEW);
00104                                    glLoadMatrixf(camera->GetWorldTransMatrix()->Inverse()._m);
00105 
00107                                    std::deque<const BVHNode *> queue;
00108                                    queue.push_back(bvh->GetRoot());
00109                                    VECTOR3 color(1,1,1);
00110                                    glDisable(GL_LIGHTING);
00111                                    glDisable(GL_TEXTURE_2D);
00112                                    while (queue.size())
00113                                    {
00114                                           const BVHNode * node = queue.front();
00115                                           queue.pop_front();
00116 
00117                                           if (node)
00118                                           {
00119                                                  glColor3fv(color._v);
00120                                                  VECTOR3 v0(node->GetAABB()->MinBound);
00121                                                  VECTOR3 v7(node->GetAABB()->MaxBound);
00122                                                  VECTOR3 v1(v7.x, v0.y, v0.z);
00123                                                  VECTOR3 v2(v0.x, v7.y, v0.z);
00124                                                  VECTOR3 v3(v7.x, v7.y, v0.z);
00125                                                  VECTOR3 v4(v0.x, v0.y, v7.z);
00126                                                  VECTOR3 v5(v7.x, v0.y, v7.z);
00127                                                  VECTOR3 v6(v0.x, v7.y, v7.z);
00128                                                  glBegin(GL_LINE_STRIP);
00129                                                  glVertex3fv(v0._v);
00130                                                  glVertex3fv(v1._v);
00131                                                  glVertex3fv(v3._v);
00132                                                  glVertex3fv(v2._v);
00133                                                  glVertex3fv(v0._v);
00134                                                  glVertex3fv(v4._v);
00135                                                  glVertex3fv(v6._v);
00136                                                  glVertex3fv(v7._v);
00137                                                  glVertex3fv(v5._v);
00138                                                  glVertex3fv(v4._v);
00139                                                  glVertex3fv(v6._v);
00140                                                  glVertex3fv(v2._v);
00141                                                  glVertex3fv(v3._v);
00142                                                  glVertex3fv(v7._v);
00143                                                  glVertex3fv(v5._v);
00144                                                  glVertex3fv(v1._v);
00145                                                  glEnd();
00146 
00147                                                  queue.push_back(node->GetLChild());
00148                                                  queue.push_back(node->GetRChild());
00149                                           }
00150                                    }
00151                             }
00152                      }
00153               }

virtual void VRUT::_render::Deinitialize (  )  [inline, virtual]

Use this to deinitialize and release render data It is also called by kernel with GL context set so you can use anything like glDelete* etc.

Implements VRUT::RenderModule.

Definition at line 157 of file _render.h.

00158               {
00159               }

virtual void VRUT::_render::processEvent ( wxCommandEvent &  evt  )  [inline, protected, virtual]

Overload this to process events you need.

Always call base method

Remember to process registered param update events

Reimplemented from VRUT::RenderModule.

Definition at line 38 of file _render.h.

00039               {
00041                      RenderModule::processEvent(evt);
00042 
00043                      switch (evt.GetEventType())
00044                      {
00046                      case Event::EVT_PARAM_SET:
00047                             UPDATE_PARAM_FROM_EVENT_INT(varParamID, var, evt);
00048                             break;
00049                      }
00050               }

virtual wxString VRUT::_render::GetDesc (  )  const [inline, virtual]

Always overload method giving description for your module.

Implements VRUT::Module.

Definition at line 69 of file _render.h.

00070               {
00071                      return wxT("This is my module");
00072               }

virtual void VRUT::_render::Draw (  )  [inline, virtual]

This is the most important method in any render module It is called by kernel with GL context properly set so any GL calls can be done here and nowhere else

These are some of the methods provided by base classes

You can use BVH that is already update for you by kernel DO NOT update BVH in module

Get associated camera, again it is associated for you already

You should lock camera for writing as it is shared

and can be modified during update that you should also do before using it

Some projection adjustments

Set view matrix

Let's draw BVH hierarchy to simply show the abilities of render module

Implements VRUT::RenderModule.

Definition at line 76 of file _render.h.

00077               {
00078                      glClearColor(0.8, 0.3, 0.2, 0.0);
00079                      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00080 
00082                      Scene * scene = GetSceneMgr()->GetScene(GetSceneID());
00083                      if (scene)
00084                      {
00087                             BVH * bvh = scene->GetBVH();
00089                             Camera * camera = (Camera *)scene->GetNode(cameraID);
00090                             if (camera && bvh)
00091                             {
00092                                    glMatrixMode(GL_PROJECTION);
00094                                    WriteLocker wrLock(*camera);
00096                                    scene->UpdateTransformation(camera->GetID());
00098                                    unsigned w, h;
00099                                    camera->GetWidthHeight(&w, &h);
00100                                    glViewport(0, 0, w, h);
00101                                    glLoadMatrixf(camera->GetProjectionMatrix()->_m);
00103                                    glMatrixMode(GL_MODELVIEW);
00104                                    glLoadMatrixf(camera->GetWorldTransMatrix()->Inverse()._m);
00105 
00107                                    std::deque<const BVHNode *> queue;
00108                                    queue.push_back(bvh->GetRoot());
00109                                    VECTOR3 color(1,1,1);
00110                                    glDisable(GL_LIGHTING);
00111                                    glDisable(GL_TEXTURE_2D);
00112                                    while (queue.size())
00113                                    {
00114                                           const BVHNode * node = queue.front();
00115                                           queue.pop_front();
00116 
00117                                           if (node)
00118                                           {
00119                                                  glColor3fv(color._v);
00120                                                  VECTOR3 v0(node->GetAABB()->MinBound);
00121                                                  VECTOR3 v7(node->GetAABB()->MaxBound);
00122                                                  VECTOR3 v1(v7.x, v0.y, v0.z);
00123                                                  VECTOR3 v2(v0.x, v7.y, v0.z);
00124                                                  VECTOR3 v3(v7.x, v7.y, v0.z);
00125                                                  VECTOR3 v4(v0.x, v0.y, v7.z);
00126                                                  VECTOR3 v5(v7.x, v0.y, v7.z);
00127                                                  VECTOR3 v6(v0.x, v7.y, v7.z);
00128                                                  glBegin(GL_LINE_STRIP);
00129                                                  glVertex3fv(v0._v);
00130                                                  glVertex3fv(v1._v);
00131                                                  glVertex3fv(v3._v);
00132                                                  glVertex3fv(v2._v);
00133                                                  glVertex3fv(v0._v);
00134                                                  glVertex3fv(v4._v);
00135                                                  glVertex3fv(v6._v);
00136                                                  glVertex3fv(v7._v);
00137                                                  glVertex3fv(v5._v);
00138                                                  glVertex3fv(v4._v);
00139                                                  glVertex3fv(v6._v);
00140                                                  glVertex3fv(v2._v);
00141                                                  glVertex3fv(v3._v);
00142                                                  glVertex3fv(v7._v);
00143                                                  glVertex3fv(v5._v);
00144                                                  glVertex3fv(v1._v);
00145                                                  glEnd();
00146 
00147                                                  queue.push_back(node->GetLChild());
00148                                                  queue.push_back(node->GetRChild());
00149                                           }
00150                                    }
00151                             }
00152                      }
00153               }

virtual void VRUT::_render::Deinitialize (  )  [inline, virtual]

Use this to deinitialize and release render data It is also called by kernel with GL context set so you can use anything like glDelete* etc.

Implements VRUT::RenderModule.

Definition at line 157 of file _render.h.

00158               {
00159               }

virtual void VRUT::_render::processEvent ( wxCommandEvent &  evt  )  [inline, protected, virtual]

Overload this to process events you need.

Always call base method

Remember to process registered param update events

Reimplemented from VRUT::RenderModule.

Definition at line 38 of file _render.h.

00039               {
00041                      RenderModule::processEvent(evt);
00042 
00043                      switch (evt.GetEventType())
00044                      {
00046                      case Event::EVT_PARAM_SET:
00047                             UPDATE_PARAM_FROM_EVENT_INT(varParamID, var, evt);
00048                             break;
00049                      }
00050               }

virtual wxString VRUT::_render::GetDesc (  )  const [inline, virtual]

Always overload method giving description for your module.

Implements VRUT::Module.

Definition at line 69 of file _render.h.

00070               {
00071                      return wxT("This is my module");
00072               }

virtual void VRUT::_render::Draw (  )  [inline, virtual]

This is the most important method in any render module It is called by kernel with GL context properly set so any GL calls can be done here and nowhere else

These are some of the methods provided by base classes

You can use BVH that is already update for you by kernel DO NOT update BVH in module

Get associated camera, again it is associated for you already

You should lock camera for writing as it is shared

and can be modified during update that you should also do before using it

Some projection adjustments

Set view matrix

Let's draw BVH hierarchy to simply show the abilities of render module

Implements VRUT::RenderModule.

Definition at line 76 of file _render.h.

00077               {
00078                      glClearColor(0.8, 0.3, 0.2, 0.0);
00079                      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00080 
00082                      Scene * scene = GetSceneMgr()->GetScene(GetSceneID());
00083                      if (scene)
00084                      {
00087                             BVH * bvh = scene->GetBVH();
00089                             Camera * camera = (Camera *)scene->GetNode(cameraID);
00090                             if (camera && bvh)
00091                             {
00092                                    glMatrixMode(GL_PROJECTION);
00094                                    WriteLocker wrLock(*camera);
00096                                    scene->UpdateTransformation(camera->GetID());
00098                                    unsigned w, h;
00099                                    camera->GetWidthHeight(&w, &h);
00100                                    glViewport(0, 0, w, h);
00101                                    glLoadMatrixf(camera->GetProjectionMatrix()->_m);
00103                                    glMatrixMode(GL_MODELVIEW);
00104                                    glLoadMatrixf(camera->GetWorldTransMatrix()->Inverse()._m);
00105 
00107                                    std::deque<const BVHNode *> queue;
00108                                    queue.push_back(bvh->GetRoot());
00109                                    VECTOR3 color(1,1,1);
00110                                    glDisable(GL_LIGHTING);
00111                                    glDisable(GL_TEXTURE_2D);
00112                                    while (queue.size())
00113                                    {
00114                                           const BVHNode * node = queue.front();
00115                                           queue.pop_front();
00116 
00117                                           if (node)
00118                                           {
00119                                                  glColor3fv(color._v);
00120                                                  VECTOR3 v0(node->GetAABB()->MinBound);
00121                                                  VECTOR3 v7(node->GetAABB()->MaxBound);
00122                                                  VECTOR3 v1(v7.x, v0.y, v0.z);
00123                                                  VECTOR3 v2(v0.x, v7.y, v0.z);
00124                                                  VECTOR3 v3(v7.x, v7.y, v0.z);
00125                                                  VECTOR3 v4(v0.x, v0.y, v7.z);
00126                                                  VECTOR3 v5(v7.x, v0.y, v7.z);
00127                                                  VECTOR3 v6(v0.x, v7.y, v7.z);
00128                                                  glBegin(GL_LINE_STRIP);
00129                                                  glVertex3fv(v0._v);
00130                                                  glVertex3fv(v1._v);
00131                                                  glVertex3fv(v3._v);
00132                                                  glVertex3fv(v2._v);
00133                                                  glVertex3fv(v0._v);
00134                                                  glVertex3fv(v4._v);
00135                                                  glVertex3fv(v6._v);
00136                                                  glVertex3fv(v7._v);
00137                                                  glVertex3fv(v5._v);
00138                                                  glVertex3fv(v4._v);
00139                                                  glVertex3fv(v6._v);
00140                                                  glVertex3fv(v2._v);
00141                                                  glVertex3fv(v3._v);
00142                                                  glVertex3fv(v7._v);
00143                                                  glVertex3fv(v5._v);
00144                                                  glVertex3fv(v1._v);
00145                                                  glEnd();
00146 
00147                                                  queue.push_back(node->GetLChild());
00148                                                  queue.push_back(node->GetRChild());
00149                                           }
00150                                    }
00151                             }
00152                      }
00153               }

virtual void VRUT::_render::Deinitialize (  )  [inline, virtual]

Use this to deinitialize and release render data It is also called by kernel with GL context set so you can use anything like glDelete* etc.

Implements VRUT::RenderModule.

Definition at line 157 of file _render.h.

00158               {
00159               }


Member Data Documentation

int VRUT::_render::var [protected]

Add any variables.

Definition at line 33 of file _render.h.

Add var param identificator to register this as parameter.

Definition at line 35 of file _render.h.


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

Generated on Tue Mar 10 14:41:45 2009 for VRUT by  doxygen 1.5.5