This project is a web program that mimic the photoshop draw shape and line feature. With WebGL platform, the shape and sizes is drawed, edited, and visualize in a web application containing multiple option to transform, add, and save the shape model. The shape that implemented is line, square, rectangle, and polygon each with its transformation option that relevant to the shape.
- Draw basic shape (Line, Square, Rectangle, and Polygon)
- Geometry Transformation: translation, dilatation, shear, and rotation
- Modify the shape with moving corner point with slider and drag and drop
- Change corner point color
- Save and load shape model
- Extra Feature: Convex Hull
- Extra Feature: Fade in Animation
- Extra Feature: Advanced UX
- Clone this repo to your local directory.
user@hello:~$ git clone https://github.com/GAIB20/tugas-besar-grafkom-1-chader.git
- Navigate to the cloned directory. e.g. with
cd ${DIR_NAME}
. - Install all the dependencies
npm install
. - Run the dev script =>
npm run dev
.
- Abstract Class Geometry: this is a parent class that contain abstract function for each shape type (setGeometry, drawGeometry, etc.)
- setGeometry(): Fill the webGl buffer with vertices data
- drawGeometry(): Load the attribute pointers, initialize transformation matrix, uniforms and draw the geometry to the scene using drawElements()
- Main(): main program that run with several functionalities, link vertex shader and fragment shader, create a WebGL program, viewport setup, canvas setup, and draw scene using drawScene()
- drawScene(): viewport setup again, clear canvas before draw shape, and draw geometry of each shape that present in the scene with each shape drawGeometry() function.