Tweaks for usability, next we will do pathtracing passback
This commit is contained in:
@@ -6,6 +6,12 @@ file(GLOB SRC "src/*.cpp")
|
||||
add_library(hart_cpu_accel SHARED ${SRC})
|
||||
set_target_properties(hart_cpu_accel PROPERTIES PREFIX "")
|
||||
|
||||
find_package(OpenMP)
|
||||
if(OpenMP_CXX_FOUND)
|
||||
target_link_libraries(hart_cpu_accel PUBLIC OpenMP::OpenMP_CXX)
|
||||
endif()
|
||||
|
||||
target_include_directories(hart_cpu_accel PRIVATE "../../libhart/")
|
||||
target_include_directories(hart_cpu_accel PRIVATE "../../libhart/thirdparty")
|
||||
target_include_directories(hart_cpu_accel PRIVATE "src/")
|
||||
|
||||
|
||||
@@ -90,10 +90,9 @@ public:
|
||||
glm::vec2 bestTexcoord;
|
||||
float bestDist = INFINITY;
|
||||
float dist;
|
||||
|
||||
|
||||
for (int i = 0; i < mIc; i += 3)
|
||||
{
|
||||
|
||||
uint32_t ind1 = mIndicies[i];
|
||||
uint32_t ind2 = mIndicies[i + 1];
|
||||
uint32_t ind3 = mIndicies[i + 2];
|
||||
@@ -103,7 +102,6 @@ public:
|
||||
const glm::vec3 c = { mVert[ind3 * 3], mVert[ind3 * 3 + 1], mVert[ind3 * 3 + 2] };
|
||||
|
||||
// Perform intersection test...
|
||||
|
||||
if (!glm::intersectRayTriangle(ray->Origin, ray->Direction, a, b, c, coords, dist)) { continue; }
|
||||
if (dist > bestDist || dist < 0.0f) { continue; }
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ void RayRenderer::draw()
|
||||
for (int x = 0; x < mRenderTargetSize.x; x++)
|
||||
for (int y = 0; y < mRenderTargetSize.y; y++)
|
||||
{
|
||||
mTarget[y * mRenderTargetSize.x + x] = { 1.0f, 0.0f, 0.0f, 1.0f };
|
||||
mTarget[y * mRenderTargetSize.x + x] = { 0.1f, 0.1f, 0.1f, 1.0f };
|
||||
}
|
||||
mCurrentRefTable = &startRays.Reference;
|
||||
|
||||
@@ -115,6 +115,8 @@ void RayRenderer::draw()
|
||||
|
||||
void RayRenderer::computeHit(HitInfo* info)
|
||||
{
|
||||
static float mind = 100000.0f;
|
||||
static float maxd = 0.0f;
|
||||
// TODO: Make sure signal is started
|
||||
if (!(*mCurrentRefTable).count(info->Caller->Reference))
|
||||
{
|
||||
@@ -123,5 +125,8 @@ void RayRenderer::computeHit(HitInfo* info)
|
||||
}
|
||||
glm::ivec2 pos = (*mCurrentRefTable)[info->Caller->Reference];
|
||||
float d = info->Distance;
|
||||
mTarget[pos.y * mRenderTargetSize.x + pos.x] = { d, d, d, 1.0f };
|
||||
if (d < mind) mind = d;
|
||||
if (d > maxd) maxd = d;
|
||||
float n = (d - mind) / (maxd - mind);
|
||||
mTarget[pos.y * mRenderTargetSize.x + pos.x] = { n, n, n, 1.0f};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user