VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtEffectTextureRegistry.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2019 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
17 
19 
20 #include <osg/ExtendedMaterial>
21 
22 #include <string>
23 #include <boost/thread/shared_mutex.hpp>
24 
25 namespace makVrv
26 {
27  class DtDe;
28 
33  {
34 
35  protected:
36 
39  {
41  std::string readableString;
42  std::string typeString;
44  std::set<osg::ExtendedMaterial::EffectTextureLayer> extendedMaterialLayer;
45  std::string effectTexturePostfix;
46  };
47 
48  protected:
49  //protected constructor so it can never be instantiated by accident.
51 
52  //destructor
54 
55  private:
59  DtEffectTextureRegistry &operator=(const DtEffectTextureRegistry &other);
60 
61  public:
62 
64  int effectTextureTypeFromName(const std::string& texName);
65 
67  bool isEffectTexture(const std::string& texName, const std::string& effectTypeCode);
68 
70  bool isEffectTexture(const osg::Texture* tex, const std::string& texName, const std::string& effectTypeCode);
71 
72  // get the name of the texture without path, extension,
73  // underScore(represent the original extension for meif texture)
74  // a/b/c_png.meif => c
75  // a.rgb=>a
76  std::string getTextureNameLessExtension(const std::string& baseFileName);
77 
78  // find the extended name for a texture file.
79  std::string getExtendedFileName(const std::string& baseFileName, const std::string& effectTypeCode);
80 
81  // get the effect texture type given the extended material type
82  int effectTextureTypeFrom(osg::ExtendedMaterial::EffectTextureLayer extendedMaterialLayer);
83 
84  // Given the file name of a base texture, populate the output
85  // vector with possible file names for corresponding effect textures.
86  void getPossibleEffectTextureFileNames(const std::string& baseFileName, std::vector<std::string>& output, const std::string& effectTypeCode);
87 
89  void registerEffectTextureType(int effectTextureType,
90  const std::string& readableString,
91  const std::string& typeString,
92  const std::string& postfix,
93  bool isExtendedMaterialType,
94  const std::set<osg::ExtendedMaterial::EffectTextureLayer>& extendedMaterialLayer = std::set<osg::ExtendedMaterial::EffectTextureLayer>());
95 
97  void registerIndirectShaderEffectTexturetype(int effectTextureType, const DtIndirectEffectTextureShader& indirectEffectTextureShader);
98 
100  bool hasIndirectShaderForType(int effectTextureType) const;
101 
103  DtIndirectEffectTextureShader indirectEffectTextureShaderForType(int effectTextureType) const;
104 
106  std::string toString(int effectTextureType);
108  std::string toDtEffectTextureTypeString(int effectTextureType);
109 
111  std::string toTextureMapNameString(int effectTextureType) const;
112 
114  std::string toTextureCoordNameString(int effectTextureType) const;
115 
117  std::string getTextureArrayPattern(const std::string& effectUnitName);
118 
120  std::string getTextureArrayReplacement(const std::string& effectUnitName);
121 
123  bool isSupportedByExtendedMaterial(int effectTextureType);
124 
127  bool effectTextureInstalled(const std::string& baseTextureName, const osg::StateSet* stateSet, const std::string& effectTypeCode);
128 
130  std::string getTextureFilePathAndSetNameIfNotSet(const osg::Texture* texture, bool doSetName);
131 
133  bool isRemoteTexture(const std::string& texturePath);
134 
137  DtIndirectEffectTexturesTemplate effectTexturesTemplate();
138 
139  public:
140 
142  static DtEffectTextureRegistry& instance(DtDe& de);
143 
144  protected:
145 
146  typedef std::map<int, EffectTextureTypeInfo> IntEffectTextureTypeMap;
148 
149  std::map<int, DtIndirectEffectTextureShader> myMapTypeToFXTextureShader;
150 
152 
153  boost::shared_mutex myEffectTextureInfoTypeMapMutex;
154 
156 
158  mutable boost::shared_mutex myMutableMapTypeToFxTextureShaderMutex;
159 
160  protected:
162 
163  };
164 }
boost::shared_mutex myMutableMapTypeToFxTextureShaderMutex
mutable so the accessor function for the map can be const.
Definition: DtEffectTextureRegistry.h:158
std::map< int, EffectTextureTypeInfo > IntEffectTextureTypeMap
Definition: DtEffectTextureRegistry.h:146
Contains info about the shader file, execution priority and name of the shader corresponding to a par...
Definition: DtIndirectEffectTextureShader.h:25
Contains makVrv::DtEffectTextureType declaration.
std::string typeString
Definition: DtEffectTextureRegistry.h:42
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
static const DtIndirectEffectTextureShader theDummyShader
Definition: DtEffectTextureRegistry.h:161
data only struct for holding information about a particular effect texture type
Definition: DtEffectTextureRegistry.h:38
std::map< int, DtIndirectEffectTextureShader > myMapTypeToFXTextureShader
Definition: DtEffectTextureRegistry.h:149
Contains the DtIndirectEffectTexturesTemplate class declaration.
Contains makVrv::DtVirtualBaseClass class.
class which holds some static utility functions for handling effect textures once we work out how to ...
Definition: DtEffectTextureRegistry.h:32
DtIndirectEffectTexturesTemplate myEffectTexturesTemplate
Definition: DtEffectTextureRegistry.h:155
bool isExtendedMaterialType
Definition: DtEffectTextureRegistry.h:43
Contains the DtIndirectEffectTextureShader class declaration.
std::string effectTexturePostfix
Definition: DtEffectTextureRegistry.h:45
int effectTextureType
Definition: DtEffectTextureRegistry.h:40
std::set< osg::ExtendedMaterial::EffectTextureLayer > extendedMaterialLayer
Definition: DtEffectTextureRegistry.h:44
DtDe & myDe
Definition: DtEffectTextureRegistry.h:151
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:72
Class that allows you to abstractly register effect texture types the effect texture types are client...
Definition: DtIndirectEffectTexturesTemplate.h:40
std::string readableString
Definition: DtEffectTextureRegistry.h:41
IntEffectTextureTypeMap myEffectTextureTypeInfoMap
Definition: DtEffectTextureRegistry.h:147
boost::shared_mutex myEffectTextureInfoTypeMapMutex
Definition: DtEffectTextureRegistry.h:153

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)