2014-04-14 05:20:16 +02:00
|
|
|
#ifndef _LC_CONTEXT_H_
|
|
|
|
#define _LC_CONTEXT_H_
|
|
|
|
|
2014-04-20 03:50:41 +02:00
|
|
|
#include "lc_array.h"
|
2015-01-02 12:58:14 +01:00
|
|
|
#include "lc_math.h"
|
2014-04-20 03:50:41 +02:00
|
|
|
|
2014-11-24 00:48:56 +01:00
|
|
|
struct lcScene
|
|
|
|
{
|
2015-01-02 12:58:14 +01:00
|
|
|
lcMatrix44 ViewMatrix;
|
2014-11-24 00:48:56 +01:00
|
|
|
lcArray<lcRenderMesh> OpaqueMeshes;
|
|
|
|
lcArray<lcRenderMesh> TranslucentMeshes;
|
|
|
|
lcArray<lcObject*> InterfaceObjects;
|
|
|
|
};
|
|
|
|
|
2014-04-14 05:20:16 +02:00
|
|
|
class lcContext
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
lcContext();
|
|
|
|
~lcContext();
|
|
|
|
|
2014-10-24 00:03:50 +02:00
|
|
|
int GetViewportWidth() const
|
|
|
|
{
|
|
|
|
return mViewportWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
int GetViewportHeight() const
|
|
|
|
{
|
|
|
|
return mViewportHeight;
|
|
|
|
}
|
|
|
|
|
2014-04-16 02:29:54 +02:00
|
|
|
void SetDefaultState();
|
|
|
|
|
2014-10-24 00:03:50 +02:00
|
|
|
void SetViewport(int x, int y, int Width, int Height);
|
2014-04-14 05:20:16 +02:00
|
|
|
void SetWorldViewMatrix(const lcMatrix44& WorldViewMatrix);
|
|
|
|
void SetProjectionMatrix(const lcMatrix44& ProjectionMatrix);
|
|
|
|
// void SetColor(const lcVector4& Color);
|
|
|
|
void SetLineWidth(float LineWidth);
|
|
|
|
|
2014-10-12 01:26:23 +02:00
|
|
|
bool BeginRenderToTexture(int Width, int Height);
|
|
|
|
void EndRenderToTexture();
|
2014-10-12 04:30:34 +02:00
|
|
|
bool SaveRenderToTextureImage(const QString& FileName, int Width, int Height);
|
2014-10-12 01:26:23 +02:00
|
|
|
|
2014-04-14 05:20:16 +02:00
|
|
|
void BindMesh(lcMesh* Mesh);
|
|
|
|
void UnbindMesh();
|
|
|
|
void DrawMeshSection(lcMesh* Mesh, lcMeshSection* Section);
|
2014-04-20 03:50:41 +02:00
|
|
|
void DrawOpaqueMeshes(const lcMatrix44& ViewMatrix, const lcArray<lcRenderMesh>& OpaqueMeshes);
|
|
|
|
void DrawTranslucentMeshes(const lcMatrix44& ViewMatrix, const lcArray<lcRenderMesh>& TranslucentMeshes);
|
2014-11-24 00:48:56 +01:00
|
|
|
void DrawInterfaceObjects(const lcMatrix44& ViewMatrix, const lcArray<lcObject*>& InterfaceObjects);
|
2014-04-14 05:20:16 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
GLuint mVertexBufferObject;
|
|
|
|
GLuint mIndexBufferObject;
|
|
|
|
char* mVertexBufferPointer;
|
|
|
|
char* mIndexBufferPointer;
|
|
|
|
char* mVertexBufferOffset;
|
|
|
|
|
|
|
|
lcTexture* mTexture;
|
|
|
|
float mLineWidth;
|
|
|
|
int mMatrixMode;
|
2014-10-12 01:26:23 +02:00
|
|
|
|
2014-10-24 00:03:50 +02:00
|
|
|
int mViewportX;
|
|
|
|
int mViewportY;
|
|
|
|
int mViewportWidth;
|
|
|
|
int mViewportHeight;
|
|
|
|
|
2014-10-12 01:26:23 +02:00
|
|
|
GLuint mFramebufferObject;
|
|
|
|
GLuint mFramebufferTexture;
|
|
|
|
GLuint mDepthRenderbufferObject;
|
2014-10-12 04:30:34 +02:00
|
|
|
|
|
|
|
Q_DECLARE_TR_FUNCTIONS(lcContext);
|
2014-04-14 05:20:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _LC_CONTEXT_H_
|