Carna  Version 3.0.1
BufferedVectorFieldTexture.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 - 2015 Leonid Kostrykin
3  *
4  * Chair of Medical Engineering (mediTEC)
5  * RWTH Aachen University
6  * Pauwelsstr. 20
7  * 52074 Aachen
8  * Germany
9  *
10  */
11 
12 #ifndef BUFFEREDVECTORFIELDTEXTURE_H_6014714286
13 #define BUFFEREDVECTORFIELDTEXTURE_H_6014714286
14 
17 #include <memory>
18 
23 namespace Carna
24 {
25 
26 namespace base
27 {
28 
29 
30 
31 // ----------------------------------------------------------------------------------
32 // BufferedVectorFieldTexture
33 // ----------------------------------------------------------------------------------
34 
43 template< typename BufferedVectorFieldType >
45 {
46 
47 protected:
48 
55  BufferedVectorFieldTexture( const BufferedVectorFieldType& field );
56 
57 public:
58 
62  const BufferedVectorFieldType& field;
63 
70  static BufferedVectorFieldTexture< BufferedVectorFieldType >& create( const BufferedVectorFieldType& field );
71 
76  virtual bool controlsSameVideoResource( const GeometryFeature& other ) const override;
77 
78 }; // BufferedVectorFieldTexture
79 
80 
81 template< typename BufferedVectorFieldType >
84  ( field.size
85  , BufferedVectorFieldFormat< BufferedVectorFieldType >::INTERNAL_FORMAT
86  , BufferedVectorFieldFormat< BufferedVectorFieldType >::PIXEL_FORMAT
87  , BufferedVectorFieldFormat< BufferedVectorFieldType >::BUFFER_TYPE
88  , &field.buffer().front() )
89  , field( field )
90 {
91 }
92 
93 
94 template< typename BufferedVectorFieldType >
96  ( const BufferedVectorFieldType& field )
97 {
99 }
100 
101 
102 template< typename BufferedVectorFieldType >
104 {
105  typedef BufferedVectorFieldTexture< BufferedVectorFieldType > CompatibleBufferedVectorFieldTexture;
106  const CompatibleBufferedVectorFieldTexture* const other2
107  = dynamic_cast< const CompatibleBufferedVectorFieldTexture* >( &other );
108  if( other2 == nullptr )
109  {
110  return false;
111  }
112  else
113  {
114  return &field == &other2->field;
115  }
116 }
117 
118 
119 
120 } // namespace Carna :: base
121 
122 } // namespace Carna
123 
124 #endif // BUFFEREDVECTORFIELDTEXTURE_H_6014714286
Maps math::VectorField implementations to Texture formats.
Specializes the ManagedTexture3D class s.t. the texture's data is initialized from a math::VectorFiel...
static BufferedVectorFieldTexture< BufferedVectorFieldType > & create(const BufferedVectorFieldType &field)
Instantiates. Invoke release when it isn't needed any longer.
Represents 3D OpenGL texture object whose lifetime is managed by instances of this class...
Represents "components" that are aggregated by Geometry objects. Closer description is given here...
const BufferedVectorFieldType & field
References the math::VectorField to be uploaded to the texture.
Defines Carna::base::ManagedTexture3D.
virtual bool controlsSameVideoResource(const GeometryFeature &other) const override
Tells true if other is of same type and references the same field. Tells false otherwise.
BufferedVectorFieldTexture(const BufferedVectorFieldType &field)
Instantiates.
Defines Carna::base::BufferedVectorFieldFormat.