Update widgets module. Raster example initial.
This commit is contained in:
parent
aa10424fbb
commit
90244934d9
48 changed files with 1169 additions and 530 deletions
34
RasterRender/public/FrameBuffer.hpp
Normal file
34
RasterRender/public/FrameBuffer.hpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Rect.hpp"
|
||||
#include "Color.hpp"
|
||||
|
||||
namespace tp {
|
||||
class RenderBuffer {
|
||||
public:
|
||||
RenderBuffer(const Vec2F& size);
|
||||
RenderBuffer(const Vec2F& size, tp::uint1 samples);
|
||||
~RenderBuffer();
|
||||
|
||||
void beginDraw();
|
||||
void setViewport(const RectF& viewport);
|
||||
void clear();
|
||||
void endDraw();
|
||||
|
||||
uint4 texId() const;
|
||||
uint4 buffId() const;
|
||||
|
||||
const Vec2F& getSize() const;
|
||||
|
||||
public:
|
||||
RGBA mClearCol = 0.f;
|
||||
|
||||
private:
|
||||
uint4 mFrameBufferID = 0; // regroups 0, 1, or more textures, and 0 or 1 depth buffer.
|
||||
uint4 mTextureId = 0; // texture we're going to render to ( colour attachement #0 )
|
||||
uint4 mDepthBufferID = 0;
|
||||
uint4 mDrawBuffers[1];
|
||||
Vec2F mSize;
|
||||
};
|
||||
};
|
||||
19
RasterRender/public/GraphicsApi.hpp
Normal file
19
RasterRender/public/GraphicsApi.hpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Environment.hpp"
|
||||
|
||||
#ifdef ENV_OS_ANDROID
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES3/gl32.h>
|
||||
#else
|
||||
#include "GL/glew.h"
|
||||
#endif
|
||||
|
||||
#ifdef ENV_OS_ANDROID
|
||||
#define GLW_CONTEXT_DEPTH_BITS 16
|
||||
#define GLW_CONTEXT_DEPTH_COMPONENT GL_DEPTH_COMPONENT16
|
||||
#else
|
||||
#define GLW_CONTEXT_DEPTH_BITS 32
|
||||
#define GLW_CONTEXT_DEPTH_COMPONENT GL_DEPTH_COMPONENT32
|
||||
#endif
|
||||
32
RasterRender/public/Shader.hpp
Normal file
32
RasterRender/public/Shader.hpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
namespace tp {
|
||||
class RenderShader {
|
||||
public:
|
||||
RenderShader();
|
||||
RenderShader(const char* vertid, const char* geomid, const char* fragid, bool paths = true);
|
||||
~RenderShader();
|
||||
|
||||
void vert_bind_source(const char* vert_src);
|
||||
void frag_bind_source(const char* frag_src);
|
||||
void geom_bind_source(const char* geom_src);
|
||||
|
||||
void compile();
|
||||
|
||||
void bind();
|
||||
uint4 getu(const char* uid);
|
||||
void unbind();
|
||||
|
||||
void load(const char* vert, const char* geom, const char* frag, bool paths);
|
||||
|
||||
private:
|
||||
bool compile_shader(const char* ShaderCode, uint4 ShaderID);
|
||||
|
||||
private:
|
||||
uint4 programm;
|
||||
uint4 VertexShaderID;
|
||||
uint4 FragmentShaderID;
|
||||
uint4 GeometryShaderID;
|
||||
};
|
||||
};
|
||||
29
RasterRender/public/Texture.hpp
Normal file
29
RasterRender/public/Texture.hpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Buffer2D.hpp"
|
||||
#include "Color.hpp"
|
||||
#include "Vec.hpp"
|
||||
|
||||
namespace tp {
|
||||
class RenderTexture {
|
||||
public:
|
||||
RenderTexture();
|
||||
~RenderTexture();
|
||||
|
||||
uint4 getid();
|
||||
|
||||
void update(const Buffer2D<RGBA>& buff);
|
||||
void draw(const uint4& out = 0);
|
||||
|
||||
public:
|
||||
static void init();
|
||||
static void deinit();
|
||||
static void draw_texture(uint4 out, uint4 in);
|
||||
static uint4 get_tex(const char* TexId);
|
||||
static void drawCurcle(Vec2F pos, double radius, RGBA col);
|
||||
|
||||
private:
|
||||
uint4 id;
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue