![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /***************************************************************************** 00002 * Copyright (c) 2011 MAK Technologies, Inc. 00003 * All rights reserved. 00004 *****************************************************************************/ 00005 00009 00010 #pragma once 00011 00012 #include <vrvOsg/vrvOsg.h> 00013 #include <vrvCore/DtDe.h> 00014 00015 #include <osg/Node> 00016 #include <osg/BoundingBox> 00017 #include <osg/Matrix> 00018 #include <osg/Texture> 00019 #include <osg/TexEnv> 00020 00021 #include <string> 00022 00023 00024 namespace makVrv 00025 { 00026 00029 class DT_DLL_VRVOSG DtOsgTexturizer 00030 { 00031 public: 00032 00033 DtOsgTexturizer( DtDe& de ); 00034 00038 virtual void drapeTexture(osg::Node* node, const std::string& definition, int textureunit = 0); 00039 00043 virtual void drapeTexture(osg::Node* node, const std::string& definition, 00044 std::vector<double> scale, std::vector<double> offset, 00045 osg::TexEnv::Mode blendmode = osg::TexEnv::MODULATE, 00046 osg::Texture::WrapMode wrapMode = osg::Texture::REPEAT, int textureunit = 0); 00047 00052 virtual void colorizeByElevation(osg::Node* node, 00053 const std::string& definition, int textureunit = 0); 00054 00059 virtual void drawContours(osg::Node* node, const std::string& definition, 00060 int textureunit = 0); 00061 00068 virtual void enableAutoTexturing(osg::Node* node); 00069 00072 virtual void blankMaterial(osg::Node* node, int minunit=0, int maxunit=3); 00073 00075 virtual void defaultDrapeParameters(osg::Node* node, 00076 const std::string& definition, double& xScale, double& yScale, 00077 double& xOffset, double& yOffset, osg::Texture::WrapMode& wrapMode, 00078 osg::TexEnv::Mode& blendMode); 00079 00081 virtual void reset(osg::Node* node, int minunit=0, int maxunit=3); 00082 00084 virtual void resetUnit(osg::Node* node, int unit); 00085 00086 protected: 00087 00088 //Create a gradient image. 00089 osg::Image* createGradientImageRGBA(const std::string& def, int resolution = 256); 00090 00092 virtual void graphBoundingBox(const osg::Node* node, 00093 osg::BoundingBox &bbox) const; 00094 00097 virtual void project2dTexture(osg::Node* node, const std::string& texdef, 00098 osg::Matrix mat, osg::Texture::WrapMode wrapmode, 00099 osg::TexEnv::Mode blendmode, unsigned int texunit); 00100 00103 virtual void project1dTexture(osg::Node* node, const std::string& texdef, 00104 osg::Matrix mat, osg::Texture::WrapMode wrapmode, 00105 osg::TexEnv::Mode blendmode, unsigned int texunit); 00106 00109 virtual void rescaleTexture(osg::Node* node, osg::Matrix mat, 00110 osg::TexEnv::Mode blendmode, unsigned int texunit); 00111 00114 virtual bool isNameTextureExempt(const std::string& name) const; 00115 00117 virtual osg::Image* convertImageToRGBA(osg::Image* img); 00118 00119 DtDe& myDe; 00120 }; 00121 } 00122