VR-Forces 4.0.4 Class Documentation
include/vrvOsg/DtEllipsoidModelInstance.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2011 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile: DtEllipsoidModelInstance.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/ShapeDrawable>
00019 #include <osg/Material>
00020 
00021 namespace makVrv
00022 {
00025    class DT_DLL_VRVOSG DtEllipsoidModelInstance : public DtOsgModelInstance
00026    {
00027    public:
00028 
00030       DtEllipsoidModelInstance(DtDe& de);
00031 
00033       virtual ~DtEllipsoidModelInstance();
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::ShapeDrawable> myEllipsoidDrawable;
00085       osg::ref_ptr<osg::Geode> myGeode;
00087       osg::ref_ptr<osg::Geode> myBlendedGeode;
00089       osg::ref_ptr<osg::Geode> myFrontGeode;
00091       osg::ref_ptr<osg::Geode> myBackGeode;
00093       osg::ref_ptr<osg::MatrixTransform> myTransform;
00095       osg::ref_ptr<osg::Material> myMaterial;
00096 
00097       bool mySingleSided;
00098    };
00099 
00102    class DT_DLL_VRVOSG DtEllipsoidModelInstanceCreator : public DtModelInstanceCreator
00103    {
00104    public:      
00105 
00107       static void registerCreator(DtDe& de);
00108 
00110       virtual ~DtEllipsoidModelInstanceCreator ();
00111 
00113       virtual DtModelInstance* create(DtDe& de);
00114 
00115    protected:
00116 
00117       DtEllipsoidModelInstanceCreator ();
00118    };
00119 }
00120 

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)