fix uv mapping for the circle shape
This commit is contained in:
@@ -33,23 +33,31 @@ class Circle : public Shape
|
||||
public:
|
||||
enum class kUVMapping: uint8_t { Planar, Tube };
|
||||
template<int div>
|
||||
bool create(float radius)
|
||||
{
|
||||
static GLushort idx[div*3 + div*2];
|
||||
static vertex_t vertices[div+1];
|
||||
create_impl(radius, div, idx, vertices, kUVMapping::Planar);
|
||||
return create_buffers(idx, vertices, sizeof(idx), sizeof(vertices));
|
||||
}
|
||||
template<int div>
|
||||
bool create(float radius, kUVMapping map)
|
||||
{
|
||||
static GLushort idx[div * 3 + div * 2];
|
||||
static vertex_t vertices[div + 1];
|
||||
create_impl(radius, div, idx, vertices, map);
|
||||
static GLushort idx[div*3 + div*2];
|
||||
static vertex_t vertices[div*2];
|
||||
create_impl(radius, 0.f, div, idx, vertices, map);
|
||||
return create_buffers(idx, vertices, sizeof(idx), sizeof(vertices));
|
||||
}
|
||||
template<int div>
|
||||
bool create(float radius_out, float radius_in, kUVMapping map)
|
||||
{
|
||||
static GLushort idx[div*6 + div*4];
|
||||
static vertex_t vertices[div * 2];
|
||||
create_impl(radius_out, radius_in, div, idx, vertices, map);
|
||||
static GLushort idx[(div+1)*6 + (div+1)*4];
|
||||
static vertex_t vertices[(div+1) * 2];
|
||||
create_impl(radius_out, radius_in, (div+1), idx, vertices, map);
|
||||
return create_buffers(idx, vertices, sizeof(idx), sizeof(vertices));
|
||||
}
|
||||
private:
|
||||
void create_impl(float radius, int div, GLushort* idx, vertex_t* vertices, kUVMapping map);
|
||||
void create_impl(float radius, int div, GLushort* idx, vertex_t* vertices);
|
||||
void create_impl(float radius_out, float radius_in, int div, GLushort* idx, vertex_t* vertices, kUVMapping map);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user