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

mitkScene.h

00001 /*=========================================================================
00002 
00003   Program:   3DMed
00004   Date:      $Date: 2014-02-25 18:30:00 +0800 $
00005   Version:   $Version: 4.6.0 $
00006   Copyright: MIPG, Institute of Automation, Chinese Academy of Sciences
00007 
00008 =========================================================================*/
00009 
00010 #ifndef __mitkScene_h
00011 #define __mitkScene_h
00012 
00013 #include "mitkSceneBase.h"
00014 #include "mitkRCPtr.h"
00015 #include "mitkManipulator.h"
00016 #include "mitkQuaternion.h"
00017 #include "mitkCamera.h"
00018 #include "mitkLight.h"
00019 
00020 class mitkList;
00021 class mitkModel;
00022 
00034 class MITK_VISUALIZATION_API mitkScene : public mitkSceneBase
00035 {
00036 public:
00037     MITK_TYPE(mitkScene,mitkSceneBase)
00038     mitkScene();
00039     mitkScene(mitkSceneContainer* container);
00040 protected:
00041     virtual ~mitkScene();
00042 
00043 public:
00044 // Scene Functions
00054     const int * GetViewPort() { return m_ViewPort; }
00065     void GetViewPort(int vp[4])
00066     {
00067         vp[0] = m_ViewPort[0];
00068         vp[1] = m_ViewPort[1];
00069         vp[2] = m_ViewPort[2];
00070         vp[3] = m_ViewPort[3];
00071     }
00075     virtual void InitGL();
00079     virtual void DestroyGL();
00083     virtual void ResizeGL(int newX, int newY);
00087     virtual void RenderGL();
00091     virtual void OnMouseDown(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00095     virtual void OnMouseUp(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00099     virtual void OnMouseMove(bool ctrlDown, bool shiftDown, int xPos, int yPos);
00103     virtual void OnMouseWheel(bool ctrlDown, bool shiftDown, int xPos, int yPos, int delta);
00113     void SetBackColor(unsigned char rColor, unsigned char gColor, unsigned char bColor);
00123     void SetBackColor(float rColor, float gColor, float bColor);
00133     void SetBackColor(int rColor, int gColor, int bColor);
00143     void GetBackColor(float &rColor, float &gColor, float &bColor);
00153     void GetBackColor(unsigned char &rColor, unsigned char &gColor, unsigned char &bColor);
00163     void GetBackColor(int &rColor, int &gColor, int &bColor);
00167     virtual void ResetScene();
00174     virtual void Translate(float deltX, float deltY, float deltZ);
00182     virtual void Rotate(float deltX, float deltY, float deltZ);
00191     virtual void Rotate(float ax, float ay, float az, float angle);
00197     virtual void Rotate(const mitkQuaternion &q);
00204     virtual void SetRotation(float x, float y, float z);
00212     virtual void SetRotation(float ax, float ay, float az, float angle);
00217     virtual void SetRotation(const mitkQuaternion &q);
00223     virtual void Scale(float delt);
00228     virtual mitkManipulator* CreateManipulator();
00235     void SetManipulator(mitkManipulator *mani);
00248     void AddModel(mitkModel *model);    
00255     void RemoveModel(mitkModel *model);
00260     void RemoveModel(int i);
00264     void RemoveAllModels();
00268     void RemoveAllModel() { this->RemoveAllModels(); }
00274     mitkModel* GetModel(int i);
00280     mitkList*  GetModels();
00285     int GetModelCount();
00289     int GetNumberOfPropsRendered() {return m_NumberOfPropsRendered;}
00294     void SetCamera(mitkCamera *cam);
00299     mitkCamera* GetCamera();
00306     void SetDefaultLight(mitkLight *lit);
00313     mitkLight* GetDefaultLight();
00317     mitkLight* GetLight() { return this->GetDefaultLight(); }
00323     void AddAdditionalLight(mitkLight *lit);
00328     void RemoveAdditionalLight(int idx);
00335     void RemoveAdditionalLight(mitkLight *lit);
00339     void RemoveAllAdditionalLights();
00344     int GetAdditionalLightCount();
00349     mitkLight* GetAdditionalLight(int idx);
00353     void AlignScene();
00364     float* GetZbufferData(int x1, int y1, int x2, int y2);
00379     void GetZbufferData(int x1, int y1, int x2, int y2, float *buffer);
00391     unsigned char* GetPixelData(int xOffset, int yOffset, int width, int height);
00413     void GetPixelData(int xOffset, int yOffset, int width, int height, unsigned char *buffer, int packAlignment = 4, bool swapRGB = false)
00414     { this->GetPixelData24(xOffset, yOffset, width, height, buffer, packAlignment, swapRGB); }
00434     void GetPixelData24(int xOffset, int yOffset, int width, int height, unsigned char *buffer, int packAlignment = 4, bool swapRGB = false);
00449     void GetPixelData32(int xOffset, int yOffset, int width, int height, unsigned char *buffer, bool swapRGB = false);
00456     void  SetSelected(bool isSelected) {if(isSelected) m_Selected = 1; else m_Selected = 0;}
00463     bool  GetSelected() {return (m_Selected) ? true : false;}
00467     float GetTranslateSpeed() { return m_TranslateSpeed; }
00473     float GetTranslationX()    { return m_TransX; }
00479     float GetTranslationY()    { return m_TransY; }
00485     float GetTranslationZ()    { return m_TransZ; }
00493     void   GetTranslation(float trans[3]) {trans[0] = m_TransX; trans[1] = m_TransY; trans[2] = m_TransZ;}
00498     const mitkQuaternion& GetRotation() { return m_Rot; }
00503     float GetScale() { return m_Scale; }
00509     void EnableLoD();
00515     void DisableLoD();
00520     bool IsLoDEnabled();
00525     bool IsModelsModified() 
00526     {
00527         return m_ModelsModified!=0;
00528     }
00533     bool IsCameraModified()
00534     {
00535         return m_CameraModified!=0;
00536     }
00541     bool IsAdditionalLightModified()
00542     {
00543         return m_AdditionalLightModified!=0;
00544     }   
00545 
00546 protected:
00547     mitkScene(const mitkScene&);
00548     void operator = (const mitkScene&);
00549 
00550     float m_RotX, m_RotY, m_RotZ, m_RotateSpeed;
00551     float m_RotDeltX, m_RotDeltY, m_RotDeltZ;
00552     mitkQuaternion m_Rot;
00553     float m_TransX, m_TransY, m_TransZ, m_TranslateSpeed;
00554     float m_Scale, m_ScaleSpeed;
00555     
00556     float m_BackColor[4];
00557     int   m_ViewPort[4];
00558 
00559     
00560     mitkRCPtr<mitkManipulator> m_Mani;
00561     mitkRCPtr<mitkCamera> m_Camera; 
00562     mitkRCPtr<mitkLight> m_Light;
00563     mitkList *m_AdditionalLights;
00564     mitkList *m_Models;
00565     mitkModel **m_VisibleModels;
00566     int m_NumberOfPropsRendered;
00567     int m_RotAccuCount;
00568     unsigned char m_VisibleModelCount;  
00569     unsigned char m_CameraModified;
00570     unsigned char m_AdditionalLightModified;
00571     unsigned char m_Selected;
00572     unsigned char m_ModelsModified;
00573 
00574 
00575     void _init();
00576     void _drawScene();
00577     void _drawBorder();
00578     void _drawLights();
00579     bool _isAdditionalLightsModified();
00580     void _rotateModels();
00581 
00582 };
00583 
00584 #endif
00585 

Generated on Tue Feb 25 15:00:37 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3