VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtCameraPointerStateAttribute.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2023 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/DtDe.h>
13 #include <vrvOsg/vrvOsg.h>
15 
16 #include <osg/StateAttribute>
17 #include <osg/observer_ptr>
18 #include <osg/Camera>
19 
20 namespace makVrv
21 {
22 
27  class DT_DLL_VRVOSG DtCameraPointerStateAttribute : public osg::StateAttribute
28  {
29  public:
30 
32  DtCameraPointerStateAttribute(const osg::Camera* camera);
33 
36  const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
37 
40 
41  public:
42 
44  // OSG-required overrides:
45 
48  virtual void apply(osg::State& state) const override;
49 
50  virtual osg::Object* cloneType() const override;
51 
52  virtual osg::Object* clone(const osg::CopyOp& copyop) const override;
53 
54  virtual bool isSameKindAs(const osg::Object* obj) const override;
55 
56  virtual const char *libraryName() const override;
57 
58  virtual const char *className() const override;
59 
60  virtual Type getType() const override;
61 
62  virtual bool getModeUsage(osg::StateAttribute::ModeUsage& usage) const override;
63 
64  virtual int compare(const StateAttribute& sa) const override;
66 
68  virtual bool lock(osg::ref_ptr<const osg::Camera>& osgCameraRefPtr) const;
69 
70  public:
74  static Type theStateAttributeType();
75 
76  protected:
77  // Store it as an observer pointer instead of raw pointer
78  // The attribute can get copied to a default global attribute
79  // This global attribute may get applied while the original camera (and hence original attribute got deleted just before it)
80  // see: https://jira.mak.com/browse/VRV-4772
81  osg::observer_ptr<const osg::Camera> myCameraObserverPointer;
82  };
83 }
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Definition: featureContext.h:37
Contains makVrv::DtOsgLightManager class.
Contains makVrv::DtDe class.
osg::observer_ptr< const osg::Camera > myCameraObserverPointer
Definition: DtCameraPointerStateAttribute.h:81
Contains DLL export macros.
a state attribute which should be applied to every camera that needs lighting enabled so that the DtL...
Definition: DtCameraPointerStateAttribute.h:27

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)