VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtDiGuyOsgGraphicsTexture.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2022 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvDiGuy/vrvDiGuy.h>
13 
14 #include <diguyGraphicsTexture.h>
15 
16 #include <osg/Image>
17 #include <osg/StateSet>
18 #include <osg/Texture2D>
19 
20 #include <atomic>
21 
22 namespace makVrv
23 {
24 
25  class DtDe;
26 
31  {
32  public:
33 
34  DtDiGuyOsgGraphicsTexture( void* internal_data );
35  virtual ~DtDiGuyOsgGraphicsTexture();
36 
37  private:
38 
41 
43  DtDiGuyOsgGraphicsTexture& operator = ( const DtDiGuyOsgGraphicsTexture& ) = delete;
44 
45  public:
46 
47  virtual void asynchronous_post_load() override;
48 
49  virtual void build() override;
50  virtual void unbuild() override;
51 
52  // needed for particle rendering
53  virtual void bind_now( diguyTextureMapType texture_type );
54 
55  osg::Texture2D* texture() { return m_texture.get(); }
56  void releaseGLObjects();
57 
58  static void setCurrentStateForTextureBind( osg::State* state ) { sm_state = state; }
59 
60  static int numActiveTextures() { return theTotalCounter.myCount; }
61 
62  public:
63 
64  typedef std::vector<DtDiGuyOsgGraphicsTexture*> TextureList;
65 
67 
68  // FIXME: should refactor to rooted singleton pattern
70 
71  protected:
72 
74  struct TotalCounter
75  {
76  TotalCounter();
77  virtual ~TotalCounter();
78  std::atomic<int> myCount;
79  };
80 
81  static bool theTrackObjects;
83 
86 
87  int myId = 0;
88 
89  };
90 
91 }
92 
93 // Create function declaration.
94 // Declare a subclass creation function that will be registered with the DI-Guy Graphics API.
static bool theTrackObjects
Definition: DtDiGuyOsgGraphicsTexture.h:81
std::atomic< int > myCount
Definition: DtDiGuyOsgGraphicsTexture.h:78
static void setCurrentStateForTextureBind(osg::State *state)
Definition: DtDiGuyOsgGraphicsTexture.h:58
osg::Texture2D * texture()
Definition: DtDiGuyOsgGraphicsTexture.h:55
structure to count total number of DtDiGuyOsgGraphicsTexture(s) in the system
Definition: DtDiGuyOsgGraphicsTexture.h:74
osg::ref_ptr< osg::Texture2D > m_texture
Definition: DtDiGuyOsgGraphicsTexture.h:84
diguyGraphicsTexture * diguyOsgGraphicsTexture_create_func(void *internal_data)
static TextureList s_textures
Definition: DtDiGuyOsgGraphicsTexture.h:69
Contains DLL export macros.
std::vector< DtDiGuyOsgGraphicsTexture * > TextureList
Definition: DtDiGuyOsgGraphicsTexture.h:64
static int numActiveTextures()
Definition: DtDiGuyOsgGraphicsTexture.h:60
DtDiGuyOsgGraphicsTexture publicly inherits diguyGraphicsTexture. Virtual functions are declared for ...
Definition: DtDiGuyOsgGraphicsTexture.h:30
osg::ref_ptr< osg::Image > m_image
Definition: DtDiGuyOsgGraphicsTexture.h:85
static osg::ref_ptr< osg::State > sm_state
Definition: DtDiGuyOsgGraphicsTexture.h:66
#define DT_DLL_VRVDIGUY
Definition: vrvDiGuy.h:21
static TotalCounter theTotalCounter
Definition: DtDiGuyOsgGraphicsTexture.h:82

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)