Commit Graph
100 Commits
Author SHA1 Message Date
abdelrahman c739864489 Update variable names 2024-09-13 12:57:15 +01:00
abdelrahman f45e30620f Reorganise resources 2024-09-13 12:56:26 +01:00
abdelrahman dcbda91730 str8_substr returns copy of the string 2024-09-13 02:57:06 +01:00
abdelrahman 80f20a06cd Reformat 2024-09-13 02:48:45 +01:00
abdelrahman c12c212843 Update resources 2024-09-13 02:34:18 +01:00
abdelrahman 1223e55db1 Pass model as a CLI arg 2024-09-13 02:33:41 +01:00
abdelrahman 351b7e9d42 Rename variable 2024-09-06 19:00:17 +01:00
abdelrahman b57ec11598 Ensure intensity is clamped 2024-09-01 23:02:05 +01:00
abdelrahman d750c49f71 Update result screenshot 2024-09-01 22:31:00 +01:00
abdelrahman cf8c681474 Implement tangent normals and switch to using basic diffuse shader 2024-09-01 22:30:04 +01:00
abdelrahman 84fbb711e1 Add function to invert 3x3 matrix 2024-09-01 22:28:11 +01:00
abdelrahman 8c74706fdc Update head model 2024-09-01 22:26:04 +01:00
abdelrahman d851509321 Update result screenshot 2024-09-01 02:16:18 +01:00
abdelrahman e87f780dae Move vertex and fragment calculations to the shaders 2024-09-01 02:15:32 +01:00
abdelrahman 8726c833d4 Add extra vector and matrix types and operations 2024-09-01 02:14:25 +01:00
abdelrahman da495d9e43 Add array access to Triangle struct 2024-09-01 02:13:53 +01:00
abdelrahman 18e9964d33 Move TRIANGLE_VERTICES constant to constants.h 2024-09-01 02:13:02 +01:00
abdelrahman 95d474c956 Save viewport matrix in a variable 2024-08-31 22:24:04 +01:00
abdelrahman 41c30256b7 Remove unused variable 2024-08-31 22:23:46 +01:00
abdelrahman 4b178de784 Update vector and matrix types 2024-08-31 22:23:18 +01:00
abdelrahman bb6b0e3e5d Change f32x3 to union 2024-08-31 13:46:12 +01:00
abdelrahman 97622d0bf7 Move viewport matrix multiplication out of vertex shader 2024-08-26 22:30:05 +01:00
abdelrahman 319bad9659 Fix barycentric coordinates calculation (#2)
Reviewed-on: #2

	* Set up for debugging
	* Replace get_barycentric_coords with different calculation
	* Update commented lines
	* Add V3_ELEM_COUNT macro
	* Change loop in barycentric coordinates calculation function
	* Update debug values
	* Simplify barycentric coordinates function
	* Remove debug lines
Co-authored-by: Abdelrahman <said.abdelrahman89@gmail.com>
Co-committed-by: Abdelrahman <said.abdelrahman89@gmail.com>
2024-08-26 17:12:44 +00:00
abdelrahman 57dcf6457c Update includes and reorder variables 2024-08-25 02:47:13 +01:00
abdelrahman 7671f688a3 Extra resources for debugging 2024-08-25 02:45:20 +01:00
abdelrahman f9851967d8 Ignore python related files 2024-08-25 02:43:54 +01:00
abdelrahman 5dac82ffb7 Pass float vectors when calculating barycentric coordinates 2024-08-25 01:33:39 +01:00
abdelrahman 185f44252f Flip the Y texture coordinate when loading the OBJ model 2024-08-25 01:32:54 +01:00
abdelrahman cee57282cb Ignore png images in resources dir 2024-08-25 00:45:46 +01:00
abdelrahman cdf521f184 Switch back to using object level normals 2024-08-24 23:39:19 +01:00
abdelrahman cab1b538e6 Update result screenshot 2024-08-24 23:18:51 +01:00
abdelrahman afa9bc7468 Update phong weights 2024-08-24 23:16:35 +01:00
abdelrahman 8ccc424b06 Calculate light direction from position 2024-08-24 23:16:11 +01:00
abdelrahman 62aa2fbc3b Change directional light to point light 2024-08-24 23:15:38 +01:00
abdelrahman 22edc89593 Update wapp submodule 2024-08-24 19:08:02 +01:00
abdelrahman 1f5f01d73f Switch to using tangent normals 2024-08-24 00:48:46 +01:00
abdelrahman 798100f138 Fix Phong specular term 2024-08-24 00:39:40 +01:00
abdelrahman aa9c443997 Update result screenshot 2024-08-24 00:29:20 +01:00
abdelrahman 535ead0337 Change light direction 2024-08-24 00:28:31 +01:00
abdelrahman 6f5c094f49 Use matrices to transform light and normals 2024-08-24 00:25:41 +01:00
abdelrahman 996597684b Add transpose and inverse matrix utilities 2024-08-24 00:25:18 +01:00
abdelrahman 4f58fc4803 Rename create_shader to register_shader 2024-08-23 22:43:52 +01:00
abdelrahman c91f1b9e9b Use correct default arena init function 2024-08-23 22:31:14 +01:00
abdelrahman 3ceafe5899 Update wapp submodule 2024-08-23 22:30:32 +01:00
abdelrahman 5eeb7d6819 Switch to using wapp_mem_arena_init_default 2024-08-23 21:58:55 +01:00
abdelrahman ed43a0f286 Use GB macro to define arena size 2024-08-23 21:52:12 +01:00
abdelrahman bf1aa69cf5 Update wapp submodule 2024-08-23 21:51:57 +01:00
abdelrahman 8b8855d648 Reformat 2024-08-23 21:47:01 +01:00
abdelrahman 0b9a37a9cd Update result screenshot 2024-08-19 00:07:16 +01:00
abdelrahman 2bea7218db Test implementation of phong shader 2024-08-19 00:05:59 +01:00
abdelrahman afc10fb79a Add rgb elements to V3f 2024-08-18 22:29:47 +01:00
abdelrahman 86138f838c Add default material to model 2024-08-18 22:26:01 +01:00
abdelrahman ddfeba238d Add PhongMaterial struct 2024-08-18 22:19:54 +01:00
abdelrahman 29749c834a Create FragmentData struct 2024-08-18 22:19:23 +01:00
abdelrahman 760d9b6b9c Move shaders declaration to shaders.h 2024-08-18 22:18:12 +01:00
abdelrahman ec98a033eb Add macro for multiplying V3f with scalar 2024-08-18 22:17:27 +01:00
abdelrahman caa8c416a9 Remove extra intensity calculation 2024-08-18 21:08:59 +01:00
abdelrahman 690eb3d317 Update shaders and ensure coordinates are within buffer bounds 2024-08-18 21:04:46 +01:00
abdelrahman 6239be219a Ensure light is normalised 2024-08-18 17:09:13 +01:00
abdelrahman be7b577a0e Split obj loading and model rendering code 2024-08-18 17:04:41 +01:00
abdelrahman 2e39780272 Add support for loading normals from a map 2024-08-18 16:47:30 +01:00
abdelrahman 1adac24148 Remove seeding prng 2024-08-18 15:49:17 +01:00
abdelrahman 50b8c6dd0a Implement shaders (#1)
Reviewed-on: #1

	* Start implementing shaders and move vector code to dedicated files
	* Extract shader into its own header
	* Ensure pixel coordinates are within bounds
	* Refactor shader code and implement fragment shaders
	* Create shaders
	* Reorganise code
Co-authored-by: Abdelrahman <said.abdelrahman89@gmail.com>
Co-committed-by: Abdelrahman <said.abdelrahman89@gmail.com>
2024-08-18 14:28:09 +00:00
abdelrahman 3bbab3f624 Calculate projection matrix from eye and target 2024-08-17 22:04:33 +01:00
abdelrahman a3f0be461b Switch to calculating z buffer from viewport vertices 2024-08-17 20:27:58 +01:00
abdelrahman fdce10a85c Pass vertex as pointer 2024-08-17 20:21:30 +01:00
abdelrahman f77fa5694b Switch to using a viewport matrix 2024-08-17 16:27:45 +01:00
abdelrahman 3e414881d9 Fix global light direction 2024-08-17 11:49:56 +01:00
abdelrahman 4fa553db47 Correct head normals 2024-08-17 11:49:49 +01:00
abdelrahman 711b9d8558 Update result screenshot 2024-08-12 00:25:24 +01:00
abdelrahman 2f126f95ff Implement camera movement 2024-08-12 00:24:12 +01:00
abdelrahman 4143fd7b05 Fix model normals 2024-08-12 00:23:58 +01:00
abdelrahman 643da4e58d Implement shading based on vertex normals 2024-08-11 19:53:07 +01:00
abdelrahman d323c0ae14 Load vertex normals indices 2024-08-11 19:39:31 +01:00
abdelrahman e01c1397bc Load model normals 2024-08-11 19:33:32 +01:00
abdelrahman 46ca6bfa10 Rename NULL_MODEL macro 2024-08-11 19:31:14 +01:00
abdelrahman 91c4721c46 Make vector types public and remove unnecessary Vertex and TexCoord 2024-08-11 19:28:17 +01:00
abdelrahman 3a852cbab0 Update README 2024-08-11 18:03:15 +01:00
abdelrahman 5b55092ba2 Add screenshot of the result 2024-08-11 18:02:12 +01:00
abdelrahman b4210da399 Implement perspective projection 2024-08-11 17:58:38 +01:00
abdelrahman 34d0d17b76 Add perspective projection support 2024-08-11 17:57:56 +01:00
abdelrahman fee04607a7 Add V4f, Mat4x4f and a basic static camera matrix 2024-08-11 17:56:31 +01:00
abdelrahman b6e7b9c213 Rename variable 2024-08-10 18:31:58 +01:00
abdelrahman e472b221c0 Remove unused varaible 2024-08-10 18:28:59 +01:00
abdelrahman fa2857b5d3 Increase model's poly count 2024-08-10 17:50:40 +01:00
abdelrahman ba88c5b27c Make face region higher poly 2024-08-10 17:38:39 +01:00
abdelrahman 1ad2ca1a47 Fix checking barycentric coordinates 2024-08-10 17:38:13 +01:00
abdelrahman b111058f31 Rename IS_NULL_MODEL macro 2024-08-09 23:39:56 +01:00
abdelrahman 26c1f17a86 Correct obj name 2024-08-09 22:26:06 +00:00
abdelrahman 29c53de86e Update resources 2024-08-04 20:06:39 +01:00
abdelrahman 1ab8c964bf Implement rendering model with texture 2024-08-04 20:05:45 +01:00
abdelrahman 677627d8c9 Add utility to load P6 images 2024-08-04 20:05:30 +01:00
abdelrahman f024d51d85 Implement Z buffer 2024-08-04 17:53:52 +01:00
abdelrahman bd1326d83e Swap arg order for BUF_TYPE macro 2024-08-04 16:54:11 +01:00
abdelrahman 4eb2ae06f1 Create generic buffer type 2024-08-04 16:52:02 +01:00
abdelrahman bce85c5c71 Prep for adding z buffer 2024-08-04 14:38:52 +01:00
abdelrahman 5330e2e82c Remove unused wireframe render 2024-08-04 01:05:33 +01:00
abdelrahman c3c0dd732e Add shading 2024-07-31 23:05:39 +01:00
abdelrahman 9f9cc2308d Add math library 2024-07-31 23:05:15 +01:00
abdelrahman 5f44936dcd Add support for randomising colours 2024-07-31 22:11:11 +01:00