fix equirectangular shader for higher precision, add polygon draw mode
This commit is contained in:
@@ -9,9 +9,11 @@ protected:
|
||||
GLuint arrays[2]{ 0 };
|
||||
GLuint count[2]{ 0 };
|
||||
GLvoid* ioff[2]{ 0 };
|
||||
struct vertex_t { glm::vec4 pos; glm::vec2 uvs; };
|
||||
bool use_idx = true;
|
||||
public:
|
||||
struct vertex_t { glm::vec4 pos; glm::vec2 uvs; };
|
||||
bool create_buffers(GLvoid* idx, GLvoid* vertices, int isize, int vsize);
|
||||
bool create_buffers(GLvoid* vertices, int vsize);
|
||||
void draw_fill() const;
|
||||
void draw_stroke() const;
|
||||
virtual bool create_attrib() { return true; };
|
||||
@@ -49,18 +51,35 @@ protected:
|
||||
|
||||
class LineSegment : public Shape
|
||||
{
|
||||
void create_impl(GLushort* idx, vertex_t* vertices);
|
||||
public:
|
||||
bool create()
|
||||
{
|
||||
static GLushort idx[2];
|
||||
static vertex_t vertices[2];
|
||||
create_impl(idx, vertices);
|
||||
return create_buffers(idx, vertices, sizeof(idx), sizeof(vertices));
|
||||
count[0] = 2;
|
||||
count[1] = 2;
|
||||
ioff[0] = (GLvoid*)0;
|
||||
ioff[1] = (GLvoid*)0;
|
||||
vertices[0] = { { 0, 0, 0, 1 },{ 0, 0 } }; // A
|
||||
vertices[1] = { { 0, 0, 0, 1 },{ 0, 1 } }; // B
|
||||
return create_buffers(vertices, sizeof(vertices));
|
||||
}
|
||||
void update_vertices(const glm::vec4 data[2]);
|
||||
};
|
||||
|
||||
class DynamicShape : public Shape
|
||||
{
|
||||
public:
|
||||
bool create(vertex_t* vertices = nullptr, int vcount = 0)
|
||||
{
|
||||
count[0] = vcount;
|
||||
count[1] = vcount;
|
||||
ioff[0] = (GLvoid*)0;
|
||||
ioff[1] = (GLvoid*)0;
|
||||
return create_buffers(vertices, sizeof(vertex_t) * vcount);
|
||||
}
|
||||
void update_vertices(vertex_t* vertices, int vcount);
|
||||
};
|
||||
|
||||
class Plane : public Shape
|
||||
{
|
||||
void create_impl(float w, float h, int div, GLushort* idx, vertex_t* vertices);
|
||||
|
||||
Reference in New Issue
Block a user