VR-Vantage 1.4.1 API Class Documentation
DtChannel.h
Go to the documentation of this file.
00001 /****************************************************************************** 
00002 ** Copyright (c) 2010 MAK Technologies, Inc. 
00003 ** All rights reserved. 
00004 ******************************************************************************/ 
00005 /****************************************************************************** 
00006 ** $RCSfile: DtChannel.h,v $ $Revision: 1.43 $ $State: Exp $ 
00007 ******************************************************************************/ 
00008  
00012  
00013 #pragma once 
00014 #include <vrvCore/vrvCore.h> 
00015 #include <vrvUtil/DtSignalConnectionManager.h>
00016 #include <vrvUtil/DtVirtualBaseClass.h>
00017 #include <vrvUtil/DtChannelConfiguration.h>
00018 #include <boost/signals.hpp>
00019 
00020 namespace makVrv 
00021 { 
00022    class DtDe;
00023    class DtWindow;
00024    class DtCameraObject;
00025    class DtObserverObject;
00026    class DtMouseEvent;
00027    class DtKeyEvent;
00028 
00031    class DT_DLL_VRVCORE DtChannel
00032    { 
00033 
00034    protected:
00036       DtChannel(DtDe& de, DtWindow* window,DtChannelConfiguration&);
00037 
00038    public:
00039 
00041       virtual ~DtChannel();
00042 
00044       DtObserverObject* findObserver() const;
00045 
00047       unsigned int currentModelSet() const;
00048 
00050       virtual void setClearColor(float r,float g,float b, float a) = 0;
00051 
00053       virtual void setViewport(int x,int y,int width, int height) = 0;
00054 
00056       virtual void getViewport(int& x,int& y, int& width,int& height) const = 0;
00057 
00059       virtual void setWindow(DtWindow*) = 0;
00060 
00062       virtual void setCameraPosition(double x, double y, double z) = 0;
00063 
00065       virtual const DtWindow* window() const = 0;
00066 
00068       virtual void update() = 0;
00069 
00071       const DtChannelConfiguration& configuration() const;
00072 
00077       virtual void setCameraObject(DtCameraObject* cameraObject) = 0;
00078 
00082       virtual void setParentCameraObject(DtCameraObject* cameraObject) = 0;
00083 
00086       virtual void updateProjection() = 0;
00087 
00089       virtual void setDynamicNearFar(bool enable) = 0;
00090 
00093       virtual void setNearFarRatio(double ratio) = 0;
00094 
00096       void setObserverName( const std::string& observerName );
00097 
00100       virtual void setProjectionResizePolicy(
00101          DtChannelConfiguration::ProjectionResizePolicy policy);
00102 
00105       virtual DtChannelConfiguration::ProjectionResizePolicy 
00106          projectionResizePolicy() const;
00107 
00109       virtual bool processMouseEvent( const DtMouseEvent& ev) = 0;
00110 
00112       virtual bool processKeyboardEvent( const DtKeyEvent& ev) = 0;
00113       
00116       virtual void projectToScreen( double dbX, double dbY, double dbZ,
00117          double& screenX, double& screenY, double& screenZ ) = 0;
00118          
00120       virtual void projectToWorld( double screenX, double screenY,
00121          double& dbX, double& dbY, double& dbZ ) = 0;
00122          
00123       virtual void warpMouse( float pixelX, float pixelY ) = 0;
00124       
00125    protected:
00128       virtual void setProjectionMatrixAsPerspective(double fovy,
00129          double   aspectRatio, double zNear, double zFar) = 0;
00130 
00132       virtual void setProjectionMatrixAsFrustum (double left, double right, 
00133          double bottom, double top, 
00134          double zNear, double zFar) = 0;
00135          
00136       virtual void connectToObserver() = 0;
00137       
00138       void observerAdded( const std::string& observerName );
00139       void observerRemoved( const std::string& observerName );
00140 
00141    protected:
00142       
00143       DtDe& myDe;
00144       DtChannelConfiguration& myChannelConfiguration;
00145       DtSignalConnectionManager myConnections;
00146 
00147       int myModelSet;
00148       DtObserverObject* myObserver;
00149       std::string myObserverName;
00150       DtChannelConfiguration::ProjectionResizePolicy myProjectionResizePolicy;
00151    };
00152 
00157    class DT_DLL_VRVCORE DtChannelCreator : public DtVirtualBaseClass
00158    {
00159 
00160    public:
00163       static DtChannelCreator& instance(DtDe& theIG);
00164 
00166       static void registerInstance(DtDe& de, DtChannelCreator* instance);     
00167       
00169       virtual DtChannel* create(DtDe& de, DtWindow* window, 
00170          DtChannelConfiguration&) = 0;
00171    };
00172 } 


Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)