├── CMakeLists.txt ├── License.txt ├── README.md ├── bin └── assimp.dll ├── config ├── ROOT_PATH.h.in └── config.in ├── data ├── objects │ └── nanosuit │ │ ├── arm_dif.png │ │ ├── arm_showroom_ddn.png │ │ ├── arm_showroom_refl.png │ │ ├── arm_showroom_spec.png │ │ ├── back.jpg │ │ ├── body_dif.png │ │ ├── body_showroom_ddn.png │ │ ├── body_showroom_refl.png │ │ ├── body_showroom_spec.png │ │ ├── cell_arm_alpha.png │ │ ├── cell_body_alpha.png │ │ ├── cell_ddn.png │ │ ├── cell_hand_alpha.png │ │ ├── cell_helmet_alpha.png │ │ ├── cell_leg_alpha.png │ │ ├── front.jpg │ │ ├── glass_ddn.png │ │ ├── glass_dif.png │ │ ├── glass_refl.png │ │ ├── hand_dif.png │ │ ├── hand_showroom_ddn.png │ │ ├── hand_showroom_refl.png │ │ ├── hand_showroom_spec.png │ │ ├── helmet_diff.png │ │ ├── helmet_showroom_ddn.png │ │ ├── helmet_showroom_refl.png │ │ ├── helmet_showroom_spec.png │ │ ├── leg_dif.png │ │ ├── leg_showroom_ddn.png │ │ ├── leg_showroom_refl.png │ │ ├── leg_showroom_spec.png │ │ ├── nanosuit.mtl │ │ └── nanosuit.obj ├── shaders │ ├── 01_Introduction │ │ ├── 02_Triangle │ │ │ ├── 02_Triangle.vs │ │ │ ├── 02_Triangle_Blue.fs │ │ │ └── 02_Triangle_Red.fs │ │ ├── 03_Shader │ │ │ ├── 03_Shader.fs │ │ │ └── 03_Shader.vs │ │ ├── 04_Texture │ │ │ ├── 04_Texture.fs │ │ │ └── 04_Texture.vs │ │ ├── 05_Transform │ │ │ ├── 05_Transform.fs │ │ │ └── 05_Transform.vs │ │ ├── 06_Coordinate │ │ │ ├── 06_Coordinate.fs │ │ │ └── 06_Coordinate.vs │ │ └── 07_Camera │ │ │ ├── 07_Camera.fs │ │ │ └── 07_Camera.vs │ ├── 02_Lighting │ │ ├── 01_Color │ │ │ ├── light.fs │ │ │ ├── light.vs │ │ │ ├── lighting.fs │ │ │ └── lighting.vs │ │ ├── 02_BasicLighting │ │ │ ├── light.fs │ │ │ ├── light.vs │ │ │ ├── lighting.fs │ │ │ └── lighting.vs │ │ ├── 03_Material │ │ │ ├── light.fs │ │ │ ├── light.vs │ │ │ ├── lighting.fs │ │ │ └── lighting.vs │ │ ├── 04_LightingMap │ │ │ ├── light.fs │ │ │ ├── light.vs │ │ │ ├── lighting.fs │ │ │ └── lighting.vs │ │ ├── 05_LightCaster │ │ │ ├── light.fs │ │ │ ├── light.vs │ │ │ ├── lighting.fs │ │ │ └── lighting.vs │ │ └── 06_MultiLight │ │ │ ├── light.fs │ │ │ ├── light.vs │ │ │ ├── lighting.fs │ │ │ └── lighting.vs │ ├── 03_LoadModel │ │ └── 01_LoadModel │ │ │ ├── light.fs │ │ │ ├── light.vs │ │ │ ├── lighting.fs │ │ │ ├── lighting.vs │ │ │ ├── nanosuit.fs │ │ │ └── nanosuit.vs │ ├── 04_AdvanceOGL │ │ ├── 01_DepthTest │ │ │ ├── light.fs │ │ │ ├── light.vs │ │ │ ├── lighting.fs │ │ │ ├── lighting.vs │ │ │ ├── nanosuit.fs │ │ │ └── nanosuit.vs │ │ ├── 02_StencilTest │ │ │ ├── light.fs │ │ │ ├── light.vs │ │ │ ├── lighting.fs │ │ │ ├── lighting.vs │ │ │ ├── nanosuit.fs │ │ │ ├── nanosuit.vs │ │ │ ├── singleColor.fs │ │ │ └── singleColor.vs │ │ ├── 03_Blend │ │ │ ├── light.fs │ │ │ ├── light.vs │ │ │ ├── lighting.fs │ │ │ ├── lighting.vs │ │ │ ├── nanosuit.fs │ │ │ ├── nanosuit.vs │ │ │ ├── singleColor.fs │ │ │ ├── singleColor.vs │ │ │ ├── transparent.fs │ │ │ └── transparent.vs │ │ ├── 04_FrameBuffer │ │ │ ├── light.fs │ │ │ ├── light.vs │ │ │ ├── lighting.fs │ │ │ ├── lighting.vs │ │ │ ├── nanosuit.fs │ │ │ ├── nanosuit.vs │ │ │ ├── postProcess.fs │ │ │ ├── postProcess.vs │ │ │ ├── singleColor.fs │ │ │ ├── singleColor.vs │ │ │ ├── transparent.fs │ │ │ └── transparent.vs │ │ ├── 05_CubeMap │ │ │ ├── light.fs │ │ │ ├── light.vs │ │ │ ├── lighting.fs │ │ │ ├── lighting.vs │ │ │ ├── nanosuit.fs │ │ │ ├── nanosuit.vs │ │ │ ├── postProcess.fs │ │ │ ├── postProcess.vs │ │ │ ├── reflect.fs │ │ │ ├── reflect.vs │ │ │ ├── refract.fs │ │ │ ├── refract.vs │ │ │ ├── singleColor.fs │ │ │ ├── singleColor.vs │ │ │ ├── skybox.fs │ │ │ ├── skybox.vs │ │ │ ├── transparent.fs │ │ │ └── transparent.vs │ │ ├── 06_UBO │ │ │ ├── light.fs │ │ │ ├── light.vs │ │ │ ├── lighting.fs │ │ │ ├── lighting.vs │ │ │ ├── nanosuit.fs │ │ │ ├── nanosuit.vs │ │ │ ├── postProcess.fs │ │ │ ├── postProcess.vs │ │ │ ├── reflect.fs │ │ │ ├── reflect.vs │ │ │ ├── refract.fs │ │ │ ├── refract.vs │ │ │ ├── singleColor.fs │ │ │ ├── singleColor.vs │ │ │ ├── skybox.fs │ │ │ ├── skybox.vs │ │ │ ├── transparent.fs │ │ │ └── transparent.vs │ │ ├── 07_GS │ │ │ ├── house.fs │ │ │ ├── house.gs │ │ │ ├── house.vs │ │ │ ├── light.fs │ │ │ ├── light.vs │ │ │ ├── lighting.fs │ │ │ ├── lighting.vs │ │ │ ├── nanosuit.fs │ │ │ ├── nanosuit.vs │ │ │ ├── nanosuit_explode.fs │ │ │ ├── nanosuit_explode.gs │ │ │ ├── nanosuit_explode.vs │ │ │ ├── nanosuit_normal.fs │ │ │ ├── nanosuit_normal.gs │ │ │ ├── nanosuit_normal.vs │ │ │ ├── postProcess.fs │ │ │ ├── postProcess.vs │ │ │ ├── reflect.fs │ │ │ ├── reflect.vs │ │ │ ├── refract.fs │ │ │ ├── refract.vs │ │ │ ├── singleColor.fs │ │ │ ├── singleColor.vs │ │ │ ├── skybox.fs │ │ │ ├── skybox.vs │ │ │ ├── transparent.fs │ │ │ └── transparent.vs │ │ └── 08_Instance │ │ │ ├── house.fs │ │ │ ├── house.gs │ │ │ ├── house.vs │ │ │ ├── instance.fs │ │ │ ├── instance.vs │ │ │ ├── light.fs │ │ │ ├── light.vs │ │ │ ├── lighting.fs │ │ │ ├── lighting.vs │ │ │ ├── nanosuit.fs │ │ │ ├── nanosuit.vs │ │ │ ├── nanosuit_explode.fs │ │ │ ├── nanosuit_explode.gs │ │ │ ├── nanosuit_explode.vs │ │ │ ├── nanosuit_normal.fs │ │ │ ├── nanosuit_normal.gs │ │ │ ├── nanosuit_normal.vs │ │ │ ├── postProcess.fs │ │ │ ├── postProcess.vs │ │ │ ├── reflect.fs │ │ │ ├── reflect.vs │ │ │ ├── refract.fs │ │ │ ├── refract.vs │ │ │ ├── singleColor.fs │ │ │ ├── singleColor.vs │ │ │ ├── skybox.fs │ │ │ ├── skybox.vs │ │ │ ├── transparent.fs │ │ │ └── transparent.vs │ ├── 05_AdvanceLighting │ │ ├── 01_BlinnPhong │ │ │ ├── BlinnPhong.fs │ │ │ └── BlinnPhong.vs │ │ ├── 02_Gamma │ │ │ ├── BlinnPhong.fs │ │ │ ├── BlinnPhong.vs │ │ │ ├── Gamma.fs │ │ │ └── Gamma.vs │ │ ├── 03_ShadowMap │ │ │ ├── depth.fs │ │ │ ├── depth.vs │ │ │ ├── shadow.fs │ │ │ └── shadow.vs │ │ ├── 04_PointShadow │ │ │ ├── depth.fs │ │ │ ├── depth.gs │ │ │ ├── depth.vs │ │ │ ├── shadow.fs │ │ │ └── shadow.vs │ │ ├── 05_NormalMap │ │ │ ├── imgShow.fs │ │ │ ├── imgShow.vs │ │ │ ├── normalMap.fs │ │ │ └── normalMap.vs │ │ ├── 06_ParallaxMap │ │ │ ├── imgShow.fs │ │ │ ├── imgShow.vs │ │ │ ├── parallaxMap.fs │ │ │ └── parallaxMap.vs │ │ ├── 07_HDR │ │ │ ├── hdr.fs │ │ │ ├── hdr.vs │ │ │ ├── lighting.fs │ │ │ └── lighting.vs │ │ ├── 08_Bloom │ │ │ ├── blend.fs │ │ │ ├── bloomLight.fs │ │ │ ├── bloomObj.fs │ │ │ └── blur.fs │ │ ├── 09_DeferedShading │ │ │ ├── deferedShading.fs │ │ │ └── gBuffer.fs │ │ ├── 09_DefferedShading │ │ │ ├── defferedShading.fs │ │ │ └── gBuffer.fs │ │ └── 10_SSAO │ │ │ ├── SSAO.fs │ │ │ ├── blur.fs │ │ │ ├── deferedShading.fs │ │ │ ├── gBuffer.fs │ │ │ └── gBuffer.vs │ └── Common │ │ ├── basic.fs │ │ ├── basic_P2T2.vs │ │ ├── basic_P3.vs │ │ ├── basic_P3N3.vs │ │ ├── basic_P3N3T2.vs │ │ ├── basic_P3N3T2_invN.vs │ │ ├── basic_P3N3_invN.vs │ │ ├── basic_P3T2.vs │ │ └── basic_T2.fs └── textures │ ├── awesomeface.png │ ├── bricks2.jpg │ ├── bricks2_disp.jpg │ ├── bricks2_normal.jpg │ ├── brickwall.jpg │ ├── brickwall_normal.jpg │ ├── container.jpg │ ├── container2.png │ ├── container2_specular.png │ ├── earth.jpg │ ├── grass.png │ ├── marble.jpg │ ├── matrix.jpg │ ├── skybox │ ├── back.jpg │ ├── bottom.jpg │ ├── front.jpg │ ├── left.jpg │ ├── right.jpg │ └── top.jpg │ ├── window.png │ └── wood.png ├── include ├── GLFW │ ├── Glfw.h │ ├── glfw3.h │ └── glfw3native.h ├── KHR │ └── khrplatform.h ├── LOGL │ ├── Camera.h │ ├── CommonDefine.h │ ├── FBO.h │ ├── Mesh.h │ ├── Model.h │ ├── Shader.h │ ├── Texture.h │ └── VAO.h ├── Utility │ ├── ArgManager.h │ ├── Array2D.h │ ├── Config.h │ ├── Cube.h │ ├── EventManager.h │ ├── File.h │ ├── GStorage.h │ ├── Image.h │ ├── InfoLambdaOp.h │ ├── LStorage.h │ ├── LambdaOp.h │ ├── OpNode.h │ ├── OpQueue.h │ ├── Operation.h │ ├── Pool.h │ ├── Shape.h │ ├── Singleton.h │ ├── Sphere.h │ ├── Timer.h │ ├── Vec.h │ ├── Vec3.h │ ├── Vec4.h │ └── stb_image.h ├── assimp │ ├── Compiler │ │ ├── poppack1.h │ │ ├── pstdint.h │ │ └── pushpack1.h │ ├── DefaultLogger.hpp │ ├── Exporter.hpp │ ├── IOStream.hpp │ ├── IOSystem.hpp │ ├── Importer.hpp │ ├── LogStream.hpp │ ├── Logger.hpp │ ├── NullLogger.hpp │ ├── ProgressHandler.hpp │ ├── ai_assert.h │ ├── anim.h │ ├── camera.h │ ├── cexport.h │ ├── cfileio.h │ ├── cimport.h │ ├── color4.h │ ├── color4.inl │ ├── config.h │ ├── defs.h │ ├── importerdesc.h │ ├── light.h │ ├── material.h │ ├── material.inl │ ├── matrix3x3.h │ ├── matrix3x3.inl │ ├── matrix4x4.h │ ├── matrix4x4.inl │ ├── mesh.h │ ├── metadata.h │ ├── postprocess.h │ ├── quaternion.h │ ├── quaternion.inl │ ├── scene.h │ ├── texture.h │ ├── types.h │ ├── vector2.h │ ├── vector2.inl │ ├── vector3.h │ ├── vector3.inl │ └── version.h ├── glad │ └── glad.h └── glm │ ├── common.hpp │ ├── detail │ ├── _features.hpp │ ├── _fixes.hpp │ ├── _noise.hpp │ ├── _swizzle.hpp │ ├── _swizzle_func.hpp │ ├── _vectorize.hpp │ ├── dummy.cpp │ ├── func_common.hpp │ ├── func_common.inl │ ├── func_exponential.hpp │ ├── func_exponential.inl │ ├── func_geometric.hpp │ ├── func_geometric.inl │ ├── func_integer.hpp │ ├── func_integer.inl │ ├── func_matrix.hpp │ ├── func_matrix.inl │ ├── func_packing.hpp │ ├── func_packing.inl │ ├── func_trigonometric.hpp │ ├── func_trigonometric.inl │ ├── func_vector_relational.hpp │ ├── func_vector_relational.inl │ ├── glm.cpp │ ├── intrinsic_common.hpp │ ├── intrinsic_common.inl │ ├── intrinsic_exponential.hpp │ ├── intrinsic_exponential.inl │ ├── intrinsic_geometric.hpp │ ├── intrinsic_geometric.inl │ ├── intrinsic_integer.hpp │ ├── intrinsic_integer.inl │ ├── intrinsic_matrix.hpp │ ├── intrinsic_matrix.inl │ ├── intrinsic_trigonometric.hpp │ ├── intrinsic_trigonometric.inl │ ├── intrinsic_vector_relational.hpp │ ├── intrinsic_vector_relational.inl │ ├── precision.hpp │ ├── setup.hpp │ ├── type_float.hpp │ ├── type_gentype.hpp │ ├── type_gentype.inl │ ├── type_half.hpp │ ├── type_half.inl │ ├── type_int.hpp │ ├── type_mat.hpp │ ├── type_mat.inl │ ├── type_mat2x2.hpp │ ├── type_mat2x2.inl │ ├── type_mat2x3.hpp │ ├── type_mat2x3.inl │ ├── type_mat2x4.hpp │ ├── type_mat2x4.inl │ ├── type_mat3x2.hpp │ ├── type_mat3x2.inl │ ├── type_mat3x3.hpp │ ├── type_mat3x3.inl │ ├── type_mat3x4.hpp │ ├── type_mat3x4.inl │ ├── type_mat4x2.hpp │ ├── type_mat4x2.inl │ ├── type_mat4x3.hpp │ ├── type_mat4x3.inl │ ├── type_mat4x4.hpp │ ├── type_mat4x4.inl │ ├── type_vec.hpp │ ├── type_vec.inl │ ├── type_vec1.hpp │ ├── type_vec1.inl │ ├── type_vec2.hpp │ ├── type_vec2.inl │ ├── type_vec3.hpp │ ├── type_vec3.inl │ ├── type_vec4.hpp │ ├── type_vec4.inl │ ├── type_vec4_avx.inl │ ├── type_vec4_avx2.inl │ └── type_vec4_sse2.inl │ ├── exponential.hpp │ ├── ext.hpp │ ├── fwd.hpp │ ├── geometric.hpp │ ├── glm.hpp │ ├── gtc │ ├── bitfield.hpp │ ├── bitfield.inl │ ├── color_space.hpp │ ├── color_space.inl │ ├── constants.hpp │ ├── constants.inl │ ├── epsilon.hpp │ ├── epsilon.inl │ ├── integer.hpp │ ├── integer.inl │ ├── matrix_access.hpp │ ├── matrix_access.inl │ ├── matrix_integer.hpp │ ├── matrix_inverse.hpp │ ├── matrix_inverse.inl │ ├── matrix_transform.hpp │ ├── matrix_transform.inl │ ├── noise.hpp │ ├── noise.inl │ ├── packing.hpp │ ├── packing.inl │ ├── quaternion.hpp │ ├── quaternion.inl │ ├── random.hpp │ ├── random.inl │ ├── reciprocal.hpp │ ├── reciprocal.inl │ ├── round.hpp │ ├── round.inl │ ├── type_precision.hpp │ ├── type_precision.inl │ ├── type_ptr.hpp │ ├── type_ptr.inl │ ├── ulp.hpp │ ├── ulp.inl │ ├── vec1.hpp │ └── vec1.inl │ ├── gtx │ ├── associated_min_max.hpp │ ├── associated_min_max.inl │ ├── bit.hpp │ ├── bit.inl │ ├── closest_point.hpp │ ├── closest_point.inl │ ├── color_space.hpp │ ├── color_space.inl │ ├── color_space_YCoCg.hpp │ ├── color_space_YCoCg.inl │ ├── common.hpp │ ├── common.inl │ ├── compatibility.hpp │ ├── compatibility.inl │ ├── component_wise.hpp │ ├── component_wise.inl │ ├── dual_quaternion.hpp │ ├── dual_quaternion.inl │ ├── euler_angles.hpp │ ├── euler_angles.inl │ ├── extend.hpp │ ├── extend.inl │ ├── extented_min_max.hpp │ ├── extented_min_max.inl │ ├── fast_exponential.hpp │ ├── fast_exponential.inl │ ├── fast_square_root.hpp │ ├── fast_square_root.inl │ ├── fast_trigonometry.hpp │ ├── fast_trigonometry.inl │ ├── gradient_paint.hpp │ ├── gradient_paint.inl │ ├── handed_coordinate_space.hpp │ ├── handed_coordinate_space.inl │ ├── hash.hpp │ ├── hash.inl │ ├── integer.hpp │ ├── integer.inl │ ├── intersect.hpp │ ├── intersect.inl │ ├── io.hpp │ ├── io.inl │ ├── log_base.hpp │ ├── log_base.inl │ ├── matrix_cross_product.hpp │ ├── matrix_cross_product.inl │ ├── matrix_decompose.hpp │ ├── matrix_decompose.inl │ ├── matrix_interpolation.hpp │ ├── matrix_interpolation.inl │ ├── matrix_major_storage.hpp │ ├── matrix_major_storage.inl │ ├── matrix_operation.hpp │ ├── matrix_operation.inl │ ├── matrix_query.hpp │ ├── matrix_query.inl │ ├── matrix_transform_2d.hpp │ ├── matrix_transform_2d.inl │ ├── mixed_product.hpp │ ├── mixed_product.inl │ ├── norm.hpp │ ├── norm.inl │ ├── normal.hpp │ ├── normal.inl │ ├── normalize_dot.hpp │ ├── normalize_dot.inl │ ├── number_precision.hpp │ ├── number_precision.inl │ ├── optimum_pow.hpp │ ├── optimum_pow.inl │ ├── orthonormalize.hpp │ ├── orthonormalize.inl │ ├── perpendicular.hpp │ ├── perpendicular.inl │ ├── polar_coordinates.hpp │ ├── polar_coordinates.inl │ ├── projection.hpp │ ├── projection.inl │ ├── quaternion.hpp │ ├── quaternion.inl │ ├── range.hpp │ ├── raw_data.hpp │ ├── raw_data.inl │ ├── rotate_normalized_axis.hpp │ ├── rotate_normalized_axis.inl │ ├── rotate_vector.hpp │ ├── rotate_vector.inl │ ├── scalar_multiplication.hpp │ ├── scalar_relational.hpp │ ├── scalar_relational.inl │ ├── simd_mat4.hpp │ ├── simd_mat4.inl │ ├── simd_quat.hpp │ ├── simd_quat.inl │ ├── simd_vec4.hpp │ ├── simd_vec4.inl │ ├── spline.hpp │ ├── spline.inl │ ├── std_based_type.hpp │ ├── std_based_type.inl │ ├── string_cast.hpp │ ├── string_cast.inl │ ├── transform.hpp │ ├── transform.inl │ ├── transform2.hpp │ ├── transform2.inl │ ├── type_aligned.hpp │ ├── type_aligned.inl │ ├── vector_angle.hpp │ ├── vector_angle.inl │ ├── vector_query.hpp │ ├── vector_query.inl │ ├── wrap.hpp │ └── wrap.inl │ ├── integer.hpp │ ├── mat2x2.hpp │ ├── mat2x3.hpp │ ├── mat2x4.hpp │ ├── mat3x2.hpp │ ├── mat3x3.hpp │ ├── mat3x4.hpp │ ├── mat4x2.hpp │ ├── mat4x3.hpp │ ├── mat4x4.hpp │ ├── matrix.hpp │ ├── packing.hpp │ ├── trigonometric.hpp │ ├── vec2.hpp │ ├── vec3.hpp │ ├── vec4.hpp │ └── vector_relational.hpp ├── lib ├── assimp.lib └── glfw3.lib ├── notes ├── C1.md ├── C2.md ├── C3.md ├── C4.md ├── C5.md ├── C6.md └── assets │ ├── 1539936806842.png │ ├── 1540608188919.png │ ├── 1540608204250.png │ ├── 1540608253058.png │ ├── 1540608270835.png │ ├── 1540824585203.png │ ├── 1540906287862.png │ ├── 1540908270510.png │ ├── 1540908281257.png │ ├── 1540989683790.png │ ├── 1540994571587.png │ ├── 1541056303958.png │ ├── 1541056474748.png │ ├── 1541226283368.png │ ├── 1541226486104.png │ ├── 1541226499457.png │ ├── advanced_glsl_binding_points.png │ ├── bricks2_disp.jpg │ ├── camera_axes.png │ ├── camera_pitch.png │ ├── camera_pitch_yaw_roll.png │ ├── camera_yaw.png │ ├── cubemaps_reflection_nanosuit.png │ ├── cubemaps_reflection_theory.png │ ├── cubemaps_refraction.png │ ├── cubemaps_refraction_theory.png │ ├── cubemaps_sampling.png │ ├── cubemaps_skybox.png │ ├── framebuffers_blur.png │ ├── framebuffers_edge_detection.png │ ├── framebuffers_grayscale.png │ ├── framebuffers_inverse.png │ └── framebuffers_sharpen.png ├── run_all.bat └── src ├── 01_Introduction ├── 01_Window │ ├── 01_Window.cpp │ └── CMakeLists.txt ├── 02_Triangle │ ├── 02_Triangle.cpp │ ├── 02_Triangle.vs │ ├── 02_Triangle_Blue.fs │ ├── 02_Triangle_Red.fs │ └── CMakeLists.txt ├── 03_Shader │ ├── 03_Shader.cpp │ ├── 03_Shader.fs │ ├── 03_Shader.vs │ └── CMakeLists.txt ├── 04_Texture │ ├── 04_Texture.cpp │ ├── 04_Texture.fs │ ├── 04_Texture.vs │ └── CMakeLists.txt ├── 05_Transform │ ├── 05_Transform.cpp │ ├── 05_Transform.fs │ ├── 05_Transform.vs │ └── CMakeLists.txt ├── 06_Coordinate │ ├── 06_Coordinate.cpp │ ├── 06_Coordinate.fs │ ├── 06_Coordinate.vs │ └── CMakeLists.txt ├── 07_Camera │ ├── 07_Camera.cpp │ ├── 07_Camera.fs │ ├── 07_Camera.vs │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RegisterInput.cpp │ └── RegisterInput.h └── CMakeLists.txt ├── 02_Lighting ├── 01_Color │ ├── 01_Color.cpp │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── light.fs │ ├── light.vs │ ├── lighting.fs │ └── lighting.vs ├── 02_BasicLighting │ ├── 02_BasicLighting.cpp │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── light.fs │ ├── light.vs │ ├── lighting.fs │ └── lighting.vs ├── 03_Material │ ├── 03_Material.cpp │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── light.fs │ ├── light.vs │ ├── lighting.fs │ └── lighting.vs ├── 04_LightingMap │ ├── 04_LightingMap.cpp │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── light.fs │ ├── light.vs │ ├── lighting.fs │ └── lighting.vs ├── 05_LightCaster │ ├── 05_LightCaster.cpp │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── light.fs │ ├── light.vs │ ├── lighting.fs │ └── lighting.vs ├── 06_MultiLight │ ├── 06_MultiLight.cpp │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── light.fs │ ├── light.vs │ ├── lighting.fs │ └── lighting.vs └── CMakeLists.txt ├── 03_LoadModel ├── 01_LoadModel │ ├── 01_LoadModel.cpp │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── light.fs │ ├── light.vs │ ├── lighting.fs │ ├── lighting.vs │ ├── nanosuit.fs │ └── nanosuit.vs └── CMakeLists.txt ├── 04_AdvanceOGL ├── 01_DepthTest │ ├── 01_DepthTest.cpp │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── light.fs │ ├── light.vs │ ├── lighting.fs │ ├── lighting.vs │ ├── nanosuit.fs │ └── nanosuit.vs ├── 02_StencilTest │ ├── 02_StencilTest.cpp │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── light.fs │ ├── light.vs │ ├── lighting.fs │ ├── lighting.vs │ ├── nanosuit.fs │ ├── nanosuit.vs │ ├── singleColor.fs │ └── singleColor.vs ├── 03_Blend │ ├── 03_Blend.cpp │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── light.fs │ ├── light.vs │ ├── lighting.fs │ ├── lighting.vs │ ├── nanosuit.fs │ ├── nanosuit.vs │ ├── singleColor.fs │ ├── singleColor.vs │ ├── transparent.fs │ └── transparent.vs ├── 04_FrameBuffer │ ├── 04_FrameBuffer.cpp │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── light.fs │ ├── light.vs │ ├── lighting.fs │ ├── lighting.vs │ ├── nanosuit.fs │ ├── nanosuit.vs │ ├── postProcess.fs │ ├── postProcess.vs │ ├── singleColor.fs │ ├── singleColor.vs │ ├── transparent.fs │ └── transparent.vs ├── 05_CubeMap │ ├── 05_CubeMap.cpp │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── light.fs │ ├── light.vs │ ├── lighting.fs │ ├── lighting.vs │ ├── nanosuit.fs │ ├── nanosuit.vs │ ├── postProcess.fs │ ├── postProcess.vs │ ├── reflect.fs │ ├── reflect.vs │ ├── refract.fs │ ├── refract.vs │ ├── singleColor.fs │ ├── singleColor.vs │ ├── skybox.fs │ ├── skybox.vs │ ├── transparent.fs │ └── transparent.vs ├── 06_UBO │ ├── 06_UBO.cpp │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── light.fs │ ├── light.vs │ ├── lighting.fs │ ├── lighting.vs │ ├── nanosuit.fs │ ├── nanosuit.vs │ ├── postProcess.fs │ ├── postProcess.vs │ ├── reflect.fs │ ├── reflect.vs │ ├── refract.fs │ ├── refract.vs │ ├── singleColor.fs │ ├── singleColor.vs │ ├── skybox.fs │ ├── skybox.vs │ ├── transparent.fs │ └── transparent.vs ├── 07_GS │ ├── 07_GS.cpp │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── house.fs │ ├── house.gs │ ├── house.vs │ ├── light.fs │ ├── light.vs │ ├── lighting.fs │ ├── lighting.vs │ ├── nanosuit.fs │ ├── nanosuit.vs │ ├── nanosuit_explode.fs │ ├── nanosuit_explode.gs │ ├── nanosuit_explode.vs │ ├── nanosuit_normal.fs │ ├── nanosuit_normal.gs │ ├── nanosuit_normal.vs │ ├── postProcess.fs │ ├── postProcess.vs │ ├── reflect.fs │ ├── reflect.vs │ ├── refract.fs │ ├── refract.vs │ ├── singleColor.fs │ ├── singleColor.vs │ ├── skybox.fs │ ├── skybox.vs │ ├── transparent.fs │ └── transparent.vs ├── 08_Instance │ ├── 08_Instance.cpp │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── house.fs │ ├── house.gs │ ├── house.vs │ ├── instance.fs │ ├── instance.vs │ ├── light.fs │ ├── light.vs │ ├── lighting.fs │ ├── lighting.vs │ ├── nanosuit.fs │ ├── nanosuit.vs │ ├── nanosuit_explode.fs │ ├── nanosuit_explode.gs │ ├── nanosuit_explode.vs │ ├── nanosuit_normal.fs │ ├── nanosuit_normal.gs │ ├── nanosuit_normal.vs │ ├── postProcess.fs │ ├── postProcess.vs │ ├── reflect.fs │ ├── reflect.vs │ ├── refract.fs │ ├── refract.vs │ ├── singleColor.fs │ ├── singleColor.vs │ ├── skybox.fs │ ├── skybox.vs │ ├── transparent.fs │ └── transparent.vs └── CMakeLists.txt ├── 05_AdvanceLighting ├── 01_BlinnPhong │ ├── 01_BlinnPhong.cpp │ ├── BlinnPhong.fs │ ├── BlinnPhong.vs │ ├── CMakeLists.txt │ ├── Defines.cpp │ ├── Defines.h │ ├── RegisterInput.cpp │ └── RegisterInput.h ├── 02_Gamma │ ├── 02_Gamma.cpp │ ├── CMakeLists.txt │ ├── Defines.cpp │ ├── Defines.h │ ├── Gamma.fs │ ├── Gamma.vs │ ├── RegisterInput.cpp │ └── RegisterInput.h ├── 03_ShadowMap │ ├── 03_ShadowMap.cpp │ ├── CMakeLists.txt │ ├── Defines.cpp │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── depth.fs │ ├── depth.vs │ ├── shadow.fs │ └── shadow.vs ├── 04_PointShadow │ ├── 04_PointShadow.cpp │ ├── CMakeLists.txt │ ├── Defines.cpp │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── depth.fs │ ├── depth.gs │ ├── depth.vs │ ├── shadow.fs │ └── shadow.vs ├── 05_NormalMap │ ├── 05_NormalMap.cpp │ ├── CMakeLists.txt │ ├── Defines.cpp │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── imgShow.fs │ ├── imgShow.vs │ ├── normalMap.fs │ └── normalMap.vs ├── 06_ParallaxMap │ ├── 06_ParallaxMap.cpp │ ├── CMakeLists.txt │ ├── Defines.cpp │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── imgShow.fs │ ├── imgShow.vs │ ├── parallaxMap.fs │ └── parallaxMap.vs ├── 07_HDR │ ├── 07_HDR.cpp │ ├── CMakeLists.txt │ ├── Defines.cpp │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── hdr.fs │ ├── hdr.vs │ ├── lighting.fs │ └── lighting.vs ├── 08_Bloom │ ├── 08_Bloom.cpp │ ├── CMakeLists.txt │ ├── Defines.cpp │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── blend.fs │ ├── bloomLight.fs │ ├── bloomObj.fs │ └── blur.fs ├── 09_DeferedShading │ ├── 09_DeferedShading.cpp │ ├── CMakeLists.txt │ ├── Defines.cpp │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── deferedShading.fs │ └── gBuffer.fs ├── 10_SSAO │ ├── 10_SSAO.cpp │ ├── CMakeLists.txt │ ├── Defines.cpp │ ├── Defines.h │ ├── RegisterInput.cpp │ ├── RegisterInput.h │ ├── SSAO.fs │ ├── blur.fs │ ├── deferedShading.fs │ ├── gBuffer.fs │ └── gBuffer.vs └── CMakeLists.txt ├── CMakeLists.txt └── LIBs ├── CMakeLists.txt ├── LOGL ├── CMakeLists.txt ├── Camera │ ├── CMakeLists.txt │ └── Camera.cpp ├── FBO │ ├── CMakeLists.txt │ └── FBO.cpp ├── Glfw │ ├── CMakeLists.txt │ └── Glfw.cpp ├── Mesh │ ├── CMakeLists.txt │ └── Mesh.cpp ├── Model │ ├── CMakeLists.txt │ └── Model.cpp ├── Shader │ ├── CMakeLists.txt │ └── Shader.cpp ├── Texture │ ├── CMakeLists.txt │ └── Texture.cpp └── VAO │ ├── CMakeLists.txt │ └── VAO.cpp ├── Utility ├── ArgManager │ ├── ArgManager.cpp │ └── CMakeLists.txt ├── CMakeLists.txt ├── Config │ ├── CMakeLists.txt │ └── Config.cpp ├── EventManager │ ├── CMakeLists.txt │ └── EventManager.cpp ├── File │ ├── CMakeLists.txt │ └── File.cpp ├── Header │ ├── CMakeLists.txt │ └── [NO_USE].cpp ├── Image │ ├── CMakeLists.txt │ └── Image.cpp ├── Operation │ ├── CMakeLists.txt │ ├── LambdaOp.cpp │ ├── OpNode.cpp │ ├── OpQueue.cpp │ └── Operation.cpp ├── Shape │ ├── CMakeLists.txt │ ├── Cube.cpp │ ├── Shape.cpp │ └── Sphere.cpp └── Timer │ ├── CMakeLists.txt │ └── Timer.cpp └── glad ├── CMakeLists.txt └── glad.c /License.txt: -------------------------------------------------------------------------------- 1 | the license is empty now. -------------------------------------------------------------------------------- /bin/assimp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/bin/assimp.dll -------------------------------------------------------------------------------- /config/ROOT_PATH.h.in: -------------------------------------------------------------------------------- 1 | #ifndef _ROOT_PATH_H_ 2 | #define _ROOT_PATH_H_ 3 | 4 | const char * ROOT_PATH = "${CMAKE_SOURCE_DIR}"; 5 | 6 | #endif //!_ROOT_PATH_H_ -------------------------------------------------------------------------------- /data/objects/nanosuit/arm_dif.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/arm_dif.png -------------------------------------------------------------------------------- /data/objects/nanosuit/arm_showroom_ddn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/arm_showroom_ddn.png -------------------------------------------------------------------------------- /data/objects/nanosuit/arm_showroom_refl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/arm_showroom_refl.png -------------------------------------------------------------------------------- /data/objects/nanosuit/arm_showroom_spec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/arm_showroom_spec.png -------------------------------------------------------------------------------- /data/objects/nanosuit/back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/back.jpg -------------------------------------------------------------------------------- /data/objects/nanosuit/body_dif.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/body_dif.png -------------------------------------------------------------------------------- /data/objects/nanosuit/body_showroom_ddn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/body_showroom_ddn.png -------------------------------------------------------------------------------- /data/objects/nanosuit/body_showroom_refl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/body_showroom_refl.png -------------------------------------------------------------------------------- /data/objects/nanosuit/body_showroom_spec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/body_showroom_spec.png -------------------------------------------------------------------------------- /data/objects/nanosuit/cell_arm_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/cell_arm_alpha.png -------------------------------------------------------------------------------- /data/objects/nanosuit/cell_body_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/cell_body_alpha.png -------------------------------------------------------------------------------- /data/objects/nanosuit/cell_ddn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/cell_ddn.png -------------------------------------------------------------------------------- /data/objects/nanosuit/cell_hand_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/cell_hand_alpha.png -------------------------------------------------------------------------------- /data/objects/nanosuit/cell_helmet_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/cell_helmet_alpha.png -------------------------------------------------------------------------------- /data/objects/nanosuit/cell_leg_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/cell_leg_alpha.png -------------------------------------------------------------------------------- /data/objects/nanosuit/front.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/front.jpg -------------------------------------------------------------------------------- /data/objects/nanosuit/glass_ddn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/glass_ddn.png -------------------------------------------------------------------------------- /data/objects/nanosuit/glass_dif.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/glass_dif.png -------------------------------------------------------------------------------- /data/objects/nanosuit/glass_refl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/glass_refl.png -------------------------------------------------------------------------------- /data/objects/nanosuit/hand_dif.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/hand_dif.png -------------------------------------------------------------------------------- /data/objects/nanosuit/hand_showroom_ddn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/hand_showroom_ddn.png -------------------------------------------------------------------------------- /data/objects/nanosuit/hand_showroom_refl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/hand_showroom_refl.png -------------------------------------------------------------------------------- /data/objects/nanosuit/hand_showroom_spec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/hand_showroom_spec.png -------------------------------------------------------------------------------- /data/objects/nanosuit/helmet_diff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/helmet_diff.png -------------------------------------------------------------------------------- /data/objects/nanosuit/helmet_showroom_ddn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/helmet_showroom_ddn.png -------------------------------------------------------------------------------- /data/objects/nanosuit/helmet_showroom_refl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/helmet_showroom_refl.png -------------------------------------------------------------------------------- /data/objects/nanosuit/helmet_showroom_spec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/helmet_showroom_spec.png -------------------------------------------------------------------------------- /data/objects/nanosuit/leg_dif.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/leg_dif.png -------------------------------------------------------------------------------- /data/objects/nanosuit/leg_showroom_ddn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/leg_showroom_ddn.png -------------------------------------------------------------------------------- /data/objects/nanosuit/leg_showroom_refl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/leg_showroom_refl.png -------------------------------------------------------------------------------- /data/objects/nanosuit/leg_showroom_spec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/objects/nanosuit/leg_showroom_spec.png -------------------------------------------------------------------------------- /data/shaders/01_Introduction/02_Triangle/02_Triangle.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | void main() 5 | { 6 | gl_Position = vec4(aPos, 1.0); 7 | } -------------------------------------------------------------------------------- /data/shaders/01_Introduction/02_Triangle/02_Triangle_Blue.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(0, 0, 1.0f, 1.0f); 7 | } -------------------------------------------------------------------------------- /data/shaders/01_Introduction/02_Triangle/02_Triangle_Red.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(1.0f, 0, 0, 1.0f); 7 | } -------------------------------------------------------------------------------- /data/shaders/01_Introduction/03_Shader/03_Shader.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/01_Introduction/03_Shader/03_Shader.fs -------------------------------------------------------------------------------- /data/shaders/01_Introduction/03_Shader/03_Shader.vs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/01_Introduction/03_Shader/03_Shader.vs -------------------------------------------------------------------------------- /data/shaders/01_Introduction/04_Texture/04_Texture.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/01_Introduction/04_Texture/04_Texture.fs -------------------------------------------------------------------------------- /data/shaders/01_Introduction/04_Texture/04_Texture.vs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/01_Introduction/04_Texture/04_Texture.vs -------------------------------------------------------------------------------- /data/shaders/01_Introduction/05_Transform/05_Transform.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/01_Introduction/05_Transform/05_Transform.fs -------------------------------------------------------------------------------- /data/shaders/01_Introduction/05_Transform/05_Transform.vs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/01_Introduction/05_Transform/05_Transform.vs -------------------------------------------------------------------------------- /data/shaders/01_Introduction/06_Coordinate/06_Coordinate.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec4 vertexColor; 5 | in vec2 TexCoord; 6 | 7 | uniform sampler2D texture0; 8 | uniform sampler2D texture1; 9 | 10 | void main() 11 | { 12 | vec4 texColor = mix(texture(texture0, TexCoord), texture(texture1, TexCoord), 0.5); 13 | FragColor = mix( vertexColor, texColor, 0.5); 14 | } -------------------------------------------------------------------------------- /data/shaders/01_Introduction/06_Coordinate/06_Coordinate.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec2 aTexCoord; 4 | 5 | out vec4 vertexColor; 6 | out vec2 TexCoord; 7 | 8 | uniform mat4 model; 9 | uniform mat4 view; 10 | uniform mat4 projection; 11 | 12 | void main() 13 | { 14 | gl_Position = projection * view * model * vec4(aPos,1.0); 15 | vertexColor = vec4(aPos, 1.0); 16 | TexCoord = aTexCoord; 17 | } -------------------------------------------------------------------------------- /data/shaders/01_Introduction/07_Camera/07_Camera.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec4 vertexColor; 5 | in vec2 TexCoord; 6 | 7 | uniform sampler2D texture0; 8 | uniform sampler2D texture1; 9 | 10 | void main() 11 | { 12 | vec4 texColor = mix(texture(texture0, TexCoord), texture(texture1, TexCoord), 0.5); 13 | FragColor = mix( vertexColor, texColor, 0.5); 14 | } -------------------------------------------------------------------------------- /data/shaders/01_Introduction/07_Camera/07_Camera.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec2 aTexCoord; 4 | 5 | out vec4 vertexColor; 6 | out vec2 TexCoord; 7 | 8 | uniform mat4 model; 9 | uniform mat4 view; 10 | uniform mat4 projection; 11 | 12 | void main() 13 | { 14 | gl_Position = projection * view * model * vec4(aPos,1.0); 15 | vertexColor = vec4(aPos, 1.0); 16 | TexCoord = aTexCoord; 17 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/01_Color/light.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/02_Lighting/01_Color/light.fs -------------------------------------------------------------------------------- /data/shaders/02_Lighting/01_Color/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/01_Color/lighting.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 objectColor; 5 | uniform vec3 lightColor; 6 | 7 | void main() 8 | { 9 | FragColor = vec4(lightColor * objectColor, 1.0); 10 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/01_Color/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/02_BasicLighting/light.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/02_Lighting/02_BasicLighting/light.fs -------------------------------------------------------------------------------- /data/shaders/02_Lighting/02_BasicLighting/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/02_BasicLighting/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | uniform mat4 model; 6 | uniform mat4 view; 7 | uniform mat4 projection; 8 | 9 | out vec3 Normal; 10 | out vec3 FragPos; 11 | 12 | void main() 13 | { 14 | gl_Position = projection * view * model * vec4(aPos, 1.0); 15 | FragPos = vec3(model * vec4(aPos, 1.0)); 16 | Normal = mat3(transpose(inverse(model))) * aNormal; 17 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/03_Material/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/03_Material/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/03_Material/lighting.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/02_Lighting/03_Material/lighting.fs -------------------------------------------------------------------------------- /data/shaders/02_Lighting/03_Material/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | uniform mat4 model; 6 | uniform mat4 view; 7 | uniform mat4 projection; 8 | 9 | out vec3 Normal; 10 | out vec3 FragPos; 11 | 12 | void main() 13 | { 14 | gl_Position = projection * view * model * vec4(aPos, 1.0); 15 | FragPos = vec3(model * vec4(aPos, 1.0)); 16 | Normal = mat3(transpose(inverse(model))) * aNormal; 17 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/04_LightingMap/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/04_LightingMap/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/04_LightingMap/lighting.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/02_Lighting/04_LightingMap/lighting.fs -------------------------------------------------------------------------------- /data/shaders/02_Lighting/04_LightingMap/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/05_LightCaster/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/05_LightCaster/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/05_LightCaster/lighting.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/02_Lighting/05_LightCaster/lighting.fs -------------------------------------------------------------------------------- /data/shaders/02_Lighting/05_LightCaster/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/06_MultiLight/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/06_MultiLight/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/02_Lighting/06_MultiLight/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /data/shaders/03_LoadModel/01_LoadModel/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/03_LoadModel/01_LoadModel/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/03_LoadModel/01_LoadModel/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /data/shaders/03_LoadModel/01_LoadModel/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/01_DepthTest/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/01_DepthTest/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/01_DepthTest/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/01_DepthTest/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/02_StencilTest/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/02_StencilTest/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/02_StencilTest/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/02_StencilTest/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/02_StencilTest/singleColor.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(0.04, 0.28, 0.26, 1.0); 7 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/02_StencilTest/singleColor.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/03_Blend/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/03_Blend/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/03_Blend/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/03_Blend/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/03_Blend/singleColor.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(0.04, 0.28, 0.26, 1.0); 7 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/03_Blend/singleColor.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/03_Blend/transparent.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture1; 7 | 8 | void main() 9 | { 10 | vec4 texColor = texture(texture1, TexCoords); 11 | //if(texColor.a < 0.1) 12 | // discard; 13 | FragColor = texColor; 14 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/03_Blend/transparent.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec2 TexCoords; 11 | 12 | void main() 13 | { 14 | gl_Position = projection * view * model * vec4(aPos, 1.0); 15 | TexCoords = aTexCoords; 16 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/04_FrameBuffer/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/04_FrameBuffer/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/04_FrameBuffer/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/04_FrameBuffer/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/04_FrameBuffer/postProcess.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/04_AdvanceOGL/04_FrameBuffer/postProcess.fs -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/04_FrameBuffer/postProcess.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec2 aTexCoords; 4 | 5 | out vec2 TexCoords; 6 | 7 | void main() 8 | { 9 | TexCoords = aTexCoords; 10 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/04_FrameBuffer/singleColor.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(0.04, 0.28, 0.26, 1.0); 7 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/04_FrameBuffer/singleColor.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/04_FrameBuffer/transparent.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture1; 7 | 8 | void main() 9 | { 10 | vec4 texColor = texture(texture1, TexCoords); 11 | //if(texColor.a < 0.1) 12 | // discard; 13 | FragColor = texColor; 14 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/04_FrameBuffer/transparent.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec2 TexCoords; 11 | 12 | void main() 13 | { 14 | gl_Position = projection * view * model * vec4(aPos, 1.0); 15 | TexCoords = aTexCoords; 16 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/05_CubeMap/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/05_CubeMap/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/05_CubeMap/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/05_CubeMap/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/05_CubeMap/postProcess.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/04_AdvanceOGL/05_CubeMap/postProcess.fs -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/05_CubeMap/postProcess.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec2 aTexCoords; 4 | 5 | out vec2 TexCoords; 6 | 7 | void main() 8 | { 9 | TexCoords = aTexCoords; 10 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/05_CubeMap/reflect.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 Normal; 5 | in vec3 Position; 6 | 7 | uniform vec3 viewPos; 8 | uniform samplerCube skybox; 9 | 10 | void main() 11 | { 12 | vec3 I = normalize(Position - viewPos); 13 | vec3 R = reflect(I, normalize(Normal)); 14 | FragColor = vec4(texture(skybox, R).rgb, 1.0); 15 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/05_CubeMap/reflect.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out vec3 Normal; 6 | out vec3 Position; 7 | 8 | uniform mat4 model; 9 | uniform mat4 view; 10 | uniform mat4 projection; 11 | 12 | void main() 13 | { 14 | Normal = mat3(transpose(inverse(model))) * aNormal; 15 | Position = vec3(model * vec4(aPos, 1.0)); 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/05_CubeMap/refract.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 Normal; 5 | in vec3 Position; 6 | 7 | uniform vec3 viewPos; 8 | uniform samplerCube skybox; 9 | 10 | void main() 11 | { 12 | float ratio = 1.00 / 1.52; 13 | vec3 I = normalize(Position - viewPos); 14 | vec3 R = refract(I, normalize(Normal), ratio); 15 | FragColor = vec4(texture(skybox, R).rgb, 1.0); 16 | } 17 | -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/05_CubeMap/refract.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out vec3 Normal; 6 | out vec3 Position; 7 | 8 | uniform mat4 model; 9 | uniform mat4 view; 10 | uniform mat4 projection; 11 | 12 | void main() 13 | { 14 | Normal = mat3(transpose(inverse(model))) * aNormal; 15 | Position = vec3(model * vec4(aPos, 1.0)); 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/05_CubeMap/singleColor.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(0.04, 0.28, 0.26, 1.0); 7 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/05_CubeMap/singleColor.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/05_CubeMap/skybox.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 TexCoords; 5 | 6 | uniform samplerCube skybox; 7 | 8 | void main() 9 | { 10 | FragColor = texture(skybox, TexCoords); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/05_CubeMap/skybox.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | out vec3 TexCoords; 5 | 6 | uniform mat4 projection; 7 | uniform mat4 view; 8 | 9 | void main() 10 | { 11 | TexCoords = aPos; 12 | vec4 pos = projection * view * vec4(aPos, 1.0); 13 | gl_Position = pos.xyww; 14 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/05_CubeMap/transparent.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture1; 7 | 8 | void main() 9 | { 10 | vec4 texColor = texture(texture1, TexCoords); 11 | //if(texColor.a < 0.1) 12 | // discard; 13 | FragColor = texColor; 14 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/05_CubeMap/transparent.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec2 TexCoords; 11 | 12 | void main() 13 | { 14 | gl_Position = projection * view * model * vec4(aPos, 1.0); 15 | TexCoords = aTexCoords; 16 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/06_UBO/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/06_UBO/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | void main() 12 | { 13 | gl_Position = projection * view * model * vec4(aPos, 1.0); 14 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/06_UBO/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec3 Normal; 14 | out vec3 FragPos; 15 | out vec2 TexCoords; 16 | 17 | void main() 18 | { 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | FragPos = vec3(model * vec4(aPos, 1.0)); 21 | Normal = mat3(transpose(inverse(model))) * aNormal; 22 | TexCoords = aTexCoords; 23 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/06_UBO/postProcess.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/04_AdvanceOGL/06_UBO/postProcess.fs -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/06_UBO/postProcess.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec2 aTexCoords; 4 | 5 | out vec2 TexCoords; 6 | 7 | void main() 8 | { 9 | TexCoords = aTexCoords; 10 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/06_UBO/reflect.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 Normal; 5 | in vec3 Position; 6 | 7 | uniform vec3 viewPos; 8 | uniform samplerCube skybox; 9 | 10 | void main() 11 | { 12 | vec3 I = normalize(Position - viewPos); 13 | vec3 R = reflect(I, normalize(Normal)); 14 | FragColor = vec4(texture(skybox, R).rgb, 1.0); 15 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/06_UBO/reflect.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out vec3 Normal; 6 | out vec3 Position; 7 | 8 | uniform mat4 model; 9 | 10 | layout (std140) uniform CameraMatrixs{ 11 | mat4 view; 12 | mat4 projection; 13 | }; 14 | 15 | void main() 16 | { 17 | Normal = mat3(transpose(inverse(model))) * aNormal; 18 | Position = vec3(model * vec4(aPos, 1.0)); 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/06_UBO/refract.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 Normal; 5 | in vec3 Position; 6 | 7 | uniform vec3 viewPos; 8 | uniform samplerCube skybox; 9 | 10 | void main() 11 | { 12 | float ratio = 1.00 / 1.52; 13 | vec3 I = normalize(Position - viewPos); 14 | vec3 R = refract(I, normalize(Normal), ratio); 15 | FragColor = vec4(texture(skybox, R).rgb, 1.0); 16 | } 17 | -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/06_UBO/refract.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out vec3 Normal; 6 | out vec3 Position; 7 | 8 | uniform mat4 model; 9 | 10 | layout (std140) uniform CameraMatrixs{ 11 | mat4 view; 12 | mat4 projection; 13 | }; 14 | 15 | void main() 16 | { 17 | Normal = mat3(transpose(inverse(model))) * aNormal; 18 | Position = vec3(model * vec4(aPos, 1.0)); 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/06_UBO/singleColor.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(0.04, 0.28, 0.26, 1.0); 7 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/06_UBO/singleColor.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | void main() 12 | { 13 | gl_Position = projection * view * model * vec4(aPos, 1.0); 14 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/06_UBO/skybox.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 TexCoords; 5 | 6 | uniform samplerCube skybox; 7 | 8 | void main() 9 | { 10 | FragColor = texture(skybox, TexCoords); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/06_UBO/skybox.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | out vec3 TexCoords; 5 | 6 | 7 | layout (std140) uniform CameraMatrixs{ 8 | mat4 view; 9 | mat4 projection; 10 | }; 11 | 12 | void main() 13 | { 14 | TexCoords = aPos; 15 | vec4 pos = projection * mat4(mat3(view)) * vec4(aPos, 1.0); 16 | gl_Position = pos.xyww; 17 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/06_UBO/transparent.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture1; 7 | 8 | void main() 9 | { 10 | vec4 texColor = texture(texture1, TexCoords); 11 | //if(texColor.a < 0.1) 12 | // discard; 13 | FragColor = texColor; 14 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/06_UBO/transparent.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec2 TexCoords; 14 | 15 | void main() 16 | { 17 | gl_Position = projection * view * model * vec4(aPos, 1.0); 18 | TexCoords = aTexCoords; 19 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/house.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 fColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(fColor, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/house.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec3 aColor; 4 | 5 | out VS_OUT { 6 | vec3 color; 7 | } vs_out; 8 | 9 | void main() 10 | { 11 | vs_out.color = aColor; 12 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 13 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | void main() 12 | { 13 | gl_Position = projection * view * model * vec4(aPos, 1.0); 14 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec3 Normal; 14 | out vec3 FragPos; 15 | out vec2 TexCoords; 16 | 17 | void main() 18 | { 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | FragPos = vec3(model * vec4(aPos, 1.0)); 21 | Normal = mat3(transpose(inverse(model))) * aNormal; 22 | TexCoords = aTexCoords; 23 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec3 Normal; 14 | out vec3 FragPos; 15 | out vec2 TexCoords; 16 | 17 | void main() 18 | { 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | FragPos = vec3(model * vec4(aPos, 1.0)); 21 | Normal = mat3(transpose(inverse(model))) * aNormal; 22 | TexCoords = aTexCoords; 23 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/nanosuit_explode.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture_diffuse1; 7 | 8 | void main() 9 | { 10 | FragColor = texture(texture_diffuse1, TexCoords); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/nanosuit_explode.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 2) in vec2 aTexCoords; 4 | 5 | out VS_OUT { 6 | vec2 texCoords; 7 | } vs_out; 8 | 9 | layout (std140) uniform CameraMatrixs{ 10 | mat4 view; 11 | mat4 projection; 12 | }; 13 | uniform mat4 model; 14 | 15 | void main() 16 | { 17 | vs_out.texCoords = aTexCoords; 18 | gl_Position = projection * view * model * vec4(aPos, 1.0); 19 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/nanosuit_normal.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(1.0, 1.0, 0.0, 1.0); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/nanosuit_normal.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out VS_OUT { 6 | vec3 normal; 7 | } vs_out; 8 | 9 | layout (std140) uniform CameraMatrixs{ 10 | mat4 view; 11 | mat4 projection; 12 | }; 13 | uniform mat4 model; 14 | 15 | void main() 16 | { 17 | mat3 normalMatrix = mat3(transpose(inverse(view * model))); 18 | vs_out.normal = vec3(projection * vec4(normalMatrix * aNormal, 0.0)); 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/postProcess.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/04_AdvanceOGL/07_GS/postProcess.fs -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/postProcess.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec2 aTexCoords; 4 | 5 | out vec2 TexCoords; 6 | 7 | void main() 8 | { 9 | TexCoords = aTexCoords; 10 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/reflect.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 Normal; 5 | in vec3 Position; 6 | 7 | uniform vec3 viewPos; 8 | uniform samplerCube skybox; 9 | 10 | void main() 11 | { 12 | vec3 I = normalize(Position - viewPos); 13 | vec3 R = reflect(I, normalize(Normal)); 14 | FragColor = vec4(texture(skybox, R).rgb, 1.0); 15 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/reflect.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out vec3 Normal; 6 | out vec3 Position; 7 | 8 | uniform mat4 model; 9 | 10 | layout (std140) uniform CameraMatrixs{ 11 | mat4 view; 12 | mat4 projection; 13 | }; 14 | 15 | void main() 16 | { 17 | Normal = mat3(transpose(inverse(model))) * aNormal; 18 | Position = vec3(model * vec4(aPos, 1.0)); 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/refract.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 Normal; 5 | in vec3 Position; 6 | 7 | uniform vec3 viewPos; 8 | uniform samplerCube skybox; 9 | 10 | void main() 11 | { 12 | float ratio = 1.00 / 1.52; 13 | vec3 I = normalize(Position - viewPos); 14 | vec3 R = refract(I, normalize(Normal), ratio); 15 | FragColor = vec4(texture(skybox, R).rgb, 1.0); 16 | } 17 | -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/refract.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out vec3 Normal; 6 | out vec3 Position; 7 | 8 | uniform mat4 model; 9 | 10 | layout (std140) uniform CameraMatrixs{ 11 | mat4 view; 12 | mat4 projection; 13 | }; 14 | 15 | void main() 16 | { 17 | Normal = mat3(transpose(inverse(model))) * aNormal; 18 | Position = vec3(model * vec4(aPos, 1.0)); 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/singleColor.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(0.04, 0.28, 0.26, 1.0); 7 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/singleColor.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | void main() 12 | { 13 | gl_Position = projection * view * model * vec4(aPos, 1.0); 14 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/skybox.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 TexCoords; 5 | 6 | uniform samplerCube skybox; 7 | 8 | void main() 9 | { 10 | FragColor = texture(skybox, TexCoords); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/skybox.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | out vec3 TexCoords; 5 | 6 | 7 | layout (std140) uniform CameraMatrixs{ 8 | mat4 view; 9 | mat4 projection; 10 | }; 11 | 12 | void main() 13 | { 14 | TexCoords = aPos; 15 | vec4 pos = projection * mat4(mat3(view)) * vec4(aPos, 1.0); 16 | gl_Position = pos.xyww; 17 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/transparent.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture1; 7 | 8 | void main() 9 | { 10 | vec4 texColor = texture(texture1, TexCoords); 11 | //if(texColor.a < 0.1) 12 | // discard; 13 | FragColor = texColor; 14 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/07_GS/transparent.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec2 TexCoords; 14 | 15 | void main() 16 | { 17 | gl_Position = projection * view * model * vec4(aPos, 1.0); 18 | TexCoords = aTexCoords; 19 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/house.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 fColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(fColor, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/house.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec3 aColor; 4 | 5 | out VS_OUT { 6 | vec3 color; 7 | } vs_out; 8 | 9 | void main() 10 | { 11 | vs_out.color = aColor; 12 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 13 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/instance.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture0; 7 | 8 | void main() 9 | { 10 | FragColor = texture(texture0, TexCoords); 11 | } 12 | -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/instance.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec2 aTexCoords; 4 | layout (location = 2) in vec3 offset; 5 | 6 | out vec2 TexCoords; 7 | 8 | uniform mat4 model; 9 | 10 | layout (std140) uniform CameraMatrixs{ 11 | mat4 view; 12 | mat4 projection; 13 | }; 14 | 15 | void main() 16 | { 17 | TexCoords = aTexCoords; 18 | gl_Position = projection * view * model * vec4(aPos + offset, 1.0); 19 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | void main() 12 | { 13 | gl_Position = projection * view * model * vec4(aPos, 1.0); 14 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec3 Normal; 14 | out vec3 FragPos; 15 | out vec2 TexCoords; 16 | 17 | void main() 18 | { 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | FragPos = vec3(model * vec4(aPos, 1.0)); 21 | Normal = mat3(transpose(inverse(model))) * aNormal; 22 | TexCoords = aTexCoords; 23 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec3 Normal; 14 | out vec3 FragPos; 15 | out vec2 TexCoords; 16 | 17 | void main() 18 | { 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | FragPos = vec3(model * vec4(aPos, 1.0)); 21 | Normal = mat3(transpose(inverse(model))) * aNormal; 22 | TexCoords = aTexCoords; 23 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/nanosuit_explode.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture_diffuse1; 7 | 8 | void main() 9 | { 10 | FragColor = texture(texture_diffuse1, TexCoords); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/nanosuit_explode.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 2) in vec2 aTexCoords; 4 | 5 | out VS_OUT { 6 | vec2 texCoords; 7 | } vs_out; 8 | 9 | layout (std140) uniform CameraMatrixs{ 10 | mat4 view; 11 | mat4 projection; 12 | }; 13 | uniform mat4 model; 14 | 15 | void main() 16 | { 17 | vs_out.texCoords = aTexCoords; 18 | gl_Position = projection * view * model * vec4(aPos, 1.0); 19 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/nanosuit_normal.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(1.0, 1.0, 0.0, 1.0); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/nanosuit_normal.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out VS_OUT { 6 | vec3 normal; 7 | } vs_out; 8 | 9 | layout (std140) uniform CameraMatrixs{ 10 | mat4 view; 11 | mat4 projection; 12 | }; 13 | uniform mat4 model; 14 | 15 | void main() 16 | { 17 | mat3 normalMatrix = mat3(transpose(inverse(view * model))); 18 | vs_out.normal = vec3(projection * vec4(normalMatrix * aNormal, 0.0)); 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/postProcess.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/04_AdvanceOGL/08_Instance/postProcess.fs -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/postProcess.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec2 aTexCoords; 4 | 5 | out vec2 TexCoords; 6 | 7 | void main() 8 | { 9 | TexCoords = aTexCoords; 10 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/reflect.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 Normal; 5 | in vec3 Position; 6 | 7 | uniform vec3 viewPos; 8 | uniform samplerCube skybox; 9 | 10 | void main() 11 | { 12 | vec3 I = normalize(Position - viewPos); 13 | vec3 R = reflect(I, normalize(Normal)); 14 | FragColor = vec4(texture(skybox, R).rgb, 1.0); 15 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/reflect.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out vec3 Normal; 6 | out vec3 Position; 7 | 8 | uniform mat4 model; 9 | 10 | layout (std140) uniform CameraMatrixs{ 11 | mat4 view; 12 | mat4 projection; 13 | }; 14 | 15 | void main() 16 | { 17 | Normal = mat3(transpose(inverse(model))) * aNormal; 18 | Position = vec3(model * vec4(aPos, 1.0)); 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/refract.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 Normal; 5 | in vec3 Position; 6 | 7 | uniform vec3 viewPos; 8 | uniform samplerCube skybox; 9 | 10 | void main() 11 | { 12 | float ratio = 1.00 / 1.52; 13 | vec3 I = normalize(Position - viewPos); 14 | vec3 R = refract(I, normalize(Normal), ratio); 15 | FragColor = vec4(texture(skybox, R).rgb, 1.0); 16 | } 17 | -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/refract.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out vec3 Normal; 6 | out vec3 Position; 7 | 8 | uniform mat4 model; 9 | 10 | layout (std140) uniform CameraMatrixs{ 11 | mat4 view; 12 | mat4 projection; 13 | }; 14 | 15 | void main() 16 | { 17 | Normal = mat3(transpose(inverse(model))) * aNormal; 18 | Position = vec3(model * vec4(aPos, 1.0)); 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/singleColor.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(0.04, 0.28, 0.26, 1.0); 7 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/singleColor.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | void main() 12 | { 13 | gl_Position = projection * view * model * vec4(aPos, 1.0); 14 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/skybox.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 TexCoords; 5 | 6 | uniform samplerCube skybox; 7 | 8 | void main() 9 | { 10 | FragColor = texture(skybox, TexCoords); 11 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/skybox.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | out vec3 TexCoords; 5 | 6 | 7 | layout (std140) uniform CameraMatrixs{ 8 | mat4 view; 9 | mat4 projection; 10 | }; 11 | 12 | void main() 13 | { 14 | TexCoords = aPos; 15 | vec4 pos = projection * mat4(mat3(view)) * vec4(aPos, 1.0); 16 | gl_Position = pos.xyww; 17 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/transparent.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture1; 7 | 8 | void main() 9 | { 10 | vec4 texColor = texture(texture1, TexCoords); 11 | //if(texColor.a < 0.1) 12 | // discard; 13 | FragColor = texColor; 14 | } -------------------------------------------------------------------------------- /data/shaders/04_AdvanceOGL/08_Instance/transparent.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec2 TexCoords; 14 | 15 | void main() 16 | { 17 | gl_Position = projection * view * model * vec4(aPos, 1.0); 18 | TexCoords = aTexCoords; 19 | } -------------------------------------------------------------------------------- /data/shaders/05_AdvanceLighting/03_ShadowMap/depth.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | void main() 4 | { 5 | // gl_FragDepth = gl_FragCoord.z; 6 | } -------------------------------------------------------------------------------- /data/shaders/05_AdvanceLighting/03_ShadowMap/depth.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | layout (std140) uniform LightMatrix{ 5 | mat4 lightSpaceMatrix; 6 | }; 7 | 8 | uniform mat4 model; 9 | 10 | void main() 11 | { 12 | gl_Position = lightSpaceMatrix * model * vec4(aPos, 1.0); 13 | } -------------------------------------------------------------------------------- /data/shaders/05_AdvanceLighting/04_PointShadow/depth.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | in vec4 FragPos; 3 | 4 | uniform vec3 lightPos; 5 | uniform float far_plane; 6 | 7 | void main() 8 | { 9 | // get distance between fragment and light source 10 | float lightDistance = length(FragPos.xyz - lightPos); 11 | 12 | // map to [0;1] range by dividing by far_plane 13 | lightDistance = lightDistance / far_plane; 14 | 15 | // Write this as modified depth 16 | gl_FragDepth = lightDistance; 17 | } -------------------------------------------------------------------------------- /data/shaders/05_AdvanceLighting/04_PointShadow/depth.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | 6 | void main() 7 | { 8 | gl_Position = model * vec4(aPos, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/05_AdvanceLighting/05_NormalMap/imgShow.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in VS_OUT{ 5 | vec2 TexCoords; 6 | } fs_in; 7 | 8 | uniform sampler2D texture0; 9 | 10 | void main(){ 11 | FragColor = vec4(vec3(texture(texture0, fs_in.TexCoords)), 1.0f); 12 | } -------------------------------------------------------------------------------- /data/shaders/05_AdvanceLighting/05_NormalMap/imgShow.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | layout (location = 0) in vec3 aPos; 4 | layout (location = 1) in vec2 aTexCoords; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | uniform mat4 model; 12 | 13 | out VS_OUT{ 14 | vec2 TexCoords; 15 | } vs_out; 16 | 17 | void main(){ 18 | vs_out.TexCoords = aTexCoords; 19 | 20 | gl_Position = projection * view * model * vec4(aPos,1.0); 21 | } -------------------------------------------------------------------------------- /data/shaders/05_AdvanceLighting/06_ParallaxMap/imgShow.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in VS_OUT{ 5 | vec2 TexCoords; 6 | } fs_in; 7 | 8 | uniform sampler2D texture0; 9 | 10 | void main(){ 11 | FragColor = vec4(vec3(texture(texture0, fs_in.TexCoords)), 1.0f); 12 | } -------------------------------------------------------------------------------- /data/shaders/05_AdvanceLighting/06_ParallaxMap/imgShow.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | layout (location = 0) in vec3 aPos; 4 | layout (location = 1) in vec2 aTexCoords; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | uniform mat4 model; 12 | 13 | out VS_OUT{ 14 | vec2 TexCoords; 15 | } vs_out; 16 | 17 | void main(){ 18 | vs_out.TexCoords = aTexCoords; 19 | 20 | gl_Position = projection * view * model * vec4(aPos,1.0); 21 | } -------------------------------------------------------------------------------- /data/shaders/05_AdvanceLighting/07_HDR/hdr.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/shaders/05_AdvanceLighting/07_HDR/hdr.fs -------------------------------------------------------------------------------- /data/shaders/05_AdvanceLighting/07_HDR/hdr.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec2 aTexCoords; 4 | 5 | out vec2 TexCoords; 6 | 7 | void main() 8 | { 9 | TexCoords = aTexCoords; 10 | gl_Position = vec4(aPos, 0.0, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/05_AdvanceLighting/08_Bloom/bloomLight.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) out vec4 FragColor; 3 | layout (location = 1) out vec4 BrightColor; 4 | 5 | uniform vec3 lightColor; 6 | 7 | void main() 8 | { 9 | FragColor = vec4(lightColor, 1.0); 10 | float brightness = dot(FragColor.rgb, vec3(0.2126, 0.7152, 0.0722)); 11 | if(brightness > 1.0) 12 | BrightColor = vec4(FragColor.rgb, 1.0); 13 | } -------------------------------------------------------------------------------- /data/shaders/05_AdvanceLighting/10_SSAO/blur.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out float FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D SSAO; 7 | 8 | void main() 9 | { 10 | vec2 texelSize = 1.0 / vec2(textureSize(SSAO, 0)); 11 | float result = 0.0; 12 | for (int x = -2; x < 2; ++x) 13 | { 14 | for (int y = -2; y < 2; ++y) 15 | { 16 | vec2 offset = vec2(float(x), float(y)) * texelSize; 17 | result += texture(SSAO, TexCoords + offset).r; 18 | } 19 | } 20 | FragColor = result / (4.0 * 4.0); 21 | } -------------------------------------------------------------------------------- /data/shaders/Common/basic.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) out vec4 FragColor; 3 | 4 | uniform vec3 color; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(color, 1.0); 9 | } -------------------------------------------------------------------------------- /data/shaders/Common/basic_P2T2.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec2 aTexCoords; 4 | 5 | out vec2 TexCoords; 6 | 7 | void main() 8 | { 9 | TexCoords = aTexCoords; 10 | gl_Position = vec4(aPos, 0.0, 1.0); 11 | } -------------------------------------------------------------------------------- /data/shaders/Common/basic_P3.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | layout (location = 0) in vec3 aPos; 4 | 5 | layout (std140) uniform CameraMatrixs{ 6 | mat4 view; 7 | mat4 projection; 8 | }; 9 | 10 | uniform mat4 model; 11 | 12 | void main(){ 13 | gl_Position = projection * view * model * vec4(aPos,1.0); 14 | } -------------------------------------------------------------------------------- /data/shaders/Common/basic_P3T2.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | layout (location = 0) in vec3 aPos; 4 | layout (location = 1) in vec2 aTexCoords; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | uniform mat4 model; 12 | 13 | out vec2 TexCoords; 14 | 15 | void main(){ 16 | TexCoords = aTexCoords; 17 | 18 | gl_Position = projection * view * model * vec4(aPos,1.0); 19 | } -------------------------------------------------------------------------------- /data/shaders/Common/basic_T2.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture0; 7 | 8 | void main(){ 9 | FragColor = vec4(vec3(texture(texture0, TexCoords)), 1.0f); 10 | } -------------------------------------------------------------------------------- /data/textures/awesomeface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/awesomeface.png -------------------------------------------------------------------------------- /data/textures/bricks2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/bricks2.jpg -------------------------------------------------------------------------------- /data/textures/bricks2_disp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/bricks2_disp.jpg -------------------------------------------------------------------------------- /data/textures/bricks2_normal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/bricks2_normal.jpg -------------------------------------------------------------------------------- /data/textures/brickwall.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/brickwall.jpg -------------------------------------------------------------------------------- /data/textures/brickwall_normal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/brickwall_normal.jpg -------------------------------------------------------------------------------- /data/textures/container.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/container.jpg -------------------------------------------------------------------------------- /data/textures/container2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/container2.png -------------------------------------------------------------------------------- /data/textures/container2_specular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/container2_specular.png -------------------------------------------------------------------------------- /data/textures/earth.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/earth.jpg -------------------------------------------------------------------------------- /data/textures/grass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/grass.png -------------------------------------------------------------------------------- /data/textures/marble.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/marble.jpg -------------------------------------------------------------------------------- /data/textures/matrix.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/matrix.jpg -------------------------------------------------------------------------------- /data/textures/skybox/back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/skybox/back.jpg -------------------------------------------------------------------------------- /data/textures/skybox/bottom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/skybox/bottom.jpg -------------------------------------------------------------------------------- /data/textures/skybox/front.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/skybox/front.jpg -------------------------------------------------------------------------------- /data/textures/skybox/left.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/skybox/left.jpg -------------------------------------------------------------------------------- /data/textures/skybox/right.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/skybox/right.jpg -------------------------------------------------------------------------------- /data/textures/skybox/top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/skybox/top.jpg -------------------------------------------------------------------------------- /data/textures/window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/window.png -------------------------------------------------------------------------------- /data/textures/wood.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/data/textures/wood.png -------------------------------------------------------------------------------- /include/Utility/ArgManager.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARG_MANAGER_H_ 2 | #define _ARG_MANAGER_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace Ubpa{ 9 | class ArgManager{ 10 | public: 11 | ArgManager(int argc, char** argv); 12 | std::vector GetAll(const std::string & key); 13 | std::string Get(const std::string & key, size_t idx, const std::string & defaultValue = ""); 14 | private: 15 | std::map> pairs; 16 | }; 17 | }; 18 | #endif//! _ARG_MANAGER_H_ -------------------------------------------------------------------------------- /include/Utility/Cube.h: -------------------------------------------------------------------------------- 1 | #ifndef _CUBE_H_ 2 | #define _CUBE_H_ 3 | 4 | #include 5 | 6 | namespace Ubpa { 7 | class Cube : public Shape { 8 | public: 9 | Cube(); 10 | virtual ~Cube(); 11 | float * GetNormalArr(); 12 | float * GetTexCoordsArr(); 13 | size_t * GetIndexArr(); 14 | size_t GetNormalArrSize(); 15 | size_t GetTexCoordsArrSize(); 16 | size_t GetIndexArrSize(); 17 | protected: 18 | Array2D * normalArr; 19 | Array2D * texCoordsArr; 20 | Array2D * indexArr; 21 | static const float cubeData[192]; 22 | }; 23 | } 24 | 25 | #endif // !_CUBE_H_ 26 | -------------------------------------------------------------------------------- /include/Utility/GStorage.h: -------------------------------------------------------------------------------- 1 | #ifndef _STORAGE_H_ 2 | #define _STORAGE_H_ 3 | 4 | #include 5 | #include 6 | 7 | namespace Ubpa{ 8 | template 9 | class GStorage final : public Singleton>, public LStorage{ 10 | friend class Singleton>; 11 | public: 12 | static GStorage * GetInstance() { 13 | return Singleton>::GetInstance(); 14 | } 15 | private: 16 | GStorage() = default; 17 | ~GStorage() = default; 18 | }; 19 | } 20 | 21 | #endif -------------------------------------------------------------------------------- /include/Utility/LStorage.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/include/Utility/LStorage.h -------------------------------------------------------------------------------- /include/Utility/Shape.h: -------------------------------------------------------------------------------- 1 | #ifndef _SHAPE_H_ 2 | #define _SHAPE_H_ 3 | 4 | #include 5 | 6 | namespace Ubpa { 7 | class Shape { 8 | public: 9 | Shape(size_t vertexNum, size_t triNum = 0); 10 | virtual ~Shape(); 11 | float * GetVertexArr(); 12 | size_t GetTriNum(); 13 | size_t GetVertexArrSize(); 14 | protected: 15 | static const float PI; 16 | //------------ 17 | Array2D * vertexArr; 18 | size_t triNum; 19 | size_t vertexNum; 20 | }; 21 | } 22 | 23 | #endif // !_SHAPE_H_ 24 | -------------------------------------------------------------------------------- /include/Utility/Singleton.h: -------------------------------------------------------------------------------- 1 | #ifndef _SINGLETON_H_ 2 | #define _SINGLETON_H_ 3 | 4 | template 5 | class Singleton 6 | { 7 | public: 8 | static T * GetInstance() { 9 | static T * instance = new T; 10 | return instance; 11 | } 12 | protected: 13 | 14 | Singleton() = default; 15 | virtual ~Singleton() = default; 16 | }; 17 | 18 | #endif// !_SINGLETON_H_ -------------------------------------------------------------------------------- /include/Utility/Sphere.h: -------------------------------------------------------------------------------- 1 | #ifndef _SPHERE_H_ 2 | #define _SPHERE_H_ 3 | 4 | #include 5 | 6 | namespace Ubpa { 7 | class Sphere : public Shape { 8 | public: 9 | Sphere(size_t n); 10 | virtual ~Sphere(); 11 | float * GetNormalArr(); 12 | float * GetTexCoordsArr(); 13 | size_t * GetIndexArr(); 14 | size_t GetNormalArrSize(); 15 | size_t GetTexCoordsArrSize(); 16 | size_t GetIndexArrSize(); 17 | protected: 18 | Array2D * normalArr; 19 | Array2D * texCoordsArr; 20 | Array2D * indexArr; 21 | }; 22 | } 23 | 24 | #endif // !_SPHERE_H_ 25 | -------------------------------------------------------------------------------- /include/Utility/Timer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/include/Utility/Timer.h -------------------------------------------------------------------------------- /include/Utility/Vec.h: -------------------------------------------------------------------------------- 1 | #ifndef _VEC_H_ 2 | #define _VEC_H_ 3 | 4 | #include 5 | #include 6 | 7 | namespace Ubpa { 8 | typedef Vec3 Vec3f; 9 | typedef Vec3 Vec3d; 10 | 11 | typedef Vec4 Vec4f; 12 | typedef Vec4 Vec4d; 13 | } 14 | 15 | #endif // !_VEC_H_ 16 | -------------------------------------------------------------------------------- /include/assimp/ai_assert.h: -------------------------------------------------------------------------------- 1 | /** @file assert.h 2 | */ 3 | #ifndef AI_DEBUG_H_INC 4 | #define AI_DEBUG_H_INC 5 | 6 | #ifdef ASSIMP_BUILD_DEBUG 7 | # include 8 | # define ai_assert(expression) assert(expression) 9 | #else 10 | # define ai_assert(expression) 11 | #endif 12 | 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /include/assimp/defs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/include/assimp/defs.h -------------------------------------------------------------------------------- /include/assimp/matrix3x3.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/include/assimp/matrix3x3.h -------------------------------------------------------------------------------- /include/assimp/matrix3x3.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/include/assimp/matrix3x3.inl -------------------------------------------------------------------------------- /include/assimp/matrix4x4.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/include/assimp/matrix4x4.h -------------------------------------------------------------------------------- /include/assimp/matrix4x4.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/include/assimp/matrix4x4.inl -------------------------------------------------------------------------------- /lib/assimp.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/lib/assimp.lib -------------------------------------------------------------------------------- /lib/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/lib/glfw3.lib -------------------------------------------------------------------------------- /notes/C3.md: -------------------------------------------------------------------------------- 1 | # 3. 模型加载 2 | 3 | [TOC] 4 | 5 | ## 3.1 Assimp 6 | 7 | Open Asset Import Library 8 | 9 | ![img](https://learnopengl-cn.github.io/img/03/01/assimp_structure.png) 10 | 11 | **结构** 12 | 13 | - 资源(Vertex, Normal, TexCoords, Face, Material) 14 | - 结构(Tree): 每个节点有一些孩子和一些网格 15 | 16 | -------------------------------------------------------------------------------- /notes/assets/1539936806842.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/1539936806842.png -------------------------------------------------------------------------------- /notes/assets/1540608188919.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/1540608188919.png -------------------------------------------------------------------------------- /notes/assets/1540608204250.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/1540608204250.png -------------------------------------------------------------------------------- /notes/assets/1540608253058.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/1540608253058.png -------------------------------------------------------------------------------- /notes/assets/1540608270835.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/1540608270835.png -------------------------------------------------------------------------------- /notes/assets/1540824585203.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/1540824585203.png -------------------------------------------------------------------------------- /notes/assets/1540906287862.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/1540906287862.png -------------------------------------------------------------------------------- /notes/assets/1540908270510.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/1540908270510.png -------------------------------------------------------------------------------- /notes/assets/1540908281257.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/1540908281257.png -------------------------------------------------------------------------------- /notes/assets/1540989683790.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/1540989683790.png -------------------------------------------------------------------------------- /notes/assets/1540994571587.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/1540994571587.png -------------------------------------------------------------------------------- /notes/assets/1541056303958.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/1541056303958.png -------------------------------------------------------------------------------- /notes/assets/1541056474748.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/1541056474748.png -------------------------------------------------------------------------------- /notes/assets/1541226283368.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/1541226283368.png -------------------------------------------------------------------------------- /notes/assets/1541226486104.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/1541226486104.png -------------------------------------------------------------------------------- /notes/assets/1541226499457.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/1541226499457.png -------------------------------------------------------------------------------- /notes/assets/advanced_glsl_binding_points.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/advanced_glsl_binding_points.png -------------------------------------------------------------------------------- /notes/assets/bricks2_disp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/bricks2_disp.jpg -------------------------------------------------------------------------------- /notes/assets/camera_axes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/camera_axes.png -------------------------------------------------------------------------------- /notes/assets/camera_pitch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/camera_pitch.png -------------------------------------------------------------------------------- /notes/assets/camera_pitch_yaw_roll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/camera_pitch_yaw_roll.png -------------------------------------------------------------------------------- /notes/assets/camera_yaw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/camera_yaw.png -------------------------------------------------------------------------------- /notes/assets/cubemaps_reflection_nanosuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/cubemaps_reflection_nanosuit.png -------------------------------------------------------------------------------- /notes/assets/cubemaps_reflection_theory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/cubemaps_reflection_theory.png -------------------------------------------------------------------------------- /notes/assets/cubemaps_refraction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/cubemaps_refraction.png -------------------------------------------------------------------------------- /notes/assets/cubemaps_refraction_theory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/cubemaps_refraction_theory.png -------------------------------------------------------------------------------- /notes/assets/cubemaps_sampling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/cubemaps_sampling.png -------------------------------------------------------------------------------- /notes/assets/cubemaps_skybox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/cubemaps_skybox.png -------------------------------------------------------------------------------- /notes/assets/framebuffers_blur.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/framebuffers_blur.png -------------------------------------------------------------------------------- /notes/assets/framebuffers_edge_detection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/framebuffers_edge_detection.png -------------------------------------------------------------------------------- /notes/assets/framebuffers_grayscale.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/framebuffers_grayscale.png -------------------------------------------------------------------------------- /notes/assets/framebuffers_inverse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/framebuffers_inverse.png -------------------------------------------------------------------------------- /notes/assets/framebuffers_sharpen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/notes/assets/framebuffers_sharpen.png -------------------------------------------------------------------------------- /src/01_Introduction/01_Window/01_Window.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/01_Introduction/01_Window/01_Window.cpp -------------------------------------------------------------------------------- /src/01_Introduction/02_Triangle/02_Triangle.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/01_Introduction/02_Triangle/02_Triangle.cpp -------------------------------------------------------------------------------- /src/01_Introduction/02_Triangle/02_Triangle.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | void main() 5 | { 6 | gl_Position = vec4(aPos, 1.0); 7 | } -------------------------------------------------------------------------------- /src/01_Introduction/02_Triangle/02_Triangle_Blue.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(0, 0, 1.0f, 1.0f); 7 | } -------------------------------------------------------------------------------- /src/01_Introduction/02_Triangle/02_Triangle_Red.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(1.0f, 0, 0, 1.0f); 7 | } -------------------------------------------------------------------------------- /src/01_Introduction/03_Shader/03_Shader.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/01_Introduction/03_Shader/03_Shader.cpp -------------------------------------------------------------------------------- /src/01_Introduction/03_Shader/03_Shader.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/01_Introduction/03_Shader/03_Shader.fs -------------------------------------------------------------------------------- /src/01_Introduction/03_Shader/03_Shader.vs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/01_Introduction/03_Shader/03_Shader.vs -------------------------------------------------------------------------------- /src/01_Introduction/04_Texture/04_Texture.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/01_Introduction/04_Texture/04_Texture.cpp -------------------------------------------------------------------------------- /src/01_Introduction/04_Texture/04_Texture.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/01_Introduction/04_Texture/04_Texture.fs -------------------------------------------------------------------------------- /src/01_Introduction/04_Texture/04_Texture.vs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/01_Introduction/04_Texture/04_Texture.vs -------------------------------------------------------------------------------- /src/01_Introduction/05_Transform/05_Transform.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/01_Introduction/05_Transform/05_Transform.cpp -------------------------------------------------------------------------------- /src/01_Introduction/05_Transform/05_Transform.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/01_Introduction/05_Transform/05_Transform.fs -------------------------------------------------------------------------------- /src/01_Introduction/05_Transform/05_Transform.vs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/01_Introduction/05_Transform/05_Transform.vs -------------------------------------------------------------------------------- /src/01_Introduction/06_Coordinate/06_Coordinate.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/01_Introduction/06_Coordinate/06_Coordinate.cpp -------------------------------------------------------------------------------- /src/01_Introduction/06_Coordinate/06_Coordinate.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec4 vertexColor; 5 | in vec2 TexCoord; 6 | 7 | uniform sampler2D texture0; 8 | uniform sampler2D texture1; 9 | 10 | void main() 11 | { 12 | vec4 texColor = mix(texture(texture0, TexCoord), texture(texture1, TexCoord), 0.5); 13 | FragColor = mix( vertexColor, texColor, 0.5); 14 | } -------------------------------------------------------------------------------- /src/01_Introduction/06_Coordinate/06_Coordinate.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec2 aTexCoord; 4 | 5 | out vec4 vertexColor; 6 | out vec2 TexCoord; 7 | 8 | uniform mat4 model; 9 | uniform mat4 view; 10 | uniform mat4 projection; 11 | 12 | void main() 13 | { 14 | gl_Position = projection * view * model * vec4(aPos,1.0); 15 | vertexColor = vec4(aPos, 1.0); 16 | TexCoord = aTexCoord; 17 | } -------------------------------------------------------------------------------- /src/01_Introduction/07_Camera/07_Camera.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/01_Introduction/07_Camera/07_Camera.cpp -------------------------------------------------------------------------------- /src/01_Introduction/07_Camera/07_Camera.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec4 vertexColor; 5 | in vec2 TexCoord; 6 | 7 | uniform sampler2D texture0; 8 | uniform sampler2D texture1; 9 | 10 | void main() 11 | { 12 | vec4 texColor = mix(texture(texture0, TexCoord), texture(texture1, TexCoord), 0.5); 13 | FragColor = mix( vertexColor, texColor, 0.5); 14 | } -------------------------------------------------------------------------------- /src/01_Introduction/07_Camera/07_Camera.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec2 aTexCoord; 4 | 5 | out vec4 vertexColor; 6 | out vec2 TexCoord; 7 | 8 | uniform mat4 model; 9 | uniform mat4 view; 10 | uniform mat4 projection; 11 | 12 | void main() 13 | { 14 | gl_Position = projection * view * model * vec4(aPos,1.0); 15 | vertexColor = vec4(aPos, 1.0); 16 | TexCoord = aTexCoord; 17 | } -------------------------------------------------------------------------------- /src/01_Introduction/07_Camera/Defines.h: -------------------------------------------------------------------------------- 1 | #ifndef _DEFINE_H_ 2 | #define _DEFINE_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace Define { 10 | const std::string str_Chapter = "01_Introduction"; 11 | const std::string str_Subchapter = "07_Camera"; 12 | 13 | const std::string str_ChangeTexture = "changeTexture"; 14 | 15 | const int textureWarpMode[] = { 16 | GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_BORDER, GL_CLAMP_TO_EDGE 17 | }; 18 | } 19 | 20 | #endif // !_DEFINE_H_ 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/01_Introduction/07_Camera/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/01_Introduction/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #生成 exe 就 "EXE",生成 lib 就 "LIB" 2 | set(MODE "EXE") 3 | set(TARGET_PREFIX "01_") 4 | 5 | GET_DIR_NAME(DIRNAME) 6 | set(FOLDER_NAME ${DIRNAME}) 7 | 8 | ADD_ALL_SUBDIR() -------------------------------------------------------------------------------- /src/02_Lighting/01_Color/01_Color.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/02_Lighting/01_Color/01_Color.cpp -------------------------------------------------------------------------------- /src/02_Lighting/01_Color/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/02_Lighting/01_Color/light.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/02_Lighting/01_Color/light.fs -------------------------------------------------------------------------------- /src/02_Lighting/01_Color/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/02_Lighting/01_Color/lighting.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 objectColor; 5 | uniform vec3 lightColor; 6 | 7 | void main() 8 | { 9 | FragColor = vec4(lightColor * objectColor, 1.0); 10 | } -------------------------------------------------------------------------------- /src/02_Lighting/01_Color/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/02_Lighting/02_BasicLighting/02_BasicLighting.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/02_Lighting/02_BasicLighting/02_BasicLighting.cpp -------------------------------------------------------------------------------- /src/02_Lighting/02_BasicLighting/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/02_Lighting/02_BasicLighting/light.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/02_Lighting/02_BasicLighting/light.fs -------------------------------------------------------------------------------- /src/02_Lighting/02_BasicLighting/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/02_Lighting/02_BasicLighting/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | uniform mat4 model; 6 | uniform mat4 view; 7 | uniform mat4 projection; 8 | 9 | out vec3 Normal; 10 | out vec3 FragPos; 11 | 12 | void main() 13 | { 14 | gl_Position = projection * view * model * vec4(aPos, 1.0); 15 | FragPos = vec3(model * vec4(aPos, 1.0)); 16 | Normal = mat3(transpose(inverse(model))) * aNormal; 17 | } -------------------------------------------------------------------------------- /src/02_Lighting/03_Material/03_Material.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/02_Lighting/03_Material/03_Material.cpp -------------------------------------------------------------------------------- /src/02_Lighting/03_Material/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/02_Lighting/03_Material/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /src/02_Lighting/03_Material/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/02_Lighting/03_Material/lighting.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/02_Lighting/03_Material/lighting.fs -------------------------------------------------------------------------------- /src/02_Lighting/03_Material/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | uniform mat4 model; 6 | uniform mat4 view; 7 | uniform mat4 projection; 8 | 9 | out vec3 Normal; 10 | out vec3 FragPos; 11 | 12 | void main() 13 | { 14 | gl_Position = projection * view * model * vec4(aPos, 1.0); 15 | FragPos = vec3(model * vec4(aPos, 1.0)); 16 | Normal = mat3(transpose(inverse(model))) * aNormal; 17 | } -------------------------------------------------------------------------------- /src/02_Lighting/04_LightingMap/04_LightingMap.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/02_Lighting/04_LightingMap/04_LightingMap.cpp -------------------------------------------------------------------------------- /src/02_Lighting/04_LightingMap/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/02_Lighting/04_LightingMap/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /src/02_Lighting/04_LightingMap/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/02_Lighting/04_LightingMap/lighting.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/02_Lighting/04_LightingMap/lighting.fs -------------------------------------------------------------------------------- /src/02_Lighting/04_LightingMap/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /src/02_Lighting/05_LightCaster/05_LightCaster.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/02_Lighting/05_LightCaster/05_LightCaster.cpp -------------------------------------------------------------------------------- /src/02_Lighting/05_LightCaster/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/02_Lighting/05_LightCaster/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /src/02_Lighting/05_LightCaster/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/02_Lighting/05_LightCaster/lighting.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/02_Lighting/05_LightCaster/lighting.fs -------------------------------------------------------------------------------- /src/02_Lighting/05_LightCaster/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /src/02_Lighting/06_MultiLight/06_MultiLight.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/02_Lighting/06_MultiLight/06_MultiLight.cpp -------------------------------------------------------------------------------- /src/02_Lighting/06_MultiLight/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/02_Lighting/06_MultiLight/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /src/02_Lighting/06_MultiLight/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/02_Lighting/06_MultiLight/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /src/02_Lighting/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #生成 exe 就 "EXE",生成 lib 就 "LIB" 2 | set(MODE "EXE") 3 | set(TARGET_PREFIX "02_") 4 | 5 | GET_DIR_NAME(DIRNAME) 6 | set(FOLDER_NAME ${DIRNAME}) 7 | 8 | ADD_ALL_SUBDIR() -------------------------------------------------------------------------------- /src/03_LoadModel/01_LoadModel/01_LoadModel.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/03_LoadModel/01_LoadModel/01_LoadModel.cpp -------------------------------------------------------------------------------- /src/03_LoadModel/01_LoadModel/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/03_LoadModel/01_LoadModel/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /src/03_LoadModel/01_LoadModel/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/03_LoadModel/01_LoadModel/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /src/03_LoadModel/01_LoadModel/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /src/03_LoadModel/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #生成 exe 就 "EXE",生成 lib 就 "LIB" 2 | set(MODE "EXE") 3 | set(TARGET_PREFIX "03_") 4 | 5 | GET_DIR_NAME(DIRNAME) 6 | set(FOLDER_NAME ${DIRNAME}) 7 | 8 | ADD_ALL_SUBDIR() -------------------------------------------------------------------------------- /src/04_AdvanceOGL/01_DepthTest/01_DepthTest.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/04_AdvanceOGL/01_DepthTest/01_DepthTest.cpp -------------------------------------------------------------------------------- /src/04_AdvanceOGL/01_DepthTest/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/01_DepthTest/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/01_DepthTest/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/01_DepthTest/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/01_DepthTest/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/02_StencilTest/02_StencilTest.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/04_AdvanceOGL/02_StencilTest/02_StencilTest.cpp -------------------------------------------------------------------------------- /src/04_AdvanceOGL/02_StencilTest/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/02_StencilTest/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/02_StencilTest/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/02_StencilTest/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/02_StencilTest/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/02_StencilTest/singleColor.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(0.04, 0.28, 0.26, 1.0); 7 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/02_StencilTest/singleColor.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/03_Blend/03_Blend.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/04_AdvanceOGL/03_Blend/03_Blend.cpp -------------------------------------------------------------------------------- /src/04_AdvanceOGL/03_Blend/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/03_Blend/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/03_Blend/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/03_Blend/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/03_Blend/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/03_Blend/singleColor.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(0.04, 0.28, 0.26, 1.0); 7 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/03_Blend/singleColor.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/03_Blend/transparent.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture1; 7 | 8 | void main() 9 | { 10 | vec4 texColor = texture(texture1, TexCoords); 11 | //if(texColor.a < 0.1) 12 | // discard; 13 | FragColor = texColor; 14 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/03_Blend/transparent.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec2 TexCoords; 11 | 12 | void main() 13 | { 14 | gl_Position = projection * view * model * vec4(aPos, 1.0); 15 | TexCoords = aTexCoords; 16 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/04_FrameBuffer/04_FrameBuffer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/04_AdvanceOGL/04_FrameBuffer/04_FrameBuffer.cpp -------------------------------------------------------------------------------- /src/04_AdvanceOGL/04_FrameBuffer/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/04_FrameBuffer/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/04_FrameBuffer/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/04_FrameBuffer/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/04_FrameBuffer/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/04_FrameBuffer/postProcess.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/04_AdvanceOGL/04_FrameBuffer/postProcess.fs -------------------------------------------------------------------------------- /src/04_AdvanceOGL/04_FrameBuffer/postProcess.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec2 aTexCoords; 4 | 5 | out vec2 TexCoords; 6 | 7 | void main() 8 | { 9 | TexCoords = aTexCoords; 10 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/04_FrameBuffer/singleColor.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(0.04, 0.28, 0.26, 1.0); 7 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/04_FrameBuffer/singleColor.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/04_FrameBuffer/transparent.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture1; 7 | 8 | void main() 9 | { 10 | vec4 texColor = texture(texture1, TexCoords); 11 | //if(texColor.a < 0.1) 12 | // discard; 13 | FragColor = texColor; 14 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/04_FrameBuffer/transparent.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec2 TexCoords; 11 | 12 | void main() 13 | { 14 | gl_Position = projection * view * model * vec4(aPos, 1.0); 15 | TexCoords = aTexCoords; 16 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/05_CubeMap.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/04_AdvanceOGL/05_CubeMap/05_CubeMap.cpp -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec3 Normal; 11 | out vec3 FragPos; 12 | out vec2 TexCoords; 13 | 14 | void main() 15 | { 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | FragPos = vec3(model * vec4(aPos, 1.0)); 18 | Normal = mat3(transpose(inverse(model))) * aNormal; 19 | TexCoords = aTexCoords; 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/postProcess.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/04_AdvanceOGL/05_CubeMap/postProcess.fs -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/postProcess.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec2 aTexCoords; 4 | 5 | out vec2 TexCoords; 6 | 7 | void main() 8 | { 9 | TexCoords = aTexCoords; 10 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/reflect.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 Normal; 5 | in vec3 Position; 6 | 7 | uniform vec3 viewPos; 8 | uniform samplerCube skybox; 9 | 10 | void main() 11 | { 12 | vec3 I = normalize(Position - viewPos); 13 | vec3 R = reflect(I, normalize(Normal)); 14 | FragColor = vec4(texture(skybox, R).rgb, 1.0); 15 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/reflect.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out vec3 Normal; 6 | out vec3 Position; 7 | 8 | uniform mat4 model; 9 | uniform mat4 view; 10 | uniform mat4 projection; 11 | 12 | void main() 13 | { 14 | Normal = mat3(transpose(inverse(model))) * aNormal; 15 | Position = vec3(model * vec4(aPos, 1.0)); 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/refract.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 Normal; 5 | in vec3 Position; 6 | 7 | uniform vec3 viewPos; 8 | uniform samplerCube skybox; 9 | 10 | void main() 11 | { 12 | float ratio = 1.00 / 1.52; 13 | vec3 I = normalize(Position - viewPos); 14 | vec3 R = refract(I, normalize(Normal), ratio); 15 | FragColor = vec4(texture(skybox, R).rgb, 1.0); 16 | } 17 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/refract.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out vec3 Normal; 6 | out vec3 Position; 7 | 8 | uniform mat4 model; 9 | uniform mat4 view; 10 | uniform mat4 projection; 11 | 12 | void main() 13 | { 14 | Normal = mat3(transpose(inverse(model))) * aNormal; 15 | Position = vec3(model * vec4(aPos, 1.0)); 16 | gl_Position = projection * view * model * vec4(aPos, 1.0); 17 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/singleColor.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(0.04, 0.28, 0.26, 1.0); 7 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/singleColor.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/skybox.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 TexCoords; 5 | 6 | uniform samplerCube skybox; 7 | 8 | void main() 9 | { 10 | FragColor = texture(skybox, TexCoords); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/skybox.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | out vec3 TexCoords; 5 | 6 | uniform mat4 projection; 7 | uniform mat4 view; 8 | 9 | void main() 10 | { 11 | TexCoords = aPos; 12 | vec4 pos = projection * view * vec4(aPos, 1.0); 13 | gl_Position = pos.xyww; 14 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/transparent.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture1; 7 | 8 | void main() 9 | { 10 | vec4 texColor = texture(texture1, TexCoords); 11 | //if(texColor.a < 0.1) 12 | // discard; 13 | FragColor = texColor; 14 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/05_CubeMap/transparent.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | uniform mat4 view; 8 | uniform mat4 projection; 9 | 10 | out vec2 TexCoords; 11 | 12 | void main() 13 | { 14 | gl_Position = projection * view * model * vec4(aPos, 1.0); 15 | TexCoords = aTexCoords; 16 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/06_UBO.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/04_AdvanceOGL/06_UBO/06_UBO.cpp -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | void main() 12 | { 13 | gl_Position = projection * view * model * vec4(aPos, 1.0); 14 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec3 Normal; 14 | out vec3 FragPos; 15 | out vec2 TexCoords; 16 | 17 | void main() 18 | { 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | FragPos = vec3(model * vec4(aPos, 1.0)); 21 | Normal = mat3(transpose(inverse(model))) * aNormal; 22 | TexCoords = aTexCoords; 23 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec3 Normal; 14 | out vec3 FragPos; 15 | out vec2 TexCoords; 16 | 17 | void main() 18 | { 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | FragPos = vec3(model * vec4(aPos, 1.0)); 21 | Normal = mat3(transpose(inverse(model))) * aNormal; 22 | TexCoords = aTexCoords; 23 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/postProcess.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/04_AdvanceOGL/06_UBO/postProcess.fs -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/postProcess.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec2 aTexCoords; 4 | 5 | out vec2 TexCoords; 6 | 7 | void main() 8 | { 9 | TexCoords = aTexCoords; 10 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/reflect.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 Normal; 5 | in vec3 Position; 6 | 7 | uniform vec3 viewPos; 8 | uniform samplerCube skybox; 9 | 10 | void main() 11 | { 12 | vec3 I = normalize(Position - viewPos); 13 | vec3 R = reflect(I, normalize(Normal)); 14 | FragColor = vec4(texture(skybox, R).rgb, 1.0); 15 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/reflect.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out vec3 Normal; 6 | out vec3 Position; 7 | 8 | uniform mat4 model; 9 | 10 | layout (std140) uniform CameraMatrixs{ 11 | mat4 view; 12 | mat4 projection; 13 | }; 14 | 15 | void main() 16 | { 17 | Normal = mat3(transpose(inverse(model))) * aNormal; 18 | Position = vec3(model * vec4(aPos, 1.0)); 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/refract.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 Normal; 5 | in vec3 Position; 6 | 7 | uniform vec3 viewPos; 8 | uniform samplerCube skybox; 9 | 10 | void main() 11 | { 12 | float ratio = 1.00 / 1.52; 13 | vec3 I = normalize(Position - viewPos); 14 | vec3 R = refract(I, normalize(Normal), ratio); 15 | FragColor = vec4(texture(skybox, R).rgb, 1.0); 16 | } 17 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/refract.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out vec3 Normal; 6 | out vec3 Position; 7 | 8 | uniform mat4 model; 9 | 10 | layout (std140) uniform CameraMatrixs{ 11 | mat4 view; 12 | mat4 projection; 13 | }; 14 | 15 | void main() 16 | { 17 | Normal = mat3(transpose(inverse(model))) * aNormal; 18 | Position = vec3(model * vec4(aPos, 1.0)); 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/singleColor.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(0.04, 0.28, 0.26, 1.0); 7 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/singleColor.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | void main() 12 | { 13 | gl_Position = projection * view * model * vec4(aPos, 1.0); 14 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/skybox.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 TexCoords; 5 | 6 | uniform samplerCube skybox; 7 | 8 | void main() 9 | { 10 | FragColor = texture(skybox, TexCoords); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/skybox.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | out vec3 TexCoords; 5 | 6 | 7 | layout (std140) uniform CameraMatrixs{ 8 | mat4 view; 9 | mat4 projection; 10 | }; 11 | 12 | void main() 13 | { 14 | TexCoords = aPos; 15 | vec4 pos = projection * mat4(mat3(view)) * vec4(aPos, 1.0); 16 | gl_Position = pos.xyww; 17 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/transparent.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture1; 7 | 8 | void main() 9 | { 10 | vec4 texColor = texture(texture1, TexCoords); 11 | //if(texColor.a < 0.1) 12 | // discard; 13 | FragColor = texColor; 14 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/06_UBO/transparent.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec2 TexCoords; 14 | 15 | void main() 16 | { 17 | gl_Position = projection * view * model * vec4(aPos, 1.0); 18 | TexCoords = aTexCoords; 19 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/07_GS.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/04_AdvanceOGL/07_GS/07_GS.cpp -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/house.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 fColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(fColor, 1.0); 9 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/house.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec3 aColor; 4 | 5 | out VS_OUT { 6 | vec3 color; 7 | } vs_out; 8 | 9 | void main() 10 | { 11 | vs_out.color = aColor; 12 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 13 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | void main() 12 | { 13 | gl_Position = projection * view * model * vec4(aPos, 1.0); 14 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec3 Normal; 14 | out vec3 FragPos; 15 | out vec2 TexCoords; 16 | 17 | void main() 18 | { 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | FragPos = vec3(model * vec4(aPos, 1.0)); 21 | Normal = mat3(transpose(inverse(model))) * aNormal; 22 | TexCoords = aTexCoords; 23 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec3 Normal; 14 | out vec3 FragPos; 15 | out vec2 TexCoords; 16 | 17 | void main() 18 | { 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | FragPos = vec3(model * vec4(aPos, 1.0)); 21 | Normal = mat3(transpose(inverse(model))) * aNormal; 22 | TexCoords = aTexCoords; 23 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/nanosuit_explode.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture_diffuse1; 7 | 8 | void main() 9 | { 10 | FragColor = texture(texture_diffuse1, TexCoords); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/nanosuit_explode.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 2) in vec2 aTexCoords; 4 | 5 | out VS_OUT { 6 | vec2 texCoords; 7 | } vs_out; 8 | 9 | layout (std140) uniform CameraMatrixs{ 10 | mat4 view; 11 | mat4 projection; 12 | }; 13 | uniform mat4 model; 14 | 15 | void main() 16 | { 17 | vs_out.texCoords = aTexCoords; 18 | gl_Position = projection * view * model * vec4(aPos, 1.0); 19 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/nanosuit_normal.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(1.0, 1.0, 0.0, 1.0); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/nanosuit_normal.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out VS_OUT { 6 | vec3 normal; 7 | } vs_out; 8 | 9 | layout (std140) uniform CameraMatrixs{ 10 | mat4 view; 11 | mat4 projection; 12 | }; 13 | uniform mat4 model; 14 | 15 | void main() 16 | { 17 | mat3 normalMatrix = mat3(transpose(inverse(view * model))); 18 | vs_out.normal = vec3(projection * vec4(normalMatrix * aNormal, 0.0)); 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/postProcess.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/04_AdvanceOGL/07_GS/postProcess.fs -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/postProcess.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec2 aTexCoords; 4 | 5 | out vec2 TexCoords; 6 | 7 | void main() 8 | { 9 | TexCoords = aTexCoords; 10 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/reflect.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 Normal; 5 | in vec3 Position; 6 | 7 | uniform vec3 viewPos; 8 | uniform samplerCube skybox; 9 | 10 | void main() 11 | { 12 | vec3 I = normalize(Position - viewPos); 13 | vec3 R = reflect(I, normalize(Normal)); 14 | FragColor = vec4(texture(skybox, R).rgb, 1.0); 15 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/reflect.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out vec3 Normal; 6 | out vec3 Position; 7 | 8 | uniform mat4 model; 9 | 10 | layout (std140) uniform CameraMatrixs{ 11 | mat4 view; 12 | mat4 projection; 13 | }; 14 | 15 | void main() 16 | { 17 | Normal = mat3(transpose(inverse(model))) * aNormal; 18 | Position = vec3(model * vec4(aPos, 1.0)); 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/refract.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 Normal; 5 | in vec3 Position; 6 | 7 | uniform vec3 viewPos; 8 | uniform samplerCube skybox; 9 | 10 | void main() 11 | { 12 | float ratio = 1.00 / 1.52; 13 | vec3 I = normalize(Position - viewPos); 14 | vec3 R = refract(I, normalize(Normal), ratio); 15 | FragColor = vec4(texture(skybox, R).rgb, 1.0); 16 | } 17 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/refract.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out vec3 Normal; 6 | out vec3 Position; 7 | 8 | uniform mat4 model; 9 | 10 | layout (std140) uniform CameraMatrixs{ 11 | mat4 view; 12 | mat4 projection; 13 | }; 14 | 15 | void main() 16 | { 17 | Normal = mat3(transpose(inverse(model))) * aNormal; 18 | Position = vec3(model * vec4(aPos, 1.0)); 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/singleColor.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(0.04, 0.28, 0.26, 1.0); 7 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/singleColor.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | void main() 12 | { 13 | gl_Position = projection * view * model * vec4(aPos, 1.0); 14 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/skybox.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 TexCoords; 5 | 6 | uniform samplerCube skybox; 7 | 8 | void main() 9 | { 10 | FragColor = texture(skybox, TexCoords); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/skybox.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | out vec3 TexCoords; 5 | 6 | 7 | layout (std140) uniform CameraMatrixs{ 8 | mat4 view; 9 | mat4 projection; 10 | }; 11 | 12 | void main() 13 | { 14 | TexCoords = aPos; 15 | vec4 pos = projection * mat4(mat3(view)) * vec4(aPos, 1.0); 16 | gl_Position = pos.xyww; 17 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/transparent.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture1; 7 | 8 | void main() 9 | { 10 | vec4 texColor = texture(texture1, TexCoords); 11 | //if(texColor.a < 0.1) 12 | // discard; 13 | FragColor = texColor; 14 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/07_GS/transparent.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec2 TexCoords; 14 | 15 | void main() 16 | { 17 | gl_Position = projection * view * model * vec4(aPos, 1.0); 18 | TexCoords = aTexCoords; 19 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/08_Instance.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/04_AdvanceOGL/08_Instance/08_Instance.cpp -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/house.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 fColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(fColor, 1.0); 9 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/house.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec3 aColor; 4 | 5 | out VS_OUT { 6 | vec3 color; 7 | } vs_out; 8 | 9 | void main() 10 | { 11 | vs_out.color = aColor; 12 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 13 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/instance.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture0; 7 | 8 | void main() 9 | { 10 | FragColor = texture(texture0, TexCoords); 11 | } 12 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/instance.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec2 aTexCoords; 4 | layout (location = 2) in vec3 offset; 5 | 6 | out vec2 TexCoords; 7 | 8 | uniform mat4 model; 9 | 10 | layout (std140) uniform CameraMatrixs{ 11 | mat4 view; 12 | mat4 projection; 13 | }; 14 | 15 | void main() 16 | { 17 | TexCoords = aTexCoords; 18 | gl_Position = projection * view * model * vec4(aPos + offset, 1.0); 19 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | uniform vec3 lightColor; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(lightColor, 1.0); 9 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/light.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | void main() 12 | { 13 | gl_Position = projection * view * model * vec4(aPos, 1.0); 14 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/lighting.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec3 Normal; 14 | out vec3 FragPos; 15 | out vec2 TexCoords; 16 | 17 | void main() 18 | { 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | FragPos = vec3(model * vec4(aPos, 1.0)); 21 | Normal = mat3(transpose(inverse(model))) * aNormal; 22 | TexCoords = aTexCoords; 23 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/nanosuit.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec3 Normal; 14 | out vec3 FragPos; 15 | out vec2 TexCoords; 16 | 17 | void main() 18 | { 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | FragPos = vec3(model * vec4(aPos, 1.0)); 21 | Normal = mat3(transpose(inverse(model))) * aNormal; 22 | TexCoords = aTexCoords; 23 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/nanosuit_explode.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture_diffuse1; 7 | 8 | void main() 9 | { 10 | FragColor = texture(texture_diffuse1, TexCoords); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/nanosuit_explode.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 2) in vec2 aTexCoords; 4 | 5 | out VS_OUT { 6 | vec2 texCoords; 7 | } vs_out; 8 | 9 | layout (std140) uniform CameraMatrixs{ 10 | mat4 view; 11 | mat4 projection; 12 | }; 13 | uniform mat4 model; 14 | 15 | void main() 16 | { 17 | vs_out.texCoords = aTexCoords; 18 | gl_Position = projection * view * model * vec4(aPos, 1.0); 19 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/nanosuit_normal.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(1.0, 1.0, 0.0, 1.0); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/nanosuit_normal.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out VS_OUT { 6 | vec3 normal; 7 | } vs_out; 8 | 9 | layout (std140) uniform CameraMatrixs{ 10 | mat4 view; 11 | mat4 projection; 12 | }; 13 | uniform mat4 model; 14 | 15 | void main() 16 | { 17 | mat3 normalMatrix = mat3(transpose(inverse(view * model))); 18 | vs_out.normal = vec3(projection * vec4(normalMatrix * aNormal, 0.0)); 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/postProcess.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/04_AdvanceOGL/08_Instance/postProcess.fs -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/postProcess.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec2 aTexCoords; 4 | 5 | out vec2 TexCoords; 6 | 7 | void main() 8 | { 9 | TexCoords = aTexCoords; 10 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/reflect.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 Normal; 5 | in vec3 Position; 6 | 7 | uniform vec3 viewPos; 8 | uniform samplerCube skybox; 9 | 10 | void main() 11 | { 12 | vec3 I = normalize(Position - viewPos); 13 | vec3 R = reflect(I, normalize(Normal)); 14 | FragColor = vec4(texture(skybox, R).rgb, 1.0); 15 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/reflect.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out vec3 Normal; 6 | out vec3 Position; 7 | 8 | uniform mat4 model; 9 | 10 | layout (std140) uniform CameraMatrixs{ 11 | mat4 view; 12 | mat4 projection; 13 | }; 14 | 15 | void main() 16 | { 17 | Normal = mat3(transpose(inverse(model))) * aNormal; 18 | Position = vec3(model * vec4(aPos, 1.0)); 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/refract.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 Normal; 5 | in vec3 Position; 6 | 7 | uniform vec3 viewPos; 8 | uniform samplerCube skybox; 9 | 10 | void main() 11 | { 12 | float ratio = 1.00 / 1.52; 13 | vec3 I = normalize(Position - viewPos); 14 | vec3 R = refract(I, normalize(Normal), ratio); 15 | FragColor = vec4(texture(skybox, R).rgb, 1.0); 16 | } 17 | -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/refract.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | 5 | out vec3 Normal; 6 | out vec3 Position; 7 | 8 | uniform mat4 model; 9 | 10 | layout (std140) uniform CameraMatrixs{ 11 | mat4 view; 12 | mat4 projection; 13 | }; 14 | 15 | void main() 16 | { 17 | Normal = mat3(transpose(inverse(model))) * aNormal; 18 | Position = vec3(model * vec4(aPos, 1.0)); 19 | gl_Position = projection * view * model * vec4(aPos, 1.0); 20 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/singleColor.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | void main() 5 | { 6 | FragColor = vec4(0.04, 0.28, 0.26, 1.0); 7 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/singleColor.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | void main() 12 | { 13 | gl_Position = projection * view * model * vec4(aPos, 1.0); 14 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/skybox.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 TexCoords; 5 | 6 | uniform samplerCube skybox; 7 | 8 | void main() 9 | { 10 | FragColor = texture(skybox, TexCoords); 11 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/skybox.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | out vec3 TexCoords; 5 | 6 | 7 | layout (std140) uniform CameraMatrixs{ 8 | mat4 view; 9 | mat4 projection; 10 | }; 11 | 12 | void main() 13 | { 14 | TexCoords = aPos; 15 | vec4 pos = projection * mat4(mat3(view)) * vec4(aPos, 1.0); 16 | gl_Position = pos.xyww; 17 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/transparent.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture1; 7 | 8 | void main() 9 | { 10 | vec4 texColor = texture(texture1, TexCoords); 11 | //if(texColor.a < 0.1) 12 | // discard; 13 | FragColor = texColor; 14 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/08_Instance/transparent.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aNormal; 4 | layout (location = 2) in vec2 aTexCoords; 5 | 6 | uniform mat4 model; 7 | 8 | layout (std140) uniform CameraMatrixs{ 9 | mat4 view; 10 | mat4 projection; 11 | }; 12 | 13 | out vec2 TexCoords; 14 | 15 | void main() 16 | { 17 | gl_Position = projection * view * model * vec4(aPos, 1.0); 18 | TexCoords = aTexCoords; 19 | } -------------------------------------------------------------------------------- /src/04_AdvanceOGL/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #生成 exe 就 "EXE",生成 lib 就 "LIB" 2 | set(MODE "EXE") 3 | set(TARGET_PREFIX "04_") 4 | 5 | GET_DIR_NAME(DIRNAME) 6 | set(FOLDER_NAME ${DIRNAME}) 7 | 8 | ADD_ALL_SUBDIR() -------------------------------------------------------------------------------- /src/05_AdvanceLighting/01_BlinnPhong/01_BlinnPhong.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/05_AdvanceLighting/01_BlinnPhong/01_BlinnPhong.cpp -------------------------------------------------------------------------------- /src/05_AdvanceLighting/01_BlinnPhong/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/05_AdvanceLighting/02_Gamma/02_Gamma.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/05_AdvanceLighting/02_Gamma/02_Gamma.cpp -------------------------------------------------------------------------------- /src/05_AdvanceLighting/02_Gamma/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/05_AdvanceLighting/03_ShadowMap/03_ShadowMap.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/05_AdvanceLighting/03_ShadowMap/03_ShadowMap.cpp -------------------------------------------------------------------------------- /src/05_AdvanceLighting/03_ShadowMap/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/05_AdvanceLighting/03_ShadowMap/depth.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | void main() 4 | { 5 | // gl_FragDepth = gl_FragCoord.z; 6 | } -------------------------------------------------------------------------------- /src/05_AdvanceLighting/03_ShadowMap/depth.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | layout (std140) uniform LightMatrix{ 5 | mat4 lightSpaceMatrix; 6 | }; 7 | 8 | uniform mat4 model; 9 | 10 | void main() 11 | { 12 | gl_Position = lightSpaceMatrix * model * vec4(aPos, 1.0); 13 | } -------------------------------------------------------------------------------- /src/05_AdvanceLighting/04_PointShadow/04_PointShadow.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/05_AdvanceLighting/04_PointShadow/04_PointShadow.cpp -------------------------------------------------------------------------------- /src/05_AdvanceLighting/04_PointShadow/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/05_AdvanceLighting/04_PointShadow/depth.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | in vec4 FragPos; 3 | 4 | uniform vec3 lightPos; 5 | uniform float far_plane; 6 | 7 | void main() 8 | { 9 | // get distance between fragment and light source 10 | float lightDistance = length(FragPos.xyz - lightPos); 11 | 12 | // map to [0;1] range by dividing by far_plane 13 | lightDistance = lightDistance / far_plane; 14 | 15 | // Write this as modified depth 16 | gl_FragDepth = lightDistance; 17 | } -------------------------------------------------------------------------------- /src/05_AdvanceLighting/04_PointShadow/depth.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | 6 | void main() 7 | { 8 | gl_Position = model * vec4(aPos, 1.0); 9 | } -------------------------------------------------------------------------------- /src/05_AdvanceLighting/05_NormalMap/05_NormalMap.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/05_AdvanceLighting/05_NormalMap/05_NormalMap.cpp -------------------------------------------------------------------------------- /src/05_AdvanceLighting/05_NormalMap/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/05_AdvanceLighting/05_NormalMap/imgShow.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in VS_OUT{ 5 | vec2 TexCoords; 6 | } fs_in; 7 | 8 | uniform sampler2D texture0; 9 | 10 | void main(){ 11 | FragColor = vec4(vec3(texture(texture0, fs_in.TexCoords)), 1.0f); 12 | } -------------------------------------------------------------------------------- /src/05_AdvanceLighting/05_NormalMap/imgShow.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | layout (location = 0) in vec3 aPos; 4 | layout (location = 1) in vec2 aTexCoords; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | uniform mat4 model; 12 | 13 | out VS_OUT{ 14 | vec2 TexCoords; 15 | } vs_out; 16 | 17 | void main(){ 18 | vs_out.TexCoords = aTexCoords; 19 | 20 | gl_Position = projection * view * model * vec4(aPos,1.0); 21 | } -------------------------------------------------------------------------------- /src/05_AdvanceLighting/06_ParallaxMap/06_ParallaxMap.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/05_AdvanceLighting/06_ParallaxMap/06_ParallaxMap.cpp -------------------------------------------------------------------------------- /src/05_AdvanceLighting/06_ParallaxMap/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/05_AdvanceLighting/06_ParallaxMap/imgShow.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in VS_OUT{ 5 | vec2 TexCoords; 6 | } fs_in; 7 | 8 | uniform sampler2D texture0; 9 | 10 | void main(){ 11 | FragColor = vec4(vec3(texture(texture0, fs_in.TexCoords)), 1.0f); 12 | } -------------------------------------------------------------------------------- /src/05_AdvanceLighting/06_ParallaxMap/imgShow.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | layout (location = 0) in vec3 aPos; 4 | layout (location = 1) in vec2 aTexCoords; 5 | 6 | layout (std140) uniform CameraMatrixs{ 7 | mat4 view; 8 | mat4 projection; 9 | }; 10 | 11 | uniform mat4 model; 12 | 13 | out VS_OUT{ 14 | vec2 TexCoords; 15 | } vs_out; 16 | 17 | void main(){ 18 | vs_out.TexCoords = aTexCoords; 19 | 20 | gl_Position = projection * view * model * vec4(aPos,1.0); 21 | } -------------------------------------------------------------------------------- /src/05_AdvanceLighting/07_HDR/07_HDR.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/05_AdvanceLighting/07_HDR/07_HDR.cpp -------------------------------------------------------------------------------- /src/05_AdvanceLighting/07_HDR/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/05_AdvanceLighting/07_HDR/hdr.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/05_AdvanceLighting/07_HDR/hdr.fs -------------------------------------------------------------------------------- /src/05_AdvanceLighting/07_HDR/hdr.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec2 aTexCoords; 4 | 5 | out vec2 TexCoords; 6 | 7 | void main() 8 | { 9 | TexCoords = aTexCoords; 10 | gl_Position = vec4(aPos, 0.0, 1.0); 11 | } -------------------------------------------------------------------------------- /src/05_AdvanceLighting/08_Bloom/08_Bloom.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/05_AdvanceLighting/08_Bloom/08_Bloom.cpp -------------------------------------------------------------------------------- /src/05_AdvanceLighting/08_Bloom/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/05_AdvanceLighting/08_Bloom/bloomLight.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) out vec4 FragColor; 3 | layout (location = 1) out vec4 BrightColor; 4 | 5 | uniform vec3 lightColor; 6 | 7 | void main() 8 | { 9 | FragColor = vec4(lightColor, 1.0); 10 | float brightness = dot(FragColor.rgb, vec3(0.2126, 0.7152, 0.0722)); 11 | if(brightness > 1.0) 12 | BrightColor = vec4(FragColor.rgb, 1.0); 13 | } -------------------------------------------------------------------------------- /src/05_AdvanceLighting/09_DeferedShading/09_DeferedShading.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/05_AdvanceLighting/09_DeferedShading/09_DeferedShading.cpp -------------------------------------------------------------------------------- /src/05_AdvanceLighting/09_DeferedShading/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/05_AdvanceLighting/10_SSAO/10_SSAO.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/05_AdvanceLighting/10_SSAO/10_SSAO.cpp -------------------------------------------------------------------------------- /src/05_AdvanceLighting/10_SSAO/RegisterInput.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGISTER_INPUT_H_ 2 | #define _REGISTER_INPUT_H_ 3 | 4 | #include 5 | 6 | class RegisterInput : public Ubpa::Operation { 7 | public: 8 | RegisterInput(bool isHold = true) 9 | :Operation(isHold) { } 10 | void Run(); 11 | private: 12 | void RegisterMouse(); 13 | void RegisterKey(); 14 | void PrintInfo(); 15 | }; 16 | 17 | #endif // !_REGISTER_INPUT_H_ 18 | -------------------------------------------------------------------------------- /src/05_AdvanceLighting/10_SSAO/blur.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out float FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D SSAO; 7 | 8 | void main() 9 | { 10 | vec2 texelSize = 1.0 / vec2(textureSize(SSAO, 0)); 11 | float result = 0.0; 12 | for (int x = -2; x < 2; ++x) 13 | { 14 | for (int y = -2; y < 2; ++y) 15 | { 16 | vec2 offset = vec2(float(x), float(y)) * texelSize; 17 | result += texture(SSAO, TexCoords + offset).r; 18 | } 19 | } 20 | FragColor = result / (4.0 * 4.0); 21 | } -------------------------------------------------------------------------------- /src/05_AdvanceLighting/10_SSAO/gBuffer.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) out vec3 gPosition; 3 | layout (location = 1) out vec3 gNormal; 4 | layout (location = 2) out vec4 gAlbedoSpec; 5 | 6 | in VS_OUT { 7 | vec3 FragPos; 8 | vec3 Normal; 9 | } fs_in; 10 | 11 | void main() 12 | { 13 | // store the fragment position vector in the first gbuffer texture 14 | gPosition = fs_in.FragPos; 15 | // also store the per-fragment normals into the gbuffer 16 | gNormal = normalize(fs_in.Normal); 17 | // and the diffuse per-fragment color 18 | gAlbedoSpec = vec4(vec3(0.95), 1.0f); 19 | } -------------------------------------------------------------------------------- /src/05_AdvanceLighting/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #生成 exe 就 "EXE",生成 lib 就 "LIB" 2 | set(MODE "EXE") 3 | set(TARGET_PREFIX "05_") 4 | 5 | GET_DIR_NAME(DIRNAME) 6 | set(FOLDER_NAME ${DIRNAME}) 7 | 8 | ADD_ALL_SUBDIR() -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_ALL_SUBDIR() -------------------------------------------------------------------------------- /src/LIBs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #生成 exe 就 "EXE",生成 lib 就 "LIB" 2 | set(MODE "LIB") 3 | 4 | GET_DIR_NAME(DIRNAME) 5 | set(FOLDER_NAME ${DIRNAME}) 6 | 7 | ADD_ALL_SUBDIR() -------------------------------------------------------------------------------- /src/LIBs/LOGL/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(FOLDER_NAME "${FOLDER_NAME}/LOGL") 2 | ADD_ALL_SUBDIR() 3 | -------------------------------------------------------------------------------- /src/LIBs/LOGL/Camera/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | GET_DIR_NAME(DIRNAME) 3 | set(TARGET_NAME ${DIRNAME}) 4 | #多个源文件用 [空格] 分隔 5 | #如:set(STR_TARGET_SOURCES "main.cpp src_2.cpp") 6 | set(STR_TARGET_SOURCES "${DIRNAME}.cpp ${CMAKE_SOURCE_DIR}/include/LOGL/${DIRNAME}.h") 7 | #多个库文件用 [空格] 分隔,如果为空,就输入[一个空格] 8 | #如:set(STR_TARGET_LIBS "lib1.lib lib2.lib") 9 | set(STR_TARGET_LIBS " ") 10 | 11 | SETUP_PROJECT(${MODE} ${TARGET_NAME} ${STR_TARGET_SOURCES} ${STR_TARGET_LIBS}) 12 | -------------------------------------------------------------------------------- /src/LIBs/LOGL/FBO/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | GET_DIR_NAME(DIRNAME) 3 | set(TARGET_NAME ${DIRNAME}) 4 | #多个源文件用 [空格] 分隔 5 | #如:set(STR_TARGET_SOURCES "main.cpp src_2.cpp") 6 | set(STR_TARGET_SOURCES "${DIRNAME}.cpp ${CMAKE_SOURCE_DIR}/include/LOGL/${DIRNAME}.h") 7 | #多个库文件用 [空格] 分隔,如果为空,就输入[一个空格] 8 | #如:set(STR_TARGET_LIBS "lib1.lib lib2.lib") 9 | set(STR_TARGET_LIBS " ") 10 | 11 | SETUP_PROJECT(${MODE} ${TARGET_NAME} ${STR_TARGET_SOURCES} ${STR_TARGET_LIBS}) 12 | -------------------------------------------------------------------------------- /src/LIBs/LOGL/Glfw/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | GET_DIR_NAME(DIRNAME) 3 | set(TARGET_NAME ${DIRNAME}) 4 | #多个源文件用 [空格] 分隔 5 | #如:set(STR_TARGET_SOURCES "main.cpp src_2.cpp") 6 | set(STR_TARGET_SOURCES "${DIRNAME}.cpp ${CMAKE_SOURCE_DIR}/include/GLFW/${DIRNAME}.h") 7 | #多个库文件用 [空格] 分隔,如果为空,就输入[一个空格] 8 | #如:set(STR_TARGET_LIBS "lib1.lib lib2.lib") 9 | set(STR_TARGET_LIBS " ") 10 | 11 | SETUP_PROJECT(${MODE} ${TARGET_NAME} ${STR_TARGET_SOURCES} ${STR_TARGET_LIBS}) 12 | -------------------------------------------------------------------------------- /src/LIBs/LOGL/Mesh/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | GET_DIR_NAME(DIRNAME) 3 | set(TARGET_NAME ${DIRNAME}) 4 | #多个源文件用 [空格] 分隔 5 | #如:set(STR_TARGET_SOURCES "main.cpp src_2.cpp") 6 | set(STR_TARGET_SOURCES "${DIRNAME}.cpp ${CMAKE_SOURCE_DIR}/include/LOGL/${DIRNAME}.h") 7 | #多个库文件用 [空格] 分隔,如果为空,就输入[一个空格] 8 | #如:set(STR_TARGET_LIBS "lib1.lib lib2.lib") 9 | set(STR_TARGET_LIBS "Shader Texture") 10 | 11 | SETUP_PROJECT(${MODE} ${TARGET_NAME} ${STR_TARGET_SOURCES} ${STR_TARGET_LIBS}) 12 | -------------------------------------------------------------------------------- /src/LIBs/LOGL/Model/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | GET_DIR_NAME(DIRNAME) 3 | set(TARGET_NAME ${DIRNAME}) 4 | #多个源文件用 [空格] 分隔 5 | #如:set(STR_TARGET_SOURCES "main.cpp src_2.cpp") 6 | set(STR_TARGET_SOURCES "${DIRNAME}.cpp ${CMAKE_SOURCE_DIR}/include/LOGL/${DIRNAME}.h") 7 | #多个库文件用 [空格] 分隔,如果为空,就输入[一个空格] 8 | #如:set(STR_TARGET_LIBS "lib1.lib lib2.lib") 9 | set(STR_TARGET_LIBS "Shader Mesh Texture assimp.lib") 10 | 11 | SETUP_PROJECT(${MODE} ${TARGET_NAME} ${STR_TARGET_SOURCES} ${STR_TARGET_LIBS}) 12 | -------------------------------------------------------------------------------- /src/LIBs/LOGL/Shader/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | GET_DIR_NAME(DIRNAME) 3 | set(TARGET_NAME ${DIRNAME}) 4 | #多个源文件用 [空格] 分隔 5 | #如:set(STR_TARGET_SOURCES "main.cpp src_2.cpp") 6 | set(STR_TARGET_SOURCES "${DIRNAME}.cpp ${CMAKE_SOURCE_DIR}/include/LOGL/${DIRNAME}.h") 7 | #多个库文件用 [空格] 分隔,如果为空,就输入[一个空格] 8 | #如:set(STR_TARGET_LIBS "lib1.lib lib2.lib") 9 | set(STR_TARGET_LIBS "File Glfw") 10 | 11 | SETUP_PROJECT(${MODE} ${TARGET_NAME} ${STR_TARGET_SOURCES} ${STR_TARGET_LIBS}) 12 | -------------------------------------------------------------------------------- /src/LIBs/LOGL/Texture/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | GET_DIR_NAME(DIRNAME) 3 | set(TARGET_NAME ${DIRNAME}) 4 | #多个源文件用 [空格] 分隔 5 | #如:set(STR_TARGET_SOURCES "main.cpp src_2.cpp") 6 | set(STR_TARGET_SOURCES "${DIRNAME}.cpp ${CMAKE_SOURCE_DIR}/include/LOGL/${DIRNAME}.h") 7 | #多个库文件用 [空格] 分隔,如果为空,就输入[一个空格] 8 | #如:set(STR_TARGET_LIBS "lib1.lib lib2.lib") 9 | set(STR_TARGET_LIBS "File Image") 10 | 11 | SETUP_PROJECT(${MODE} ${TARGET_NAME} ${STR_TARGET_SOURCES} ${STR_TARGET_LIBS}) 12 | -------------------------------------------------------------------------------- /src/LIBs/LOGL/Texture/Texture.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/LIBs/LOGL/Texture/Texture.cpp -------------------------------------------------------------------------------- /src/LIBs/LOGL/VAO/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | GET_DIR_NAME(DIRNAME) 3 | set(TARGET_NAME ${DIRNAME}) 4 | #多个源文件用 [空格] 分隔 5 | #如:set(STR_TARGET_SOURCES "main.cpp src_2.cpp") 6 | set(STR_TARGET_SOURCES "${DIRNAME}.cpp ${CMAKE_SOURCE_DIR}/include/LOGL/${DIRNAME}.h") 7 | #多个库文件用 [空格] 分隔,如果为空,就输入[一个空格] 8 | #如:set(STR_TARGET_LIBS "lib1.lib lib2.lib") 9 | set(STR_TARGET_LIBS " ") 10 | 11 | SETUP_PROJECT(${MODE} ${TARGET_NAME} ${STR_TARGET_SOURCES} ${STR_TARGET_LIBS}) 12 | -------------------------------------------------------------------------------- /src/LIBs/LOGL/VAO/VAO.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/LIBs/LOGL/VAO/VAO.cpp -------------------------------------------------------------------------------- /src/LIBs/Utility/ArgManager/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | GET_DIR_NAME(DIRNAME) 3 | set(TARGET_NAME "${TARGET_PREFIX}${DIRNAME}") 4 | #多个源文件用 [空格] 分隔 5 | #如:set(STR_TARGET_SOURCES "main.cpp src_2.cpp") 6 | set(STR_TARGET_SOURCES "${DIRNAME}.cpp ${CMAKE_SOURCE_DIR}/include/Utility/${DIRNAME}.h" ) 7 | #多个库文件用 [空格] 分隔,如果为空,就输入[一个空格] 8 | #如:set(STR_TARGET_LIBS "lib1.lib lib2.lib") 9 | set(STR_TARGET_LIBS " ") 10 | 11 | SETUP_PROJECT(${MODE} ${TARGET_NAME} ${STR_TARGET_SOURCES} ${STR_TARGET_LIBS}) -------------------------------------------------------------------------------- /src/LIBs/Utility/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(FOLDER_NAME "${FOLDER_NAME}/Utility") 2 | ADD_ALL_SUBDIR() 3 | -------------------------------------------------------------------------------- /src/LIBs/Utility/Config/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | GET_DIR_NAME(DIRNAME) 3 | set(TARGET_NAME ${DIRNAME}) 4 | #多个源文件用 [空格] 分隔 5 | #如:set(STR_TARGET_SOURCES "main.cpp src_2.cpp") 6 | set(STR_TARGET_SOURCES "${DIRNAME}.cpp ${CMAKE_SOURCE_DIR}/include/Utility/${DIRNAME}.h" ) 7 | #多个库文件用 [空格] 分隔,如果为空,就输入[一个空格] 8 | #如:set(STR_TARGET_LIBS "lib1.lib lib2.lib") 9 | set(STR_TARGET_LIBS " ") 10 | 11 | SETUP_PROJECT(${MODE} ${TARGET_NAME} ${STR_TARGET_SOURCES} ${STR_TARGET_LIBS}) -------------------------------------------------------------------------------- /src/LIBs/Utility/EventManager/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | GET_DIR_NAME(DIRNAME) 3 | set(TARGET_NAME ${DIRNAME}) 4 | #多个源文件用 [空格] 分隔 5 | #如:set(STR_TARGET_SOURCES "main.cpp src_2.cpp") 6 | set(STR_TARGET_SOURCES "${DIRNAME}.cpp ${CMAKE_SOURCE_DIR}/include/Utility/${DIRNAME}.h" ) 7 | #多个库文件用 [空格] 分隔,如果为空,就输入[一个空格] 8 | #如:set(STR_TARGET_LIBS "lib1.lib lib2.lib") 9 | set(STR_TARGET_LIBS "Operation") 10 | 11 | SETUP_PROJECT(${MODE} ${TARGET_NAME} ${STR_TARGET_SOURCES} ${STR_TARGET_LIBS}) -------------------------------------------------------------------------------- /src/LIBs/Utility/File/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | GET_DIR_NAME(DIRNAME) 3 | set(TARGET_NAME ${DIRNAME}) 4 | #多个源文件用 [空格] 分隔 5 | #如:set(STR_TARGET_SOURCES "main.cpp src_2.cpp") 6 | set(STR_TARGET_SOURCES "${DIRNAME}.cpp ${CMAKE_SOURCE_DIR}/include/Utility/${DIRNAME}.h" ) 7 | #多个库文件用 [空格] 分隔,如果为空,就输入[一个空格] 8 | #如:set(STR_TARGET_LIBS "lib1.lib lib2.lib") 9 | set(STR_TARGET_LIBS " ") 10 | 11 | SETUP_PROJECT(${MODE} ${TARGET_NAME} ${STR_TARGET_SOURCES} ${STR_TARGET_LIBS}) -------------------------------------------------------------------------------- /src/LIBs/Utility/Header/[NO_USE].cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/LIBs/Utility/Header/[NO_USE].cpp -------------------------------------------------------------------------------- /src/LIBs/Utility/Image/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | GET_DIR_NAME(DIRNAME) 3 | set(TARGET_NAME ${DIRNAME}) 4 | #多个源文件用 [空格] 分隔 5 | #如:set(STR_TARGET_SOURCES "main.cpp src_2.cpp") 6 | set(STR_TARGET_SOURCES "${DIRNAME}.cpp ${CMAKE_SOURCE_DIR}/include/Utility/${DIRNAME}.h ${CMAKE_SOURCE_DIR}/include/Utility/stb_image.h" ) 7 | #多个库文件用 [空格] 分隔,如果为空,就输入[一个空格] 8 | #如:set(STR_TARGET_LIBS "lib1.lib lib2.lib") 9 | set(STR_TARGET_LIBS " ") 10 | 11 | SETUP_PROJECT(${MODE} ${TARGET_NAME} ${STR_TARGET_SOURCES} ${STR_TARGET_LIBS}) -------------------------------------------------------------------------------- /src/LIBs/Utility/Operation/LambdaOp.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace Ubpa; 4 | 5 | LambdaOp::LambdaOp(const std::function & op, bool isHold) 6 | : op(op), Operation(isHold) { } 7 | 8 | LambdaOp::~LambdaOp() { printf("INFO: Delete LambdaOp\n"); }; 9 | 10 | 11 | void LambdaOp::SetOp(const std::function & op) { 12 | this->op = op; 13 | } 14 | 15 | void LambdaOp::Run() { 16 | if (op == NULL) 17 | isHold = false; 18 | else 19 | op(); 20 | } 21 | -------------------------------------------------------------------------------- /src/LIBs/Utility/Operation/Operation.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace Ubpa; 4 | using namespace std; 5 | 6 | Operation::Operation(bool isHold): isHold(isHold) { }; 7 | 8 | Operation::~Operation() { printf("INFO: Delete Operation\n"); }; 9 | 10 | void Operation::ProtectDelete(Operation * op) { delete op; } 11 | //------------ 12 | 13 | bool Operation::IsHold() { return isHold; } 14 | 15 | void Operation::SetIsHold(bool isHold) { this->isHold = isHold; } 16 | 17 | void Operation::operator()() { Run(); } -------------------------------------------------------------------------------- /src/LIBs/Utility/Shape/Sphere.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ubpa/LearnOpenGL/86184bbdf51c9e1497d1a4aba438474da59d2767/src/LIBs/Utility/Shape/Sphere.cpp -------------------------------------------------------------------------------- /src/LIBs/Utility/Timer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | GET_DIR_NAME(DIRNAME) 3 | set(TARGET_NAME ${DIRNAME}) 4 | #多个源文件用 [空格] 分隔 5 | #如:set(STR_TARGET_SOURCES "main.cpp src_2.cpp") 6 | set(STR_TARGET_SOURCES "${DIRNAME}.cpp ${CMAKE_SOURCE_DIR}/include/Utility/${DIRNAME}.h" ) 7 | #多个库文件用 [空格] 分隔,如果为空,就输入[一个空格] 8 | #如:set(STR_TARGET_LIBS "lib1.lib lib2.lib") 9 | set(STR_TARGET_LIBS " ") 10 | 11 | SETUP_PROJECT(${MODE} ${TARGET_NAME} ${STR_TARGET_SOURCES} ${STR_TARGET_LIBS}) -------------------------------------------------------------------------------- /src/LIBs/glad/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | GET_DIR_NAME(DIRNAME) 3 | set(TARGET_NAME ${DIRNAME}) 4 | #多个源文件用 [空格] 分隔 5 | #如:set(STR_TARGET_SOURCES "main.cpp src_2.cpp") 6 | set(STR_TARGET_SOURCES "glad.c") 7 | #多个库文件用 [空格] 分隔,如果为空,就输入[一个空格] 8 | #如:set(STR_TARGET_LIBS "lib1.lib lib2.lib") 9 | set(STR_TARGET_LIBS " ") 10 | 11 | SETUP_PROJECT(${MODE} ${TARGET_NAME} ${STR_TARGET_SOURCES} ${STR_TARGET_LIBS}) 12 | --------------------------------------------------------------------------------