VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtTextureInterface.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/vrvCore.h>
13 #include <vrvCore/DtFileCache.h>
14 
16 
17 #include <vrvMath/DtVector4.h>
18 
19 #include <cstdint>
20 
21 namespace makVrv
22 {
23  class DtDe;
24 
27  {
28  public:
31 
33  virtual ~DtTextureInterface();
34 
36  DtTextureInterface( const DtTextureInterface& ) = delete;
37 
39  DtTextureInterface & operator=( const DtTextureInterface& ) = delete;
40 
41  public:
46  virtual bool loadTextureFromFile( const std::string& fileName ) = 0;
47 
57  virtual bool allocateGpuStorage( const std::string& key, int width, int height ) { return false; }
58 
64  virtual void setCpuBackingBuffer( const uint8_t* pixels ) {}
65 
70  virtual bool markCpuBackingBufferDirty() { return false; }
71 
85  virtual bool enqueueSubRegion( int x, int y, int width, int height,
86  const uint8_t* rgbaPixels ) { return false; }
87 
88  virtual bool loadTextureFromFile( const std::string& fileName,
89  const DtFileCache::LoadFileOptions& loadFileOptions ) = 0;
90 
93  virtual const std::string& filename() const = 0;
94 
95  virtual float textureWidth() const = 0;
96 
97  virtual void scaleTexture( int w, int h ) = 0;
98 
100  virtual bool getStipplePattern(char** stipplePattern) = 0;
101 
103  virtual bool valid() const = 0;
104 
106  virtual DtVector4<float> color(unsigned int x, unsigned int y) const = 0;
107  };
108 
110  {
111  public:
114  static DtTextureInterfaceCreator& instance( DtDe& );
115 
117  static void registerInstance( DtDe& de, DtTextureInterfaceCreator* anInstance );
118 
121  static DtTextureInterfaceCreator* instanceGl( DtDe& de );
122 
124  static void registerGlInstance( DtDe& de, DtTextureInterfaceCreator* anInstance );
125 
127  virtual DtTextureInterface* create( DtDe& de ) = 0;
128  };
129 }
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
Definition: DtTextureInterface.h:109
virtual bool enqueueSubRegion(int x, int y, int width, int height, const uint8_t *rgbaPixels)
Queue a sub-region upload for the next render frame.
Definition: DtTextureInterface.h:85
const char * filename
Definition: ioapi.h:38
virtual void setCpuBackingBuffer(const uint8_t *pixels)
Attach a CPU-side pixel buffer that will be uploaded to the GPU on each call to markCpuBackingBufferD...
Definition: DtTextureInterface.h:64
Interface for a texture. Used to pass in a texture to vrvGraphics.
Definition: DtTextureInterface.h:26
4 dimensional vector
virtual bool allocateGpuStorage(const std::string &key, int width, int height)
Allocate uninitialised GPU texture storage of the given dimensions. No pixel data is uploaded...
Definition: DtTextureInterface.h:57
virtual bool markCpuBackingBufferDirty()
Signal that the CPU backing buffer has changed and must be re-uploaded to the GPU on the next render ...
Definition: DtTextureInterface.h:70
Contains makVrv::DtFileCache class.
Contains makVrv::DtVirtualBaseClass class.
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
Definition: DtFileCache.h:45
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:76
Contains DLL export macros.

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)