![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2010 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtModelInstance.h,v $ $Revision: 1.11 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #pragma once 00014 00015 #include <vrvCore/vrvCore.h> 00016 #include <vrvCore/DtUniqueID.h> 00017 #include <vrvUtil/DtVirtualBaseClass.h> 00018 00019 #include <string> 00020 #include <vector> 00021 00022 #include <matrix/vlVector.h> 00023 #include <matrix/vlTaitBryan.h> 00024 00025 #include <boost/signal.hpp> 00026 00027 namespace makVrv 00028 { 00029 class DtModelDefinition; 00030 class DtDe; 00031 00036 class DT_DLL_VRVCORE DtModelInstance 00037 { 00038 public: 00039 00041 DtModelInstance(DtDe& de); 00042 00044 virtual ~DtModelInstance(); 00045 00048 virtual bool realize(DtModelDefinition& definition); 00049 00052 const std::string& realizedDefinitionName() const; 00053 00055 virtual bool saveModelToFile(const std::string& filename) const; 00056 00058 const DtVector& boundingBoxExtents() const; 00059 00061 void getBoundingBoxExtents(double& x, double& y, double& z) const; 00062 00064 const DtVector& boundingBoxCenter() const; 00065 00067 void getBoundingBoxCenter(double& x, double& y, double& z) const; 00068 00069 void getBoundingBoxComponents( DtVector& minimum, DtVector& maximum ); 00070 00073 virtual void setContributesToBound( bool trueOrFalse ); 00074 00077 bool contributesToBound() const; 00078 00080 virtual void setVisible(bool isVisible) = 0; 00081 00083 virtual void setVisibleViaSwitch(bool isVisible) = 0; 00084 00086 virtual void setBlendColor(float r, float g, float b, float a); 00087 00089 virtual void enableColorBlending( bool b ); 00090 00091 //Utility function for reading a float from a definition. 00092 static float readFloat(const std::string& paramName, const DtModelDefinition& definition); 00093 00094 //Utility function for reading a Vec4 from a definition. 00095 static DtVector readVector(const std::string& paramName, const DtModelDefinition& definition); 00096 00097 boost::signal<void (DtModelInstance*)> signal_modelInstanceChanged; 00098 00099 protected: 00100 00101 DtDe& myDe; 00102 std::string myRealizedModelDefinitionName; 00103 DtVector myBoundingBoxCenter; 00104 DtVector myBoundingBoxExtents; 00105 DtVector myBoundingBoxMinimum; 00106 DtVector myBoundingBoxMaximum; 00107 bool myContributesToBound; 00108 bool myColorBlendingEnabled; 00109 float myBlendRed; 00110 float myBlendBlue; 00111 float myBlendGreen; 00112 float myBlendAlpha; 00113 00114 }; 00115 00118 class DT_DLL_VRVCORE DtModelInstanceCreator : public DtVirtualBaseClass 00119 { 00120 public: 00121 00123 virtual ~DtModelInstanceCreator(); 00124 00126 virtual DtModelInstance* create(DtDe& de) = 0; 00127 00128 protected: 00129 00130 DtModelInstanceCreator(); 00131 }; 00132 00133 } 00134 00135