| 
																	
																	
																		
																			
																		
																	
																	
																 | 
																@ -33,6 +33,7 @@ | 
															
														
														
													
														
															
																 | 
																 | 
																
 | 
																 | 
																 | 
																
 | 
															
														
														
													
														
															
																 | 
																 | 
																#define MAX_CUBES   30 | 
																 | 
																 | 
																#define MAX_CUBES   30 | 
															
														
														
													
														
															
																 | 
																 | 
																
 | 
																 | 
																 | 
																
 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																// GBuffer data | 
															
														
														
													
														
															
																 | 
																 | 
																typedef struct GBuffer { | 
																 | 
																 | 
																typedef struct GBuffer { | 
															
														
														
													
														
															
																 | 
																 | 
																    unsigned int framebuffer; | 
																 | 
																 | 
																    unsigned int framebuffer; | 
															
														
														
													
														
															
																 | 
																 | 
																
 | 
																 | 
																 | 
																
 | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																			
																		
																	
																 | 
																@ -43,6 +44,7 @@ typedef struct GBuffer { | 
															
														
														
													
														
															
																 | 
																 | 
																    unsigned int depthRenderbuffer; | 
																 | 
																 | 
																    unsigned int depthRenderbuffer; | 
															
														
														
													
														
															
																 | 
																 | 
																} GBuffer; | 
																 | 
																 | 
																} GBuffer; | 
															
														
														
													
														
															
																 | 
																 | 
																
 | 
																 | 
																 | 
																
 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																// Deferred mode passes | 
															
														
														
													
														
															
																 | 
																 | 
																typedef enum { | 
																 | 
																 | 
																typedef enum { | 
															
														
														
													
														
															
																 | 
																 | 
																   DEFERRED_POSITION, | 
																 | 
																 | 
																   DEFERRED_POSITION, | 
															
														
														
													
														
															
																 | 
																 | 
																   DEFERRED_NORMAL, | 
																 | 
																 | 
																   DEFERRED_NORMAL, | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																			
																		
																	
																	
																		
																			
																		
																	
																	
																 | 
																@ -270,9 +272,9 @@ int main(void) | 
															
														
														
													
														
															
																 | 
																 | 
																                            } | 
																 | 
																 | 
																                            } | 
															
														
														
													
														
															
																 | 
																 | 
																                        rlDisableShader(); | 
																 | 
																 | 
																                        rlDisableShader(); | 
															
														
														
													
														
															
																 | 
																 | 
																                    EndMode3D(); | 
																 | 
																 | 
																                    EndMode3D(); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                     | 
															
														
														
													
														
															
																 | 
																 | 
																                    DrawText("FINAL RESULT", 10, screenHeight - 30, 20, DARKGREEN); | 
																 | 
																 | 
																                    DrawText("FINAL RESULT", 10, screenHeight - 30, 20, DARKGREEN); | 
															
														
														
													
														
															
																 | 
																 | 
																                } break; | 
																 | 
																 | 
																                } break; | 
															
														
														
													
														
															
																 | 
																 | 
																                 | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                case DEFERRED_POSITION: | 
																 | 
																 | 
																                case DEFERRED_POSITION: | 
															
														
														
													
														
															
																 | 
																 | 
																                { | 
																 | 
																 | 
																                { | 
															
														
														
													
														
															
																 | 
																 | 
																                    DrawTextureRec((Texture2D){ | 
																 | 
																 | 
																                    DrawTextureRec((Texture2D){ | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																			
																		
																	
																 | 
																@ -280,9 +282,9 @@ int main(void) | 
															
														
														
													
														
															
																 | 
																 | 
																                        .width = screenWidth, | 
																 | 
																 | 
																                        .width = screenWidth, | 
															
														
														
													
														
															
																 | 
																 | 
																                        .height = screenHeight, | 
																 | 
																 | 
																                        .height = screenHeight, | 
															
														
														
													
														
															
																 | 
																 | 
																                    }, (Rectangle) { 0, 0, screenWidth, -screenHeight }, Vector2Zero(), RAYWHITE); | 
																 | 
																 | 
																                    }, (Rectangle) { 0, 0, screenWidth, -screenHeight }, Vector2Zero(), RAYWHITE); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                     | 
															
														
														
													
														
															
																 | 
																 | 
																                    DrawText("POSITION TEXTURE", 10, screenHeight - 30, 20, DARKGREEN); | 
																 | 
																 | 
																                    DrawText("POSITION TEXTURE", 10, screenHeight - 30, 20, DARKGREEN); | 
															
														
														
													
														
															
																 | 
																 | 
																                } break; | 
																 | 
																 | 
																                } break; | 
															
														
														
													
														
															
																 | 
																 | 
																                 | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                case DEFERRED_NORMAL: | 
																 | 
																 | 
																                case DEFERRED_NORMAL: | 
															
														
														
													
														
															
																 | 
																 | 
																                { | 
																 | 
																 | 
																                { | 
															
														
														
													
														
															
																 | 
																 | 
																                    DrawTextureRec((Texture2D){ | 
																 | 
																 | 
																                    DrawTextureRec((Texture2D){ | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																			
																		
																	
																 | 
																@ -290,9 +292,9 @@ int main(void) | 
															
														
														
													
														
															
																 | 
																 | 
																                        .width = screenWidth, | 
																 | 
																 | 
																                        .width = screenWidth, | 
															
														
														
													
														
															
																 | 
																 | 
																                        .height = screenHeight, | 
																 | 
																 | 
																                        .height = screenHeight, | 
															
														
														
													
														
															
																 | 
																 | 
																                    }, (Rectangle) { 0, 0, screenWidth, -screenHeight }, Vector2Zero(), RAYWHITE); | 
																 | 
																 | 
																                    }, (Rectangle) { 0, 0, screenWidth, -screenHeight }, Vector2Zero(), RAYWHITE); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                     | 
															
														
														
													
														
															
																 | 
																 | 
																                    DrawText("NORMAL TEXTURE", 10, screenHeight - 30, 20, DARKGREEN); | 
																 | 
																 | 
																                    DrawText("NORMAL TEXTURE", 10, screenHeight - 30, 20, DARKGREEN); | 
															
														
														
													
														
															
																 | 
																 | 
																                } break; | 
																 | 
																 | 
																                } break; | 
															
														
														
													
														
															
																 | 
																 | 
																
 | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                case DEFERRED_ALBEDO: | 
																 | 
																 | 
																                case DEFERRED_ALBEDO: | 
															
														
														
													
														
															
																 | 
																 | 
																                { | 
																 | 
																 | 
																                { | 
															
														
														
													
														
															
																 | 
																 | 
																                    DrawTextureRec((Texture2D){ | 
																 | 
																 | 
																                    DrawTextureRec((Texture2D){ | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																			
																		
																	
																 | 
																@ -300,8 +302,10 @@ int main(void) | 
															
														
														
													
														
															
																 | 
																 | 
																                        .width = screenWidth, | 
																 | 
																 | 
																                        .width = screenWidth, | 
															
														
														
													
														
															
																 | 
																 | 
																                        .height = screenHeight, | 
																 | 
																 | 
																                        .height = screenHeight, | 
															
														
														
													
														
															
																 | 
																 | 
																                    }, (Rectangle) { 0, 0, screenWidth, -screenHeight }, Vector2Zero(), RAYWHITE); | 
																 | 
																 | 
																                    }, (Rectangle) { 0, 0, screenWidth, -screenHeight }, Vector2Zero(), RAYWHITE); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                     | 
															
														
														
													
														
															
																 | 
																 | 
																                    DrawText("ALBEDO TEXTURE", 10, screenHeight - 30, 20, DARKGREEN); | 
																 | 
																 | 
																                    DrawText("ALBEDO TEXTURE", 10, screenHeight - 30, 20, DARKGREEN); | 
															
														
														
													
														
															
																 | 
																 | 
																                } break; | 
																 | 
																 | 
																                } break; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                default: break; | 
															
														
														
													
														
															
																 | 
																 | 
																            } | 
																 | 
																 | 
																            } | 
															
														
														
													
														
															
																 | 
																 | 
																
 | 
																 | 
																 | 
																
 | 
															
														
														
													
														
															
																 | 
																 | 
																            DrawText("Toggle lights keys: [Y][R][G][B]", 10, 40, 20, DARKGRAY); | 
																 | 
																 | 
																            DrawText("Toggle lights keys: [Y][R][G][B]", 10, 40, 20, DARKGRAY); | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																			
																		
																	
																 | 
																@ -318,7 +322,7 @@ int main(void) | 
															
														
														
													
														
															
																 | 
																 | 
																    UnloadModel(model);     // Unload the models | 
																 | 
																 | 
																    UnloadModel(model);     // Unload the models | 
															
														
														
													
														
															
																 | 
																 | 
																    UnloadModel(cube); | 
																 | 
																 | 
																    UnloadModel(cube); | 
															
														
														
													
														
															
																 | 
																 | 
																
 | 
																 | 
																 | 
																
 | 
															
														
														
													
														
															
																 | 
																 | 
																    UnloadShader(deferredShader);   // Unload shaders | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    UnloadShader(deferredShader); // Unload shaders | 
															
														
														
													
														
															
																 | 
																 | 
																    UnloadShader(gbufferShader); | 
																 | 
																 | 
																    UnloadShader(gbufferShader); | 
															
														
														
													
														
															
																 | 
																 | 
																
 | 
																 | 
																 | 
																
 | 
															
														
														
													
														
															
																 | 
																 | 
																    // Unload geometry buffer and all attached textures | 
																 | 
																 | 
																    // Unload geometry buffer and all attached textures | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																			
																		
																	
																 | 
																@ -333,4 +337,3 @@ int main(void) | 
															
														
														
													
														
															
																 | 
																 | 
																
 | 
																 | 
																 | 
																
 | 
															
														
														
													
														
															
																 | 
																 | 
																    return 0; | 
																 | 
																 | 
																    return 0; | 
															
														
														
													
														
															
																 | 
																 | 
																} | 
																 | 
																 | 
																} | 
															
														
														
													
														
															
																 | 
																 | 
																
 | 
																 | 
																 | 
																 |