Skip to content

Commit

Permalink
Creating window using sokol_app
Browse files Browse the repository at this point in the history
  • Loading branch information
serhii-rieznik committed Jan 28, 2022
1 parent 038c769 commit bc6e157
Show file tree
Hide file tree
Showing 11 changed files with 11,749 additions and 4 deletions.
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
project(etx-tracer)

cmake_minimum_required(VERSION 3.1)
cmake_policy(SET CMP0091 NEW)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake")

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

add_subdirectory(thirdparty)
add_subdirectory(sources)

set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT raytracer)


12 changes: 9 additions & 3 deletions docs/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

This description will be updated during the development process.

At the moment there is nothing to build.

## Requirements
Most of external libraries will be located directly in the source code, to reduce a number of dependencies and make building faster.
But this libraries and tools you have to install by yourself:
- CMake
- CUDA
- OptiX
- optionally OpenVDB if you want to load .vdb files with volumetric data.
- optionally OpenVDB if you want to load .vdb files with volumetric data.

## Building for Windows
Windows is the only one platform, which is supported at the moment.
Building should be as simple as creating a folder for build files and calling CMake, something like:
```
cmake -G "Visual Studio 17 2022" ..
```

2 changes: 1 addition & 1 deletion scripts/format-all.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ REM ############################################################################

set ROOT=%CD%
set FOLDERS=(sources)
set EXTENSIONS=(h, hpp, c, cpp, cxx, mm, glsl, hlsl, cu)
set EXTENSIONS=(h, hpp, hxx, c, cpp, cxx, mm, glsl, hlsl, cu)
for %%f in %FOLDERS% do (
for %%e in %EXTENSIONS% do (
forfiles /s /p "%ROOT%\%%f" /m *.%%e /c "cmd /c %ROOT%\scripts\format-file.bat @relpath @path @fsize"
Expand Down
2 changes: 2 additions & 0 deletions sources/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_subdirectory(rt-api)
add_subdirectory(raytracer)
6 changes: 6 additions & 0 deletions sources/raytracer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
add_executable(raytracer
main.cxx
)

set_target_properties(raytracer PROPERTIES WIN32_EXECUTABLE YES)
target_link_libraries(raytracer sokol_app)
30 changes: 30 additions & 0 deletions sources/raytracer/main.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <sokol_app.h>

void init_application() {
}

void frame() {
}

void cleanup_application() {
}

void handle_event(const sapp_event*) {
}

sapp_desc sokol_main(int argc, char* argv[]) {
sapp_desc result = {};
{
result.init_cb = init_application;
result.frame_cb = frame;
result.cleanup_cb = cleanup_application;
result.event_cb = handle_event;
result.width = 1280;
result.height = 720;
result.window_title = "etx-tracer";
result.high_dpi = true;
result.win32_console_utf8 = true;
result.win32_console_create = true;
};
return result;
}
Empty file added sources/rt-api/CMakeLists.txt
Empty file.
1 change: 1 addition & 0 deletions thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(sokol_app)
6 changes: 6 additions & 0 deletions thirdparty/sokol_app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
add_library(sokol_app STATIC
sokol_app.h
sokol_app.c
)
set_target_properties(sokol_app PROPERTIES FOLDER "thirdparty")
target_include_directories(sokol_app PUBLIC ${CMAKE_CURRENT_LIST_DIR})
4 changes: 4 additions & 0 deletions thirdparty/sokol_app/sokol_app.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#define SOKOL_APP_IMPL 1
#define SOKOL_D3D11 1

#include "sokol_app.h"
11,671 changes: 11,671 additions & 0 deletions thirdparty/sokol_app/sokol_app.h

Large diffs are not rendered by default.

0 comments on commit bc6e157

Please sign in to comment.