├── .editorconfig ├── .gitignore ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Kuplung.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── Kuplung ├── .clang-format ├── .editorconfig ├── CMakeLists.txt ├── CMakeLists_APPLE.cmake ├── CMakeLists_UNIX.cmake ├── CMakeLists_WIN32.cmake ├── Info.plist ├── Kuplung.pro ├── cmake │ ├── FindGLM.cmake │ ├── FindMinizip.cmake │ ├── Findassimp.cmake │ └── Findbenchmark.cmake ├── cppcheck.cmake ├── cppcheck_results.log ├── kuplung │ ├── Kuplung.cpp │ ├── Kuplung.hpp │ ├── cuda │ │ ├── CudaExamples.cpp │ │ ├── CudaExamples.hpp │ │ ├── cu │ │ │ ├── cuda_OBJParser.cu │ │ │ ├── cuda_oceanFFT_kernel.cu │ │ │ └── cuda_vectorAddition.cu │ │ └── examples │ │ │ ├── VectorAddition.cpp │ │ │ ├── VectorAddition.hpp │ │ │ ├── oceanFFT.cpp │ │ │ ├── oceanFFT.hpp │ │ │ ├── oceanFFT0.cpp │ │ │ └── oceanFFT0.hpp │ ├── meshes │ │ ├── artefacts │ │ │ ├── Shadertoy.cpp │ │ │ ├── Shadertoy.hpp │ │ │ ├── Spaceship.cpp │ │ │ ├── Spaceship.hpp │ │ │ ├── StructuredVolumetricSampling.cpp │ │ │ ├── StructuredVolumetricSampling.hpp │ │ │ ├── Terrain.cpp │ │ │ └── Terrain.hpp │ │ ├── helpers │ │ │ ├── AxisHelpers.cpp │ │ │ ├── AxisHelpers.hpp │ │ │ ├── AxisLabels.cpp │ │ │ ├── AxisLabels.hpp │ │ │ ├── BoundingBox.cpp │ │ │ ├── BoundingBox.hpp │ │ │ ├── Camera.cpp │ │ │ ├── Camera.hpp │ │ │ ├── CameraModel.cpp │ │ │ ├── CameraModel.hpp │ │ │ ├── Grid2D.cpp │ │ │ ├── Grid2D.hpp │ │ │ ├── Light.cpp │ │ │ ├── Light.hpp │ │ │ ├── LightRay.cpp │ │ │ ├── LightRay.hpp │ │ │ ├── MiniAxis.cpp │ │ │ ├── MiniAxis.hpp │ │ │ ├── RayLine.cpp │ │ │ ├── RayLine.hpp │ │ │ ├── Skybox.cpp │ │ │ ├── Skybox.hpp │ │ │ ├── VertexSphere.cpp │ │ │ ├── VertexSphere.hpp │ │ │ ├── WorldGrid.cpp │ │ │ └── WorldGrid.hpp │ │ └── scene │ │ │ ├── ModelFaceBase.cpp │ │ │ ├── ModelFaceBase.hpp │ │ │ ├── ModelFaceData.cpp │ │ │ └── ModelFaceData.hpp │ ├── objects │ │ ├── ObjectDefinitions.h │ │ ├── Objects.h │ │ ├── ObjectsManager.cpp │ │ ├── ObjectsManager.hpp │ │ ├── RayPicking.cpp │ │ └── RayPicking.hpp │ ├── pcg │ │ ├── HeightmapGenerator.cpp │ │ ├── HeightmapGenerator.hpp │ │ ├── SpaceshipMeshGenerator.cpp │ │ ├── SpaceshipMeshGenerator.hpp │ │ ├── VoronoiGenerator.cpp │ │ └── VoronoiGenerator.hpp │ ├── rendering │ │ ├── RenderingManager.cpp │ │ ├── RenderingManager.hpp │ │ └── methods │ │ │ ├── RenderingDeferred.cpp │ │ │ ├── RenderingDeferred.hpp │ │ │ ├── RenderingForward.cpp │ │ │ ├── RenderingForward.hpp │ │ │ ├── RenderingForwardShadowMapping.cpp │ │ │ ├── RenderingForwardShadowMapping.hpp │ │ │ ├── RenderingShadowMapping.cpp │ │ │ ├── RenderingShadowMapping.hpp │ │ │ ├── RenderingSimple.cpp │ │ │ └── RenderingSimple.hpp │ ├── settings │ │ ├── ConfigUtils.cpp │ │ ├── ConfigUtils.hpp │ │ ├── FontsList.cpp │ │ ├── FontsList.hpp │ │ ├── Settings.cpp │ │ ├── Settings.h │ │ └── SettingsStructs.h │ ├── ui │ │ ├── UIHelpers.cpp │ │ ├── UIHelpers.hpp │ │ ├── UIManager.cpp │ │ ├── UIManager.hpp │ │ ├── components │ │ │ ├── ColorPicker.cpp │ │ │ ├── ColorPicker.hpp │ │ │ ├── FileBrowser.cpp │ │ │ ├── FileBrowser.hpp │ │ │ ├── FileSaver.cpp │ │ │ ├── FileSaver.hpp │ │ │ ├── ImageViewer.cpp │ │ │ ├── ImageViewer.hpp │ │ │ ├── Log.cpp │ │ │ ├── Log.hpp │ │ │ ├── RendererUI.cpp │ │ │ ├── RendererUI.hpp │ │ │ ├── Screenshot.cpp │ │ │ ├── Screenshot.hpp │ │ │ ├── ShaderEditor.cpp │ │ │ ├── ShaderEditor.hpp │ │ │ ├── Tabs.cpp │ │ │ ├── Tabs.hpp │ │ │ ├── exporters │ │ │ │ ├── ExportFile.cpp │ │ │ │ ├── ExportFile.hpp │ │ │ │ ├── ExportGLTF.cpp │ │ │ │ ├── ExportGLTF.hpp │ │ │ │ ├── ExportOBJ.cpp │ │ │ │ └── ExportOBJ.hpp │ │ │ ├── ide │ │ │ │ ├── KuplungIDE.cpp │ │ │ │ └── KuplungIDE.hpp │ │ │ ├── importers │ │ │ │ ├── ImportFile.cpp │ │ │ │ └── ImportFile.hpp │ │ │ ├── materialeditor │ │ │ │ ├── MELink.cpp │ │ │ │ ├── MELink.hpp │ │ │ │ ├── MENode.cpp │ │ │ │ ├── MENode.hpp │ │ │ │ ├── MENode_Color.cpp │ │ │ │ ├── MENode_Color.hpp │ │ │ │ ├── MENode_Combine.cpp │ │ │ │ ├── MENode_Combine.hpp │ │ │ │ ├── MENode_Texture.cpp │ │ │ │ ├── MENode_Texture.hpp │ │ │ │ ├── MaterialEditor.cpp │ │ │ │ ├── MaterialEditor.hpp │ │ │ │ └── MaterialEditorData.h │ │ │ └── uveditor │ │ │ │ ├── UVEditor.cpp │ │ │ │ ├── UVEditor.hpp │ │ │ │ ├── UVPoint.cpp │ │ │ │ └── UVPoint.hpp │ │ ├── dialogs │ │ │ ├── DialogControlsGUI.cpp │ │ │ ├── DialogControlsGUI.hpp │ │ │ ├── DialogControlsModels.cpp │ │ │ ├── DialogControlsModels.hpp │ │ │ ├── DialogOptions.cpp │ │ │ ├── DialogOptions.hpp │ │ │ ├── DialogSVS.cpp │ │ │ ├── DialogSVS.hpp │ │ │ ├── DialogShadertoy.cpp │ │ │ ├── DialogShadertoy.hpp │ │ │ ├── DialogStyle.cpp │ │ │ └── DialogStyle.hpp │ │ └── iconfonts │ │ │ ├── IconsFontAwesome.h │ │ │ └── IconsMaterialDesign.h │ └── utilities │ │ ├── catch │ │ └── catch.hpp │ │ ├── consumption │ │ ├── Consumption.cpp │ │ ├── Consumption.hpp │ │ ├── WindowsCPUUsage.cpp │ │ └── WindowsCPUUsage.hpp │ │ ├── cpp-base64 │ │ ├── base64.cpp │ │ └── base64.h │ │ ├── cuda │ │ ├── CudaHelpers.cpp │ │ └── CudaHelpers.hpp │ │ ├── export │ │ ├── Exporter.cpp │ │ ├── Exporter.hpp │ │ ├── ExporterAssimp.cpp │ │ ├── ExporterAssimp.hpp │ │ ├── ExporterGLTF.cpp │ │ ├── ExporterGLTF.hpp │ │ ├── ExporterOBJ.cpp │ │ └── ExporterOBJ.hpp │ │ ├── font-parser │ │ ├── FNTParser.cpp │ │ └── FNTParser.hpp │ │ ├── gl │ │ ├── GLIncludes.h │ │ ├── GLUtils.cpp │ │ └── GLUtils.hpp │ │ ├── helpers │ │ ├── DateTimes.h │ │ ├── Files.h │ │ ├── Helpers.h │ │ └── Strings.h │ │ ├── imgui │ │ ├── ImGuiColorTextEdit │ │ │ ├── TextEditor.cpp │ │ │ └── TextEditor.h │ │ ├── imconfig.h │ │ ├── imgui.cpp │ │ ├── imgui.h │ │ ├── imgui_demo.cpp │ │ ├── imgui_draw.cpp │ │ ├── imgui_impl_opengl3.cpp │ │ ├── imgui_impl_opengl3.h │ │ ├── imgui_impl_sdl.cpp │ │ ├── imgui_impl_sdl.h │ │ ├── imgui_internal.h │ │ ├── imgui_widgets.cpp │ │ ├── imguizmo │ │ │ ├── ImGuizmo.cpp │ │ │ └── ImGuizmo.h │ │ ├── imstb_rectpack.h │ │ ├── imstb_textedit.h │ │ └── imstb_truetype.h │ │ ├── input │ │ ├── Controls.cpp │ │ └── Controls.hpp │ │ ├── libnoise │ │ ├── noiseutils.cpp │ │ └── noiseutils.h │ │ ├── lua │ │ ├── LuaManager.cpp │ │ └── LuaManager.hpp │ │ ├── maths │ │ ├── Maths.cpp │ │ └── Maths.hpp │ │ ├── measurement │ │ ├── Timings.cpp │ │ └── Timings.hpp │ │ ├── miniz │ │ ├── KuplungMiniz.cpp │ │ ├── KuplungMiniz.hpp │ │ ├── miniz.c │ │ └── miniz.h │ │ ├── minizip │ │ ├── KuplungMinizip.cpp │ │ └── KuplungMinizip.hpp │ │ ├── nanovg │ │ ├── fontstash.h │ │ ├── nanovg.c │ │ ├── nanovg.h │ │ ├── nanovg_gl.h │ │ └── nanovg_gl_utils.h │ │ ├── oui │ │ ├── blendish.h │ │ └── oui.h │ │ ├── parsers │ │ ├── FileModelManager.cpp │ │ ├── FileModelManager.hpp │ │ ├── ModelObject.h │ │ ├── ParserUtils.cpp │ │ ├── ParserUtils.hpp │ │ ├── assimp-parser │ │ │ ├── AssimpParser.cpp │ │ │ └── AssimpParser.hpp │ │ ├── gltf-parser │ │ │ ├── GLTFParser.cpp │ │ │ └── GLTFParser.hpp │ │ ├── obj-parser │ │ │ ├── objParser1.cpp │ │ │ ├── objParser1.hpp │ │ │ ├── objParser2.cpp │ │ │ ├── objParser2.hpp │ │ │ ├── objParserCuda.cpp │ │ │ └── objParserCuda.hpp │ │ ├── ply-parser │ │ │ ├── PLYParser.cpp │ │ │ └── PLYParser.hpp │ │ └── stl-parser │ │ │ ├── STLParser.cpp │ │ │ └── STLParser.hpp │ │ ├── renderers │ │ ├── ImageRenderer.cpp │ │ ├── ImageRenderer.hpp │ │ ├── KuplungRendererBase.cpp │ │ ├── KuplungRendererBase.hpp │ │ ├── default-forward │ │ │ ├── DefaultForwardRenderer.cpp │ │ │ └── DefaultForwardRenderer.hpp │ │ ├── ray-tracer │ │ │ ├── RayTracerRenderer.cpp │ │ │ └── RayTracerRenderer.hpp │ │ └── scene-renderer │ │ │ ├── SceneRenderer.cpp │ │ │ └── SceneRenderer.hpp │ │ ├── saveopen │ │ ├── KuplungAppScene.pb.cc │ │ ├── KuplungAppScene.pb.h │ │ ├── KuplungAppSettings.pb.cc │ │ ├── KuplungAppSettings.pb.h │ │ ├── KuplungDefinitions.pb.cc │ │ ├── KuplungDefinitions.pb.h │ │ ├── SaveOpen.cpp │ │ ├── SaveOpen.hpp │ │ ├── SaveOpenBinarySeq.cpp │ │ ├── SaveOpenBinarySeq.hpp │ │ ├── SaveOpenGProtocolBufs.cpp │ │ └── SaveOpenGProtocolBufs.hpp │ │ ├── shapes │ │ └── Shapes.h │ │ └── stb │ │ ├── stb_image.h │ │ ├── stb_image_write.h │ │ ├── stb_rect_pack.h │ │ ├── stb_textedit.h │ │ └── stb_truetype.h ├── main.cpp └── resources │ ├── Images.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── icon_128x128.png │ │ ├── icon_128x128@2x.png │ │ ├── icon_16x16.png │ │ ├── icon_16x16@2x.png │ │ ├── icon_256x256.png │ │ ├── icon_256x256@2x.png │ │ ├── icon_32x32.png │ │ ├── icon_32x32@2x.png │ │ ├── icon_512x512.png │ │ └── icon_512x512@2x.png │ ├── Kuplung.icns │ ├── Kuplung.ico │ ├── Kuplung_RecentFiles.ini │ ├── Kuplung_RecentFilesImported.ini │ ├── Kuplung_Settings.ini │ ├── axis_helpers │ ├── x_minus.mtl │ ├── x_minus.obj │ ├── x_plus.mtl │ ├── x_plus.obj │ ├── y_minus.mtl │ ├── y_minus.obj │ ├── y_plus.mtl │ ├── y_plus.obj │ ├── z_minus.mtl │ ├── z_minus.obj │ ├── z_plus.mtl │ └── z_plus.obj │ ├── fonts │ ├── fontawesome-webfont.ttf │ └── material-icons-regular.ttf │ ├── gui │ ├── camera.mtl │ ├── camera.obj │ ├── light_directional.mtl │ ├── light_directional.obj │ ├── light_point.mtl │ ├── light_point.obj │ ├── light_spot.mtl │ └── light_spot.obj │ ├── kuplung.rc │ ├── lua │ └── test.lua │ ├── noise16.png │ ├── protobuf │ ├── KuplungAppScene.proto │ ├── KuplungAppSettings.proto │ └── KuplungDefinitions.proto │ ├── shaders │ ├── axis.frag │ ├── axis.vert │ ├── axis_helpers.frag │ ├── axis_helpers.vert │ ├── axis_labels.frag │ ├── axis_labels.vert │ ├── bounding_box.frag │ ├── bounding_box.vert │ ├── camera.frag │ ├── camera.vert │ ├── cuda │ │ ├── oceanFFT.frag │ │ └── oceanFFT.vert │ ├── deferred_g_buffer.frag │ ├── deferred_g_buffer.vert │ ├── deferred_light_box.frag │ ├── deferred_light_box.vert │ ├── deferred_shading.frag │ ├── deferred_shading.vert │ ├── grid.frag │ ├── grid.vert │ ├── grid2d.frag │ ├── grid2d.vert │ ├── light.frag │ ├── light.vert │ ├── light_ray.frag │ ├── light_ray.vert │ ├── model_face.frag │ ├── model_face.geom │ ├── model_face.tcs │ ├── model_face.tes │ ├── model_face.vert │ ├── model_face_effects.frag │ ├── model_face_lights.frag │ ├── model_face_mapping.frag │ ├── model_face_misc.frag │ ├── model_face_pbr.frag │ ├── model_face_shadow_mapping.frag │ ├── model_face_vars.frag │ ├── ray_line.frag │ ├── ray_line.vert │ ├── reflection.frag │ ├── reflection.vert │ ├── rendering_simple.frag │ ├── rendering_simple.geom │ ├── rendering_simple.tcs │ ├── rendering_simple.tes │ ├── rendering_simple.vert │ ├── shadertoy.vert │ ├── shadow_mapping_depth.frag │ ├── shadow_mapping_depth.vert │ ├── shadows_debug_quad.vert │ ├── shadows_debug_quad_depth.frag │ ├── skybox.frag │ ├── skybox.vert │ ├── spaceship.frag │ ├── spaceship.vert │ ├── stoy │ │ ├── 4ljGW1.stoy │ │ ├── 4tlSzl.stoy │ │ ├── Ms2SD1.stoy │ │ ├── XlSSzK.stoy │ │ └── XlfGRj.stoy │ ├── structured_vol_sampling.frag │ ├── structured_vol_sampling.vert │ ├── terrain.frag │ ├── terrain.vert │ ├── vertex_sphere.frag │ └── vertex_sphere.vert │ ├── shadertoy │ ├── LICENSE.txt │ ├── cube00_0.jpg │ ├── cube00_1.jpg │ ├── cube00_2.jpg │ ├── cube00_3.jpg │ ├── cube00_4.jpg │ ├── cube00_5.jpg │ ├── cube01_0.png │ ├── cube01_1.png │ ├── cube01_2.png │ ├── cube01_3.png │ ├── cube01_4.png │ ├── cube01_5.png │ ├── cube02_0.jpg │ ├── cube02_1.jpg │ ├── cube02_2.jpg │ ├── cube02_3.jpg │ ├── cube02_4.jpg │ ├── cube02_5.jpg │ ├── cube03_0.png │ ├── cube03_1.png │ ├── cube03_2.png │ ├── cube03_3.png │ ├── cube03_4.png │ ├── cube03_5.png │ ├── cube04_0.png │ ├── cube04_1.png │ ├── cube04_2.png │ ├── cube04_3.png │ ├── cube04_4.png │ ├── cube04_5.png │ ├── cube05_0.png │ ├── cube05_1.png │ ├── cube05_2.png │ ├── cube05_3.png │ ├── cube05_4.png │ ├── cube05_5.png │ ├── tex00.jpg │ ├── tex01.jpg │ ├── tex02.jpg │ ├── tex03.jpg │ ├── tex04.jpg │ ├── tex05.jpg │ ├── tex06.jpg │ ├── tex07.jpg │ ├── tex08.jpg │ ├── tex09.jpg │ ├── tex10.png │ ├── tex11.png │ ├── tex12.png │ ├── tex13.png │ ├── tex14.png │ ├── tex15.png │ ├── tex16.png │ ├── tex17.jpg │ ├── tex18.jpg │ ├── tex19.png │ ├── tex20.jpg │ └── webcamBig.png │ ├── shapes │ ├── MaterialBall.mtl │ ├── MaterialBall.obj │ ├── MaterialBallBlender.mtl │ ├── MaterialBallBlender.obj │ ├── brick_wall.mtl │ ├── brick_wall.obj │ ├── brick_wall_diffuse.png │ ├── brick_wall_displacement.png │ ├── brick_wall_normal.png │ ├── brick_wall_occlusion.png │ ├── brick_wall_spec.png │ ├── cone.mtl │ ├── cone.obj │ ├── cube.mtl │ ├── cube.obj │ ├── cylinder.mtl │ ├── cylinder.obj │ ├── epcot.mtl │ ├── epcot.obj │ ├── grid.mtl │ ├── grid.obj │ ├── ico_sphere.mtl │ ├── ico_sphere.obj │ ├── monkey_head.mtl │ ├── monkey_head.obj │ ├── plane.mtl │ ├── plane.obj │ ├── plane_objects.mtl │ ├── plane_objects.obj │ ├── plane_objects_large.mtl │ ├── plane_objects_large.obj │ ├── torus.mtl │ ├── torus.obj │ ├── triangle.mtl │ ├── triangle.obj │ ├── tube.mtl │ ├── tube.obj │ ├── uv_sphere.mtl │ └── uv_sphere.obj │ └── skybox │ ├── fire_planet_back.jpg │ ├── fire_planet_bottom.jpg │ ├── fire_planet_front.jpg │ ├── fire_planet_left.jpg │ ├── fire_planet_right.jpg │ ├── fire_planet_top.jpg │ ├── lake_mountain_back.jpg │ ├── lake_mountain_bottom.jpg │ ├── lake_mountain_front.jpg │ ├── lake_mountain_left.jpg │ ├── lake_mountain_right.jpg │ ├── lake_mountain_top.jpg │ ├── stormydays_back.jpg │ ├── stormydays_bottom.jpg │ ├── stormydays_front.jpg │ ├── stormydays_left.jpg │ ├── stormydays_right.jpg │ └── stormydays_top.jpg ├── KuplungCuda.bash ├── KuplungCuda.make ├── LICENSE.md ├── MSVC ├── Kuplung.sln ├── Kuplung.vcxproj └── Kuplung.vcxproj.filters ├── README.md ├── appveyor.yml ├── external └── libnoise │ ├── headers │ ├── basictypes.h │ ├── exception.h │ ├── interp.h │ ├── latlon.h │ ├── mathconsts.h │ ├── misc.h │ ├── model │ │ ├── cylinder.h │ │ ├── line.h │ │ ├── model.h │ │ ├── plane.h │ │ └── sphere.h │ ├── module │ │ ├── abs.h │ │ ├── add.h │ │ ├── billow.h │ │ ├── blend.h │ │ ├── cache.h │ │ ├── checkerboard.h │ │ ├── clamp.h │ │ ├── const.h │ │ ├── curve.h │ │ ├── cylinders.h │ │ ├── displace.h │ │ ├── exponent.h │ │ ├── invert.h │ │ ├── max.h │ │ ├── min.h │ │ ├── module.h │ │ ├── modulebase.h │ │ ├── multiply.h │ │ ├── perlin.h │ │ ├── power.h │ │ ├── ridgedmulti.h │ │ ├── rotatepoint.h │ │ ├── scalebias.h │ │ ├── scalepoint.h │ │ ├── select.h │ │ ├── spheres.h │ │ ├── terrace.h │ │ ├── translatepoint.h │ │ ├── turbulence.h │ │ └── voronoi.h │ ├── noise.h │ ├── noisegen.h │ └── vectortable.h │ ├── lib │ ├── libnoise.a │ └── libnoise.lib │ └── windows │ ├── include │ └── noise │ │ ├── basictypes.h │ │ ├── exception.h │ │ ├── interp.h │ │ ├── latlon.h │ │ ├── mathconsts.h │ │ ├── misc.h │ │ ├── model │ │ ├── cylinder.h │ │ ├── line.h │ │ ├── model.h │ │ ├── plane.h │ │ └── sphere.h │ │ ├── module │ │ ├── abs.h │ │ ├── add.h │ │ ├── billow.h │ │ ├── blend.h │ │ ├── cache.h │ │ ├── checkerboard.h │ │ ├── clamp.h │ │ ├── const.h │ │ ├── curve.h │ │ ├── cylinders.h │ │ ├── displace.h │ │ ├── exponent.h │ │ ├── invert.h │ │ ├── max.h │ │ ├── min.h │ │ ├── module.h │ │ ├── modulebase.h │ │ ├── multiply.h │ │ ├── perlin.h │ │ ├── power.h │ │ ├── ridgedmulti.h │ │ ├── rotatepoint.h │ │ ├── scalebias.h │ │ ├── scalepoint.h │ │ ├── select.h │ │ ├── spheres.h │ │ ├── terrace.h │ │ ├── translatepoint.h │ │ ├── turbulence.h │ │ └── voronoi.h │ │ ├── noise.h │ │ ├── noisegen.h │ │ └── vectortable.h │ └── lib │ └── noise.lib ├── lizard.txt ├── lizard_duplicates.txt └── screenshots ├── screenshot.png ├── screenshot2.png └── screenshot3.png /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 2 9 | tab_width = 2 10 | trim_trailing_whitespace = true 11 | 12 | [*.txt] 13 | indent_style = space 14 | indent_size = 2 15 | 16 | [*.{diff,md}] 17 | trim_trailing_whitespace = false 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | 3 | *.slo 4 | *.lo 5 | *.o 6 | *.a 7 | *.la 8 | *.lai 9 | *.so 10 | *.dll 11 | *.dylib 12 | 13 | 14 | # Qt-es 15 | 16 | /.qmake.cache 17 | /.qmake.stash 18 | *.pro.user 19 | *.pro.user.* 20 | *.qbs.user 21 | *.qbs.user.* 22 | *.moc 23 | moc_*.cpp 24 | qrc_*.cpp 25 | ui_*.h 26 | Makefile* 27 | *build-* 28 | 29 | # QtCreator 30 | 31 | *.autosave 32 | imgui.ini 33 | 34 | #Cmake build 35 | cmake-build/ 36 | build/ 37 | 38 | #QtCtreator Qml 39 | *.qmlproject.user 40 | *.qmlproject.user.* 41 | 42 | # Visual Studio 43 | *.tlog 44 | VS2015/packages/* 45 | VS2015/Kuplung.VC.opendb 46 | VS2015/Kuplung.sdf 47 | *.sdf 48 | MSVC/resources/* 49 | MSVC/.vs/* 50 | MSVC/Kuplung.dir/* 51 | Kuplung.dir/* 52 | MSVC/Release/* 53 | Kuplung/CMakeFiles/* 54 | *.vcxproj.user 55 | *.aps 56 | 57 | 58 | # VSCode 59 | .vscode 60 | 61 | # Xcode 62 | .DS_Store 63 | */build/* 64 | *.pbxuser 65 | !default.pbxuser 66 | *.mode1v3 67 | !default.mode1v3 68 | *.mode2v3 69 | !default.mode2v3 70 | *.perspectivev3 71 | !default.perspectivev3 72 | xcuserdata 73 | profile 74 | *.moved-aside 75 | DerivedData 76 | .idea/ 77 | *.hmap 78 | xcuserdata/* 79 | 80 | # protobuf generated files 81 | Kuplung/**/*.pb.h 82 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | env: 2 | global: 3 | - secure: "pxjms1QSZMRZHTdZKdLBhUaqMav/AV8WYRwLDRlywpMIT+13BCS6iII2WFyxK2Lx6si7jq6sRdd/HjtYl4eiXv9NkWLTZqW+1CfRm8Ns57F60+6zCHOby/2zTJgNt6d7uGtXc2dbud9+HWBnZVrZ4KyihFj9niTh3+sm7iSe5GmGL1gMN87JEheS3zZIEAIN1cBjn5LY7O2jcERH4lLuHrjv6fWuLXE06KhcZ1cSqn/1ebhS+LaGuMzBzD5CjYZ4DLN63IupNrOvLdNECW5bUrVZ3pvvt8phmyOiP5N7W2CeOSuycJowEkKt3u7Qrh5i87Uq4tvYbZarx2jN2w8PhUeY5JzZQGKX/wlXCmLJKrqk9JiF2rsDu4Re4E73AGcs/Wv50NLIsXd/tHHUWneC/WKF+wqce9lAltl87HB+ZNSnsvi2jvxxDJp8gc7D2ryWm5olAqW58nNYOlQeBDDg+jxVnGwBhY4Gd46iZAlthmvzewBupfjR7yajm5qfxlK9IPkIDwnWzuVZUoS2GUIqNTSMSb8lM0LDlwx/h4wIAyiKaQEVpIGUj8JJZ3TbN1WiF2eztc7/sXYpv3XdYX8To6sq8Jnk/bmUIeJSsNfzVm2lcw2nft+YeNM/DHpmcYqWCXc1GfA0Lle8NjThRd9wmwRvXgSuShFysldWaBBLQu8=" 4 | 5 | language: cpp 6 | os: osx 7 | compiler: 8 | - clang 9 | 10 | before_install: 11 | - echo -n | openssl s_client -connect https://scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- 12 | - brew update 13 | - brew install sdl2 glm minizip glfw3 assimp lua@5.3 14 | #- brew tap caskroom/drivers 15 | 16 | addons: 17 | coverity_scan: 18 | project: 19 | name: "supudo/Kuplung" 20 | description: "OpenGL Model Viewer" 21 | notification_email: supudo@gmail.com 22 | build_command_prepend: "" 23 | build_command: "mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug ../Kuplung && cmake --build ./" 24 | branch_pattern: coverity_scan 25 | 26 | script: 27 | - mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug ../Kuplung && cmake --build ./ 28 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Kuplung 2 | 3 | First, thank you for even considering contributing. 4 | 5 | If you really want to contribute feel free to post an issue, do a pull request or drop me a line. Every piece of advise is highly appreciated. 6 | Of course every contributor will be added in the list. 7 | -------------------------------------------------------------------------------- /Kuplung.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Kuplung/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 2 9 | tab_width = 2 10 | trim_trailing_whitespace = true 11 | 12 | [*.txt] 13 | indent_style = space 14 | indent_size = 2 15 | 16 | [*.{diff,md}] 17 | trim_trailing_whitespace = false 18 | -------------------------------------------------------------------------------- /Kuplung/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 3.5) 2 | 3 | SET(PROJECT_NAME "Kuplung") 4 | PROJECT(${PROJECT_NAME}) 5 | 6 | IF(CMAKE_BUILD_TYPE STREQUAL Debug) 7 | SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/cmake-build/Debug") 8 | SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/cmake-build/Debug") 9 | SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/cmake-build/Debug") 10 | ELSE(CMAKE_BUILD_TYPE STREQUAL Debug) 11 | SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/cmake-build/Release") 12 | SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/cmake-build/Release") 13 | SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/cmake-build/Release") 14 | ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug) 15 | 16 | IF(APPLE) 17 | INCLUDE(CMakeLists_APPLE.cmake) 18 | ELSEIF(WIN32) 19 | INCLUDE(CMakeLists_WIN32.cmake) 20 | ELSEIF(UNIX) 21 | INCLUDE(CMakeLists_UNIX.cmake) 22 | ENDIF(APPLE) 23 | -------------------------------------------------------------------------------- /Kuplung/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | Kuplung 9 | CFBundleIdentifier 10 | net.supudo.apps.Kuplung 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | Kuplung 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSApplicationCategoryType 24 | public.app-category.developer-tools 25 | LSMinimumSystemVersion 26 | 10.11 27 | NSHumanReadableCopyright 28 | Copyright © 2015 supudo.net. All rights reserved. 29 | CFBundleIconFile 30 | Kuplung.icns 31 | NSHighResolutionCapable 32 | True 33 | 34 | 35 | -------------------------------------------------------------------------------- /Kuplung/cmake/FindMinizip.cmake: -------------------------------------------------------------------------------- 1 | # - Find minizip 2 | # Find the native MINIZIP includes and library 3 | # 4 | # MINIZIP_INCLUDE_DIR - where to find minizip.h, etc. 5 | # MINIZIP_LIBRARIES - List of libraries when using minizip. 6 | # MINIZIP_FOUND - True if minizip found. 7 | 8 | 9 | IF (MINIZIP_INCLUDE_DIR) 10 | # Already in cache, be silent 11 | SET(MINIZIP_FIND_QUIETLY TRUE) 12 | ENDIF (MINIZIP_INCLUDE_DIR) 13 | 14 | FIND_PATH(MINIZIP_INCLUDE_DIR zip.h PATH_SUFFIXES minizip) 15 | 16 | SET(MINIZIP_NAMES minizip) 17 | FIND_LIBRARY(MINIZIP_LIBRARY NAMES ${MINIZIP_NAMES}) 18 | 19 | # handle the QUIETLY and REQUIRED arguments and set MINIZIP_FOUND to TRUE if 20 | # all listed variables are TRUE 21 | INCLUDE(FindPackageHandleStandardArgs) 22 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(MiniZip DEFAULT_MSG MINIZIP_LIBRARY MINIZIP_INCLUDE_DIR) 23 | 24 | IF(MINIZIP_FOUND) 25 | SET(MINIZIP_LIBRARIES ${MINIZIP_LIBRARY}) 26 | ELSE(MINIZIP_FOUND) 27 | SET(MINIZIP_LIBRARIES) 28 | ENDIF(MINIZIP_FOUND) 29 | 30 | MARK_AS_ADVANCED(MINIZIP_LIBRARY MINIZIP_INCLUDE_DIR) -------------------------------------------------------------------------------- /Kuplung/cmake/Findbenchmark.cmake: -------------------------------------------------------------------------------- 1 | # Findbenchmark.cmake 2 | # - Try to find benchmark 3 | # 4 | # The following variables are optionally searched for defaults 5 | # benchmark_ROOT_DIR: Base directory where all benchmark components are found 6 | # 7 | # Once done this will define 8 | # benchmark_FOUND - System has benchmark 9 | # benchmark_INCLUDE_DIRS - The benchmark include directories 10 | # benchmark_LIBRARIES - The libraries needed to use benchmark 11 | 12 | set(GBenchmark_ROOT_DIR "" CACHE PATH "Folder containing benchmark") 13 | 14 | find_path(GBenchmark_INCLUDE_DIR "benchmark/benchmark.h" 15 | PATHS ${benchmark_ROOT_DIR} 16 | PATH_SUFFIXES include 17 | NO_DEFAULT_PATH) 18 | find_path(GBenchmark_INCLUDE_DIR "benchmark/benchmark.h") 19 | 20 | find_library(GBenchmark_LIBRARY NAMES "benchmark" 21 | PATHS ${benchmark_ROOT_DIR} 22 | PATH_SUFFIXES lib lib64 23 | NO_DEFAULT_PATH) 24 | find_library(GBenchmark_LIBRARY NAMES "benchmark") 25 | 26 | include(FindPackageHandleStandardArgs) 27 | # handle the QUIETLY and REQUIRED arguments and set benchmark_FOUND to TRUE 28 | # if all listed variables are TRUE 29 | find_package_handle_standard_args(GBenchmark FOUND_VAR GBenchmark_FOUND 30 | REQUIRED_VARS GBenchmark_LIBRARY 31 | GBenchmark_INCLUDE_DIR) 32 | 33 | if(GBenchmark_FOUND) 34 | set(GBenchmark_LIBRARIES ${benchmark_LIBRARY}) 35 | set(GBenchmark_INCLUDE_DIRS ${benchmark_INCLUDE_DIR}) 36 | endif() 37 | 38 | mark_as_advanced(GBenchmark_INCLUDE_DIR GBenchmark_LIBRARY) 39 | -------------------------------------------------------------------------------- /Kuplung/kuplung/cuda/CudaExamples.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // CudaExamples.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/3/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef CudaExamples_hpp 10 | #define CudaExamples_hpp 11 | 12 | #ifdef DEF_KuplungSetting_UseCuda 13 | 14 | # include "kuplung/cuda/examples/VectorAddition.hpp" 15 | # include "kuplung/cuda/examples/oceanFFT.hpp" 16 | # include "kuplung/utilities/gl/GLIncludes.h" 17 | # include 18 | # include 19 | # include 20 | # include 21 | # include 22 | 23 | class CudaExamples { 24 | public: 25 | ~CudaExamples(); 26 | void init(); 27 | void draw(bool* p_opened, glm::mat4 matrixProjection, glm::mat4 matrixCamera, glm::mat4 matrixGrid); 28 | std::unique_ptr exampleOceanFFT; 29 | 30 | private: 31 | int selectedCudaExample; 32 | GLuint vboTexture; 33 | void renderExample(glm::mat4 matrixProjection, glm::mat4 matrixCamera, glm::mat4 matrixGrid); 34 | std::unique_ptr exampleVectorAddition; 35 | }; 36 | 37 | #endif 38 | 39 | #endif /* CudaExamples_hpp */ 40 | -------------------------------------------------------------------------------- /Kuplung/kuplung/cuda/cu/cuda_OBJParser.cu: -------------------------------------------------------------------------------- 1 | // 2 | // cuda_OBJParser.cu 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/3/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | extern "C" 14 | __global__ void cudaParseOBJFile(int* obj_data, 15 | float *vertices, 16 | float *textureCoordinates, 17 | float *normals, 18 | float *indices 19 | ) { 20 | const unsigned int tid = threadIdx.x; 21 | int data = obj_data[tid]; 22 | } 23 | 24 | void parseOBJFile(const char* obj_file_contents, 25 | int obj_file_content_length, 26 | float *vertices, 27 | float *textureCoordinates, 28 | float *normals, 29 | float *indices 30 | ) { 31 | float *cuda_vertices, *cuda_textureCoordinates, *cuda_normals, *cuda_indices; 32 | const unsigned int num_threads = obj_file_content_length / 4; 33 | const unsigned int mem_size = sizeof(char) * obj_file_content_length; 34 | 35 | char *d_data; 36 | cudaMalloc((void **) &d_data, mem_size); 37 | cudaMemcpy(d_data, obj_file_contents, mem_size, cudaMemcpyHostToDevice); 38 | 39 | dim3 grid(1, 1, 1); 40 | dim3 threads(num_threads, 1, 1); 41 | // execute the kernel 42 | cudaParseOBJFile<<< grid, threads >>>((int *) d_data, vertices, textureCoordinates, normals, indices); 43 | 44 | cudaFree(d_data); 45 | cudaFree(cuda_vertices); 46 | cudaFree(cuda_textureCoordinates); 47 | cudaFree(cuda_normals); 48 | cudaFree(cuda_indices); 49 | } 50 | -------------------------------------------------------------------------------- /Kuplung/kuplung/cuda/cu/cuda_vectorAddition.cu: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern "C" 5 | __global__ void vectorAdditionCUDA(const float* a, const float* b, float* c, int n) 6 | { 7 | int ii = blockDim.x * blockIdx.x + threadIdx.x; 8 | if (ii < n) 9 | c[ii] = a[ii] + b[ii]; 10 | } 11 | 12 | void vectorAddition(const float* a, const float* b, float* c, int n) { 13 | float *a_cuda, *b_cuda, *c_cuda; 14 | unsigned int nBytes = sizeof(float) * n; 15 | int threadsPerBlock = 256; 16 | int blocksPerGrid = (n + threadsPerBlock - 1) / threadsPerBlock; 17 | 18 | // allocate and copy memory into the device 19 | cudaMalloc((void **)& a_cuda, nBytes); 20 | cudaMalloc((void **)& b_cuda, nBytes); 21 | cudaMalloc((void **)& c_cuda, nBytes); 22 | cudaMemcpy(a_cuda, a, nBytes, cudaMemcpyHostToDevice); 23 | cudaMemcpy(b_cuda, b, nBytes, cudaMemcpyHostToDevice); 24 | 25 | vectorAdditionCUDA<<>>(a_cuda, b_cuda, c_cuda, n); 26 | 27 | // load the answer back into the host 28 | cudaMemcpy(c, c_cuda, nBytes, cudaMemcpyDeviceToHost); 29 | 30 | cudaFree(a_cuda); 31 | cudaFree(b_cuda); 32 | cudaFree(c_cuda); 33 | } 34 | -------------------------------------------------------------------------------- /Kuplung/kuplung/cuda/examples/VectorAddition.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // VectorAddition.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/3/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifdef DEF_KuplungSetting_UseCuda 10 | 11 | #ifndef VectorAddition_hpp 12 | #define VectorAddition_hpp 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | class VectorAddition { 20 | public: 21 | ~VectorAddition(); 22 | void init(); 23 | void doVectorAddition(); 24 | 25 | private: 26 | std::string printArray(const float* a, const unsigned int n); 27 | }; 28 | 29 | #endif /* VectorAddition_hpp */ 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /Kuplung/kuplung/meshes/artefacts/Spaceship.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Spaceship.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/22/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef Spaceship_hpp 10 | #define Spaceship_hpp 11 | 12 | #include 13 | #include "kuplung/settings/Settings.h" 14 | #include "kuplung/utilities/gl/GLIncludes.h" 15 | #include "kuplung/pcg/SpaceshipMeshGenerator.hpp" 16 | #include "kuplung/objects/Objects.h" 17 | #include "kuplung/meshes/helpers/Light.hpp" 18 | 19 | class Spaceship { 20 | public: 21 | ~Spaceship(); 22 | Spaceship(); 23 | bool initShaderProgram(); 24 | void initBuffers(const int gridSize); 25 | void render(const glm::mat4& matrixProjection, const glm::mat4& matrixCamera, const glm::mat4& matrixModel, const glm::vec3& vecCameraPosition); 26 | std::unique_ptr spaceshipGenerator; 27 | 28 | float solidLightSkin_Ambient_Strength, solidLightSkin_Diffuse_Strength, solidLightSkin_Specular_Strength; 29 | bool Setting_UseTexture, Setting_Wireframe; 30 | glm::vec3 lightDirection; 31 | glm::vec3 solidLightSkin_MaterialColor, solidLightSkin_Ambient, solidLightSkin_Diffuse, solidLightSkin_Specular; 32 | 33 | private: 34 | GLuint shaderProgram; 35 | GLuint shaderVertex, shaderFragment; 36 | GLuint glVAO; 37 | GLuint vboVertices, vboTextureCoordinates, vboTextureDiffuse, vboNormals, vboColors, vboIndices; 38 | GLuint glUniformMVPMatrix, glUniformMMatrix, glAttributeVertexPosition, glAttributeVertexNormal; 39 | GLuint glAttributeColor, glFS_CameraPosition; 40 | GLint glAttributeTextureCoord, glUniformHasTexture, glUniformSamplerTexture; 41 | 42 | std::unique_ptr solidLight; 43 | }; 44 | 45 | #endif /* Spaceship_hpp */ 46 | -------------------------------------------------------------------------------- /Kuplung/kuplung/meshes/artefacts/StructuredVolumetricSampling.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // StructuredVolumetricSampling.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/22/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef StructuredVolumetricSampling_hpp 10 | #define StructuredVolumetricSampling_hpp 11 | 12 | #include 13 | #include "kuplung/settings/Settings.h" 14 | #include "kuplung/utilities/gl/GLIncludes.h" 15 | 16 | class StructuredVolumetricSampling { 17 | public: 18 | ~StructuredVolumetricSampling(); 19 | StructuredVolumetricSampling(); 20 | bool initShaderProgram(); 21 | void initBuffers(); 22 | void initNoiseTexture(); 23 | void initFBO(const int windowWidth, const int windowHeight, GLuint* vboTexture); 24 | void render(const int mouseX, const int mouseY, const float seconds); 25 | void renderToTexture(const int mouseX, const int mouseY, const float seconds, GLuint* vboTexture); 26 | 27 | private: 28 | GLuint shaderProgram, shaderVertex, shaderFragment; 29 | GLuint glVAO, vboVertices, vboTextureNoise; 30 | GLuint glVS_screenResolution; 31 | GLuint glAttributeVertexPosition, glFS_deltaRunningTime, glFS_noiseTextureSampler, glFS_screenResolution, glFS_mouseCoordinates; 32 | 33 | void bindFBO(); 34 | void unbindFBO(GLuint* vboTexture); 35 | GLuint tFBO, tRBO; 36 | }; 37 | 38 | #endif /* StructuredVolumetricSampling_hpp */ 39 | -------------------------------------------------------------------------------- /Kuplung/kuplung/meshes/artefacts/Terrain.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Terrain.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/22/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef Terrain_hpp 10 | #define Terrain_hpp 11 | 12 | #include 13 | #include "kuplung/utilities/gl/GLIncludes.h" 14 | #include "kuplung/settings/Settings.h" 15 | #include "kuplung/pcg/HeightmapGenerator.hpp" 16 | 17 | class Terrain { 18 | public: 19 | ~Terrain(); 20 | Terrain(); 21 | bool initShaderProgram(); 22 | void initBuffers(std::string const& assetsFolder, const int width, const int height); 23 | void render(const glm::mat4& matrixProjection, const glm::mat4& matrixCamera, const glm::mat4& matrixModel); 24 | std::string heightmapImage; 25 | std::unique_ptr terrainGenerator; 26 | 27 | bool Setting_UseTexture, Setting_Wireframe; 28 | 29 | private: 30 | GLuint shaderProgram; 31 | GLuint shaderVertex, shaderFragment; 32 | GLuint glVAO; 33 | GLuint vboVertices, vboTextureCoordinates, vboTextureDiffuse, vboNormals, vboColors, vboIndices; 34 | GLuint glUniformMVPMatrix, glAttributeVertexPosition, glAttributeVertexNormal, glAttributeColor; 35 | GLint glAttributeTextureCoord, glUniformHasTexture, glUniformSamplerTexture; 36 | }; 37 | 38 | #endif /* Terrain_hpp */ 39 | -------------------------------------------------------------------------------- /Kuplung/kuplung/meshes/helpers/AxisHelpers.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // AxisHelpers.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/14/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef AxisHelpers_hpp 10 | #define AxisHelpers_hpp 11 | 12 | #include 13 | #include 14 | #include "kuplung/utilities/gl/GLIncludes.h" 15 | #include "kuplung/utilities/parsers/ModelObject.h" 16 | #include "kuplung/objects/ObjectDefinitions.h" 17 | #include "kuplung/meshes/helpers/Camera.hpp" 18 | 19 | class AxisHelpers { 20 | public: 21 | ~AxisHelpers(); 22 | AxisHelpers(); 23 | void setModel(const MeshModel& meshModel); 24 | void initProperties(); 25 | const bool initShaderProgram(); 26 | void initBuffers(); 27 | void render(const glm::mat4& mtxProjection, const glm::mat4& mtxCamera, const glm::vec3& position); 28 | MeshModel meshModel; 29 | 30 | private: 31 | GLuint shaderProgram; 32 | GLuint shaderVertex, shaderFragment; 33 | GLuint glVAO; 34 | GLuint vboVertices, vboIndices; 35 | GLint glUniformMVPMatrix, glUniformColor; 36 | }; 37 | 38 | #endif /* AxisHelpers_hpp */ 39 | -------------------------------------------------------------------------------- /Kuplung/kuplung/meshes/helpers/AxisLabels.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // AxisLabels.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/14/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef AxisLabels_hpp 10 | #define AxisLabels_hpp 11 | 12 | #include 13 | #include "kuplung/utilities/gl/GLIncludes.h" 14 | #include "kuplung/utilities/parsers/ModelObject.h" 15 | #include "kuplung/objects/ObjectDefinitions.h" 16 | #include "kuplung/meshes/helpers/Camera.hpp" 17 | 18 | class AxisLabels { 19 | public: 20 | ~AxisLabels(); 21 | AxisLabels(); 22 | void setModels(const MeshModel& meshModel_PosX, const MeshModel& meshModel_NegX, const MeshModel& meshModel_PosY, 23 | const MeshModel& meshModel_NegY, const MeshModel& meshModel_PosZ, const MeshModel& meshModel_NegZ, 24 | int position); 25 | void initProperties(); 26 | const bool initShaderProgram(); 27 | void initBuffers(); 28 | void render(const glm::mat4& mtxProjection, const glm::mat4& mtxCamera, int position); 29 | MeshModel meshModel_PosX, meshModel_NegX, meshModel_PosY, meshModel_NegY, meshModel_PosZ, meshModel_NegZ; 30 | 31 | private: 32 | GLuint shaderProgram; 33 | GLuint shaderVertex, shaderFragment; 34 | GLuint glVAO_PosX, glVAO_NegX, glVAO_PosY, glVAO_NegY, glVAO_PosZ, glVAO_NegZ; 35 | GLuint vboVertices_PosX, vboColors_PosX, vboIndices_PosX; 36 | GLuint vboVertices_NegX, vboColors_NegX, vboIndices_NegX; 37 | GLuint vboVertices_PosY, vboColors_PosY, vboIndices_PosY; 38 | GLuint vboVertices_NegY, vboColors_NegY, vboIndices_NegY; 39 | GLuint vboVertices_PosZ, vboColors_PosZ, vboIndices_PosZ; 40 | GLuint vboVertices_NegZ, vboColors_NegZ, vboIndices_NegZ; 41 | GLint glUniformMVPMatrix; 42 | 43 | int ahPosition; 44 | }; 45 | 46 | #endif /* AxisLabels_hpp */ 47 | -------------------------------------------------------------------------------- /Kuplung/kuplung/meshes/helpers/BoundingBox.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // BoundingBox.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/2/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef BoundingBox_hpp 10 | #define BoundingBox_hpp 11 | 12 | #include "kuplung/objects/ObjectDefinitions.h" 13 | #include "kuplung/settings/Settings.h" 14 | #include "kuplung/utilities/gl/GLIncludes.h" 15 | #include "kuplung/utilities/parsers/ModelObject.h" 16 | #include 17 | 18 | class BoundingBox { 19 | public: 20 | ~BoundingBox(); 21 | BoundingBox() noexcept; 22 | const bool initShaderProgram(); 23 | void initBuffers(const MeshModel& meshModel); 24 | void render(const glm::mat4& matrixMVP, const glm::vec4& outlineColor); 25 | MeshModel meshModel; 26 | 27 | glm::mat4 matrixTransform; 28 | 29 | GLfloat min_x, max_x, min_y, max_y, min_z, max_z; 30 | glm::vec3 size, center; 31 | 32 | private: 33 | std::vector dataVertices; 34 | std::vector dataIndices; 35 | 36 | GLuint shaderProgram; 37 | GLuint shaderVertex, shaderFragment; 38 | GLuint glVAO; 39 | GLuint vboVertices, vboIndices; 40 | 41 | GLint glUniformMVPMatrix, glUniformColor; 42 | }; 43 | 44 | #endif /* BoundingBox_hpp */ 45 | -------------------------------------------------------------------------------- /Kuplung/kuplung/meshes/helpers/Camera.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Camera.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/3/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef Camera_hpp 10 | #define Camera_hpp 11 | 12 | #include 13 | #include 14 | #include "kuplung/settings/Settings.h" 15 | #include "kuplung/objects/ObjectDefinitions.h" 16 | 17 | class Camera { 18 | public: 19 | ~Camera(); 20 | Camera(); 21 | void initProperties(); 22 | void render(); 23 | const glm::vec3 createRay(const float mouse_x, const float mouse_y, const float fov, const float ratio, const float pNear, const float pFar); 24 | const PixelDataPoint getClickData(const int x, const int y, const int height) const; 25 | 26 | std::unique_ptr eyeSettings; 27 | std::unique_ptr positionX, positionY, positionZ; 28 | std::unique_ptr rotateX, rotateY, rotateZ; 29 | std::unique_ptr rotateCenterX, rotateCenterY, rotateCenterZ; 30 | 31 | glm::vec3 cameraPosition; 32 | glm::mat4 matrixCamera; 33 | }; 34 | 35 | #endif /* Camera_hpp */ 36 | -------------------------------------------------------------------------------- /Kuplung/kuplung/meshes/helpers/CameraModel.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // CameraModel.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/3/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef CameraModel_hpp 10 | #define CameraModel_hpp 11 | 12 | #include 13 | #include 14 | #include "kuplung/settings/Settings.h" 15 | #include "kuplung/objects/ObjectDefinitions.h" 16 | #include "kuplung/utilities/gl/GLIncludes.h" 17 | #include "kuplung/utilities/parsers/ModelObject.h" 18 | 19 | class CameraModel { 20 | public: 21 | ~CameraModel(); 22 | CameraModel(); 23 | void setModel(MeshModel const& meshModel); 24 | void initProperties(); 25 | const bool initShaderProgram(); 26 | void initBuffers(); 27 | void render(const glm::mat4& mtxProjection, const glm::mat4& mtxCamera, const glm::mat4& mtxGrid, const bool& fixedGridWorld); 28 | MeshModel meshModel; 29 | 30 | std::unique_ptr positionX, positionY, positionZ; 31 | std::unique_ptr rotateX, rotateY, rotateZ; 32 | std::unique_ptr rotateCenterX, rotateCenterY, rotateCenterZ; 33 | std::unique_ptr innerLightDirectionX, innerLightDirectionY, innerLightDirectionZ; 34 | std::unique_ptr colorR, colorG, colorB; 35 | bool showCameraObject, showInWire; 36 | 37 | glm::mat4 matrixModel; 38 | 39 | private: 40 | GLuint shaderProgram; 41 | GLuint shaderVertex, shaderFragment; 42 | GLuint glVAO; 43 | GLuint vboVertices, vboNormals, vboIndices; 44 | GLint glUniformMVPMatrix, glUniformInnerLightDirection, glUniformColor; 45 | }; 46 | 47 | #endif /* CameraModel_hpp */ 48 | -------------------------------------------------------------------------------- /Kuplung/kuplung/meshes/helpers/LightRay.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // LightRay.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/17/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef LightRay_hpp 10 | #define LightRay_hpp 11 | 12 | #include 13 | #include 14 | #include "kuplung/utilities/gl/GLIncludes.h" 15 | #include "kuplung/utilities/parsers/ModelObject.h" 16 | #include "kuplung/settings/Settings.h" 17 | 18 | class LightRay { 19 | public: 20 | LightRay(); 21 | ~LightRay(); 22 | const bool initShaderProgram(); 23 | void initBuffers(const glm::vec3& position, const glm::vec3& direction, const bool simple); 24 | void render(const glm::mat4& matrixProjection, const glm::mat4& matrixCamera, const glm::mat4& matrixModel); 25 | 26 | private: 27 | short int axisSize; 28 | float x, y, z; 29 | 30 | GLuint shaderProgram; 31 | GLuint shaderVertex, shaderFragment; 32 | GLuint glVAO, vboVertices, vboIndices; 33 | GLint glUniformMVPMatrix; 34 | }; 35 | 36 | #endif /* LightRay_hpp */ 37 | -------------------------------------------------------------------------------- /Kuplung/kuplung/meshes/helpers/MiniAxis.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // MiniAxis.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/14/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef MiniAxis_hpp 10 | #define MiniAxis_hpp 11 | 12 | #include 13 | #include "kuplung/settings/Settings.h" 14 | #include "kuplung/utilities/gl/GLIncludes.h" 15 | #include "kuplung/utilities/parsers/ModelObject.h" 16 | #include "kuplung/objects/ObjectDefinitions.h" 17 | 18 | class MiniAxis { 19 | public: 20 | ~MiniAxis(); 21 | MiniAxis(); 22 | void initProperties(); 23 | const bool initShaderProgram(); 24 | void initBuffers(); // 0 = x, 1 = y, 2 = z 25 | void render(const glm::mat4& matrixProjection, const glm::mat4& matrixCamera); 26 | 27 | bool showAxis; 28 | std::unique_ptr rotateX, rotateY, rotateZ; 29 | glm::mat4 matrixModel; 30 | 31 | private: 32 | int axisSize; 33 | 34 | GLuint shaderProgram; 35 | GLuint shaderVertex, shaderFragment; 36 | GLuint glVAO, vboVertices, vboColors; 37 | GLint glUniformMVPMatrix; 38 | }; 39 | 40 | #endif /* MiniAxis_hpp */ 41 | -------------------------------------------------------------------------------- /Kuplung/kuplung/meshes/helpers/RayLine.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // RayLine.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/5/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef RayLine_hpp 10 | #define RayLine_hpp 11 | 12 | #include 13 | #include "kuplung/settings/Settings.h" 14 | #include "kuplung/utilities/gl/GLIncludes.h" 15 | #include "kuplung/objects/ObjectDefinitions.h" 16 | #ifdef WIN32 17 | //#include 18 | //#include 19 | typedef unsigned int uint; 20 | #endif 21 | 22 | class RayLine { 23 | public: 24 | ~RayLine(); 25 | void init(); 26 | const bool initShaderProgram(); 27 | void initBuffers(const glm::vec3& vecFrom, const glm::vec3& vecTo); 28 | void initProperties(); 29 | void render(const glm::mat4& matrixProjection, const glm::mat4& matrixCamera); 30 | 31 | glm::mat4 matrixModel; 32 | 33 | private: 34 | GLuint shaderProgram; 35 | GLuint shaderVertex, shaderFragment; 36 | GLuint glVAO, vboVertices, vboColors, vboIndices; 37 | GLint glUniformMVPMatrix, glUniformColor; 38 | 39 | std::vector dataVertices, dataColors; 40 | std::vector dataIndices; 41 | }; 42 | 43 | #endif /* RayLine_hpp */ 44 | -------------------------------------------------------------------------------- /Kuplung/kuplung/meshes/helpers/Skybox.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Skybox.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/2/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef Skybox_hpp 10 | #define Skybox_hpp 11 | 12 | #include 13 | #include 14 | #include "kuplung/utilities/gl/GLIncludes.h" 15 | #include "kuplung/settings/Settings.h" 16 | #include "kuplung/objects/ObjectDefinitions.h" 17 | 18 | class Skybox { 19 | public: 20 | Skybox(); 21 | ~Skybox(); 22 | void init(const short int& gridSize); 23 | const bool initBuffers(); 24 | void render(const glm::mat4& matrixView, const float& plane_close, const float& plane_far, const float& fov); 25 | 26 | std::vector skyboxItems; 27 | int Setting_Skybox_Item; 28 | 29 | private: 30 | short int gridSize; 31 | 32 | GLuint shaderProgram, shaderVertex, shaderFragment; 33 | GLuint glVAO, vboVertices, vboTexture; 34 | GLint glVS_MatrixView, glVS_MatrixProjection; 35 | }; 36 | 37 | #endif /* ModelFace_hpp */ 38 | -------------------------------------------------------------------------------- /Kuplung/kuplung/meshes/helpers/VertexSphere.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // VertexSphere.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/2/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef VertexSphere_hpp 10 | #define VertexSphere_hpp 11 | 12 | #include 13 | #include "kuplung/utilities/gl/GLIncludes.h" 14 | #include "kuplung/utilities/parsers/ModelObject.h" 15 | #include "kuplung/objects/ObjectDefinitions.h" 16 | #include "kuplung/settings/Settings.h" 17 | 18 | class VertexSphere { 19 | public: 20 | VertexSphere(); 21 | ~VertexSphere(); 22 | const bool initShaderProgram(); 23 | void initBuffers(MeshModel const& meshModel, const int& circleSegments, const float& radius); 24 | void render(const glm::mat4& matrixMVP, const glm::vec4& color); 25 | 26 | bool isSphere; 27 | bool showWireframes; 28 | unsigned short int circleSegments; 29 | std::vector dataVertices; 30 | std::vector dataNormals; 31 | std::vector dataIndices; 32 | 33 | private: 34 | GLuint shaderProgram; 35 | GLuint shaderVertex, shaderFragment; 36 | GLuint glVAO; 37 | GLuint vboVertices, vboNormals, vboIndices; 38 | 39 | GLint glUniformMVPMatrix, glUniformInnerLightDirection, glUniformColor; 40 | }; 41 | 42 | #endif /* VertexSphere_hpp */ 43 | -------------------------------------------------------------------------------- /Kuplung/kuplung/meshes/scene/ModelFaceData.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ModelFaceData.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/2/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef ModelFaceData_hpp 10 | #define ModelFaceData_hpp 11 | 12 | #include "kuplung/meshes/scene/ModelFaceBase.hpp" 13 | 14 | class ModelFaceData: public ModelFaceBase { 15 | public: 16 | ~ModelFaceData(); 17 | void init(MeshModel const& model, std::string const& assetsFolder) override; 18 | void initBuffers() override; 19 | void renderModel(const bool useTessellation); 20 | 21 | bool vertexSphereVisible, vertexSphereIsSphere, vertexSphereShowWireframes; 22 | float vertexSphereRadius; 23 | int vertexSphereSegments; 24 | glm::vec4 vertexSphereColor; 25 | GLuint glVAO; 26 | GLuint vboTextureAmbient, vboTextureDiffuse, vboTextureSpecular, vboTextureSpecularExp, vboTextureDissolve, vboTextureBump, vboTextureDisplacement; 27 | GLuint occQuery; 28 | 29 | glm::mat4 matrixGrid; 30 | 31 | private: 32 | GLuint vboVertices, vboNormals, vboTextureCoordinates, vboIndices, vboTangents, vboBitangents; 33 | }; 34 | 35 | #endif /* ModelFaceData_hpp */ 36 | -------------------------------------------------------------------------------- /Kuplung/kuplung/pcg/SpaceshipMeshGenerator.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // SpaceshipMeshGenerator.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/21/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef SpaceshipMeshGenerator_hpp 10 | #define SpaceshipMeshGenerator_hpp 11 | 12 | #include 13 | #include "kuplung/settings/Settings.h" 14 | #include "kuplung/utilities/parsers/ModelObject.h" 15 | #include "kuplung/utilities/parsers/FileModelManager.hpp" 16 | 17 | class SpaceshipMeshGenerator { 18 | public: 19 | void generate(const int& gridSize); 20 | 21 | std::vector vertices, normals, colors; 22 | std::vector uvs; 23 | std::vector indices; 24 | 25 | MeshModel modelSpaceship; 26 | 27 | private: 28 | int gridSize; 29 | 30 | std::unique_ptr fileParser; 31 | 32 | void generateMeshModel(); 33 | void generateFirstHull(); 34 | void generateFirstHull2(); 35 | void generateFirstHull3(); 36 | int getRandomValue(const float& valueMin, const float& valueMax, bool zeroIsValid = true); 37 | 38 | void extrudeMesh(); 39 | }; 40 | 41 | #endif /* SpaceshipMeshGenerator_hpp */ 42 | -------------------------------------------------------------------------------- /Kuplung/kuplung/pcg/VoronoiGenerator.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // VoronoiGenerator.cpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/21/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #include "VoronoiGenerator.hpp" 10 | 11 | VoronoiGenerator::~VoronoiGenerator() { 12 | } 13 | -------------------------------------------------------------------------------- /Kuplung/kuplung/pcg/VoronoiGenerator.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // VoronoiGenerator.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/21/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef VoronoiGenerator_hpp 10 | #define VoronoiGenerator_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | 14 | class VoronoiGenerator { 15 | public: 16 | ~VoronoiGenerator(); 17 | 18 | private: 19 | }; 20 | 21 | #endif /* VoronoiGenerator_hpp */ 22 | -------------------------------------------------------------------------------- /Kuplung/kuplung/rendering/RenderingManager.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // RenderingManager.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/2/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef RenderingManager_hpp 10 | #define RenderingManager_hpp 11 | 12 | #include "kuplung/rendering/methods/RenderingSimple.hpp" 13 | #include "kuplung/rendering/methods/RenderingForward.hpp" 14 | #include "kuplung/rendering/methods/RenderingForwardShadowMapping.hpp" 15 | #include "kuplung/rendering/methods/RenderingShadowMapping.hpp" 16 | #include "kuplung/rendering/methods/RenderingDeferred.hpp" 17 | #include "kuplung/meshes/scene/ModelFaceData.hpp" 18 | #include "kuplung/objects/ObjectsManager.hpp" 19 | #include "kuplung/settings/SettingsStructs.h" 20 | 21 | class RenderingManager { 22 | public: 23 | explicit RenderingManager(ObjectsManager &managerObjects); 24 | ~RenderingManager(); 25 | void init(); 26 | void render(const int& selectedModel); 27 | 28 | int RenderingTotalVertices; 29 | int RenderingTotalIndices; 30 | int RenderingTotalTriangles; 31 | int RenderingTotalFaces; 32 | 33 | std::vector meshModelFaces; 34 | 35 | private: 36 | ObjectsManager &managerObjects; 37 | 38 | std::unique_ptr rendererSimple; 39 | std::unique_ptr rendererForward; 40 | std::unique_ptr rendererForwardShadowMapping; 41 | std::unique_ptr rendererShadowMapping; 42 | std::unique_ptr rendererDeferred; 43 | }; 44 | 45 | #endif /* RenderingManager_hpp */ 46 | -------------------------------------------------------------------------------- /Kuplung/kuplung/rendering/methods/RenderingSimple.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // RenderingSimple.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/2/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef RenderingSimple_hpp 10 | #define RenderingSimple_hpp 11 | 12 | #include "kuplung/meshes/scene/ModelFaceData.hpp" 13 | #include "kuplung/objects/ObjectsManager.hpp" 14 | 15 | class RenderingSimple { 16 | public: 17 | explicit RenderingSimple(ObjectsManager &managerObjects); 18 | explicit RenderingSimple(std::unique_ptr &managerObjects); 19 | ~RenderingSimple(); 20 | 21 | bool init(); 22 | void render(const std::vector& meshModelFaces, const int& selectedModel); 23 | 24 | private: 25 | ObjectsManager &managerObjects; 26 | 27 | glm::mat4 matrixProjection, matrixCamera; 28 | glm::vec3 vecCameraPosition, uiAmbientLight; 29 | 30 | GLuint shaderProgram; 31 | GLint glVS_MVPMatrix, glVS_WorldMatrix, glFS_SamplerTexture, glFS_HasSamplerTexture; 32 | GLint glFS_CameraPosition, glFS_UIAmbient; 33 | std::unique_ptr solidLight; 34 | }; 35 | 36 | #endif /* RenderingSimple_hpp */ 37 | -------------------------------------------------------------------------------- /Kuplung/kuplung/settings/ConfigUtils.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ConfigUtils.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/4/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef ConfigUtils_hpp 10 | #define ConfigUtils_hpp 11 | 12 | #include "SettingsStructs.h" 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | class ConfigUtils { 19 | public: 20 | ~ConfigUtils(); 21 | void init(std::string const& appFolder); 22 | void saveSettings(); 23 | 24 | bool readBool(std::string const& configKey); 25 | int readInt(std::string const& configKey); 26 | float readFloat(std::string const& configKey); 27 | std::string readString(std::string const& configKey); 28 | 29 | void writeBool(std::string const& configKey, bool const& configValue); 30 | void writeInt(std::string const& configKey, int const& configValue); 31 | void writeFloat(std::string const& configKey, float const& configValue); 32 | void writeString(std::string const& configKey, std::string const& configValue); 33 | 34 | void saveRecentFiles(std::vector const& recentFiles); 35 | std::vector loadRecentFiles(); 36 | 37 | void saveRecentFilesImported(std::vector const& recentFilesImported); 38 | std::vector loadRecentFilesImported(); 39 | 40 | private: 41 | std::string configFile, recentFilesFileImported, recentFilesFile; 42 | std::map configData; 43 | 44 | std::regex regex_equalsSign; 45 | 46 | void readFile(); 47 | const std::vector splitString(const std::string& s, std::regex const& delimiter) const; 48 | }; 49 | 50 | #endif /* ConfigUtils_hpp */ 51 | -------------------------------------------------------------------------------- /Kuplung/kuplung/settings/FontsList.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // FontsList.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 2/4/16. 6 | // Copyright © 2016 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef FontsList_hpp 10 | #define FontsList_hpp 11 | 12 | #include "Settings.h" 13 | #include 14 | #include 15 | 16 | class FontsList { 17 | public: 18 | void init(); 19 | const bool fontFileExists(std::string const& font) const; 20 | void getFonts(); 21 | const int getSelectedFontSize() const; 22 | 23 | std::vector fonts; 24 | const char* fontSizes[11] = {"12", "14", "16", "18", "20", "22", "24", "26", "28", "30", "32"}; 25 | 26 | private: 27 | void loadFontsOSX(); 28 | void loadFontsWindows(); 29 | void loadFontsNix(); 30 | }; 31 | 32 | #endif /* FontsList_hpp */ 33 | -------------------------------------------------------------------------------- /Kuplung/kuplung/settings/SettingsStructs.h: -------------------------------------------------------------------------------- 1 | // 2 | // SettingsStructs.h 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/16/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef SettingsStructs_h 10 | #define SettingsStructs_h 11 | 12 | #include 13 | #include 14 | 15 | struct Color { 16 | float r, g, b, w; 17 | }; 18 | 19 | struct FBEntity { 20 | bool isFile; 21 | std::string path, title, extension, modifiedDate, size; 22 | }; 23 | 24 | typedef enum Importer_ParserType { 25 | Importer_ParserType_Own = 0, 26 | #ifdef DEF_KuplungSetting_UseCuda 27 | Importer_ParserType_Own_Cuda = 1, 28 | Importer_ParserType_Assimp = 2 29 | #else 30 | Importer_ParserType_Assimp = 1 31 | #endif 32 | } Importer_ParserType; 33 | 34 | #ifdef DEF_KuplungSetting_UseCuda 35 | static int Importer_ParserType_Count = 3; 36 | #else 37 | static int Importer_ParserType_Count = 2; 38 | #endif 39 | 40 | typedef enum InAppRendererType { 41 | InAppRendererType_Simple, 42 | InAppRendererType_Forward, 43 | InAppRendererType_ForwardShadowMapping, 44 | InAppRendererType_ShadowMapping, 45 | InAppRendererType_Deferred 46 | } InAppRendererType; 47 | 48 | typedef enum ImportExportFormats { 49 | ImportExportFormat_UNDEFINED = -1, 50 | ImportExportFormat_OBJ = 0, 51 | ImportExportFormat_GLTF = 1, 52 | ImportExportFormat_STL = 2, 53 | ImportExportFormat_PLY = 3 54 | } ImportExportFormats; 55 | 56 | struct SupportedAssimpFormat { 57 | std::string id, description, fileExtension; 58 | }; 59 | 60 | #endif /* SettingsStructs_h */ 61 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/ColorPicker.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ColorPicker.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/17/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef ColorPicker_hpp 10 | #define ColorPicker_hpp 11 | 12 | #include "kuplung/utilities/imgui/imgui.h" 13 | 14 | class ColorPicker { 15 | public: 16 | void show(const char* title, bool* p_opened, float* col, const bool show_alpha); 17 | bool ColorPicker4(float* col, const bool show_alpha); 18 | bool ColorPicker3(float col[3]); 19 | }; 20 | 21 | #endif /* ColorPicker_hpp */ 22 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/FileBrowser.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // FileBrowser.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/18/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef FileBrowser_hpp 10 | #define FileBrowser_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/utilities/imgui/imgui.h" 14 | #include "kuplung/objects/ObjectDefinitions.h" 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | class FileBrowser { 21 | public: 22 | void init(bool log, int positionX, int positionY, int width, int height, const std::function& processFile); 23 | void setStyleBrowser(const bool isStyle); 24 | void setImageBrowser(const bool isImage); 25 | void draw(const char* title, bool* p_opened = NULL, MaterialTextureType TextureType = MaterialTextureType_Undefined); 26 | 27 | private: 28 | std::map getFolderContents(std::string const& filePath); 29 | std::function processFile; 30 | 31 | void drawFiles(const std::string& fPath, MaterialTextureType TextureType = MaterialTextureType_Undefined); 32 | std::string convertToString(double num); 33 | std::string convertSize(size_t size); 34 | double roundOff(double n); 35 | void logMessage(std::string const& logMessage); 36 | 37 | bool log, isStyleBrowser, isImageBrowser; 38 | int positionX, positionY, width, height; 39 | std::string currentFolder; 40 | float panelWidth_Options, panelWidth_OptionsMin; 41 | }; 42 | 43 | #endif /* FileBrowser_hpp */ 44 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/FileSaver.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // FileSaver.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/18/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef FileSaver_hpp 10 | #define FileSaver_hpp 11 | 12 | #include "kuplung/utilities/imgui/imgui.h" 13 | #include 14 | #include 15 | #include 16 | #include "kuplung/settings/Settings.h" 17 | #include 18 | 19 | typedef enum FileSaverOperation { 20 | FileSaverOperation_SaveScene, 21 | FileSaverOperation_OpenScene, 22 | FileSaverOperation_Renderer 23 | } FileSaverOperation; 24 | 25 | class FileSaver { 26 | public: 27 | void init(int positionX, int positionY, int width, int height, const std::function& saveFile); 28 | void draw(const char* title, FileSaverOperation type, bool* p_opened = nullptr); 29 | 30 | private: 31 | std::map getFolderContents(std::string const& filePath); 32 | std::function funcFileSave; 33 | 34 | void drawFiles(const std::string& fPath); 35 | const std::string convertToString(double num) const; 36 | const std::string convertSize(size_t size) const; 37 | const double roundOff(double n) const; 38 | void modalNewFolder(); 39 | 40 | bool showNewFolderModel; 41 | float panelWidth_FileOptions; 42 | char fileName[256] = "untitled"; 43 | char newFolderName[256] = "untitled"; 44 | std::string currentFolder; 45 | int positionX, positionY, width, height; 46 | }; 47 | 48 | #endif /* FileSaver_hpp */ 49 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/ImageViewer.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ImageViewer.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 2/1/16. 6 | // Copyright © 2016 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef ImageViewer_hpp 10 | #define ImageViewer_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/utilities/gl/GLIncludes.h" 14 | #include "kuplung/utilities/imgui/imgui.h" 15 | 16 | class ImageViewer { 17 | public: 18 | void showImage(bool* show); 19 | bool genTexture; 20 | std::string imagePath; 21 | int wWidth, wHeight; 22 | 23 | private: 24 | GLuint vboBuffer; 25 | int tWidth, tHeight; 26 | void createTextureBuffer(); 27 | 28 | }; 29 | 30 | #endif /* ImageViewer_hpp */ 31 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/Log.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Log.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/17/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef Log_hpp 10 | #define Log_hpp 11 | 12 | #include "kuplung/utilities/imgui/imgui.h" 13 | 14 | class Log { 15 | public: 16 | void init(int positionX, int positionY, int width, int height); 17 | void clear(); 18 | void addToLog(const char* fmt, ...) IM_FMTARGS(2); 19 | void draw(const char* title, bool* p_opened = nullptr); 20 | 21 | ImGuiTextBuffer Buf; 22 | ImGuiTextFilter Filter; 23 | ImVector LineOffsets; 24 | bool ScrollToBottom; 25 | 26 | private: 27 | int positionX, positionY, width, height; 28 | }; 29 | 30 | #endif /* Log_hpp */ 31 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/RendererUI.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // RendererUI.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 2/1/16. 6 | // Copyright © 2016 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef RendererUI_hpp 10 | #define RendererUI_hpp 11 | 12 | #include "kuplung/objects/ObjectsManager.hpp" 13 | #include "kuplung/settings/Settings.h" 14 | #include "kuplung/ui/components/FileSaver.hpp" 15 | #include "kuplung/utilities/gl/GLIncludes.h" 16 | #include "kuplung/utilities/imgui/imgui.h" 17 | #include "kuplung/utilities/renderers/ImageRenderer.hpp" 18 | 19 | class RendererUI { 20 | public: 21 | void init(SDL_Window* sdlWindow); 22 | void render(bool* show, ImageRenderer* imageRenderer, ObjectsManager* managerObjects, std::vector* meshModelFaces); 23 | 24 | int wWidth, wHeight, wPadding; 25 | float bHeight; 26 | 27 | private: 28 | void renderImageTexture(ImageRenderer* imageRenderer, std::vector* meshModelFaces); 29 | 30 | std::unique_ptr componentFileSaver; 31 | void dialogFileSaveProcessFile(const FBEntity& file, FileSaverOperation operation); 32 | bool showSaveDialog; 33 | void dialogFileSave(); 34 | 35 | int rendererType, imageFormat; 36 | float panelWidth_RenderOptions, panelWidth_RenderOptionsMin, zoomFactor; 37 | ImVec2 scrolling = ImVec2(0.0f, 0.0f); 38 | 39 | bool genTexture; 40 | GLuint vboBuffer; 41 | int tWidth, tHeight; 42 | std::string currentFileImage; 43 | void createTextureBuffer(); 44 | }; 45 | 46 | #endif /* RendererUI_hpp */ 47 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/Screenshot.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Screenshot.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/17/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef Screenshot_hpp 10 | #define Screenshot_hpp 11 | 12 | #define _CRT_SECURE_NO_WARNINGS 13 | #include "kuplung/utilities/imgui/imgui.h" 14 | #define IMGUI_DEFINE_MATH_OPERATORS 15 | #include "kuplung/utilities/imgui/imgui_internal.h" 16 | 17 | #include 18 | 19 | class Screenshot { 20 | public: 21 | void ShowScreenshotsWindow(bool* open); 22 | }; 23 | 24 | #endif /* Screenshot_hpp */ 25 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/ShaderEditor.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ShaderEditor.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/25/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef ShaderEditor_hpp 10 | #define ShaderEditor_hpp 11 | 12 | #include 13 | #include 14 | #include 15 | #include "kuplung/utilities/imgui/imgui.h" 16 | #include "kuplung/settings/Settings.h" 17 | #include "kuplung/utilities/lua/LuaManager.hpp" 18 | 19 | class ShaderEditor { 20 | public: 21 | void init(std::string const& appPath, int positionX, int positionY, int width, int height); 22 | void draw(const std::function& fileShaderCompile, const char* title, bool* p_opened = nullptr); 23 | 24 | private: 25 | std::function doFileShaderCompile; 26 | void compileShader(); 27 | 28 | std::string appPath, fileContents, currentFileName; 29 | int positionX, positionY, width, height, shaderFileIndex; 30 | char guiEditorText[1024 * 16]; 31 | 32 | std::unique_ptr managerLua; 33 | }; 34 | 35 | #endif /* ShaderEditor_hpp */ 36 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/Tabs.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Tabs.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/17/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef Tabs_hpp 10 | #define Tabs_hpp 11 | 12 | #include "kuplung/utilities/imgui/imgui.h" 13 | 14 | namespace ImGui { 15 | IMGUI_API bool TabLabels(int numTabs, const char** tabLabels, int& selectedIndex, ImVec2 btnSize = ImVec2(0, 0), const char** tabLabelTooltips=NULL, bool wrapMode=true, int *pOptionalHoveredIndex=NULL, int* pOptionalItemOrdering=NULL, bool allowTabReorder=false, bool allowTabClosingThroughMMB=false, int *pOptionalClosedTabIndex=NULL, int *pOptionalClosedTabIndexInsideItemOrdering=NULL); 16 | } 17 | 18 | #endif /* Tabs_hpp */ 19 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/exporters/ExportFile.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ExportFile.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 17/08/17. 6 | // Copyright © 2017 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef ExportFile_hpp 10 | #define ExportFile_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/utilities/imgui/imgui.h" 14 | #include "kuplung/objects/ObjectDefinitions.h" 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | class ExportFile { 21 | public: 22 | void init(int positionX, int positionY, int width, int height, const std::function, ImportExportFormats exportFormat, int exportFormatAssimp)>& saveFile); 23 | void draw(ImportExportFormats* dialogExportType, int* dialogExportType_Assimp, bool* p_opened = nullptr); 24 | 25 | private: 26 | std::map getFolderContents(std::string const& filePath); 27 | std::function, ImportExportFormats exportFormat, int exportFormatAssimp)> funcFileSave; 28 | 29 | void drawFiles(const std::string& fPath); 30 | const std::string convertToString(double num) const; 31 | const std::string convertSize(size_t size) const; 32 | const double roundOff(double n) const; 33 | void modalNewFolder(); 34 | 35 | bool showNewFolderModel; 36 | float panelWidth_FileOptions, panelWidth_FileOptionsMin; 37 | char fileName[256] = "untitled"; 38 | char newFolderName[256] = "untitled"; 39 | std::string currentFolder; 40 | int positionX, positionY, width, height; 41 | 42 | int Setting_Forward, Setting_Up; 43 | std::vector assimpExporters; 44 | }; 45 | 46 | #endif /* ExportFile_hpp */ 47 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/exporters/ExportGLTF.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ExportGLTF.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 07/08/17. 6 | // Copyright © 2017 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef ExportGLTF_hpp 10 | #define ExportGLTF_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/utilities/imgui/imgui.h" 14 | #include "kuplung/objects/ObjectDefinitions.h" 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | class ExportGLTF { 21 | public: 22 | void init(int positionX, int positionY, int width, int height, const std::function)>& saveFile); 23 | void draw(const char* title, bool* p_opened = nullptr); 24 | 25 | private: 26 | std::map getFolderContents(std::string const& filePath); 27 | std::function)> funcFileSave; 28 | 29 | void drawFiles(const std::string& fPath); 30 | const std::string convertToString(double num) const; 31 | const std::string convertSize(size_t size) const; 32 | const double roundOff(double n) const; 33 | void modalNewFolder(); 34 | 35 | bool showNewFolderModel; 36 | float panelWidth_FileOptions, panelWidth_FileOptionsMin; 37 | char fileName[256] = "untitled"; 38 | char newFolderName[256] = "untitled"; 39 | int positionX, positionY, width, height; 40 | 41 | std::string currentFolder; 42 | }; 43 | 44 | #endif /* ExportGLTF_hpp */ 45 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/exporters/ExportOBJ.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ExportOBJ.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/18/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef ExportOBJ_hpp 10 | #define ExportOBJ_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/utilities/imgui/imgui.h" 14 | #include "kuplung/objects/ObjectDefinitions.h" 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | class ExportOBJ { 21 | public: 22 | void init(int positionX, int positionY, int width, int height, const std::function)>& saveFile); 23 | void draw(const char* title, bool* p_opened = nullptr); 24 | 25 | private: 26 | std::map getFolderContents(std::string const& filePath); 27 | std::function)> funcFileSave; 28 | 29 | void drawFiles(const std::string& fPath); 30 | const std::string convertToString(double num) const; 31 | const std::string convertSize(size_t size) const; 32 | const double roundOff(double n) const; 33 | void modalNewFolder(); 34 | 35 | bool showNewFolderModel; 36 | float panelWidth_FileOptions, panelWidth_FileOptionsMin; 37 | char fileName[256] = "untitled"; 38 | char newFolderName[256] = "untitled"; 39 | std::string currentFolder; 40 | int positionX, positionY, width, height; 41 | 42 | int Setting_Forward, Setting_Up; 43 | }; 44 | 45 | #endif /* ExportOBJ_hpp */ 46 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/ide/KuplungIDE.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // KuplungIDE.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/18/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef KuplungIDE_hpp 10 | #define KuplungIDE_hpp 11 | 12 | #include "kuplung/utilities/imgui/ImGuiColorTextEdit/TextEditor.h" 13 | #include "kuplung/meshes/scene/ModelFaceData.hpp" 14 | #include "kuplung/objects/ObjectsManager.hpp" 15 | 16 | class KuplungIDE { 17 | public: 18 | void init(); 19 | void draw(const char* title, bool* p_opened, std::vector const& meshModelFaces, ObjectsManager &managerObjects); 20 | 21 | private: 22 | TextEditor kuplungEditor; 23 | int selectedIndex; 24 | std::vector meshesShadersList; 25 | 26 | void loadSelectedShader(ObjectsManager &managerObjects); 27 | }; 28 | 29 | #endif /* KuplungIDE_hpp */ 30 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/importers/ImportFile.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ImportFile.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/18/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef ImportFile_hpp 10 | #define ImportFile_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/utilities/imgui/imgui.h" 14 | #include "kuplung/objects/ObjectDefinitions.h" 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | class ImportFile { 21 | public: 22 | void init(int positionX, int positionY, int width, int height, const std::function, ImportExportFormats importFormat, int importFormatAssimp)>& processFile); 23 | void draw(ImportExportFormats* dialogImportType, int* dialogImportType_Assimp, bool* p_opened = nullptr); 24 | 25 | private: 26 | std::map getFolderContents(ImportExportFormats* dialogImportType, std::string const& filePath); 27 | std::function, ImportExportFormats importFormat, int importFormatAssimp)> processFile; 28 | 29 | void drawFiles(ImportExportFormats* dialogImportType, int* dialogImportType_Assimp, const std::string& fPath); 30 | const std::string convertToString(double num) const; 31 | const std::string convertSize(size_t size) const; 32 | const double roundOff(double n) const; 33 | 34 | int positionX, positionY, width, height; 35 | float panelWidth_Options, panelWidth_OptionsMin; 36 | 37 | int Setting_Forward, Setting_Up; 38 | 39 | std::string currentFolder; 40 | std::vector assimpImporters; 41 | }; 42 | 43 | #endif /* ImportFile_hpp */ 44 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/materialeditor/MELink.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // MELink.cpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/17/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #include "kuplung/ui/components/materialeditor/MELink.hpp" 10 | 11 | MELink::MELink(MENode *nodeOut, int slotOut, MENode *nodeIn, int slotIn) { 12 | this->NodeOutput = nodeOut; 13 | this->SlotOutput = slotOut; 14 | this->NodeInput = nodeIn; 15 | this->SlotInput = slotIn; 16 | } 17 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/materialeditor/MELink.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // MELink.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/17/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef MELink_hpp 10 | #define MELink_hpp 11 | 12 | #include "kuplung/ui/components/materialeditor/MENode.hpp" 13 | 14 | class MELink { 15 | public: 16 | MELink(MENode *nodeOut, int slotOut, MENode *nodeIn, int slotIn); 17 | 18 | MENode *NodeOutput; 19 | int SlotOutput; 20 | MENode *NodeInput; 21 | int SlotInput; 22 | }; 23 | 24 | #endif /* MELink_hpp */ 25 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/materialeditor/MENode.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // MENode.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/17/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef MENode_hpp 10 | #define MENode_hpp 11 | 12 | #include "kuplung/utilities/imgui/imgui.h" 13 | #include "kuplung/meshes/scene/ModelFaceBase.hpp" 14 | #include "kuplung/ui/components/materialeditor/MaterialEditorData.h" 15 | 16 | class MENode { 17 | public: 18 | void init(int id, MaterialEditor_NodeType nodeType, std::string const& name, const ImVec2& pos, float value, const ImVec4& color, int inputs_count, int outputs_count, std::string const& textureFilename = "", std::string const& textureImage=""); 19 | virtual void draw(ImVec2 node_rect_min, ImVec2 NODE_WINDOW_PADDING, bool showPreview, float scale) const; 20 | 21 | ImVec2 GetInputSlotPos(int slot_no, float scale=1.0f) const; 22 | ImVec2 GetOutputSlotPos(int slot_no, float scale=1.0f) const; 23 | 24 | int ID, InputsCount, OutputsCount, NodeType; 25 | std::string Name, TextureFilename, TextureImage; 26 | ImVec2 Pos, Size; 27 | float Value; 28 | ImVec4 Color; 29 | bool IsExpanded; 30 | }; 31 | 32 | #endif /* MENode_hpp */ 33 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/materialeditor/MENode_Color.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // MENode_Color.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/17/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef MENode_Color_hpp 10 | #define MENode_Color_hpp 11 | 12 | #include "kuplung/utilities/imgui/imgui.h" 13 | #include "kuplung/ui/components/materialeditor/MENode.hpp" 14 | 15 | class MENode_Color: public MENode { 16 | public: 17 | MENode_Color(int id, std::string const& name, const ImVec2& pos, float value, const ImVec4& color, int inputs_count, int outputs_count, std::string const& textureFilename="", std::string const& textureImage=""); 18 | virtual void draw(ImVec2 node_rect_min, ImVec2 NODE_WINDOW_PADDING, bool showPreview, float scale); 19 | }; 20 | 21 | #endif /* MENode_Color_hpp */ 22 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/materialeditor/MENode_Combine.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // MENode_Combine.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/17/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef MENode_Combine_hpp 10 | #define MENode_Combine_hpp 11 | 12 | #include "kuplung/utilities/imgui/imgui.h" 13 | #include "kuplung/ui/components/materialeditor/MENode.hpp" 14 | 15 | class MENode_Combine: public MENode { 16 | public: 17 | MENode_Combine(int id, std::string const& name, const ImVec2& pos, float value, const ImVec4& color, int inputs_count, int outputs_count, std::string const& textureFilename="", std::string const& textureImage=""); 18 | virtual void draw(ImVec2 node_rect_min, ImVec2 NODE_WINDOW_PADDING, bool showPreview, float scale); 19 | }; 20 | 21 | #endif /* MENode_Combine_hpp */ 22 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/materialeditor/MENode_Texture.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // MENode_Texture.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/17/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef MENode_Texture_hpp 10 | #define MENode_Texture_hpp 11 | 12 | #include "kuplung/utilities/imgui/imgui.h" 13 | #include "kuplung/ui/components/materialeditor/MENode.hpp" 14 | #include "kuplung/ui/components/FileBrowser.hpp" 15 | 16 | class MENode_Texture: public MENode { 17 | public: 18 | MENode_Texture(int id, MaterialTextureType texType, std::string const& name, const ImVec2& pos, float value, const ImVec4& color, int inputs_count, int outputs_count, std::string const& textureFilename="", std::string const& textureImage=""); 19 | virtual void draw(ImVec2 node_rect_min, ImVec2 NODE_WINDOW_PADDING, bool showPreview, float scale); 20 | 21 | private: 22 | bool showTextureWindow, loadTexture, showFileBrowser; 23 | char filePath[256]; 24 | GLuint vboBuffer; 25 | int textureWidth, textureHeight; 26 | int TextureType; 27 | 28 | std::unique_ptr componentFileBrowser; 29 | 30 | void initBase(int id, std::string const& name, const ImVec2& pos, float value, const ImVec4& color, int inputs_count, int outputs_count, std::string const& textureFilename="", std::string const& textureImage=""); 31 | void showImage(); 32 | void createTextureBuffer(int* width, int* height); 33 | void dialogFileBrowserProcessFile(const FBEntity& file); 34 | }; 35 | 36 | #endif /* MENode_Texture_hpp */ 37 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/materialeditor/MaterialEditor.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // MaterialEditor.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/17/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef MaterialEditor_hpp 10 | #define MaterialEditor_hpp 11 | 12 | #include "kuplung/utilities/imgui/imgui.h" 13 | #include "kuplung/meshes/scene/ModelFaceBase.hpp" 14 | #include "kuplung/ui/components/materialeditor/MaterialEditorData.h" 15 | #include "kuplung/ui/components/materialeditor/MELink.hpp" 16 | #include "kuplung/ui/components/materialeditor/MENode.hpp" 17 | #include "kuplung/ui/components/materialeditor/MENode_Color.hpp" 18 | #include "kuplung/ui/components/materialeditor/MENode_Combine.hpp" 19 | #include "kuplung/ui/components/materialeditor/MENode_Texture.hpp" 20 | 21 | struct DragNode { 22 | ImVec2 pos; 23 | MENode* node; 24 | int inputSlotIndex, outputSlotIndex; 25 | DragNode() : node(NULL), inputSlotIndex(-1), outputSlotIndex(-1) {} 26 | bool isValid() const { return node && (inputSlotIndex >= 0 || outputSlotIndex >= 0); } 27 | void reset() { *this = DragNode(); } 28 | }; 29 | 30 | class MaterialEditor { 31 | public: 32 | void init(); 33 | void draw(const int selectedModelID, ModelFaceBase *face, bool* p_opened = nullptr); 34 | 35 | private: 36 | void initMaterialNodes(ModelFaceBase *face); 37 | 38 | bool inited = false; 39 | int selectedModelID; 40 | std::vector nodes; 41 | std::vector links; 42 | ImVec2 scrolling = ImVec2(0.0f, 0.0f); 43 | bool show_grid = true; 44 | int node_selected = -1; 45 | 46 | DragNode dragNode; 47 | ImColor style_LinkColor; 48 | float style_LinkThickness; 49 | bool style_ShowImages; 50 | float panelWidth_Nodes; 51 | }; 52 | 53 | #endif /* MaterialEditor_hpp */ 54 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/materialeditor/MaterialEditorData.h: -------------------------------------------------------------------------------- 1 | // 2 | // MaterialEditorData.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/17/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef MaterialEditorData_hpp 10 | #define MaterialEditorData_hpp 11 | 12 | #include "kuplung/utilities/imgui/imgui.h" 13 | #include "kuplung/meshes/scene/ModelFaceBase.hpp" 14 | 15 | typedef enum MaterialEditor_NodeType { 16 | MaterialEditor_NodeType_Combine, 17 | MaterialEditor_NodeType_Color, 18 | MaterialEditor_NodeType_Image 19 | } MaterialEditor_NodeType; 20 | 21 | #endif /* MaterialEditorData_hpp */ 22 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/uveditor/UVPoint.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // UVPoint.cpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/25/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #include "kuplung/ui/components/uveditor/UVPoint.hpp" 10 | 11 | UVPoint::UVPoint(int id, ImVec2 position, ImColor const& color, float radius) 12 | : ID(id), position(position), color(color), radius(radius), isDragging(false) { 13 | } 14 | 15 | void UVPoint::draw(ImVec2 pointRect) const { 16 | ImGui::SetCursorScreenPos(pointRect); 17 | ImGui::BeginGroup(); 18 | 19 | ImDrawList* draw_list = ImGui::GetWindowDrawList(); 20 | draw_list->AddCircleFilled(pointRect, this->radius, this->color); 21 | 22 | ImGui::EndGroup(); 23 | } 24 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/components/uveditor/UVPoint.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // UVPoint.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/25/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef UVPoint_hpp 10 | #define UVPoint_hpp 11 | 12 | #include "kuplung/utilities/imgui/imgui.h" 13 | 14 | class UVPoint { 15 | public: 16 | UVPoint(int id, ImVec2 position, ImColor const& color, float radius); 17 | void draw(ImVec2 pointRect) const; 18 | 19 | int ID; 20 | ImVec2 position; 21 | ImColor color; 22 | float radius; 23 | bool isDragging; 24 | }; 25 | 26 | #endif /* UVPoint_hpp */ 27 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/dialogs/DialogOptions.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // DialogOptions.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/17/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef DialogOptions_hpp 10 | #define DialogOptions_hpp 11 | 12 | #include "kuplung/settings/FontsList.hpp" 13 | #include "kuplung/settings/Settings.h" 14 | #include "kuplung/ui/dialogs/DialogStyle.hpp" 15 | #include "kuplung/utilities/imgui/imgui.h" 16 | 17 | class DialogOptions { 18 | public: 19 | void init(); 20 | void showOptionsWindow(ImGuiStyle* ref, DialogStyle* wStyle, bool* p_opened = NULL, bool* needsFontChange = nullptr); 21 | void loadFonts(bool* needsFontChange = nullptr); 22 | 23 | private: 24 | std::unique_ptr fontLister; 25 | 26 | int optionsFontSelected, optionsFontSizeSelected, optionsRendererType, optionsGUIProvider, optionsSceneExporters; 27 | }; 28 | 29 | #endif /* DialogOptions_hpp */ 30 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/dialogs/DialogSVS.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // DialogSVS.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 2/1/16. 6 | // Copyright © 2016 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef DialogSVS_hpp 10 | #define DialogSVS_hpp 11 | 12 | #include "kuplung/utilities/gl/GLIncludes.h" 13 | #include "kuplung/utilities/imgui/imgui.h" 14 | #include "kuplung/meshes/artefacts/StructuredVolumetricSampling.hpp" 15 | 16 | class DialogSVS { 17 | public: 18 | void init(); 19 | void render(bool* p_opened); 20 | 21 | GLuint vboTexture; 22 | float windowWidth, windowHeight; 23 | float viewPaddingHorizontal, viewPaddingVertical; 24 | 25 | private: 26 | int textureWidth, textureHeight; 27 | ImVec2 scrolling = ImVec2(0.0f, 0.0f); 28 | 29 | std::unique_ptr structured_Volumetric_Sampling; 30 | }; 31 | 32 | #endif /* DialogSVS_hpp */ 33 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/dialogs/DialogShadertoy.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // DialogShadertoy.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 2/1/16. 6 | // Copyright © 2016 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef DialogShadertoy_hpp 10 | #define DialogShadertoy_hpp 11 | 12 | #include "kuplung/utilities/gl/GLIncludes.h" 13 | #include "kuplung/utilities/imgui/imgui.h" 14 | #include "kuplung/meshes/artefacts/Shadertoy.hpp" 15 | 16 | class DialogShadertoy { 17 | public: 18 | void init(const std::function& fShowErrorMessage); 19 | void render(bool* p_opened); 20 | 21 | GLuint vboTexture; 22 | float windowWidth, windowHeight; 23 | float viewPaddingHorizontal, viewPaddingVertical; 24 | 25 | private: 26 | std::function funcShowMessage; 27 | 28 | int textureWidth, textureHeight; 29 | ImVec2 scrolling = ImVec2(0.0f, 0.0f); 30 | 31 | std::unique_ptr engineShadertoy; 32 | float heightTopPanel, widthTexturesPanel, buttonCompileHeight; 33 | char shadertoyEditorText[1024 * 16]; 34 | void compileShader(); 35 | bool channel0Cube, channel1Cube, channel2Cube, channel3Cube; 36 | int texImage0, texImage1, texImage2, texImage3; 37 | int cubemapImage0, cubemapImage1, cubemapImage2, cubemapImage3; 38 | 39 | std::string exec(const char* cmd) const; 40 | std::string paste() const; 41 | void getFromClipboard(); 42 | void openExample(const std::string& fileName); 43 | }; 44 | 45 | #endif /* DialogShadertoy_hpp */ 46 | -------------------------------------------------------------------------------- /Kuplung/kuplung/ui/dialogs/DialogStyle.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // DialogStyle.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 2/1/16. 6 | // Copyright © 2016 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef DialogStyle_hpp 10 | #define DialogStyle_hpp 11 | 12 | #include 13 | #include 14 | #include 15 | #include "kuplung/utilities/imgui/imgui.h" 16 | 17 | class DialogStyle { 18 | public: 19 | void saveDefault(ImGuiStyle& style) const; 20 | void save(std::string const& fontfile, std::string const& fontsize, const ImGuiStyle& style) const; 21 | const ImGuiStyle& loadCurrent() const; 22 | const ImGuiStyle& load(const std::string& styleFilePath) const; 23 | const ImGuiStyle& loadDefault() const; 24 | 25 | private: 26 | void saveStyles(std::string const& fontfile, std::string const& fontsize, std::string const& styleFilePath, const ImGuiStyle& style) const; 27 | const std::vector splitString(const std::string &s, const std::regex& delimiter) const; 28 | const ImVec4 tov4(const std::string& opValue) const; 29 | const ImVec2 tov2(const std::string& opValue) const; 30 | }; 31 | 32 | #endif /* DialogStyle_hpp */ 33 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/consumption/Consumption.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Consumption.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/16/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef Consumption_hpp 10 | #define Consumption_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #ifdef WIN32 14 | #include "WindowsCPUUsage.hpp" 15 | #endif 16 | 17 | namespace KuplungApp { namespace Utilities { namespace Consumption { 18 | 19 | class Consumption { 20 | public: 21 | void init(); 22 | std::string getOverallStats(); 23 | std::string getMemoryConsumption(); 24 | std::string getCPULoad(); 25 | 26 | private: 27 | double memoryMarkPoint; 28 | std::string usageOverall; 29 | std::string usageMemory; 30 | std::string usageCPU; 31 | unsigned int lastTimeMemory = 0, currentTimeMemory; 32 | unsigned int lastTimeCPU = 0, currentTimeCPU; 33 | 34 | bool isTimeToUpdateMemory(); 35 | bool isTimeToUpdateCPU(); 36 | 37 | size_t getPeakRSS(); 38 | size_t getCurrentRSS(); 39 | size_t getWorkingRSS(); 40 | size_t getPagefileUsage(); 41 | void windows_printMemStruct(); 42 | 43 | void memoryMark(); 44 | void memoryUnmark(); 45 | 46 | const std::string exec(const char* cmd) const; 47 | 48 | #ifdef _WIN32 49 | WindowsCPUUsage winCPUMeter; 50 | #endif 51 | }; 52 | 53 | }}} 54 | 55 | #endif /* Consumption_hpp */ 56 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/consumption/WindowsCPUUsage.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // WindowsCPUUsage.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/16/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef WindowsCPUUsage_hpp 10 | #define WindowsCPUUsage_hpp 11 | 12 | namespace KuplungApp { namespace Utilities { namespace Consumption { 13 | 14 | #include 15 | 16 | class WindowsCPUUsage { 17 | public: 18 | WindowsCPUUsage(); 19 | short GetUsage(); 20 | 21 | private: 22 | ULONGLONG SubtractTimes(const FILETIME& ftA, const FILETIME& ftB); 23 | bool EnoughTimePassed(); 24 | inline bool IsFirstRun() const { return (m_dwLastRun == 0); } 25 | 26 | //system total times 27 | FILETIME m_ftPrevSysKernel; 28 | FILETIME m_ftPrevSysUser; 29 | 30 | //process times 31 | FILETIME m_ftPrevProcKernel; 32 | FILETIME m_ftPrevProcUser; 33 | 34 | short m_nCpuUsage; 35 | ULONGLONG m_dwLastRun; 36 | 37 | volatile LONG m_lRunCount; 38 | }; 39 | 40 | }}} 41 | 42 | #endif /* WindowsCPUUsage_hpp */ 43 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/cpp-base64/base64.h: -------------------------------------------------------------------------------- 1 | // 2 | // base64 encoding and decoding with C++. 3 | // Version: 1.01.00 4 | // 5 | 6 | #ifndef BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A 7 | #define BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A 8 | 9 | #include 10 | 11 | std::string base64_encode(unsigned char const* , unsigned int len); 12 | std::string base64_decode(std::string const& s); 13 | 14 | #endif /* BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A */ 15 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/cuda/CudaHelpers.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // CudaHelpers.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/16/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifdef DEF_KuplungSetting_UseCuda 10 | 11 | #ifndef CudaHelpers_hpp 12 | #define CudaHelpers_hpp 13 | 14 | #include "kuplung/settings/Settings.h" 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | class CudaHelpers { 24 | public: 25 | int findCudaDevice(); 26 | int findCudaGLDevice(); 27 | 28 | private: 29 | int gpuGetMaxGflopsDeviceId(); 30 | int _ConvertSMVer2Cores(int major, int minor); 31 | }; 32 | 33 | #endif /* CudaHelpers_hpp */ 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/export/Exporter.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Exporter.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/16/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef Exporter_hpp 10 | #define Exporter_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/meshes/scene/ModelFaceBase.hpp" 14 | #include "kuplung/utilities/export/ExporterAssimp.hpp" 15 | #include "kuplung/utilities/export/ExporterOBJ.hpp" 16 | #include "kuplung/utilities/export/ExporterGLTF.hpp" 17 | #include "kuplung/objects/ObjectsManager.hpp" 18 | 19 | namespace KuplungApp { namespace Utilities { namespace Export { 20 | 21 | class Exporter { 22 | public: 23 | ~Exporter(); 24 | Exporter(); 25 | void init(const std::function& doProgress); 26 | void exportScene(const FBEntity& file, const std::vector& faces, const std::vector& settings, std::unique_ptr &managerObjects, ImportExportFormats exportFormat, int exportFormatAssimp); 27 | 28 | private: 29 | std::unique_ptr exporterAssimp; 30 | std::unique_ptr exporterOBJ; 31 | std::unique_ptr exporterGLTF; 32 | }; 33 | 34 | }}} 35 | 36 | #endif /* Exporter_hpp */ 37 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/export/ExporterAssimp.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ExporterAssimp.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 13/09/17. 6 | // Copyright © 2017 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef ExporterAssimp_hpp 10 | #define ExporterAssimp_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/meshes/scene/ModelFaceBase.hpp" 14 | #include "kuplung/utilities/parsers/ParserUtils.hpp" 15 | #include 16 | #include "kuplung/objects/ObjectsManager.hpp" 17 | #include 18 | #include 19 | #include 20 | 21 | namespace KuplungApp { namespace Utilities { namespace Export { 22 | 23 | 24 | class ExporterAssimp { 25 | public: 26 | ~ExporterAssimp(); 27 | void init(const std::function& doProgress); 28 | void exportToFile(int exportFormat, const FBEntity& file, const std::vector& faces, const std::vector& settings, std::unique_ptr &managerObjects); 29 | 30 | private: 31 | std::function funcProgress; 32 | std::unique_ptr parserUtils; 33 | std::unique_ptr exporter; 34 | 35 | void saveFile(int exportFormat, aiScene* scene); 36 | 37 | FBEntity exportFile; 38 | std::string nlDelimiter; 39 | bool addSuffix = true; 40 | 41 | std::vector uniqueVertices; 42 | std::vector uniqueTextureCoordinates; 43 | std::vector uniqueNormals; 44 | int vCounter = 1, vtCounter = 1, vnCounter = 1; 45 | 46 | std::vector objSettings; 47 | }; 48 | 49 | }}} 50 | 51 | #endif /* ExporterAssimp_hpp */ 52 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/export/ExporterGLTF.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ExporterGLTF.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 07/08/17. 6 | // Copyright © 2017 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef ExporterGLTF_hpp 10 | #define ExporterGLTF_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/meshes/scene/ModelFaceBase.hpp" 14 | #include "kuplung/utilities/parsers/ParserUtils.hpp" 15 | #include 16 | #include "kuplung/objects/ObjectsManager.hpp" 17 | 18 | namespace KuplungApp { namespace Utilities { namespace Export { 19 | 20 | class ExporterGLTF { 21 | public: 22 | ~ExporterGLTF(); 23 | void init(const std::function& doProgress); 24 | void exportToFile(const FBEntity& file, const std::vector& faces, const std::vector& settings, std::unique_ptr &managerObjects); 25 | 26 | bool BufferInExternalFile; 27 | 28 | private: 29 | std::function funcProgress; 30 | std::unique_ptr parserUtils; 31 | std::vector objSettings; 32 | 33 | void prepFolderLocation(); 34 | const nlohmann::json exportCameras(std::unique_ptr &managerObjects) const; 35 | const nlohmann::json exportScenes(const std::vector& faces) const; 36 | const nlohmann::json copyImage(std::string imagePath) const; 37 | 38 | const bool saveFile(const nlohmann::json& jsonObj) const; 39 | const bool saveBufferFile(std::string buffer) const; 40 | 41 | FBEntity exportFile; 42 | std::string nlDelimiter, exportFileFolder, defaultSceneName, defaultMaterialName; 43 | bool addSuffix = true; 44 | 45 | std::string gltfGenerator, gltfVersion; 46 | }; 47 | 48 | }}} 49 | 50 | #endif /* ExporterGLTF_hpp */ 51 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/export/ExporterOBJ.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ExporterOBJ.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/16/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef ExporterOBJ_hpp 10 | #define ExporterOBJ_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/meshes/scene/ModelFaceBase.hpp" 14 | #include "kuplung/utilities/parsers/ParserUtils.hpp" 15 | #include "kuplung/objects/ObjectsManager.hpp" 16 | 17 | namespace KuplungApp { namespace Utilities { namespace Export { 18 | 19 | class ExporterOBJ { 20 | public: 21 | ~ExporterOBJ(); 22 | void init(const std::function& doProgress); 23 | void exportToFile(const FBEntity& file, const std::vector& faces, const std::vector& settings, std::unique_ptr &managerObjects); 24 | 25 | private: 26 | std::function funcProgress; 27 | 28 | std::unique_ptr parserUtils; 29 | 30 | void exportGeometry(const std::vector& faces); 31 | void exportMaterials(const std::vector& faces); 32 | 33 | void saveFile(const std::string& fileContents, const std::string& fileName) const; 34 | std::string exportMesh(const ModelFaceBase& face); 35 | 36 | FBEntity exportFile; 37 | std::string nlDelimiter; 38 | bool addSuffix = true; 39 | 40 | std::vector uniqueVertices; 41 | std::vector uniqueTextureCoordinates; 42 | std::vector uniqueNormals; 43 | int vCounter = 1, vtCounter = 1, vnCounter = 1; 44 | 45 | std::vector objSettings; 46 | }; 47 | 48 | }}} 49 | 50 | #endif /* ExporterOBJ_hpp */ 51 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/font-parser/FNTParser.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // FNTParser.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/16/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef FNTParser_hpp 10 | #define FNTParser_hpp 11 | 12 | #include 13 | #include "kuplung/settings/Settings.h" 14 | 15 | namespace KuplungApp { namespace Utilities { namespace FontParser { 16 | 17 | struct KuplungFontMapCharacter { 18 | int id, x, y, width, height, xoffset, yoffset, xadvance, page, chnl; 19 | std::string letter; 20 | }; 21 | 22 | struct KuplungFontMap { 23 | int count; 24 | int size, bold, italic, unicode, stretchH, smooth, aa; 25 | int pageid, lineHeight, base, scaleW, scaleH, pages, packed; 26 | int paddingTop, paddingRight, paddingBottom, paddingLeft; 27 | int spacingHorizontal, spacingVertical; 28 | std::string fontName, charset, file; 29 | std::vector characters; 30 | }; 31 | 32 | class FNTParser { 33 | public: 34 | ~FNTParser(); 35 | void init(); 36 | const KuplungFontMap parse(FBEntity const& file); 37 | 38 | private: 39 | KuplungFontMap fm; 40 | 41 | std::regex regex_whiteSpace; // whitespace 42 | std::regex regex_equals; // equals 43 | std::regex regex_info; // info 44 | std::regex regex_common; // common 45 | std::regex regex_page; // page 46 | std::regex regex_chars; // chars 47 | std::regex regex_char; // char 48 | 49 | const std::vector splitString(const std::string &s, std::regex delimiter) const; 50 | }; 51 | 52 | }}} 53 | 54 | #endif /* FNTParser_hpp */ 55 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/gl/GLIncludes.h: -------------------------------------------------------------------------------- 1 | // 2 | // GLIncludes.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/1/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef GLIncludes_h 10 | #define GLIncludes_h 11 | 12 | #ifndef _WIN32 13 | #pragma clang diagnostic push 14 | #pragma clang diagnostic ignored "-Wunused-local-typedefs" 15 | #pragma clang diagnostic ignored "-Wunused-private-field" 16 | #pragma clang diagnostic ignored "-Wunused-parameter" 17 | #pragma clang diagnostic ignored "-Wextern-c-compat" 18 | #pragma clang diagnostic ignored "-Wunknown-pragmas" 19 | #pragma clang diagnostic ignored "-Wunused-function" 20 | #pragma clang diagnostic ignored "-W#warnings" 21 | #pragma clang diagnostic ignored "-Wpadded" 22 | #endif 23 | 24 | #include 25 | #ifdef _WIN32 26 | #undef main 27 | #endif 28 | 29 | #ifdef _WIN32 30 | #include 31 | #include 32 | #else 33 | //#include 34 | //#include 35 | #endif 36 | 37 | #define GL_GLEXT_PROTOTYPES 1 38 | #include 39 | 40 | #ifndef _WIN32 41 | #pragma clang diagnostic pop 42 | #endif 43 | 44 | #endif /* GLIncludes_h */ 45 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/gl/GLUtils.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // GLUtils.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/1/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef GLUtils_hpp 10 | #define GLUtils_hpp 11 | 12 | #include 13 | #include 14 | #include 15 | #include "kuplung/utilities/gl/GLIncludes.h" 16 | 17 | namespace KuplungApp { namespace Utilities { namespace GL { 18 | 19 | class GLUtils { 20 | public: 21 | ~GLUtils(); 22 | explicit GLUtils(const std::function& logFunction); 23 | GLUtils(); 24 | bool compileAndAttachShader(GLuint &shaderProgram, GLuint &shader, GLenum shaderType, const char *shader_source); 25 | bool compileShader(GLuint &shader, GLenum shaderType, const char *shader_source); 26 | std::string readFile(const char *filePath); 27 | void CheckForGLErrors(const std::string& message); 28 | 29 | void printProgramLog(GLuint program); 30 | void printShaderLog(GLuint shader); 31 | bool logOpenGLError(const char *file, int line); 32 | GLint glGetAttribute(GLuint program, const char* var_name); 33 | GLint glGetUniform(GLuint program, const char* var_name); 34 | GLint glGetAttributeNoWarning(GLuint program, const char* var_name); 35 | GLint glGetUniformNoWarning(GLuint program, const char* var_name); 36 | GLsizei getGLTypeSize(GLenum type); 37 | 38 | private: 39 | std::function funcLog; 40 | std::vector reportedErrors; 41 | }; 42 | 43 | }}} 44 | 45 | #endif /* GLUtils_hpp */ 46 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/helpers/DateTimes.h: -------------------------------------------------------------------------------- 1 | // 2 | // DateTimes.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 6/3/25. 6 | // Copyright © 2025 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef DateTimes_h 10 | #define DateTimes_h 11 | 12 | #include 13 | 14 | namespace Kuplung::Helpers { 15 | static const inline std::string getDateToStringFormatted(const std::chrono::system_clock::duration& duration, const std::string& dateFormat) { 16 | const auto epoch = std::chrono::time_point(); 17 | const auto dur = std::chrono::duration_cast(std::chrono::duration(duration)); 18 | const auto oldNow = epoch + dur; 19 | const auto t_c = std::chrono::system_clock::to_time_t(oldNow); 20 | std::stringstream ss; 21 | ss << std::put_time(std::localtime(&t_c), dateFormat.c_str()); 22 | return ss.str(); 23 | } 24 | } // namespace Kuplung::Helpers 25 | 26 | #endif /* DateTimes_h */ 27 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/helpers/Files.h: -------------------------------------------------------------------------------- 1 | // 2 | // Files.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 6/3/25. 6 | // Copyright © 2025 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef Files_h 10 | #define Files_h 11 | 12 | #include 13 | 14 | namespace Kuplung::Helpers { 15 | static inline bool isHidden(const std::string& fileName) { 16 | return fileName == ".." || fileName == "." || fileName.compare(0, 1, "."); 17 | } 18 | } // namespace Kuplung::helpers 19 | 20 | #endif /* Files_h */ 21 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/helpers/Helpers.h: -------------------------------------------------------------------------------- 1 | // 2 | // Helpers.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 6/3/25. 6 | // Copyright © 2025 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef Helpers_h 10 | #define Helpers_h 11 | 12 | #include "DateTimes.h" 13 | #include "Files.h" 14 | #include "Strings.h" 15 | 16 | #endif /* Helpers_h */ 17 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/helpers/Strings.h: -------------------------------------------------------------------------------- 1 | // 2 | // Strings.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 6/3/25. 6 | // Copyright © 2025 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef Strings_h 10 | #define Strings_h 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Kuplung::Helpers { 17 | static inline std::string trim(const std::string& line) { 18 | const char* WhiteSpace = " \t\v\r\n"; 19 | std::size_t start = line.find_first_not_of(WhiteSpace); 20 | std::size_t end = line.find_last_not_of(WhiteSpace); 21 | return start == end ? std::string() : line.substr(start, end - start + 1); 22 | } 23 | 24 | static inline std::string trimRight(const std::string& line) { 25 | const char* WhiteSpace = " \t\v\r\n"; 26 | std::size_t start = 0; 27 | std::size_t end = line.find_last_not_of(WhiteSpace); 28 | return start == end ? std::string() : line.substr(0, end + 1); 29 | } 30 | 31 | static inline std::vector splitString(const std::string& s, char delimiter) { 32 | std::vector tokens; 33 | std::string token; 34 | std::istringstream tokenStream(s); 35 | while (std::getline(tokenStream, token, delimiter)) { 36 | tokens.push_back(token); 37 | } 38 | return tokens; 39 | } 40 | 41 | static inline std::string joinElementsToString(const std::vector& elements, char delimiter) { 42 | std::ostringstream s; 43 | for (const auto& i : elements) { 44 | if (&i != &elements[0]) { 45 | s << delimiter; 46 | } 47 | s << i; 48 | } 49 | return s.str(); 50 | } 51 | } // namespace Kuplung::helpers 52 | 53 | #endif /* Strings_h */ 54 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/imgui/imgui_impl_sdl.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for SDL2 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | // (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.) 4 | 5 | // Implemented features: 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Clipboard support. 8 | // [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE). 9 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 10 | // Missing features: 11 | // [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME. 12 | 13 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 14 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 15 | // https://github.com/ocornut/imgui 16 | 17 | #pragma once 18 | 19 | struct SDL_Window; 20 | typedef union SDL_Event SDL_Event; 21 | 22 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* sdl_gl_context); 23 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window); 24 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window); 25 | IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown(); 26 | IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame(SDL_Window* window); 27 | IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event); 28 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/input/Controls.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Controls.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/9/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef Controls_hpp 10 | #define Controls_hpp 11 | 12 | #include 13 | #ifdef _WIN32 14 | # undef main 15 | #endif 16 | #include "kuplung/settings/Settings.h" 17 | 18 | namespace KuplungApp { 19 | namespace Utilities { 20 | namespace Input { 21 | 22 | struct ControlPoint { 23 | int x, y; 24 | }; 25 | 26 | class Controls { 27 | public: 28 | Controls(); 29 | ~Controls(); 30 | void init(SDL_Window* sdlWindow); 31 | void processEvents(const SDL_Event* ev); 32 | 33 | bool gameIsRunning, keyPressed_ESC, keyPressed_DELETE; 34 | 35 | bool mouseButton_LEFT, mouseButton_MIDDLE, mouseButton_RIGHT; 36 | bool mouseGoLeft, mouseGoRight, mouseGoUp, mouseGoDown; 37 | 38 | bool keyPressed_LALT, keyPressed_LSHIFT, keyPressed_LCTRL; 39 | bool keyPressed_RALT, keyPressed_RSHIFT, keyPressed_RCTRL; 40 | bool keyPresset_TAB; 41 | 42 | int xrel, yrel; 43 | 44 | ControlPoint mouseWheel, mousePosition; 45 | 46 | private: 47 | SDL_Window* sdlWindow; 48 | 49 | void handleInput(const SDL_Event* ev); 50 | void handleKeyDown(const SDL_Event* ev); 51 | void handleMouse(const SDL_Event* ev); 52 | void handleMouseWheel(const SDL_Event* ev); 53 | void handleMouseMotion(const SDL_Event* ev); 54 | }; 55 | 56 | } // namespace Input 57 | } // namespace Utilities 58 | } // namespace KuplungApp 59 | 60 | #endif /* Controls_hpp */ 61 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/lua/LuaManager.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // LuaManager.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 14/3/17. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef LuaManager_hpp 10 | #define LuaManager_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | 14 | #ifdef __cplusplus 15 | #include 16 | #else 17 | #include 18 | #include 19 | #include 20 | #endif 21 | 22 | namespace KuplungApp { namespace Utilities { namespace Lua { 23 | 24 | class LuaManager { 25 | public: 26 | LuaManager(); 27 | void initLua(); 28 | void closeLua(); 29 | void checkLuaErrors(); 30 | 31 | void execute(const std::string& fileName); 32 | static int testFromLua(lua_State *state); 33 | 34 | private: 35 | lua_State *luaState; 36 | }; 37 | 38 | }}} 39 | 40 | #endif /* LuaManager_hpp */ 41 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/maths/Maths.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Maths.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/1/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef Maths_hpp 10 | #define Maths_hpp 11 | 12 | #include 13 | #include 14 | 15 | namespace KuplungApp { namespace Utilities { namespace Math { 16 | 17 | class Maths { 18 | public: 19 | void computeTangentBasis( 20 | // inputs 21 | std::vector &vertices, 22 | std::vector &uvs, 23 | std::vector &normals, 24 | // outputs 25 | std::vector &tangents, 26 | std::vector &bitangents 27 | ) const; 28 | }; 29 | 30 | }}} 31 | 32 | #endif /* Maths_hpp */ 33 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/measurement/Timings.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Timings.cpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/1/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #include "Timings.hpp" 10 | 11 | namespace KuplungApp { 12 | namespace Utilities { 13 | namespace Measurement { 14 | 15 | std::chrono::high_resolution_clock::time_point tStart; 16 | std::chrono::high_resolution_clock::time_point tEnd; 17 | 18 | void timingStart() { 19 | tStart = std::chrono::high_resolution_clock::now(); 20 | } 21 | 22 | void timingEnd() { 23 | tEnd = std::chrono::high_resolution_clock::now(); 24 | } 25 | 26 | void timingPrint() { 27 | auto durationMS = std::chrono::duration_cast(tEnd - tStart).count(); 28 | auto duration_seconds = durationMS * pow(10, -6); 29 | Settings::Instance()->funcDoLog(Settings::Instance()->string_format("[TIMINGS] %f seconds", duration_seconds)); 30 | } 31 | 32 | void timingPrintPretty(const char* fileName, const char* functionName, const int lineNumber) { 33 | auto durationMS = std::chrono::duration_cast(tEnd - tStart).count(); 34 | auto durationS = durationMS * pow(10, -6); 35 | Settings::Instance()->funcDoLog(Settings::Instance()->string_format("[TIMINGS] %f s: [%s] @ [%s] on line [%i]", durationS, fileName, functionName, lineNumber)); 36 | } 37 | 38 | } // namespace Measurement 39 | } // namespace Utilities 40 | } // namespace KuplungApp 41 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/measurement/Timings.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Timings.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/1/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef Timings_hpp 10 | #define Timings_hpp 11 | 12 | #include 13 | #include "kuplung/settings/Settings.h" 14 | 15 | #define TimingStart() KuplungApp::Utilities::Measurement::timingStart(); 16 | #define TimingEnd() KuplungApp::Utilities::Measurement::timingEnd(); 17 | #define TimingPrint() KuplungApp::Utilities::Measurement::timingPrint(); 18 | #define TimingPrintPretty(fileName, functionName, lineNumber) KuplungApp::Utilities::Measurement::timingPrintPretty(fileName, functionName, lineNumber); 19 | 20 | namespace KuplungApp { namespace Utilities { namespace Measurement { 21 | 22 | void timingStart(); 23 | void timingEnd(); 24 | void timingPrint(); 25 | // KuplungApp::Utilities::Measurement::timingPrintPretty(__FILE__, __PRETTY_FUNCTION__, __LINE__); 26 | void timingPrintPretty(const char* fileName, const char* functionName, const int lineNumber); 27 | 28 | }}} 29 | 30 | #endif /* Timings_hpp */ 31 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/miniz/KuplungMiniz.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // KuplungMiniz.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/17/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef KuplungMiniz_hpp 10 | #define KuplungMiniz_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "miniz.h" 14 | 15 | namespace KuplungApp { namespace Utilities { namespace Miniz { 16 | 17 | class KuplungMiniz { 18 | public: 19 | ~KuplungMiniz(void); 20 | 21 | void createZipFile(const std::string& zipFilename); 22 | int addFileToArchive(const std::string& contentPath, const std::string& zipPath=""); 23 | bool unzipArchive(std::string const& archiveFile, std::string const& archiveFolder); 24 | void closeZipFile(); 25 | 26 | private: 27 | mz_zip_archive zipFile; 28 | }; 29 | 30 | }}} 31 | 32 | #endif /* KuplungMiniz_hpp */ 33 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/parsers/FileModelManager.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // FileModelManager.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 1/2/16. 6 | // Copyright © 2016 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef FileModelManager_hpp 10 | #define FileModelManager_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/utilities/parsers/ModelObject.h" 14 | #include "kuplung/utilities/parsers/obj-parser/objParser1.hpp" 15 | #include "kuplung/utilities/parsers/obj-parser/objParser2.hpp" 16 | #ifdef DEF_KuplungSetting_UseCuda 17 | #include "kuplung/utilities/parsers/obj-parser/objParserCuda.hpp" 18 | #endif 19 | #include "kuplung/utilities/parsers/stl-parser/STLParser.hpp" 20 | #include "kuplung/utilities/parsers/ply-parser/PLYParser.hpp" 21 | #include "kuplung/utilities/parsers/assimp-parser/AssimpParser.hpp" 22 | #include "kuplung/utilities/parsers/gltf-parser/GLTFParser.hpp" 23 | #include "kuplung/ui/components/FileBrowser.hpp" 24 | #include 25 | 26 | class FileModelManager { 27 | public: 28 | ~FileModelManager(); 29 | FileModelManager(); 30 | void init(const std::function& doProgress); 31 | std::vector parse(FBEntity file, std::vector settings); 32 | 33 | private: 34 | std::function funcProgress; 35 | void doProgress(float value); 36 | 37 | std::unique_ptr parserOBJ1; 38 | std::unique_ptr parserOBJ2; 39 | #ifdef DEF_KuplungSetting_UseCuda 40 | std::unique_ptr parserOBJCuda; 41 | #endif 42 | std::unique_ptr parserSTL; 43 | std::unique_ptr parserPLY; 44 | std::unique_ptr parserAssimp; 45 | std::unique_ptr parserGLTF; 46 | }; 47 | 48 | #endif /* FileModelManager_hpp */ 49 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/parsers/ParserUtils.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ParserUtils.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 1/2/16. 6 | // Copyright © 2016 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef ParserUtils_hpp 10 | #define ParserUtils_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include 14 | 15 | class ParserUtils { 16 | public: 17 | glm::vec3 fixVectorAxis(glm::vec3 v, int indexForward, int indexUp); 18 | }; 19 | 20 | #endif /* ParserUtils_hpp */ 21 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/parsers/assimp-parser/AssimpParser.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // AssimpParser.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 1/2/16. 6 | // Copyright © 2016 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef AssimpParser_hpp 10 | #define AssimpParser_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/utilities/parsers/ModelObject.h" 14 | #include "kuplung/utilities/gl/GLIncludes.h" 15 | #include "kuplung/utilities/parsers/ParserUtils.hpp" 16 | #include 17 | #include 18 | #include 19 | 20 | class AssimpParser { 21 | public: 22 | ~AssimpParser(); 23 | void init(const std::function& doProgress); 24 | std::vector parse(const FBEntity& file, const std::vector& settings); 25 | 26 | std::vector vertices, normals; 27 | 28 | private: 29 | std::function funcProgress; 30 | 31 | std::unique_ptr parserUtils; 32 | 33 | FBEntity file; 34 | std::vector models; 35 | Assimp::Importer parser; 36 | 37 | int indexModel = -1, indexFace = -1, indexMaterial = -1, indicesCounter = 0, modelID = 1, faceID = 1, meshCounter = 0; 38 | std::vector vectorsVertices, vectorsNormals; 39 | std::vector vectorsTextureCoordinates; 40 | std::vector textures_loaded; 41 | 42 | void processNode(aiNode* node, const aiScene* scene); 43 | MeshModel processMesh(aiMesh* mesh, const aiScene* scene, const std::string& modelTitle); 44 | std::vector loadMaterialTextures(aiMaterial* mat, aiTextureType type); 45 | }; 46 | 47 | #endif /* AssimpParser_hpp */ 48 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/parsers/gltf-parser/GLTFParser.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // GLTFParser.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 07/08/17. 6 | // Copyright © 2016 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef GLTFParser_hpp 10 | #define GLTFParser_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/utilities/parsers/ParserUtils.hpp" 14 | #include "kuplung/utilities/parsers/ModelObject.h" 15 | #include 16 | 17 | class GLTFParser { 18 | public: 19 | GLTFParser(); 20 | ~GLTFParser(); 21 | void init(const std::function& doProgress); 22 | std::vector parse(const FBEntity& file, const std::vector& settings); 23 | 24 | private: 25 | std::function doProgress; 26 | std::vector models; 27 | }; 28 | 29 | #endif /* GLTFParser_hpp */ 30 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/parsers/obj-parser/objParserCuda.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // objParserCuda.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 11/19/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifdef DEF_KuplungSetting_UseCuda 10 | 11 | #ifndef objParserCuda_hpp 12 | #define objParserCuda_hpp 13 | 14 | #include "kuplung/settings/Settings.h" 15 | #include "kuplung/utilities/parsers/ModelObject.h" 16 | 17 | class objParserCuda { 18 | public: 19 | ~objParserCuda(); 20 | void init(const std::function& doProgress); 21 | std::vector parse(const FBEntity& file, const std::vector& settings); 22 | 23 | private: 24 | FBEntity file; 25 | std::function doProgress; 26 | int objFileLinesCount = 0; 27 | std::vector models; 28 | 29 | void doParse(std::string const& obj_file_contents, int length); 30 | }; 31 | 32 | #endif /* objParserCuda_hpp */ 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/parsers/ply-parser/PLYParser.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // PLYParser.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 1/2/16. 6 | // Copyright © 2016 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef PLYParser_hpp 10 | #define PLYParser_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/utilities/parsers/ModelObject.h" 14 | 15 | class PLYParser { 16 | public: 17 | PLYParser(); 18 | ~PLYParser(); 19 | void init(const std::function& doProgress); 20 | std::vector parse(const FBEntity& file, const std::vector& settings); 21 | 22 | std::vector vertices, normals; 23 | 24 | private: 25 | std::function funcProgress; 26 | std::vector models; 27 | 28 | int Setting_Axis_Forward, Setting_Axis_Up; 29 | 30 | void loadAsciiFile(const FBEntity& file); 31 | }; 32 | 33 | #endif /* PLYParser_hpp */ 34 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/parsers/stl-parser/STLParser.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // STLParser.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 1/2/16. 6 | // Copyright © 2016 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef STLParser_hpp 10 | #define STLParser_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/utilities/parsers/ParserUtils.hpp" 14 | #include "kuplung/utilities/parsers/ModelObject.h" 15 | #include 16 | 17 | class STLParser { 18 | public: 19 | STLParser(); 20 | ~STLParser(); 21 | void init(const std::function& doProgress); 22 | std::vector parse(const FBEntity& file, const std::vector& settings); 23 | 24 | std::vector vertices, normals; 25 | 26 | private: 27 | std::function doProgress; 28 | std::vector models; 29 | 30 | std::unique_ptr parserUtils; 31 | 32 | int Setting_Axis_Forward, Setting_Axis_Up; 33 | 34 | bool isBinarySTL(const char* buffer, unsigned int fileSize); 35 | bool isAsciiSTL(const char* buffer, unsigned int fileSize); 36 | 37 | template 38 | bool skipSpaces(const char_t** inout); 39 | 40 | template 41 | bool skipSpaces(const char_t* in, const char_t** out); 42 | 43 | template 44 | bool isLineEnd(char_t in); 45 | 46 | bool loadBinaryFile(const FBEntity& file, unsigned int fileSize); 47 | bool loadAsciiFile(const FBEntity& file); 48 | 49 | glm::vec3 parsePoint(std::ifstream& s); 50 | float parseFloat(std::ifstream& s); 51 | }; 52 | 53 | #endif /* STLParser_hpp */ 54 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/renderers/ImageRenderer.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // ImageRenderer.cpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/16/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #include "ImageRenderer.hpp" 10 | 11 | ImageRenderer::ImageRenderer(ObjectsManager &managerObjects) : managerObjects(managerObjects) { 12 | } 13 | 14 | void ImageRenderer::init() { 15 | this->rendererScene = std::make_unique(this->managerObjects); 16 | this->rendererScene->init(); 17 | 18 | this->rendererDefaultForward = std::make_unique(this->managerObjects); 19 | this->rendererDefaultForward->init(); 20 | 21 | this->rendererRayTracer = std::make_unique(this->managerObjects); 22 | this->rendererRayTracer->init(); 23 | } 24 | 25 | const std::string ImageRenderer::renderImage(ImageRendererType type, const FBEntity& file, std::vector *meshModelFaces) const { 26 | if (type == ImageRendererType_Scene) 27 | return this->rendererScene->renderImage(file, meshModelFaces); 28 | else if (type == ImageRendererType_DefaultForward) 29 | return this->rendererDefaultForward->renderImage(file, meshModelFaces); 30 | else if (type == ImageRendererType_RayTracer) 31 | return this->rendererRayTracer->renderImage(file, meshModelFaces); 32 | return ""; 33 | } 34 | 35 | void ImageRenderer::showSpecificSettings(ImageRendererType type) const { 36 | if (type == ImageRendererType_Scene) 37 | return this->rendererScene->showSpecificSettings(); 38 | else if (type == ImageRendererType_DefaultForward) 39 | return this->rendererDefaultForward->showSpecificSettings(); 40 | else if (type == ImageRendererType_RayTracer) 41 | return this->rendererRayTracer->showSpecificSettings(); 42 | } 43 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/renderers/ImageRenderer.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ImageRenderer.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/16/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef ImageRenderer_hpp 10 | #define ImageRenderer_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/utilities/renderers/scene-renderer/SceneRenderer.hpp" 14 | #include "kuplung/utilities/renderers/default-forward/DefaultForwardRenderer.hpp" 15 | #include "kuplung/utilities/renderers/ray-tracer/RayTracerRenderer.hpp" 16 | #include "kuplung/objects/ObjectsManager.hpp" 17 | #include "kuplung/meshes/scene/ModelFaceBase.hpp" 18 | 19 | typedef enum ImageRendererType { 20 | ImageRendererType_Scene, 21 | ImageRendererType_DefaultForward, 22 | ImageRendererType_DefaultForwardShadowMapping, 23 | ImageRendererType_RayTracer 24 | } ImageRendererType; 25 | 26 | class ImageRenderer { 27 | public: 28 | explicit ImageRenderer(ObjectsManager &managerObjects); 29 | void init(); 30 | const std::string renderImage(ImageRendererType type, const FBEntity& file, std::vector *meshModelFaces) const; 31 | void showSpecificSettings(ImageRendererType type) const; 32 | 33 | private: 34 | ObjectsManager &managerObjects; 35 | std::unique_ptr rendererScene; 36 | std::unique_ptr rendererDefaultForward; 37 | std::unique_ptr rendererRayTracer; 38 | }; 39 | 40 | #endif /* ImageRenderer_hpp */ 41 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/renderers/KuplungRendererBase.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // KuplungRendererBase.cpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/16/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #include "KuplungRendererBase.hpp" 10 | 11 | void KuplungRendererBase::init() { 12 | } 13 | 14 | std::string KuplungRendererBase::renderImage(const FBEntity& file, std::vector *meshModelFaces) { 15 | return ""; 16 | } 17 | 18 | void KuplungRendererBase::showSpecificSettings() { 19 | } 20 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/renderers/KuplungRendererBase.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // KuplungRendererBase.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/16/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef KuplungRendererBase_hpp 10 | #define KuplungRendererBase_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/meshes/scene/ModelFaceBase.hpp" 14 | 15 | class KuplungRendererBase { 16 | public: 17 | virtual ~KuplungRendererBase() = default; 18 | virtual void init(); 19 | virtual std::string renderImage(const FBEntity& file, std::vector *meshModelFaces); 20 | virtual void showSpecificSettings(); 21 | 22 | bool Setting_RenderSkybox; 23 | }; 24 | 25 | #endif /* KuplungRendererBase_hpp */ 26 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/renderers/ray-tracer/RayTracerRenderer.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // RayTracerRenderer.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/16/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef RayTracerRenderer_hpp 10 | #define RayTracerRenderer_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/meshes/scene/ModelFaceBase.hpp" 14 | #include "kuplung/meshes/scene/ModelFaceData.hpp" 15 | #include "kuplung/objects/ObjectsManager.hpp" 16 | #include "kuplung/utilities/renderers/KuplungRendererBase.hpp" 17 | 18 | class RayTracerRenderer: public KuplungRendererBase { 19 | public: 20 | explicit RayTracerRenderer(ObjectsManager &managerObjects); 21 | ~RayTracerRenderer(); 22 | void init(); 23 | std::string renderImage(FBEntity const& file, std::vector *meshModelFaces); 24 | 25 | private: 26 | FBEntity fileOutputImage; 27 | 28 | ObjectsManager &managerObjects; 29 | 30 | GLuint renderFBO, renderRBO, renderTextureColorBuffer; 31 | void createFBO(); 32 | void generateAttachmentTexture(GLboolean depth, GLboolean stencil); 33 | void renderSceneToFBO(std::vector *meshModelFaces) const; 34 | }; 35 | 36 | #endif /* RayTracerRenderer_hpp */ 37 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/renderers/scene-renderer/SceneRenderer.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // SceneRenderer.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/16/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef SceneRenderer_hpp 10 | #define SceneRenderer_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/meshes/scene/ModelFaceBase.hpp" 14 | #include "kuplung/objects/ObjectsManager.hpp" 15 | #include "kuplung/utilities/renderers/KuplungRendererBase.hpp" 16 | 17 | class SceneRenderer: public KuplungRendererBase { 18 | public: 19 | explicit SceneRenderer(ObjectsManager &managerObjects); 20 | void init(); 21 | const std::string renderImage(const FBEntity& file, std::vector *meshModelFaces) const; 22 | const std::string renderImage2(const FBEntity& file, std::vector *meshModelFaces) const; 23 | 24 | private: 25 | ObjectsManager &managerObjects; 26 | }; 27 | 28 | #endif /* SceneRenderer_hpp */ 29 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/saveopen/SaveOpen.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // SaveOpen.cpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/1/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #include "SaveOpen.hpp" 10 | 11 | void SaveOpen::init() { 12 | this->entBinarySeq = std::make_unique(); 13 | this->entBinarySeq->init(); 14 | 15 | this->entGProtocolBufs = std::make_unique(); 16 | this->entGProtocolBufs->init(); 17 | } 18 | 19 | void SaveOpen::saveKuplungFile(const FBEntity& file, std::unique_ptr &managerObjects, const std::vector& meshModelFaces) { 20 | // this->entBinarySeq->saveKuplungFile(file, managerObjects, meshModelFaces); 21 | this->entGProtocolBufs->saveKuplungFile(file, managerObjects, meshModelFaces); 22 | } 23 | 24 | const std::vector SaveOpen::openKuplungFile(const FBEntity& file, std::unique_ptr &managerObjects) const { 25 | // return this->entBinarySeq->openKuplungFile(file, managerObjects); 26 | return this->entGProtocolBufs->openKuplungFile(file, managerObjects); 27 | } 28 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/saveopen/SaveOpen.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // SaveOpen.hpp 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 12/1/15. 6 | // Copyright © 2015 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef SaveOpen_hpp 10 | #define SaveOpen_hpp 11 | 12 | #include "kuplung/settings/Settings.h" 13 | #include "kuplung/objects/ObjectsManager.hpp" 14 | #include "kuplung/meshes/scene/ModelFaceData.hpp" 15 | #include "kuplung/utilities/saveopen/SaveOpenBinarySeq.hpp" 16 | #include "kuplung/utilities/saveopen/SaveOpenGProtocolBufs.hpp" 17 | 18 | class SaveOpen { 19 | public: 20 | void init(); 21 | void saveKuplungFile(const FBEntity& file, std::unique_ptr &managerObjects, const std::vector& meshModelFaces); 22 | const std::vector openKuplungFile(const FBEntity& file, std::unique_ptr &managerObjects) const; 23 | 24 | private: 25 | std::unique_ptr entBinarySeq; 26 | std::unique_ptr entGProtocolBufs; 27 | }; 28 | 29 | #endif /* SaveOpen_hpp */ 30 | -------------------------------------------------------------------------------- /Kuplung/kuplung/utilities/shapes/Shapes.h: -------------------------------------------------------------------------------- 1 | // 2 | // Shapes.h 3 | // Kuplung 4 | // 5 | // Created by Sergey Petrov on 2/1/16. 6 | // Copyright © 2016 supudo.net. All rights reserved. 7 | // 8 | 9 | #ifndef Shapes_h 10 | #define Shapes_h 11 | 12 | typedef enum ShapeType { 13 | ShapeType_BrickWall, 14 | ShapeType_MaterialBall, 15 | ShapeType_MaterialBallBlender, 16 | ShapeType_Epcot, 17 | ShapeType_Cone, 18 | ShapeType_Cube, 19 | ShapeType_Cylinder, 20 | ShapeType_Grid, 21 | ShapeType_IcoSphere, 22 | ShapeType_MonkeyHead, 23 | ShapeType_Plane, 24 | ShapeType_PlaneObjects, 25 | ShapeType_PlaneObjectsLargePlane, 26 | ShapeType_Triangle, 27 | ShapeType_Torus, 28 | ShapeType_Tube, 29 | ShapeType_UVSphere 30 | } ShapeType; 31 | 32 | #endif /* Shapes_h */ 33 | -------------------------------------------------------------------------------- /Kuplung/main.cpp: -------------------------------------------------------------------------------- 1 | #include "kuplung/Kuplung.hpp" 2 | 3 | /// @mainpage Kuplung - OpenGL 3D Viewer 4 | /// 5 | /// @section intro Introduction 6 | /// 7 | /// This application represents trials and errors collection - 8 | /// adventure in C/C++ development and learning.
9 | /// It is by no means correct or exhaustive and is still work in progress.
10 | /// 11 | /// @section using Using 12 | /// 13 | /// 23 | /// 24 | /// @section built Built with 25 | /// 26 | /// 30 | /// 31 | /// @section contact Contact 32 | /// 33 | /// Contact supudo for questions about everything.
34 | /// Send your questions and comments to supudo@gmail.com
35 | /// http://supudo.net 36 | 37 | int main() { 38 | //FIXME: Remove for prod 39 | setbuf(stdout, NULL); 40 | 41 | Kuplung app; 42 | return app.run(); 43 | } 44 | -------------------------------------------------------------------------------- /Kuplung/resources/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "icon_16x16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "icon_16x16@2x.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "icon_32x32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "icon_32x32@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "icon_128x128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "icon_128x128@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "icon_256x256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "icon_256x256@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "icon_512x512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "icon_512x512@2x.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_128x128.png -------------------------------------------------------------------------------- /Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_128x128@2x.png -------------------------------------------------------------------------------- /Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_16x16.png -------------------------------------------------------------------------------- /Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_16x16@2x.png -------------------------------------------------------------------------------- /Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_256x256.png -------------------------------------------------------------------------------- /Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_256x256@2x.png -------------------------------------------------------------------------------- /Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_32x32.png -------------------------------------------------------------------------------- /Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_32x32@2x.png -------------------------------------------------------------------------------- /Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_512x512.png -------------------------------------------------------------------------------- /Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/Kuplung/resources/Images.xcassets/AppIcon.appiconset/icon_512x512@2x.png -------------------------------------------------------------------------------- /Kuplung/resources/Kuplung.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/Kuplung/resources/Kuplung.icns -------------------------------------------------------------------------------- /Kuplung/resources/Kuplung.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/Kuplung/resources/Kuplung.ico -------------------------------------------------------------------------------- /Kuplung/resources/Kuplung_RecentFiles.ini: -------------------------------------------------------------------------------- 1 | # Kuplung Recent Files file 2 | -------------------------------------------------------------------------------- /Kuplung/resources/Kuplung_RecentFilesImported.ini: -------------------------------------------------------------------------------- 1 | # Kuplung Recent Files file 2 | -------------------------------------------------------------------------------- /Kuplung/resources/Kuplung_Settings.ini: -------------------------------------------------------------------------------- 1 | # Kuplung Settings file 2 | 3 | # App settings 4 | appVersion = 1.0 d 5 | currentFolder = 6 | UIFontFile = 7 | UIFontSize = 14.0 8 | ModelFileParser = 0 9 | ImportExportFormat = 0 10 | RendererType = 1 11 | GUISystem = 1 12 | UseCuda = 1 13 | 14 | # Debug 15 | wireframesMode = false 16 | logDebugInfo = true 17 | logFileBrowser = false 18 | showPickRays = false 19 | showPickRaysSingle = true 20 | shouldRecompileShaders = false 21 | showGLErrors = true 22 | showFrameRenderTime = true 23 | 24 | # SDL & Window Settings 25 | SDL_Window_Flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE 26 | SDL_Window_Width = 0 27 | SDL_Window_Height = 0 28 | 29 | # GUI - selection & bounding box 30 | ShowBoundingBox = true 31 | BoundingBoxPadding = 0.01 32 | 33 | # GUI - clear color 34 | guiClearColor = {70.0 / 255.0, 70.0 / 255.0, 70.0 / 255.0, 255.0 / 255.0} 35 | 36 | # GUI - log frame settings 37 | frameLog_Width = 400 38 | frameLog_Height = 400 39 | 40 | # GUI - file browser frame settings 41 | frameFileBrowser_Width = 500 42 | frameFileBrowser_Height = 300 43 | 44 | # Terrain 45 | Terrain_HeightmapImageHistory = false 46 | 47 | # Consumption refresh interval in seconds 48 | Consumption_Interval_CPU = 5 49 | Consumption_Interval_Memory = 5 50 | -------------------------------------------------------------------------------- /Kuplung/resources/axis_helpers/x_minus.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl MaterialX 5 | Ns 94.117647 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.640000 0.000674 0.000000 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.000000 11 | d 1.000000 12 | illum 2 13 | -------------------------------------------------------------------------------- /Kuplung/resources/axis_helpers/x_minus.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.78 (sub 0) OBJ File: '' 2 | # www.blender.org 3 | mtllib x_minus.mtl 4 | o XMinus 5 | v 0.748000 0.174000 0.000000 6 | v 0.991000 0.267000 0.000000 7 | v 0.748000 0.267000 0.000000 8 | v 0.991000 0.174000 0.000000 9 | v 0.296000 0.353000 0.000000 10 | v 0.142000 0.682000 0.000000 11 | v 0.023000 0.682000 0.000000 12 | v 0.356000 0.422000 0.000000 13 | v 0.687000 0.682000 0.000000 14 | v 0.569000 0.682000 0.000000 15 | v 0.415000 0.353000 0.000000 16 | v 0.002000 0.000000 0.000000 17 | v 0.356000 0.282000 0.000000 18 | v 0.706000 0.000000 0.000000 19 | v 0.121000 0.000000 0.000000 20 | v 0.588000 0.000000 0.000000 21 | vn 0.0000 0.0000 1.0000 22 | usemtl MaterialX 23 | s 1 24 | f 1//1 2//1 3//1 25 | f 1//1 4//1 2//1 26 | f 5//1 6//1 7//1 27 | f 5//1 8//1 6//1 28 | f 8//1 9//1 10//1 29 | f 8//1 11//1 9//1 30 | f 5//1 11//1 8//1 31 | f 12//1 11//1 5//1 32 | f 12//1 13//1 11//1 33 | f 13//1 14//1 11//1 34 | f 12//1 15//1 13//1 35 | f 16//1 14//1 13//1 36 | -------------------------------------------------------------------------------- /Kuplung/resources/axis_helpers/x_plus.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl MaterialX 5 | Ns 94.117647 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.640000 0.000674 0.000000 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.000000 11 | d 1.000000 12 | illum 2 13 | -------------------------------------------------------------------------------- /Kuplung/resources/axis_helpers/x_plus.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.78 (sub 0) OBJ File: '' 2 | # www.blender.org 3 | mtllib x_plus.mtl 4 | o XPlus 5 | v 0.959000 0.394000 0.000000 6 | v 1.041000 0.589000 0.000000 7 | v 0.959000 0.589000 0.000000 8 | v 1.041000 0.394000 0.000000 9 | v 0.764000 0.312000 0.000000 10 | v 0.764000 0.394000 0.000000 11 | v 1.236000 0.394000 0.000000 12 | v 1.236000 0.312000 0.000000 13 | v 0.959000 0.312000 0.000000 14 | v 0.959000 0.117000 0.000000 15 | v 1.041000 0.312000 0.000000 16 | v 1.041000 0.117000 0.000000 17 | v 0.296000 0.353000 0.000000 18 | v 0.142000 0.682000 0.000000 19 | v 0.023000 0.682000 0.000000 20 | v 0.356000 0.422000 0.000000 21 | v 0.687000 0.682000 0.000000 22 | v 0.569000 0.682000 0.000000 23 | v 0.415000 0.353000 0.000000 24 | v 0.002000 0.000000 0.000000 25 | v 0.356000 0.282000 0.000000 26 | v 0.706000 0.000000 0.000000 27 | v 0.121000 0.000000 0.000000 28 | v 0.588000 0.000000 0.000000 29 | vn 0.0000 0.0000 1.0000 30 | usemtl MaterialX 31 | s 1 32 | f 1//1 2//1 3//1 33 | f 1//1 4//1 2//1 34 | f 5//1 1//1 6//1 35 | f 5//1 4//1 1//1 36 | f 5//1 7//1 4//1 37 | f 5//1 8//1 7//1 38 | f 9//1 8//1 5//1 39 | f 10//1 11//1 9//1 40 | f 11//1 8//1 9//1 41 | f 10//1 12//1 11//1 42 | f 13//1 14//1 15//1 43 | f 13//1 16//1 14//1 44 | f 16//1 17//1 18//1 45 | f 16//1 19//1 17//1 46 | f 13//1 19//1 16//1 47 | f 20//1 19//1 13//1 48 | f 20//1 21//1 19//1 49 | f 21//1 22//1 19//1 50 | f 20//1 23//1 21//1 51 | f 24//1 22//1 21//1 52 | -------------------------------------------------------------------------------- /Kuplung/resources/axis_helpers/y_minus.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl MaterialY 5 | Ns 94.117647 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.000000 0.640000 0.010096 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.000000 11 | d 1.000000 12 | illum 2 13 | -------------------------------------------------------------------------------- /Kuplung/resources/axis_helpers/y_minus.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.78 (sub 0) OBJ File: '' 2 | # www.blender.org 3 | mtllib y_minus.mtl 4 | o YMinus 5 | v 0.644000 0.174000 0.000000 6 | v 0.887000 0.267000 0.000000 7 | v 0.644000 0.267000 0.000000 8 | v 0.887000 0.174000 0.000000 9 | v 0.253000 0.361000 0.000000 10 | v 0.118000 0.682000 0.000000 11 | v 0.000000 0.682000 0.000000 12 | v 0.301000 0.447000 0.000000 13 | v 0.604000 0.682000 0.000000 14 | v 0.486000 0.682000 0.000000 15 | v 0.351000 0.360000 0.000000 16 | v 0.253000 0.000000 0.000000 17 | v 0.351000 0.000000 0.000000 18 | vn 0.0000 0.0000 1.0000 19 | usemtl MaterialY 20 | s 1 21 | f 1//1 2//1 3//1 22 | f 1//1 4//1 2//1 23 | f 5//1 6//1 7//1 24 | f 5//1 8//1 6//1 25 | f 8//1 9//1 10//1 26 | f 8//1 11//1 9//1 27 | f 5//1 11//1 8//1 28 | f 12//1 11//1 5//1 29 | f 12//1 13//1 11//1 30 | -------------------------------------------------------------------------------- /Kuplung/resources/axis_helpers/y_plus.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl MaterialYPlus 5 | Ns 94.117647 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.000000 0.640000 0.010096 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.000000 11 | d 1.000000 12 | illum 2 13 | -------------------------------------------------------------------------------- /Kuplung/resources/axis_helpers/y_plus.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.78 (sub 0) OBJ File: '' 2 | # www.blender.org 3 | mtllib y_plus.mtl 4 | o YPlus 5 | v 0.855000 0.394000 0.000000 6 | v 0.937000 0.589000 0.000000 7 | v 0.855000 0.589000 0.000000 8 | v 0.937000 0.394000 0.000000 9 | v 0.660000 0.312000 0.000000 10 | v 0.660000 0.394000 0.000000 11 | v 1.132000 0.394000 0.000000 12 | v 1.132000 0.312000 0.000000 13 | v 0.855000 0.312000 0.000000 14 | v 0.855000 0.117000 0.000000 15 | v 0.937000 0.312000 0.000000 16 | v 0.937000 0.117000 0.000000 17 | v 0.253000 0.361000 0.000000 18 | v 0.118000 0.682000 0.000000 19 | v 0.000000 0.682000 0.000000 20 | v 0.301000 0.447000 0.000000 21 | v 0.604000 0.682000 0.000000 22 | v 0.486000 0.682000 0.000000 23 | v 0.351000 0.360000 0.000000 24 | v 0.253000 0.000000 0.000000 25 | v 0.351000 0.000000 0.000000 26 | vn 0.0000 0.0000 1.0000 27 | usemtl MaterialYPlus 28 | s 1 29 | f 1//1 2//1 3//1 30 | f 1//1 4//1 2//1 31 | f 5//1 1//1 6//1 32 | f 5//1 4//1 1//1 33 | f 5//1 7//1 4//1 34 | f 5//1 8//1 7//1 35 | f 9//1 8//1 5//1 36 | f 10//1 11//1 9//1 37 | f 11//1 8//1 9//1 38 | f 10//1 12//1 11//1 39 | f 13//1 14//1 15//1 40 | f 13//1 16//1 14//1 41 | f 16//1 17//1 18//1 42 | f 16//1 19//1 17//1 43 | f 13//1 19//1 16//1 44 | f 20//1 19//1 13//1 45 | f 20//1 21//1 19//1 46 | -------------------------------------------------------------------------------- /Kuplung/resources/axis_helpers/z_minus.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl MaterialZ 5 | Ns 94.117647 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.000000 0.006078 0.640000 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.000000 11 | d 1.000000 12 | illum 2 13 | -------------------------------------------------------------------------------- /Kuplung/resources/axis_helpers/z_minus.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.78 (sub 0) OBJ File: '' 2 | # www.blender.org 3 | mtllib z_minus.mtl 4 | o Text 5 | v 0.686000 0.174000 0.000000 6 | v 0.929000 0.267000 0.000000 7 | v 0.686000 0.267000 0.000000 8 | v 0.929000 0.174000 0.000000 9 | v 0.043000 0.594000 0.000000 10 | v 0.631000 0.682000 0.000000 11 | v 0.043000 0.682000 0.000000 12 | v 0.450000 0.594000 0.000000 13 | v 0.197000 0.088000 0.000000 14 | v 0.016000 0.000000 0.000000 15 | v 0.631000 0.088000 0.000000 16 | v 0.631000 0.000000 0.000000 17 | vn 0.0000 0.0000 1.0000 18 | usemtl MaterialZ 19 | s 1 20 | f 1//1 2//1 3//1 21 | f 1//1 4//1 2//1 22 | f 5//1 6//1 7//1 23 | f 5//1 8//1 6//1 24 | f 8//1 9//1 6//1 25 | f 10//1 9//1 8//1 26 | f 10//1 11//1 9//1 27 | f 10//1 12//1 11//1 28 | -------------------------------------------------------------------------------- /Kuplung/resources/axis_helpers/z_plus.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl MaterialZ.001 5 | Ns 94.117647 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.000000 0.006078 0.640000 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.000000 11 | d 1.000000 12 | illum 2 13 | -------------------------------------------------------------------------------- /Kuplung/resources/axis_helpers/z_plus.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.78 (sub 0) OBJ File: '' 2 | # www.blender.org 3 | mtllib z_plus.mtl 4 | o ZPlus 5 | v 0.897000 0.394000 0.000000 6 | v 0.979000 0.589000 0.000000 7 | v 0.897000 0.589000 0.000000 8 | v 0.979000 0.394000 0.000000 9 | v 0.702000 0.312000 0.000000 10 | v 0.702000 0.394000 0.000000 11 | v 1.174000 0.394000 0.000000 12 | v 1.174000 0.312000 0.000000 13 | v 0.897000 0.312000 0.000000 14 | v 0.897000 0.117000 0.000000 15 | v 0.979000 0.312000 0.000000 16 | v 0.979000 0.117000 0.000000 17 | v 0.043000 0.594000 0.000000 18 | v 0.631000 0.682000 0.000000 19 | v 0.043000 0.682000 0.000000 20 | v 0.450000 0.594000 0.000000 21 | v 0.197000 0.088000 0.000000 22 | v 0.016000 0.000000 0.000000 23 | v 0.631000 0.088000 0.000000 24 | v 0.631000 0.000000 0.000000 25 | vn 0.0000 0.0000 1.0000 26 | usemtl MaterialZ.001 27 | s 1 28 | f 1//1 2//1 3//1 29 | f 1//1 4//1 2//1 30 | f 5//1 1//1 6//1 31 | f 5//1 4//1 1//1 32 | f 5//1 7//1 4//1 33 | f 5//1 8//1 7//1 34 | f 9//1 8//1 5//1 35 | f 10//1 11//1 9//1 36 | f 11//1 8//1 9//1 37 | f 10//1 12//1 11//1 38 | f 13//1 14//1 15//1 39 | f 13//1 16//1 14//1 40 | f 16//1 17//1 14//1 41 | f 18//1 17//1 16//1 42 | f 18//1 19//1 17//1 43 | f 18//1 20//1 19//1 44 | -------------------------------------------------------------------------------- /Kuplung/resources/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/Kuplung/resources/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /Kuplung/resources/fonts/material-icons-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/Kuplung/resources/fonts/material-icons-regular.ttf -------------------------------------------------------------------------------- /Kuplung/resources/gui/camera.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl MaterialCamera 5 | Ns 0.000000 6 | Ka 0.000000 0.000000 0.000000 7 | Kd 0.800000 0.800000 0.800000 8 | Ks 0.800000 0.800000 0.800000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.000000 11 | d 1.000000 12 | illum 2 13 | -------------------------------------------------------------------------------- /Kuplung/resources/gui/camera.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.78 (sub 0) OBJ File: '' 2 | # www.blender.org 3 | mtllib camera.mtl 4 | o Camera.001_Camera 5 | v -1.000000 -0.200000 0.200000 6 | v 0.417244 -1.000000 1.000000 7 | v 0.417244 1.000000 1.000000 8 | v 0.417240 -1.000000 -1.000000 9 | v 0.417244 1.000000 -1.000000 10 | v -1.000000 -0.200000 -0.200000 11 | v -1.000000 0.200000 -0.200000 12 | v -1.000000 0.200000 0.200000 13 | vn -0.4916 0.0000 0.8708 14 | vn 1.0000 -0.0000 -0.0000 15 | vn -0.4916 0.0000 -0.8708 16 | vn -1.0000 0.0000 0.0000 17 | vn -0.4916 0.8708 0.0000 18 | vn -0.4916 -0.8708 0.0000 19 | usemtl MaterialCamera 20 | s 1 21 | f 1//1 2//1 3//1 22 | f 4//2 5//2 3//2 23 | f 4//3 6//3 7//3 24 | f 1//4 8//4 7//4 25 | f 3//5 5//5 7//5 26 | f 4//6 2//6 1//6 27 | f 8//1 1//1 3//1 28 | f 2//2 4//2 3//2 29 | f 5//3 4//3 7//3 30 | f 6//4 1//4 7//4 31 | f 8//5 3//5 7//5 32 | f 6//6 4//6 1//6 33 | -------------------------------------------------------------------------------- /Kuplung/resources/gui/light_directional.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl MaterialLightDirectional 5 | Ns 94.117647 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.640000 0.640000 0.640000 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.000000 11 | d 1.000000 12 | illum 2 13 | -------------------------------------------------------------------------------- /Kuplung/resources/gui/light_point.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl MaterialLightPoint 5 | Ns 94.117647 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.356161 0.356161 0.356161 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.000000 11 | d 1.000000 12 | illum 2 13 | -------------------------------------------------------------------------------- /Kuplung/resources/gui/light_spot.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl MaterialLightSpot 5 | Ns 94.117647 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.356161 0.356161 0.356161 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.000000 11 | d 1.000000 12 | illum 2 13 | -------------------------------------------------------------------------------- /Kuplung/resources/kuplung.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "Kuplung.ico" 2 | -------------------------------------------------------------------------------- /Kuplung/resources/lua/test.lua: -------------------------------------------------------------------------------- 1 | io.write(string.format("Hello from %s\n", _VERSION)) 2 | 3 | io.write("Calling testFromLua() ...\n") 4 | local value = testFromLua("First", "Second", 112233) 5 | io.write(string.format("testFromLua() returned: %s\n", tostring(value))) 6 | -------------------------------------------------------------------------------- /Kuplung/resources/noise16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/Kuplung/resources/noise16.png -------------------------------------------------------------------------------- /Kuplung/resources/shaders/axis.frag: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | in vec4 v_axisColor; 4 | 5 | out vec4 fragColor; 6 | 7 | void main(void) { 8 | fragColor = v_axisColor;//vec4(1.0, 0.0, 0.0, 1.0); 9 | } 10 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/axis.vert: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | layout (location = 0) in vec3 a_vertexPosition; 4 | layout (location = 1) in vec4 a_axisColor; 5 | 6 | uniform mat4 u_MVPMatrix; 7 | 8 | out vec4 v_axisColor; 9 | 10 | void main(void) { 11 | v_axisColor = a_axisColor; 12 | 13 | gl_Position = u_MVPMatrix * vec4(a_vertexPosition, 1.0); 14 | } 15 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/axis_helpers.frag: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | uniform vec3 fs_color; 4 | out vec4 fragColor; 5 | 6 | void main(void) { 7 | fragColor = vec4(fs_color, 1.0); 8 | } 9 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/axis_helpers.vert: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | layout (location = 0) in vec3 a_vertexPosition; 4 | layout (location = 1) in vec3 a_color; 5 | 6 | uniform mat4 u_MVPMatrix; 7 | 8 | out vec3 fs_color; 9 | 10 | void main(void) { 11 | fs_color = a_color; 12 | gl_Position = u_MVPMatrix * vec4(a_vertexPosition, 1.0); 13 | } 14 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/axis_labels.frag: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | in vec3 fs_color; 4 | out vec4 fragColor; 5 | 6 | void main(void) { 7 | fragColor = vec4(fs_color, 1.0); 8 | } 9 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/axis_labels.vert: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | layout (location = 0) in vec3 a_vertexPosition; 4 | layout (location = 1) in vec3 a_color; 5 | 6 | uniform mat4 u_MVPMatrix; 7 | 8 | out vec3 fs_color; 9 | 10 | void main(void) { 11 | fs_color = a_color; 12 | gl_Position = u_MVPMatrix * vec4(a_vertexPosition, 1.0); 13 | } 14 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/bounding_box.frag: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | uniform vec3 fs_color; 4 | out vec4 fragColor; 5 | 6 | void main(void) { 7 | fragColor = vec4(fs_color, 1.0); 8 | } 9 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/bounding_box.vert: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | layout (location = 0) in vec3 a_vertexPosition; 4 | 5 | uniform mat4 u_MVPMatrix; 6 | 7 | void main(void) { 8 | gl_Position = u_MVPMatrix * vec4(a_vertexPosition, 1.0); 9 | } 10 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/camera.frag: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | uniform vec3 fs_color; 4 | uniform vec3 fs_innerLightDirection; 5 | in vec3 v_vertexNormal; 6 | out vec4 fragColor; 7 | 8 | void main(void) { 9 | vec3 lightDirection = fs_innerLightDirection; 10 | vec3 directionLight = normalize(lightDirection); 11 | float lambertFactor = max(dot(v_vertexNormal, -directionLight), 0.0); 12 | vec3 light = 0.6 * vec3(0.6) * lambertFactor; 13 | fragColor = vec4(fs_color + light, 1.0); 14 | } 15 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/camera.vert: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | layout (location = 0) in vec3 a_vertexPosition; 4 | layout (location = 1) in vec3 a_vertexNormal; 5 | 6 | uniform mat4 u_MVPMatrix; 7 | 8 | out vec3 v_vertexNormal; 9 | 10 | void main(void) { 11 | v_vertexNormal = a_vertexNormal; 12 | gl_Position = u_MVPMatrix * vec4(a_vertexPosition, 1.0); 13 | } 14 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/cuda/oceanFFT.frag: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | // GLSL fragment shader 4 | in vec3 v_eyeSpacePos; // eyeSpacePos 5 | in vec3 v_eyeSpaceNormal; // worldSpaceNormal; 6 | in vec3 v_worldSpaceNormal; // eyeSpaceNormal; 7 | 8 | uniform vec4 deepColor; 9 | uniform vec4 shallowColor; 10 | uniform vec4 skyColor; 11 | uniform vec3 lightDir; 12 | 13 | out vec4 fragColor; 14 | 15 | void main() { 16 | vec3 eyeVector = normalize(v_eyeSpacePos); 17 | vec3 eyeSpaceNormalVector = normalize(v_eyeSpaceNormal); 18 | vec3 worldSpaceNormalVector = normalize(v_worldSpaceNormal); 19 | 20 | float facing = max(0.0, dot(eyeSpaceNormalVector, -eyeVector)); 21 | float fresnel = pow(1.0 - facing, 5.0); 22 | float diffuse = max(0.0, dot(worldSpaceNormalVector, lightDir)); 23 | 24 | vec4 waterColor = mix(shallowColor, deepColor, facing); 25 | fragColor = waterColor * diffuse + skyColor * fresnel; 26 | } 27 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/cuda/oceanFFT.vert: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | // GLSL vertex shader 4 | 5 | layout (location = 0) in vec3 a_vertexPosition; 6 | layout (location = 1) in vec3 a_height; 7 | layout (location = 2) in vec3 a_slope; 8 | 9 | out vec3 v_eyeSpacePos; // eyeSpacePos 10 | out vec3 v_eyeSpaceNormal; // eyeSpaceNormal 11 | out vec3 v_worldSpaceNormal; // worldSpaceNormal 12 | 13 | uniform float heightScale; // = 0.5; 14 | uniform float chopiness; // = 1.0; 15 | uniform vec2 size; // = vec2(256.0, 256.0); 16 | 17 | uniform mat4 v_MVPMatrix; 18 | uniform mat4 v_MVMatrix; 19 | uniform mat3 v_NMatrix; 20 | 21 | void main() { 22 | float height = a_height.x; 23 | vec2 slope = a_slope.xy; 24 | 25 | // calculate surface normal from slope for shading 26 | vec3 normal = normalize(cross(vec3(0.0, slope.y * heightScale, 2.0 / size.x), vec3(2.0 / size.y, slope.x * heightScale, 0.0))); 27 | v_worldSpaceNormal = normal; 28 | 29 | // calculate position and transform to homogeneous clip space 30 | vec4 pos = vec4(a_vertexPosition.x, height * heightScale, a_vertexPosition.z, 1.0); 31 | gl_Position = v_MVPMatrix * pos; 32 | 33 | v_eyeSpacePos = (v_MVMatrix * pos).xyz; 34 | v_eyeSpaceNormal = (v_NMatrix * normal).xyz; 35 | } 36 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/deferred_g_buffer.frag: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | layout (location = 0) out vec3 gPosition; 4 | layout (location = 1) out vec3 gNormal; 5 | layout (location = 2) out vec4 gAlbedoSpec; 6 | 7 | in vec2 TexCoords; 8 | in vec3 FragPos; 9 | in vec3 Normal; 10 | 11 | uniform sampler2D texture_diffuse; 12 | uniform sampler2D texture_specular; 13 | 14 | void main() { 15 | // Store the fragment position vector in the first gbuffer texture 16 | gPosition = FragPos; 17 | 18 | // Also store the per-fragment normals into the gbuffer 19 | gNormal = normalize(Normal); 20 | 21 | // And the diffuse per-fragment color 22 | gAlbedoSpec.rgb = texture(texture_diffuse, TexCoords).rgb; 23 | 24 | // Store specular intensity in gAlbedoSpec's alpha component 25 | gAlbedoSpec.a = texture(texture_specular, TexCoords).r; 26 | } 27 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/deferred_g_buffer.vert: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | layout (location = 0) in vec3 position; 4 | layout (location = 1) in vec3 normal; 5 | layout (location = 2) in vec2 texCoords; 6 | 7 | out vec3 FragPos; 8 | out vec2 TexCoords; 9 | out vec3 Normal; 10 | 11 | uniform mat4 model; 12 | uniform mat4 view; 13 | uniform mat4 projection; 14 | 15 | void main() { 16 | vec4 worldPos = model * vec4(position, 1.0f); 17 | FragPos = worldPos.xyz; 18 | 19 | gl_Position = projection * view * worldPos; 20 | 21 | TexCoords = texCoords; 22 | 23 | mat3 normalMatrix = transpose(inverse(mat3(model))); 24 | Normal = normalMatrix * normal; 25 | } 26 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/deferred_light_box.frag: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | layout (location = 0) out vec4 FragColor; 4 | 5 | uniform vec3 lightColor; 6 | 7 | void main() { 8 | FragColor = vec4(lightColor, 1.0); 9 | } 10 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/deferred_light_box.vert: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | layout (location = 0) in vec3 position; 4 | layout (location = 1) in vec3 normal; 5 | layout (location = 2) in vec2 texCoords; 6 | 7 | uniform mat4 projection; 8 | uniform mat4 view; 9 | uniform mat4 model; 10 | 11 | void main() { 12 | gl_Position = projection * view * model * vec4(position, 1.0f); 13 | } 14 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/deferred_shading.vert: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | layout (location = 0) in vec3 position; 4 | layout (location = 1) in vec2 texCoords; 5 | 6 | out vec2 TexCoords; 7 | 8 | void main() { 9 | gl_Position = vec4(position, 1.0f); 10 | TexCoords = texCoords; 11 | } 12 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/grid.frag: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | uniform bool a_actAsMirror; 4 | uniform float a_alpha; 5 | in vec3 v_color; 6 | 7 | out vec4 fragColor; 8 | 9 | void main(void) { 10 | if (a_actAsMirror) 11 | fragColor = vec4(1.0, 1.0, 1.0, a_alpha); 12 | else 13 | fragColor = vec4(v_color.xyz, a_alpha);//vec4(0.7, 0.7, 0.7, a_alpha); 14 | } 15 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/grid.vert: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | layout (location = 0) in vec3 a_vertexPosition; 4 | layout (location = 1) in vec3 fs_color; 5 | 6 | uniform mat4 u_MVPMatrix; 7 | 8 | out vec3 v_color; 9 | 10 | void main(void) { 11 | v_color = fs_color; 12 | gl_Position = u_MVPMatrix * vec4(a_vertexPosition, 1.0); 13 | } 14 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/grid2d.frag: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | uniform bool a_actAsMirror; 4 | uniform float a_alpha; 5 | in vec3 v_color; 6 | 7 | out vec4 fragColor; 8 | 9 | void main(void) { 10 | if (a_actAsMirror) 11 | fragColor = vec4(1.0, 1.0, 1.0, a_alpha); 12 | else 13 | fragColor = vec4(v_color.xyz, a_alpha);//vec4(0.7, 0.7, 0.7, a_alpha); 14 | } 15 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/grid2d.vert: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | layout (location = 0) in vec4 a_vertexPosition; 4 | layout (location = 1) in vec3 fs_color; 5 | 6 | uniform mat4 u_MVPMatrix; 7 | out vec3 v_color; 8 | 9 | void main() { 10 | v_color = fs_color; 11 | gl_Position = u_MVPMatrix * a_vertexPosition; 12 | } 13 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/light.frag: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | uniform sampler2D u_sampler; 4 | uniform bool fs_useColor; 5 | uniform vec3 fs_color; 6 | in vec2 v_textureCoord; 7 | in vec3 v_vertexNormal; 8 | out vec4 fragColor; 9 | 10 | void main(void) { 11 | if (fs_useColor) { 12 | vec3 lightDirection = vec3(0.0, 1.0, 0.0); 13 | vec3 directionLight = normalize(lightDirection); 14 | float lambertFactor = max(dot(v_vertexNormal, -directionLight), 0.0); 15 | vec3 light = 0.6 * vec3(0.6) * lambertFactor; 16 | fragColor = vec4(fs_color + light, 1.0); 17 | } 18 | else 19 | fragColor = texture(u_sampler, v_textureCoord); 20 | } 21 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/light.vert: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | layout (location = 0) in vec3 a_vertexPosition; 4 | layout (location = 1) in vec3 a_vertexNormal; 5 | layout (location = 2) in vec2 a_textureCoord; 6 | 7 | uniform mat4 u_MVPMatrix; 8 | 9 | out vec3 v_vertexNormal; 10 | out vec2 v_textureCoord; 11 | 12 | void main(void) { 13 | v_vertexNormal = a_vertexNormal; 14 | v_textureCoord = a_textureCoord; 15 | 16 | gl_Position = u_MVPMatrix * vec4(a_vertexPosition, 1.0); 17 | } 18 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/light_ray.frag: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | out vec4 fragColor; 4 | 5 | void main(void) { 6 | fragColor = vec4(1.0, 0.0, 0.0, 1.0); 7 | } 8 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/light_ray.vert: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | layout (location = 0) in vec3 a_vertexPosition; 4 | 5 | uniform mat4 u_MVPMatrix; 6 | 7 | void main(void) { 8 | gl_Position = u_MVPMatrix * vec4(a_vertexPosition, 1.0); 9 | } 10 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/ray_line.frag: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | uniform vec3 fs_color; 4 | 5 | out vec4 fragColor; 6 | 7 | void main(void) { 8 | fragColor = vec4(fs_color, 1.0); 9 | } 10 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/ray_line.vert: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | layout (location = 0) in vec3 a_vertexPosition; 4 | 5 | uniform mat4 u_MVPMatrix; 6 | 7 | void main(void) { 8 | gl_Position = u_MVPMatrix * vec4(a_vertexPosition, 1.0); 9 | } 10 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/reflection.frag: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | const vec3 xUnitVec = vec3(1.0, 0.0, 0.0); 4 | const vec3 yUnitVec = vec3(0.0, 1.0, 0.0); 5 | 6 | // Color of tint to apply (blue) 7 | const vec4 tintColor = vec4(0.0, 0.0, 1.0, 1.0); 8 | 9 | // Amount of tint to apply 10 | const float tintFactor = 0.2; 11 | 12 | in vec3 fs_normal; 13 | in vec3 fs_eyeDirection; 14 | out vec4 fragColor; 15 | 16 | uniform sampler2D diffuseTexture; 17 | 18 | void main (void) { 19 | // reflection vector 20 | vec3 reflectDirection = reflect(fs_eyeDirection, fs_normal); 21 | 22 | // altitude and azimuth angles 23 | vec2 texCoordinate; 24 | 25 | texCoordinate.y = dot(normalize(reflectDirection), yUnitVec); 26 | reflectDirection.y = 0.0; 27 | texCoordinate.x = dot(normalize(reflectDirection), xUnitVec) * 0.5; 28 | 29 | // translate index values into proper range 30 | if (reflectDirection.z >= 0.0) 31 | texCoordinate = (texCoordinate + 1.0) * 0.5; 32 | else { 33 | texCoordinate.t = (texCoordinate.t + 1.0) * 0.5; 34 | texCoordinate.s = (-texCoordinate.s) * 0.5 + 1.0; 35 | } 36 | 37 | // Do a lookup into the environment map. 38 | vec4 texColor = texture(diffuseTexture, texCoordinate); 39 | 40 | // Add some blue tint to the image so it looks more like a mirror or glass 41 | fragColor = mix(texColor, tintColor, tintFactor); 42 | } 43 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/reflection.vert: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | uniform mat4 vs_modelViewMatrix; 4 | uniform mat4 vs_modelViewProjectionMatrix; 5 | uniform mat3 vs_normalMatrix; 6 | 7 | in vec3 vs_inNormal; 8 | in vec4 vs_inPosition; 9 | 10 | out vec3 fs_normal; 11 | out vec3 fs_eyeDirection; 12 | 13 | void main (void) { 14 | gl_Position = vs_modelViewProjectionMatrix * vs_inPosition; 15 | 16 | vec4 eyePos = vs_modelViewMatrix * vs_inPosition; 17 | fs_normal = normalize(vs_normalMatrix * vs_inNormal); 18 | fs_eyeDirection = eyePos.xyz; 19 | } 20 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/rendering_simple.frag: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | uniform bool has_texture; 4 | uniform sampler2D sampler_texture; 5 | 6 | struct LightSource_Directional { 7 | bool inUse; 8 | vec3 direction; 9 | vec3 ambient, diffuse, specular; 10 | float strengthAmbient, strengthDiffuse, strengthSpecular; 11 | }; 12 | 13 | uniform LightSource_Directional solidSkin_Light; 14 | uniform vec3 fs_UIAmbient; 15 | uniform vec3 fs_cameraPosition; 16 | 17 | in vec3 fs_vertexPosition; 18 | in vec2 fs_textureCoord; 19 | in vec3 fs_vertexNormal0; 20 | in vec3 fs_vertexNormal; 21 | in vec3 fs_tangent0; 22 | in vec3 fs_tangent; 23 | in vec3 fs_bitangent0; 24 | in vec3 fs_bitangent; 25 | 26 | out vec4 fragColor; 27 | 28 | void main(void) { 29 | vec4 processedColor = vec4(0, 0, 0, 1); 30 | if (has_texture) 31 | processedColor = texture(sampler_texture, fs_textureCoord); 32 | 33 | vec3 directionView = normalize(fs_cameraPosition - fs_vertexPosition); 34 | vec3 directionLight = normalize(-1.0 * solidSkin_Light.direction); 35 | float lambertFactor = max(dot(fs_vertexNormal, -directionLight), 0.0); 36 | vec3 directionReflection = normalize(reflect(-directionLight, fs_vertexNormal)); 37 | float specularFactor = pow(max(dot(directionView, directionReflection), 0.0), 1.0); 38 | vec3 solidLightColor = solidSkin_Light.strengthDiffuse * solidSkin_Light.diffuse * lambertFactor * processedColor.rgb; 39 | 40 | solidLightColor += fs_UIAmbient; 41 | 42 | fragColor = vec4(solidLightColor, 1.0); 43 | } 44 | -------------------------------------------------------------------------------- /Kuplung/resources/shaders/rendering_simple.geom: -------------------------------------------------------------------------------- 1 | #version 410 core 2 | 3 | layout(triangles) in; 4 | layout(triangle_strip, max_vertices = 3) out; 5 | 6 | in vec3 gs_vertexPosition[3]; 7 | in vec2 gs_textureCoord[3]; 8 | in vec3 gs_vertexNormal0[3]; 9 | in vec3 gs_vertexNormal[3]; 10 | in vec3 gs_tangent0[3]; 11 | in vec3 gs_tangent[3]; 12 | in vec3 gs_bitangent0[3]; 13 | in vec3 gs_bitangent[3]; 14 | 15 | out vec3 fs_vertexPosition; 16 | out vec2 fs_textureCoord; 17 | out vec3 fs_vertexNormal0; 18 | out vec3 fs_vertexNormal; 19 | out vec3 fs_tangent0; 20 | out vec3 fs_tangent; 21 | out vec3 fs_bitangent0; 22 | out vec3 fs_bitangent; 23 | 24 | void main() { 25 | for (int i=0; i/dev/null; \ 38 | done 39 | 40 | clean: 41 | @- $(RM) $(PROGRAM_NAME) $(CU_OBJS) *~ 42 | 43 | distclean: clean 44 | 45 | else 46 | 47 | all: $(PROGRAM_NAME) 48 | 49 | $(PROGRAM_NAME): 50 | @echo false 51 | 52 | #@export DEF_KuplungSetting_UseCuda="NoCuda" 53 | 54 | endif -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /MSVC/Kuplung.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 15 3 | VisualStudioVersion = 15.0.26730.16 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Kuplung", "Kuplung.vcxproj", "{C32FB03E-A9FE-3AAC-A339-D619916CA374}" 6 | EndProject 7 | Global 8 | GlobalSection(Performance) = preSolution 9 | HasPerformanceSessions = true 10 | EndGlobalSection 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|x64 = Debug|x64 13 | MinSizeRel|x64 = MinSizeRel|x64 14 | Release|x64 = Release|x64 15 | RelWithDebInfo|x64 = RelWithDebInfo|x64 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {C32FB03E-A9FE-3AAC-A339-D619916CA374}.Debug|x64.ActiveCfg = Debug|x64 19 | {C32FB03E-A9FE-3AAC-A339-D619916CA374}.Debug|x64.Build.0 = Debug|x64 20 | {C32FB03E-A9FE-3AAC-A339-D619916CA374}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 21 | {C32FB03E-A9FE-3AAC-A339-D619916CA374}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 22 | {C32FB03E-A9FE-3AAC-A339-D619916CA374}.Release|x64.ActiveCfg = Release|x64 23 | {C32FB03E-A9FE-3AAC-A339-D619916CA374}.Release|x64.Build.0 = Release|x64 24 | {C32FB03E-A9FE-3AAC-A339-D619916CA374}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 25 | {C32FB03E-A9FE-3AAC-A339-D619916CA374}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 26 | EndGlobalSection 27 | GlobalSection(SolutionProperties) = preSolution 28 | HideSolutionNode = FALSE 29 | EndGlobalSection 30 | GlobalSection(ExtensibilityGlobals) = postSolution 31 | SolutionGuid = {8925BE61-1493-46B7-9809-4BC4CC193706} 32 | EndGlobalSection 33 | EndGlobal 34 | -------------------------------------------------------------------------------- /external/libnoise/headers/model/model.h: -------------------------------------------------------------------------------- 1 | // model.h 2 | // 3 | // Copyright (C) 2003, 2004 Jason Bevins 4 | // 5 | // This library is free software; you can redistribute it and/or modify it 6 | // under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation; either version 2.1 of the License, or (at 8 | // your option) any later version. 9 | // 10 | // This library is distributed in the hope that it will be useful, but WITHOUT 11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 13 | // License (COPYING.txt) for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with this library; if not, write to the Free Software Foundation, 17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | // 19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take 20 | // off every 'zig'.) 21 | // 22 | 23 | #ifndef NOISE_MODEL_H 24 | #define NOISE_MODEL_H 25 | 26 | #include "cylinder.h" 27 | #include "line.h" 28 | #include "plane.h" 29 | #include "sphere.h" 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /external/libnoise/lib/libnoise.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/external/libnoise/lib/libnoise.a -------------------------------------------------------------------------------- /external/libnoise/lib/libnoise.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/external/libnoise/lib/libnoise.lib -------------------------------------------------------------------------------- /external/libnoise/windows/include/noise/model/model.h: -------------------------------------------------------------------------------- 1 | // model.h 2 | // 3 | // Copyright (C) 2003, 2004 Jason Bevins 4 | // 5 | // This library is free software; you can redistribute it and/or modify it 6 | // under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation; either version 2.1 of the License, or (at 8 | // your option) any later version. 9 | // 10 | // This library is distributed in the hope that it will be useful, but WITHOUT 11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 13 | // License (COPYING.txt) for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with this library; if not, write to the Free Software Foundation, 17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | // 19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take 20 | // off every 'zig'.) 21 | // 22 | 23 | #ifndef NOISE_MODEL_H 24 | #define NOISE_MODEL_H 25 | 26 | #include "cylinder.h" 27 | #include "line.h" 28 | #include "plane.h" 29 | #include "sphere.h" 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /external/libnoise/windows/lib/noise.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/external/libnoise/windows/lib/noise.lib -------------------------------------------------------------------------------- /screenshots/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/screenshots/screenshot.png -------------------------------------------------------------------------------- /screenshots/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/screenshots/screenshot2.png -------------------------------------------------------------------------------- /screenshots/screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supudo/Kuplung/f391ac59ad0b2a713ca0cf7e1a8ca5dacf0ee09f/screenshots/screenshot3.png --------------------------------------------------------------------------------