Skip to content

Commit

Permalink
Merge branch 'dev' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
larc committed Aug 17, 2024
2 parents 477f08f + 72efe30 commit 81c3c58
Show file tree
Hide file tree
Showing 23 changed files with 6,666 additions and 2,180 deletions.
18 changes: 9 additions & 9 deletions include/gproshan/raytracing/optix.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ class optix : public raytracing
CUcontext cuda_context;
CUstream stream;

OptixDeviceContext optix_context;
OptixDeviceContext _context;

OptixModule optix_module;
OptixModuleCompileOptions optix_module_compile_opt = {};
OptixModule _module;
OptixModuleCompileOptions _module_compile_opt = {};

OptixPipeline optix_pipeline;
OptixPipelineCompileOptions optix_pipeline_compile_opt = {};
OptixPipelineLinkOptions optix_pipeline_link_opt = {};
OptixPipeline _pipeline;
OptixPipelineCompileOptions _pipeline_compile_opt = {};
OptixPipelineLinkOptions _pipeline_link_opt = {};

OptixProgramGroup raygen_programs[1];
OptixProgramGroup miss_programs[2];
OptixProgramGroup hitgroup_programs[2];

OptixShaderBindingTable sbt = {};

launch_params optix_params;
launch_params * optix_params_buffer = nullptr;
optix_params params;
optix_params * params_buffer = nullptr;

std::vector<che *> d_mesh;

Expand All @@ -65,7 +65,7 @@ class optix : public raytracing
void create_pipeline();
void build_sbt();
OptixTraversableHandle build_as(const std::vector<const che *> & meshes, const std::vector<mat4> & model_mats);
void add_mesh(OptixBuildInput & optix_mesh, CUdeviceptr & d_vertex_ptr, uint32_t & optix_trig_flags, const che * mesh, const mat4 & model_mat);
void add_mesh(OptixBuildInput & _mesh, CUdeviceptr & d_vertex_ptr, uint32_t & _trig_flags, const che * mesh, const mat4 & model_mat);
};


Expand Down
2 changes: 1 addition & 1 deletion include/gproshan/raytracing/optix_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
namespace gproshan::rt {


struct launch_params: public base_params
struct optix_params: public base_params
{
OptixTraversableHandle traversable;

Expand Down
14 changes: 7 additions & 7 deletions include/gproshan/raytracing/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ __host_device__
vec<T, 3> texture(const scene::texture & tex, const vec<T, 2> & coord)
{
const int i = (tex.width + int(coord.x() * (tex.width - 1))) % tex.width;
const int j = (tex.height + int(coord.y() * (tex.height -1))) % tex.height;
const int j = (tex.height + int(coord.y() * (tex.height - 1))) % tex.height;
const int k = j * tex.width + i;

che::rgb_t color;
Expand All @@ -67,7 +67,7 @@ vec<T, 3> texture(const scene::texture & tex, const vec<T, 2> & coord)
color.r = color.g = color.b = tex.data[k];
}

return {T(color.r) / 255, T(color.g) / 255, T(color.b) / 255};
return {T(color.r) / 255.f, T(color.g) / 255.f, T(color.b) / 255.f};
}

template <class T>
Expand Down Expand Up @@ -163,15 +163,15 @@ struct t_eval_hit
__host_device__
bool scatter_reflect(vec<T, 3> & dir, random<T> & )
{
dir = normalize(dir - 2 * dot(dir, normal) * normal);
dir = normalize(dir - 2.f * dot(dir, normal) * normal);
return dot(dir, normal) > 0;
}

__host_device__
bool scatter_refract(vec<T, 3> & dir, random<T> & )
{
const float dvn = dot(dir, normal);
const float d = 1 - Ni * Ni * (1 - dvn * dvn);
const float d = 1.f - Ni * Ni * (1.f - dvn * dvn);

if(d <= 0) return false;

Expand All @@ -183,8 +183,8 @@ struct t_eval_hit
bool scatter_diffuse(vec<T, 3> & dir, random<T> & rnd)
{
// random unit sphere
const T theta = rnd() * 2 * M_PI;
const T phi = acosf(2 * rnd() - 1);
const T theta = rnd() * 2.f * M_PI;
const T phi = acosf(2.f * rnd() - 1.f);
const T r = cbrtf(rnd());

const vec<T, 3> p = { r * sinf(phi) * cosf(theta)
Expand Down Expand Up @@ -252,7 +252,7 @@ vec<T, 3> ray_view_dir( const uvec2 & pos,
vec2 screen = { (float(pos.x()) + rnd()) / windows_size.x(),
(float(pos.y()) + rnd()) / windows_size.y()
};
vec<T, 4> view = {screen.x() * 2 - 1, screen.y() * 2 - 1, 1, 1};
vec<T, 4> view = {screen.x() * 2.f - 1.f, screen.y() * 2.f - 1.f, 1.f, 1.f};
vec<T, 4> q = inv_proj_view * view;
vec<T, 3> p = q / q[3];

Expand Down
13 changes: 9 additions & 4 deletions include/imgui/imconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@

//---- Define attributes of all API symbols declarations, e.g. for DLL under Windows
// Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility.
// DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions()
// for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details.
//#define IMGUI_API __declspec( dllexport )
//#define IMGUI_API __declspec( dllimport )
// - Windows DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions()
// for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details.
//#define IMGUI_API __declspec(dllexport) // MSVC Windows: DLL export
//#define IMGUI_API __declspec(dllimport) // MSVC Windows: DLL import
//#define IMGUI_API __attribute__((visibility("default"))) // GCC/Clang: override visibility when set is hidden

//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to clean your code of obsolete function/names.
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
Expand All @@ -42,13 +43,17 @@
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with non-Visual Studio compilers] Don't implement default IME handler (won't require imm32.lib/.a)
//#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, IME).
//#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default).
//#define IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS // Don't implement default io.PlatformOpenInShellFn() handler (Win32: ShellExecute(), require shell32.lib/.a, Mac/Linux: use system("")).
//#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf)
//#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself.
//#define IMGUI_DISABLE_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle at all (replace them with dummies)
//#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function.
//#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions().
//#define IMGUI_DISABLE_SSE // Disable use of SSE intrinsics even if available

//---- Enable Test Engine / Automation features.
//#define IMGUI_ENABLE_TEST_ENGINE // Enable imgui_test_engine hooks. Generally set automatically by include "imgui_te_config.h", see Test Engine for details.

//---- Include imgui_user.h at the end of imgui.h as a convenience
// May be convenient for some users to only explicitly include vanilla imgui.h and have extra stuff included.
//#define IMGUI_INCLUDE_IMGUI_USER_H
Expand Down
Loading

0 comments on commit 81c3c58

Please sign in to comment.