VR-Forces 4.0.4 Class Documentation
include/vrvOsg/DtCylinderModelInstance.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2009 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile: DtCylinderModelInstance.h,v $ $Revision: 1.0 $ $State: Exp $
00007 ******************************************************************************/
00008 
00012 
00013 #pragma once
00014 #include <vrvOsg/vrvOsg.h>
00015 #include <vrvOsg/DtOsgModelInstance.h>
00016 #include <osg/Geode>
00017 #include <osg/MatrixTransform>
00018 #include <osg/Drawable>
00019 #include <osg/Material>
00020 
00021 namespace makVrv
00022 {
00025    class DT_DLL_VRVOSG DtCylinderModelInstance : public DtOsgModelInstance
00026    {
00027    public:
00028 
00030       DtCylinderModelInstance(DtDe& de);
00031 
00033       virtual ~DtCylinderModelInstance();
00034 
00036       virtual void setDimensions(float length, float width, float height);
00037 
00039       virtual void dimensions(float& length, float& width, float& height);
00040 
00042       virtual void setColor(float r,float g,float b,float a);
00043 
00045       virtual void setColor(const osg::Vec4& color);
00046 
00048       const osg::Vec4& color() const;
00049 
00051       virtual void setLightingEnabled( bool enabled );
00052 
00055       virtual bool realize(DtModelDefinition& definition);
00056 
00058       virtual void setVisible(bool isVisible) {}
00059 
00060    protected:
00061 
00063       virtual void updateColors();
00064 
00066       virtual void updateTransform();
00067 
00069       void createBlendedGeodes();
00070 
00072       void createOpaqueGeode();
00073 
00075       void createSingleSidedBlendedGeode();
00076 
00077    protected:
00078 
00080       osg::Vec3 myDimensions;
00081       osg::Vec4 myColor;
00082 
00083       osg::ref_ptr<osg::Drawable> myCylinderDrawable;
00085       osg::ref_ptr<osg::Geode> myGeode;
00087       osg::ref_ptr<osg::Geode> myBlendedGeode;
00088 
00090       osg::ref_ptr<osg::Geode> myFrontGeode;
00092       osg::ref_ptr<osg::Geode> myBackGeode;
00094       osg::ref_ptr<osg::MatrixTransform> myTransform;
00096       osg::ref_ptr<osg::Material> myMaterial;
00097 
00098       bool mySingleSided;
00099    };
00100 
00103    class DT_DLL_VRVOSG DtCylinderModelInstanceCreator : public DtModelInstanceCreator
00104    {
00105    public:      
00106 
00108       static void registerCreator(DtDe& de);
00109 
00111       virtual ~DtCylinderModelInstanceCreator ();
00112 
00114       virtual DtModelInstance* create(DtDe& de);
00115 
00116    protected:
00117 
00118       DtCylinderModelInstanceCreator ();
00119    };
00120 }
00121 

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)