}
}
+size_t OpenGLTexture1D::get_data_size() const
+{
+ unsigned width = static_cast<const Texture1D *>(this)->width;
+ return id ? width*get_pixel_size(storage_fmt) : 0;
+}
+
} // namespace GL
} // namespace Msp
void allocate();
void sub_image(unsigned, int, unsigned, const void *);
+
+public:
+ virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
+ virtual std::size_t get_data_size() const;
+ virtual void unload() { }
};
using Texture1DBackend = OpenGLTexture1D;
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
}
-Resource::AsyncLoader *OpenGLTexture2D::create_async_loader(IO::Seekable &io)
+Resource::AsyncLoader *OpenGLTexture2D::load(IO::Seekable &io, const Resources *)
{
return new AsyncLoader(static_cast<Texture2D &>(*this), io);
}
+uint64_t OpenGLTexture2D::get_data_size() const
+{
+ unsigned width = static_cast<const Texture2D *>(this)->width;
+ unsigned height = static_cast<const Texture2D *>(this)->height;
+ return id ? width*height*get_pixel_size(format) : 0;
+}
+
void OpenGLTexture2D::unload()
{
glDeleteTextures(1, &id);
void sub_image(unsigned, int, int, unsigned, unsigned, const void *);
void sub_image(unsigned, int, int, unsigned, unsigned, const Buffer &, unsigned);
- Resource::AsyncLoader *create_async_loader(IO::Seekable &);
- void unload();
+public:
+ virtual Resource::AsyncLoader *load(IO::Seekable &, const Resources * = 0);
+ virtual std::size_t get_data_size() const;
+ virtual void unload();
};
using Texture2DBackend = OpenGLTexture2D;
apply_swizzle();
}
+size_t OpenGLTexture2DMultisample::get_data_size() const
+{
+ unsigned width = static_cast<const Texture2DMultisample *>(this)->width;
+ unsigned height = static_cast<const Texture2DMultisample *>(this)->height;
+ unsigned samples = static_cast<const Texture2DMultisample *>(this)->samples;
+ return width*height*get_pixel_size(format)*samples;
+}
+
} // namespace GL
} // namespace Msp
OpenGLTexture2DMultisample();
void allocate();
+
+public:
+ virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
+ virtual std::size_t get_data_size() const;
+ virtual void unload() { }
};
using Texture2DMultisampleBackend = OpenGLTexture2DMultisample;
return target==GL_TEXTURE_2D_ARRAY;
}
+size_t OpenGLTexture3D::get_data_size() const
+{
+ unsigned width = static_cast<const Texture3D *>(this)->width;
+ unsigned height = static_cast<const Texture3D *>(this)->height;
+ unsigned depth = static_cast<const Texture3D *>(this)->depth;
+ return id ? width*height*depth*get_pixel_size(storage_fmt) : 0;
+}
+
} // namespace GL
} // namespace Msp
void sub_image(unsigned, int, int, int, unsigned, unsigned, unsigned, const void *);
bool is_array() const;
+
+public:
+ virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
+ virtual std::size_t get_data_size() const;
+ virtual void unload() { }
};
using Texture3DBackend = OpenGLTexture3D;
}
}
+size_t OpenGLTextureCube::get_data_size() const
+{
+ unsigned size = static_cast<const TextureCube *>(this)->size;
+ return id ? size*size*6*get_pixel_size(storage_fmt) : 0;
+}
+
+
unsigned get_gl_cube_face(unsigned face)
{
switch(static_cast<TextureCubeFace>(face))
void allocate();
void sub_image(unsigned, unsigned, int, int, unsigned, unsigned, const void *);
+
+public:
+ virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
+ virtual std::size_t get_data_size() const;
+ virtual void unload() { }
};
using TextureCubeBackend = OpenGLTextureCube;
return width>>level;
}
-uint64_t Texture1D::get_data_size() const
-{
- return id ? width*get_pixel_size(storage_fmt) : 0;
-}
-
Texture1D::Loader::Loader(Texture1D &t):
DataFile::DerivedObjectLoader<Texture1D, Texture::Loader>(t)
private:
unsigned get_n_levels() const;
unsigned get_level_size(unsigned) const;
-
-public:
- virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
- virtual std::size_t get_data_size() const;
- virtual void unload() { }
};
} // namespace GL
return LinAl::Vector<unsigned, 2>(w, h);
}
-Resource::AsyncLoader *Texture2D::load(IO::Seekable &io, const Resources *)
-{
- return create_async_loader(io);
-}
-
-uint64_t Texture2D::get_data_size() const
-{
- return id ? width*height*get_pixel_size(format) : 0;
-}
-
Texture2D::Loader::Loader(Texture2D &t):
DataFile::DerivedObjectLoader<Texture2D, Texture::Loader>(t)
private:
unsigned get_n_levels() const;
LinAl::Vector<unsigned, 2> get_level_size(unsigned) const;
-
-public:
- virtual Resource::AsyncLoader *load(IO::Seekable &, const Resources * = 0);
- virtual std::size_t get_data_size() const;
- using Texture2DBackend::unload;
};
} // namespace GL
throw invalid_operation("Texture2DMultisample::image");
}
-uint64_t Texture2DMultisample::get_data_size() const
-{
- return id ? width*height*get_pixel_size(format)*samples : 0;
-}
-
} // namespace GL
} // namespace Msp
unsigned get_width() const { return width; }
unsigned get_height() const { return height; }
unsigned get_samples() const { return samples; }
-
- virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
- virtual std::size_t get_data_size() const;
- virtual void unload() { }
};
} // namespace GL
return LinAl::Vector<unsigned, 3>(w, h, d);
}
-uint64_t Texture3D::get_data_size() const
-{
- return id ? width*height*depth*get_pixel_size(storage_fmt) : 0;
-}
-
Texture3D::Loader::Loader(Texture3D &t):
DataFile::DerivedObjectLoader<Texture3D, Texture::Loader>(t)
protected:
unsigned get_n_levels() const;
LinAl::Vector<unsigned, 3> get_level_size(unsigned) const;
-
-public:
- virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
- virtual std::size_t get_data_size() const;
- virtual void unload() { }
};
} // namespace GL
return fv+s*sv+t*tv;
}
-uint64_t TextureCube::get_data_size() const
-{
- return id ? size*size*6*get_pixel_size(storage_fmt) : 0;
-}
-
TextureCube::Loader::Loader(TextureCube &t):
DataFile::DerivedObjectLoader<TextureCube, Texture::Loader>(t)
/** Returns a vector pointing to the center of a texel. */
Vector3 get_texel_direction(TextureCubeFace, unsigned, unsigned);
-
- virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
- virtual std::size_t get_data_size() const;
- virtual void unload() { }
};
void operator>>(const LexicalConverter &, TextureCubeFace &);