summaryrefslogtreecommitdiffstats
path: root/src/graphics/opengl/gldevice.cpp
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-07-01 01:37:30 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-07-01 01:37:30 +0200
commit9bd4ec03b272e7925b11c3efc2bd8460894ea589 (patch)
treef97339cd526e4240d2fc5932a263fb84cbec93d8 /src/graphics/opengl/gldevice.cpp
parent5bbf897fb1d54df0dc84a0cea35775083591b88f (diff)
downloadcolobot-9bd4ec03b272e7925b11c3efc2bd8460894ea589.tar.gz
colobot-9bd4ec03b272e7925b11c3efc2bd8460894ea589.tar.bz2
colobot-9bd4ec03b272e7925b11c3efc2bd8460894ea589.zip
CDevice interface and stub of implementation
- added CDevice abstract interface - began implementation of CGLDevice - added stub for Texture struct - created CGLDeviceConfig - changed particule -> particle & other minor changes
Diffstat (limited to 'src/graphics/opengl/gldevice.cpp')
-rw-r--r--src/graphics/opengl/gldevice.cpp192
1 files changed, 191 insertions, 1 deletions
diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp
index 7938e62..9ef376f 100644
--- a/src/graphics/opengl/gldevice.cpp
+++ b/src/graphics/opengl/gldevice.cpp
@@ -18,4 +18,194 @@
#include "graphics/opengl/gldevice.h"
-// TODO
+#include <GL/gl.h>
+#include <GL/glu.h>
+
+
+void Gfx::GLDeviceConfig::LoadDefault()
+{
+ Gfx::DeviceConfig::LoadDefault();
+
+ hardwareAccel = true;
+
+ redSize = 8;
+ blueSize = 8;
+ greenSize = 8;
+ alphaSize = 8;
+ depthSize = 24;
+}
+
+Gfx::CGLDevice::CGLDevice()
+{
+ m_renderState = 0;
+}
+
+
+Gfx::CGLDevice::~CGLDevice()
+{
+}
+
+void Gfx::CGLDevice::Initialize()
+{
+ // TODO
+}
+
+void Gfx::CGLDevice::Destroy()
+{
+ // TODO
+}
+
+void Gfx::CGLDevice::BeginScene()
+{
+ // TODO
+}
+
+void Gfx::CGLDevice::EndScene()
+{
+ // TODO
+}
+
+void Gfx::CGLDevice::Clear()
+{
+ // TODO
+}
+
+void Gfx::CGLDevice::SetTransform(Gfx::TransformType type, const Math::Matrix &matrix)
+{
+ switch (type)
+ {
+ case Gfx::TRANSFORM_WORLD:
+ m_worldMat = matrix;
+ // TODO
+ break;
+ case Gfx::TRANSFORM_VIEW:
+ m_viewMat = matrix;
+ // TODO
+ break;
+ case Gfx::TRANSFORM_PROJECTION:
+ m_projectionMat = matrix;
+ // TODO
+ break;
+ default:
+ assert(false);
+ }
+}
+
+const Math::Matrix& Gfx::CGLDevice::GetTransform(Gfx::TransformType type)
+{
+ switch (type)
+ {
+ case Gfx::TRANSFORM_WORLD:
+ return m_worldMat;
+ case Gfx::TRANSFORM_VIEW:
+ return m_viewMat;
+ case Gfx::TRANSFORM_PROJECTION:
+ return m_projectionMat;
+ default:
+ assert(false);
+ }
+
+ return m_worldMat; // to avoid warning
+}
+
+void Gfx::CGLDevice::MultiplyTransform(Gfx::TransformType type, const Math::Matrix &matrix)
+{
+ // TODO
+}
+
+void Gfx::CGLDevice::SetMaterial(const Gfx::Material &material)
+{
+ m_material = material;
+
+ // TODO
+}
+
+const Gfx::Material& Gfx::CGLDevice::GetMaterial()
+{
+ return m_material;
+}
+
+int Gfx::CGLDevice::GetMaxLightCount()
+{
+ return m_lights.size();
+}
+
+void Gfx::CGLDevice::SetLight(int index, const Gfx::Light &light)
+{
+ assert(index >= 0);
+ assert(index < (int)m_lights.size());
+
+ m_lights[index] = light;
+
+ // TODO
+}
+
+const Gfx::Light& Gfx::CGLDevice::GetLight(int index)
+{
+ assert(index >= 0);
+ assert(index < (int)m_lights.size());
+
+ return m_lights[index];
+}
+
+void Gfx::CGLDevice::SetLightEnabled(int index, bool enabled)
+{
+ assert(index >= 0);
+ assert(index < (int)m_lightsEnabled.size());
+
+ m_lightsEnabled[index] = enabled;
+
+ // TODO
+}
+
+bool Gfx::CGLDevice::GetLightEnabled(int index)
+{
+ assert(index >= 0);
+ assert(index < (int)m_lights.size());
+
+ return m_lightsEnabled[index];
+}
+
+int Gfx::CGLDevice::GetMaxTextureCount()
+{
+ return m_textures.size();
+}
+
+const Gfx::Texture& Gfx::CGLDevice::GetTexture(int index)
+{
+ assert(index >= 0);
+ assert(index < (int)m_textures.size());
+
+ return m_textures[index];
+}
+
+void Gfx::CGLDevice::SetTexture(int index, const Gfx::Texture &texture)
+{
+ assert(index >= 0);
+ assert(index < (int)m_textures.size());
+
+ m_textures[index] = texture;
+
+ // TODO
+}
+
+void Gfx::CGLDevice::SetRenderState(Gfx::RenderState state, bool enabled)
+{
+ // TODO
+}
+
+bool Gfx::CGLDevice::GetRenderState(Gfx::RenderState state)
+{
+ // TODO
+ return false;
+}
+
+void Gfx::CGLDevice::DrawPrimitive(Gfx::PrimitiveType, Vertex *vertices, int vertexCount)
+{
+ // TODO
+}
+
+void Gfx::CGLDevice::DrawPrimitive(Gfx::PrimitiveType, VertexTex2 *vertices, int vertexCount)
+{
+ // TODO
+}