Skip to content

Commit 247aebd

Browse files
little focus fix. Enabled optimizations.
1 parent 1dbee20 commit 247aebd

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

DogeRay.vcxproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,14 @@
7272
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
7373
<ClCompile>
7474
<WarningLevel>Level3</WarningLevel>
75-
<Optimization>MaxSpeed</Optimization>
75+
<Optimization>Custom</Optimization>
7676
<FunctionLevelLinking>true</FunctionLevelLinking>
7777
<IntrinsicFunctions>true</IntrinsicFunctions>
7878
<PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
79+
<WholeProgramOptimization>true</WholeProgramOptimization>
80+
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
81+
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
82+
<OmitFramePointers>true</OmitFramePointers>
7983
</ClCompile>
8084
<Link>
8185
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -87,6 +91,7 @@
8791
<CudaCompile>
8892
<TargetMachinePlatform>64</TargetMachinePlatform>
8993
<Include>%(AdditionalIncludeDirectories)</Include>
94+
<FastMath>false</FastMath>
9095
</CudaCompile>
9196
</ItemDefinitionGroup>
9297
<ItemGroup>

classes/bvhtree.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Bvhtree {
7070
//build BVH tree
7171
void build() {
7272
//split
73-
std::cout << "building BVH \n";
73+
std::cout << "building BVH\n";
7474
recursivesplit(traingles);
7575
std::cout << "linking BVH \n";
7676
createlinks(0, -1);
@@ -106,15 +106,14 @@ class Bvhtree {
106106
nodes.push_back(parent);
107107
return parentindex;
108108
}
109-
110109
//push current node
111110
nodes.push_back(parent);
112111
//get axis with most difference
113112
int axis = (parent.box.max - parent.box.min).extent();
114113
//split by middle
115114
int mid = remaining.size() / 2;
116115
//sort and split by center of bounding box
117-
std::nth_element(remaining.begin(),remaining.begin()+mid, remaining.end(),
116+
std::nth_element(remaining.begin(), remaining.begin() + mid, remaining.end(),
118117
[axis](const Tri& a, const Tri& b) {
119118
return a.box.center[axis] < b.box.center[axis];
120119
});

classes/camera.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ class Camera {
1414
float degreefov = 45;
1515
Vec3 up{ 0, 1, 0 };
1616
float aperture = 0;
17-
float focusoffset = 0;
17+
float focus = 1;
1818

1919
//no constructor to allow this to be in struct
2020
//calculate camera parameters
2121
void calculate() {
2222
//autofocus
23-
Vec3 focusdistance = (position - lookposition).length() + focusoffset;
23+
Vec3 focusdistance = focus;
2424
//convert fov from degrees to radians
2525
radfov = degreefov * M_PI / 180.0f;
2626
float h = tan(radfov / 2);

classes/gui.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class Gui {
117117
changed |= ImGui::DragFloat3("camera position", settings->cam.position.values);
118118
//more camera options
119119
if (ImGui::CollapsingHeader("Lens")) {
120-
changed |= ImGui::DragFloat("focus distance", &settings->cam.focusoffset);
120+
changed |= ImGui::DragFloat("Focus distance", &settings->cam.focus);
121121
changed |= ImGui::SliderFloat("aperture", &settings->cam.aperture, 0, 5);
122122
changed |= ImGui::SliderFloat("FOV", &settings->cam.degreefov, 0, 180);
123123
if (settings->cam.lookat) {

classes/program.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class Program {
6868
\:\/.:| |\:\_\ \ \\:\_\ \ \ \:\____/\\ \ `\ \ \\:.\ \ \ \ \::\ \ \:\____/\
6969
\____/_/ \_____\/ \_____\/ \_____\/ \_\/ \_\/ \__\/\__\/ \__\/ \_____\/ )" << std::endl;
7070

71-
std::cout << "V.2.0 by Philip Prager Urbina 2022" << std::endl;
71+
std::cout << "V.2.0.0 by Philip Prager Urbina 2022" << std::endl;
7272
std::cout << "Find on github: https://github.com/PhilipPragerUrbina/DOGERAY2" << std::endl;
7373
}
7474

0 commit comments

Comments
 (0)