summaryrefslogtreecommitdiffstats
path: root/src/graphics/core/device.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics/core/device.h')
-rw-r--r--src/graphics/core/device.h27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/graphics/core/device.h b/src/graphics/core/device.h
index c10b853..a3d0208 100644
--- a/src/graphics/core/device.h
+++ b/src/graphics/core/device.h
@@ -15,7 +15,10 @@
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
-// device.h
+/**
+ * \file graphics/core/device.h
+ * \brief Abstract graphics device - Gfx::CDevice class and related structs/enums
+ */
#pragma once
@@ -25,13 +28,14 @@
#include "graphics/core/material.h"
#include "graphics/core/texture.h"
#include "graphics/core/vertex.h"
-#include "math/intsize.h"
+#include "math/intpoint.h"
#include "math/matrix.h"
#include <string>
class CImage;
+struct ImageData;
namespace Gfx {
@@ -45,7 +49,7 @@ namespace Gfx {
struct DeviceConfig
{
//! Screen size
- Math::IntSize size;
+ Math::IntPoint size;
//! Bits per pixel
int bpp;
//! Full screen
@@ -63,7 +67,7 @@ struct DeviceConfig
//! Loads the default values
inline void LoadDefault()
{
- size = Math::IntSize(800, 600);
+ size = Math::IntPoint(800, 600);
bpp = 32;
fullScreen = false;
resizeable = false;
@@ -149,9 +153,9 @@ enum FogMode
\brief Culling mode for polygons */
enum CullMode
{
- //! Cull clockwise side
+ //! Cull clockwise faces
CULL_CW,
- //! Cull counter-clockwise side
+ //! Cull counter-clockwise faces
CULL_CCW
};
@@ -274,13 +278,14 @@ class CDevice
public:
virtual ~CDevice() {}
+ //! Provides a hook to debug graphics code (implementation-specific)
+ virtual void DebugHook() = 0;
+
//! Initializes the device, setting the initial state
virtual bool Create() = 0;
//! Destroys the device, releasing every acquired resource
virtual void Destroy() = 0;
- //! Returns whether the device has been initialized
- virtual bool GetWasInit() = 0;
//! Returns the last encountered error
virtual std::string GetError() = 0;
@@ -317,6 +322,8 @@ public:
//! Creates a texture from image; the image can be safely removed after that
virtual Gfx::Texture CreateTexture(CImage *image, const Gfx::TextureCreateParams &params) = 0;
+ //! Creates a texture from raw image data; image data can be freed after that
+ virtual Gfx::Texture CreateTexture(ImageData *data, const Gfx::TextureCreateParams &params) = 0;
//! Deletes a given texture, freeing it from video memory
virtual void DestroyTexture(const Gfx::Texture &texture) = 0;
//! Deletes all textures created so far
@@ -324,8 +331,10 @@ public:
//! Returns the maximum number of multitexture stages
virtual int GetMaxTextureCount() = 0;
- //! Sets the (multi)texture at given index
+ //! Sets the texture at given texture stage
virtual void SetTexture(int index, const Gfx::Texture &texture) = 0;
+ //! Sets the texture image by ID at given texture stage
+ virtual void SetTexture(int index, unsigned int textureId) = 0;
//! Returns the (multi)texture at given index
virtual Gfx::Texture GetTexture(int index) = 0;
//! Enables/disables the given texture stage