leocad/common/lc_context.h

74 lines
1.8 KiB
C
Raw Normal View History

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"
#include "lc_math.h"
2014-04-20 03:50:41 +02:00
2014-11-24 00:48:56 +01:00
struct lcScene
{
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();
int GetViewportWidth() const
{
return mViewportWidth;
}
int GetViewportHeight() const
{
return mViewportHeight;
}
2014-04-16 02:29:54 +02:00
void SetDefaultState();
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();
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
int mViewportX;
int mViewportY;
int mViewportWidth;
int mViewportHeight;
2014-10-12 01:26:23 +02:00
GLuint mFramebufferObject;
GLuint mFramebufferTexture;
GLuint mDepthRenderbufferObject;
Q_DECLARE_TR_FUNCTIONS(lcContext);
2014-04-14 05:20:16 +02:00
};
#endif // _LC_CONTEXT_H_