27#ifndef EASY3D_RENDERER_SHAPE_H
28#define EASY3D_RENDERER_SHAPE_H
32#include <easy3d/core/types.h>
79 void draw_quad_filled(
const Rect &rect,
unsigned int texture,
int width,
int height,
float depth);
114 void draw_quad(
unsigned int position_attrib,
unsigned int texcoord_attrib,
int x,
int y,
int w,
int h,
int vpw,
115 int vph,
float depth);
173 void draw_box_wire(LinesDrawable *drawable,
const mat4 &mvp,
const mat4 &m,
bool abstracted =
false);
189 void create_grid(
int x_steps,
int y_steps, std::vector<vec3> &points,
float depth = 0.0f,
float scale = 0.5f);
196 void create_circle(
int slices, std::vector<vec3> &points, std::vector<unsigned int> &indices);
203 void create_box(std::vector<vec3> &points, std::vector<vec3> &colors,
bool abstracted =
false);
213 const vec3 ¢er,
double radius,
int slices,
int stacks,
const vec3 &color,
214 std::vector<vec3> &points, std::vector<vec3> &normals, std::vector<vec3> &colors
226 const vec3 ¢er,
double radius,
int slices,
int stacks,
int checker_size,
227 const vec3 &color1,
const vec3 &color2,
228 std::vector<vec3> &points, std::vector<vec3> &normals, std::vector<vec3> &colors
235 double radius,
int slices,
const vec3 &s,
const vec3 &t,
const vec3 &color,
236 std::vector<vec3> &points, std::vector<vec3> &normals, std::vector<vec3> &colors
244 double radius,
int slices,
const vec3 &s,
const vec3 &t,
const vec3 &color,
245 std::vector<vec3> &points, std::vector<vec3> &normals, std::vector<vec3> &colors
257 void create_torus(
double major_radius,
double minor_radius,
int major_slices,
int minor_slices,
258 std::vector<vec3> &points, std::vector<vec3> &normals
268 void create_camera(std::vector<vec3> &points,
float width,
float fov,
float hw_ratio = 0.6f);
277 void create_camera(std::vector<vec3> &points, std::vector<unsigned int> &indices,
float width,
float fov,
278 float hw_ratio = 0.6f);
void create_sphere(const vec3 ¢er, double radius, int slices, int stacks, const vec3 &color, std::vector< vec3 > &points, std::vector< vec3 > &normals, std::vector< vec3 > &colors)
Generates data (points, normals, and colors) for a 3D sphere.
Definition: shape.cpp:767
void draw_quad_filled(const Rect &rect, const vec4 &color, int width, int height, float depth)
Draws a solid quad defined in the screen space.
Definition: shape.cpp:90
void draw_polygon_wire(const Polygon2 &polygon, const vec4 &color, int width, int height, float depth)
Draws a polygon (line loop) in the screen space.
Definition: shape.cpp:451
void draw_polygon_filled(const Polygon2 &polygon, const vec4 &color, int width, int height, float depth)
Draws a filled polygon in the screen space.
Definition: shape.cpp:492
void create_camera(std::vector< vec3 > &points, float width, float fov, float hw_ratio)
Generates data (points) for representing a camera in the 3D world as a set of lines.
Definition: shape.cpp:985
void create_grid(int x_steps, int y_steps, std::vector< vec3 > &points, float depth, float scale)
Generates data for a grid as a set of line segments.
Definition: shape.cpp:677
void create_checker_sphere(const vec3 ¢er, double radius, int slices, int stacks, int checker_size, const vec3 &color1, const vec3 &color2, std::vector< vec3 > &points, std::vector< vec3 > &normals, std::vector< vec3 > &colors)
Generates data (points, normals, and colors) for a 3D checker sphere.
Definition: shape.cpp:774
void draw_quad(unsigned int positionAttrib, unsigned int texcoordAttrib, int x, int y, int w, int h, int vpw, int vph, float depth)
Draws a quad defined in the screen space using a bound shader.
Definition: shape.cpp:336
void draw_sphere_big_circles(LinesDrawable *drawable, const mat4 &mvp, const mat4 &m, bool axes)
Draws the outline (the 3 big circles) of a sphere.
Definition: shape.cpp:553
void create_torus(double major_radius, double minor_radius, int major_slices, int minor_slices, std::vector< vec3 > &points, std::vector< vec3 > &normals)
Prepares data for representing a torus.
Definition: shape.cpp:930
void create_circle(int slices, std::vector< vec3 > &points, std::vector< unsigned int > &indices)
Generates data for a unit circle as a set of line segments.
Definition: shape.cpp:749
void create_cylinder(double radius, int slices, const vec3 &s, const vec3 &t, const vec3 &color, std::vector< vec3 > &points, std::vector< vec3 > &normals, std::vector< vec3 > &colors)
Prepares data (points, normals, and colors) for a 3D cylinder defined by two 3D points s and t.
Definition: shape.cpp:839
void create_box(std::vector< vec3 > &points, std::vector< vec3 > &colors, bool abstracted)
Generates data for a unit box as a set of line segments.
Definition: shape.cpp:698
void create_cone(double radius, int slices, const vec3 &s, const vec3 &t, const vec3 &color, std::vector< vec3 > &points, std::vector< vec3 > &normals, std::vector< vec3 > &colors)
Prepares data (points, normals, and colors) for a 3D cone defined by two 3D points b and t....
Definition: shape.cpp:884
void draw_box_wire(LinesDrawable *drawable, const mat4 &mvp, const mat4 &m, bool abstracted)
Draws a box.
Definition: shape.cpp:641
void draw_quad_wire(const Rect &rect, const vec4 &color, int width, int height, float depth)
Draws a wire quad defined in the screen space.
Definition: shape.cpp:42
void draw_full_screen_quad(unsigned int texture, float depth)
Draws a full screen textured quad.
Definition: shape.cpp:211
void draw_depth_texture(const Rect &rect, unsigned int texture, int width, int height, float depth)
Draws a quad visualizing a depth texture in a region.
Definition: shape.cpp:269
Definition: collider.cpp:182
Vec< 3, float > vec3
A 3D point/vector of float type.
Definition: types.h:45
GenericPolygon< float > Polygon2
A 2D polygon of float type.
Definition: types.h:117
GenericRect< float > Rect
A 2D axis-aligned rectangle of float type.
Definition: types.h:112
Mat4< float > mat4
A 4 by 4 matrix of float type.
Definition: types.h:68
Vec< 4, float > vec4
A 4D point/vector of float type.
Definition: types.h:47