Skip to content

Commit

Permalink
Merge pull request vkoskiv#54 from VKoskiv/dev
Browse files Browse the repository at this point in the history
Merge dev into Master
  • Loading branch information
vkoskiv authored Jan 22, 2020
2 parents e380acd + 38736d0 commit bde1683
Show file tree
Hide file tree
Showing 86 changed files with 1,668 additions and 837 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
- name: cmake
run: cmake -G "Visual Studio 16 2019" -A x64 .
- name: build
run: msbuild c-ray.sln /p:Configuration=Release
run: msbuild c-ray.sln /p:Configuration=Release /p:WarningLevel=0
44 changes: 41 additions & 3 deletions C-Ray.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
9058A51222231E9F00193385 /* learn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9058A50F22231E9E00193385 /* learn.c */; };
9058A51522231EB100193385 /* Tinn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9058A51422231EB100193385 /* Tinn.c */; };
907CD47A2240DFFF003947B0 /* multiplatform.c in Sources */ = {isa = PBXBuildFile; fileRef = 907CD4792240DFFF003947B0 /* multiplatform.c */; };
9095392523C15A7B0017037C /* c-ray.c in Sources */ = {isa = PBXBuildFile; fileRef = 9095392423C15A7B0017037C /* c-ray.c */; };
9095392623C15A7B0017037C /* c-ray.c in Sources */ = {isa = PBXBuildFile; fileRef = 9095392423C15A7B0017037C /* c-ray.c */; };
9095392923C15AAB0017037C /* networking.c in Sources */ = {isa = PBXBuildFile; fileRef = 9095392823C15AAB0017037C /* networking.c */; };
9095392A23C15AAB0017037C /* networking.c in Sources */ = {isa = PBXBuildFile; fileRef = 9095392823C15AAB0017037C /* networking.c */; };
90CA851C2252C90C00BA7702 /* mtlloader.c in Sources */ = {isa = PBXBuildFile; fileRef = 90CA85182252C90C00BA7702 /* mtlloader.c */; };
90CA851D2252C90C00BA7702 /* objloader.c in Sources */ = {isa = PBXBuildFile; fileRef = 90CA85192252C90C00BA7702 /* objloader.c */; };
90CA851E2252C90C00BA7702 /* textureloader.c in Sources */ = {isa = PBXBuildFile; fileRef = 90CA851B2252C90C00BA7702 /* textureloader.c */; };
Expand Down Expand Up @@ -159,9 +163,10 @@
900BA128220B4602005B8EE7 /* .editorconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .editorconfig; sourceTree = "<group>"; };
900BA129220B4602005B8EE7 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
900BA12A220B4602005B8EE7 /* includes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = includes.h; sourceTree = "<group>"; };
900FB5DB20C3BA3C008174C4 /* scene.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = scene.json; path = input/scene.json; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.javascript; };
900FB5DB20C3BA3C008174C4 /* scene.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = scene.json; path = input/scene.json; sourceTree = "<group>"; };
90189DA4224EB302007FA268 /* mesh.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mesh.c; sourceTree = "<group>"; };
90189DA5224EB302007FA268 /* mesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mesh.h; sourceTree = "<group>"; };
90204C7823A07F2C00B01EEF /* assert.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = assert.h; sourceTree = "<group>"; };
90369CCA222E012F008D215B /* pcg_basic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pcg_basic.c; sourceTree = "<group>"; };
90369CCB222E012F008D215B /* pcg_basic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pcg_basic.h; sourceTree = "<group>"; };
90584305236651FC009D92F1 /* C-Ray Debug */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "C-Ray Debug"; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -173,6 +178,10 @@
9058A51422231EB100193385 /* Tinn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Tinn.c; sourceTree = "<group>"; };
907CD4782240DFFF003947B0 /* multiplatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = multiplatform.h; sourceTree = "<group>"; };
907CD4792240DFFF003947B0 /* multiplatform.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = multiplatform.c; sourceTree = "<group>"; };
9095392323C15A7B0017037C /* c-ray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "c-ray.h"; sourceTree = "<group>"; };
9095392423C15A7B0017037C /* c-ray.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "c-ray.c"; sourceTree = "<group>"; };
9095392723C15AAB0017037C /* networking.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = networking.h; sourceTree = "<group>"; };
9095392823C15AAB0017037C /* networking.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = networking.c; sourceTree = "<group>"; };
90BAE9362328344100B1EBF0 /* stb_image.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stb_image.h; sourceTree = "<group>"; };
90CA85162252C90C00BA7702 /* objloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = objloader.h; sourceTree = "<group>"; };
90CA85172252C90C00BA7702 /* textureloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = textureloader.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -225,6 +234,8 @@
900BA0EF220B4602005B8EE7 /* src */ = {
isa = PBXGroup;
children = (
9095392323C15A7B0017037C /* c-ray.h */,
9095392423C15A7B0017037C /* c-ray.c */,
900BA0F0220B4602005B8EE7 /* main.h */,
900BA129220B4602005B8EE7 /* main.c */,
900BA12A220B4602005B8EE7 /* includes.h */,
Expand Down Expand Up @@ -339,6 +350,9 @@
90FB15C822596E79008D6AAA /* gitsha1.c */,
90FB15CA22596E79008D6AAA /* gitsha1.c.in */,
90FB15C922596E79008D6AAA /* gitsha1.h */,
90204C7823A07F2C00B01EEF /* assert.h */,
9095392723C15AAB0017037C /* networking.h */,
9095392823C15AAB0017037C /* networking.c */,
);
path = utils;
sourceTree = "<group>";
Expand Down Expand Up @@ -466,6 +480,7 @@
905842DC236651FC009D92F1 /* sphere.c in Sources */,
905842DD236651FC009D92F1 /* multiplatform.c in Sources */,
905842DE236651FC009D92F1 /* poly.c in Sources */,
9095392623C15A7B0017037C /* c-ray.c in Sources */,
905842DF236651FC009D92F1 /* obj_parser.c in Sources */,
905842E0236651FC009D92F1 /* textureloader.c in Sources */,
905842E1236651FC009D92F1 /* logging.c in Sources */,
Expand All @@ -475,6 +490,7 @@
905842E5236651FC009D92F1 /* list.c in Sources */,
905842E6236651FC009D92F1 /* vertexbuffer.c in Sources */,
905842E7236651FC009D92F1 /* material.c in Sources */,
9095392A23C15AAB0017037C /* networking.c in Sources */,
905842E8236651FC009D92F1 /* lodepng.c in Sources */,
905842E9236651FC009D92F1 /* denoiser.c in Sources */,
905842EA236651FC009D92F1 /* vector.c in Sources */,
Expand Down Expand Up @@ -512,6 +528,7 @@
900BA136220B4603005B8EE7 /* sphere.c in Sources */,
907CD47A2240DFFF003947B0 /* multiplatform.c in Sources */,
900BA12F220B4603005B8EE7 /* poly.c in Sources */,
9095392523C15A7B0017037C /* c-ray.c in Sources */,
900BA13C220B4603005B8EE7 /* obj_parser.c in Sources */,
90CA851E2252C90C00BA7702 /* textureloader.c in Sources */,
900BA143220B4603005B8EE7 /* logging.c in Sources */,
Expand All @@ -521,6 +538,7 @@
900BA13B220B4603005B8EE7 /* list.c in Sources */,
90CA85242252D99700BA7702 /* vertexbuffer.c in Sources */,
900BA135220B4603005B8EE7 /* material.c in Sources */,
9095392923C15AAB0017037C /* networking.c in Sources */,
900BA13D220B4603005B8EE7 /* lodepng.c in Sources */,
9058A51122231E9F00193385 /* denoiser.c in Sources */,
900BA130220B4603005B8EE7 /* vector.c in Sources */,
Expand Down Expand Up @@ -584,6 +602,8 @@
OTHER_CFLAGS = (
"-I/usr/local/include/SDL2",
"-D_THREAD_SAFE",
"-DXCODE_NO_COLOR",
"-ferror-limit=1000",
);
OTHER_LDFLAGS = (
"-L/usr/local/lib",
Expand Down Expand Up @@ -622,6 +642,8 @@
OTHER_CFLAGS = (
"-I/usr/local/include/SDL2",
"-D_THREAD_SAFE",
"-DXCODE_NO_COLOR",
"-ferror-limit=1000",
);
OTHER_LDFLAGS = (
"-L/usr/local/lib",
Expand Down Expand Up @@ -690,6 +712,10 @@
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
WARNING_CFLAGS = (
"-Wall",
"-Wextra",
);
};
name = Debug;
};
Expand Down Expand Up @@ -745,6 +771,10 @@
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
WARNING_CFLAGS = (
"-Wall",
"-Wextra",
);
};
name = Release;
};
Expand All @@ -767,25 +797,29 @@
);
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = NO;
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
GCC_USE_STANDARD_INCLUDE_SEARCHING = NO;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
GCC_WARN_PEDANTIC = NO;
GCC_WARN_SHADOW = NO;
GCC_WARN_UNUSED_PARAMETER = NO;
GCC_WARN_UNUSED_PARAMETER = YES;
HEADER_SEARCH_PATHS = "";
LIBRARY_SEARCH_PATHS = "";
OTHER_CFLAGS = (
"-I/usr/local/include/SDL2",
"-D_THREAD_SAFE",
"-DXCODE_NO_COLOR",
"-ferror-limit=1000",
);
OTHER_LDFLAGS = (
"-L/usr/local/lib",
"-lSDL2",
);
PRODUCT_NAME = "$(TARGET_NAME)";
RUN_CLANG_STATIC_ANALYZER = NO;
WARNING_CFLAGS = "";
};
name = Debug;
};
Expand All @@ -805,25 +839,29 @@
GCC_PREPROCESSOR_DEFINITIONS = UI_ENABLED;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = NO;
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
GCC_USE_STANDARD_INCLUDE_SEARCHING = NO;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
GCC_WARN_PEDANTIC = NO;
GCC_WARN_SHADOW = NO;
GCC_WARN_UNUSED_PARAMETER = NO;
GCC_WARN_UNUSED_PARAMETER = YES;
HEADER_SEARCH_PATHS = "";
LIBRARY_SEARCH_PATHS = "";
OTHER_CFLAGS = (
"-I/usr/local/include/SDL2",
"-D_THREAD_SAFE",
"-DXCODE_NO_COLOR",
"-ferror-limit=1000",
);
OTHER_LDFLAGS = (
"-L/usr/local/lib",
"-lSDL2",
);
PRODUCT_NAME = "$(TARGET_NAME)";
RUN_CLANG_STATIC_ANALYZER = NO;
WARNING_CFLAGS = "";
};
name = Release;
};
Expand Down
19 changes: 16 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,22 @@ if (MSVC)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE)
else()
# set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic -Wconversion -std=gnu99")
set(CMAKE_C_FLAGS "-Wall -std=gnu99")
set(CMAKE_C_FLAGS_DEBUG "-fsanitize=address -O0 -g")
set(CMAKE_C_FLAGS_RELEASE "-O3 -ftree-vectorize -ffast-math")
set(CMAKE_C_FLAGS "-Wall -Wextra -std=gnu99")
set(CMAKE_C_FLAGS_RELEASE "-O3 -ftree-vectorize")
if (ASAN)
unset(UBSAN CACHE)
unset(ASAN CACHE)
set(CMAKE_C_FLAGS_DEBUG "-fsanitize=address -O0 -g")
message(STATUS "Address sanitizer enabled")
elseif(UBSAN)
unset(ASAN CACHE)
unset(UBSAN CACHE)
set(CMAKE_C_FLAGS_DEBUG "-fsanitize=undefined -O0 -g")
message(STATUS "Undefined behaviour sanitizer enabled")
else()
set(CMAKE_C_FLAGS_DEBUG "-O0 -g")
message(STATUS "No sanitizations")
endif()
endif()

message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
Expand Down
3 changes: 3 additions & 0 deletions asan
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/local/bin/fish

cmake . -DCMAKE_BUILD_TYPE=Debug -DASAN=True; and make
3 changes: 3 additions & 0 deletions dbg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/local/bin/fish

cmake . -DCMAKE_BUILD_TYPE=Debug; and make
18 changes: 9 additions & 9 deletions input/fence.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{
"version": 1.0,
"renderer": {
"threadCount": 0,
"sampleCount": 2000,
"threads": 0,
"samples": 2000,
"bounces": 50,
"antialiasing": true,
"tileWidth": 32,
"tileHeight": 32,
"tileOrder": "fromMiddle"
"tileOrder": "fromMiddle",
"outputFilePath": "output/",
"outputFileName": "rendered",
"fileType": "png",
"count": 0,
"width": 1280,
"height": 800
},
"display": {
"isFullscreen": false,
Expand All @@ -31,12 +37,6 @@
]
},
"scene": {
"outputFilePath": "output/",
"outputFileName": "rendered",
"fileType": "png",
"count": 0,
"width": 1280,
"height": 800,
"ambientColor": {
"down": {
"r": 0.056470,
Expand Down
21 changes: 11 additions & 10 deletions input/hdr.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{
"version": 1.0,
"renderer": {
"threadCount": 0,
"sampleCount": 250,
"threads": 0,
"samples": 250,
"bounces": 30,
"antialiasing": true,
"tileWidth": 64,
"tileHeight": 64,
"tileOrder": "fromMiddle"
"tileOrder": "fromMiddle",
"outputFilePath": "output/",
"outputFileName": "rendered",
"fileType": "png",
"count": 0,
"width": 1280,
"height": 800
},
"display": {
"isFullscreen": false,
Expand All @@ -16,7 +22,8 @@
},
"camera": {
"FOV": 30.0,
"aperture": 0.0,
"focalDistance": 0.7,
"aperture": 0.01,
"transforms": [
{
"type": "translate",
Expand All @@ -35,12 +42,6 @@
]
},
"scene": {
"outputFilePath": "output/",
"outputFileName": "rendered",
"fileType": "png",
"count": 0,
"width": 1280,
"height": 800,
"ambientColor": {
"hdr": "input/HDRs/rooitou_park_1k.hdr",
"offset": 0,
Expand Down
18 changes: 9 additions & 9 deletions input/refraction.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{
"version": 1.0,
"renderer": {
"threadCount": 0,
"sampleCount": 100,
"threads": 0,
"samples": 100,
"bounces": 50,
"antialiasing": true,
"tileWidth": 64,
"tileHeight": 64,
"tileOrder": "fromMiddle"
"tileOrder": "fromMiddle",
"outputFilePath": "output/",
"outputFileName": "rendered",
"fileType": "png",
"count": 0,
"width": 1280,
"height": 800
},
"display": {
"isFullscreen": false,
Expand Down Expand Up @@ -35,12 +41,6 @@
]
},
"scene": {
"outputFilePath": "output/",
"outputFileName": "rendered",
"fileType": "png",
"count": 0,
"width": 1280,
"height": 800,
"ambientColor": {
"down": {
"r": 1.0,
Expand Down
19 changes: 10 additions & 9 deletions input/scene.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{
"version": 1.0,
"renderer": {
"threadCount": 0,
"sampleCount": 100,
"threads": 0,
"samples": 50,
"bounces": 50,
"antialiasing": true,
"tileWidth": 64,
"tileHeight": 64,
"tileOrder": "fromMiddle"
"tileOrder": "fromMiddle",
"outputFilePath": "output/",
"outputFileName": "rendered",
"fileType": "png",
"count": 0,
"width": 1280,
"height": 800
},
"display": {
"isFullscreen": false,
Expand All @@ -16,6 +22,7 @@
},
"camera": {
"FOV": 80.0,
"focalDistance": 450.0,
"aperture": 0.0,
"transforms": [
{
Expand All @@ -35,12 +42,6 @@
]
},
"scene": {
"outputFilePath": "output/",
"outputFileName": "rendered",
"fileType": "png",
"count": 0,
"width": 1280,
"height": 800,
"ambientColor": {
"down": {
"r": 1.0,
Expand Down
Loading

0 comments on commit bde1683

Please sign in to comment.