Commit 3a0e9fe9 authored by Sébastien Garmier's avatar Sébastien Garmier
Browse files

17_03_19_1

parent 98bfd02d
No preview for this file type
No preview for this file type
......@@ -9,26 +9,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cuRRay_dev_cpu", "cuRRay_de
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|win32 = Debug|win32
Debug|x64 = Debug|x64
Release|win32 = Release|win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AD34E443-0DFF-4CC2-A6B9-B3F54B548FA1}.Debug|win32.ActiveCfg = Debug|Win32
{AD34E443-0DFF-4CC2-A6B9-B3F54B548FA1}.Debug|win32.Build.0 = Debug|Win32
{AD34E443-0DFF-4CC2-A6B9-B3F54B548FA1}.Debug|x64.ActiveCfg = Debug|x64
{AD34E443-0DFF-4CC2-A6B9-B3F54B548FA1}.Debug|x64.Build.0 = Debug|x64
{AD34E443-0DFF-4CC2-A6B9-B3F54B548FA1}.Release|win32.ActiveCfg = Release|Win32
{AD34E443-0DFF-4CC2-A6B9-B3F54B548FA1}.Release|win32.Build.0 = Release|Win32
{AD34E443-0DFF-4CC2-A6B9-B3F54B548FA1}.Release|x64.ActiveCfg = Release|x64
{AD34E443-0DFF-4CC2-A6B9-B3F54B548FA1}.Release|x64.Build.0 = Release|x64
{CB68EC38-50AB-48F6-8034-D0EE0A44C97F}.Debug|win32.ActiveCfg = Debug|Win32
{CB68EC38-50AB-48F6-8034-D0EE0A44C97F}.Debug|win32.Build.0 = Debug|Win32
{CB68EC38-50AB-48F6-8034-D0EE0A44C97F}.Debug|x64.ActiveCfg = Debug|x64
{CB68EC38-50AB-48F6-8034-D0EE0A44C97F}.Debug|x64.Build.0 = Debug|x64
{CB68EC38-50AB-48F6-8034-D0EE0A44C97F}.Release|win32.ActiveCfg = Release|Win32
{CB68EC38-50AB-48F6-8034-D0EE0A44C97F}.Release|win32.Build.0 = Release|Win32
{CB68EC38-50AB-48F6-8034-D0EE0A44C97F}.Release|x64.ActiveCfg = Release|x64
{CB68EC38-50AB-48F6-8034-D0EE0A44C97F}.Release|x64.Build.0 = Release|x64
EndGlobalSection
......
......@@ -1106,19 +1106,67 @@ void FrameRenderer::ApplySkyMap(PixelData* pixelData, Util::Vector4_double const
*/
// Get pixel coordinates
double xPixel = (double)m_skyMapWidth * (1.0 - azimuth / MATH_TWO_PI);
double yPixel = (double)m_skyMapHeight * (zenith / MATH_PI);
int32_t xPixel1 = (int32_t)floor(xPixel);
int32_t yPixel1 = (int32_t)floor(yPixel);
int32_t xPixel2 = xPixel1 + 1; if(xPixel2 >= m_skyMapWidth) xPixel2 = 0;
int32_t yPixel2 = yPixel1 + 1; if(yPixel2 >= m_skyMapHeight) yPixel2 = 0;
double xFrac = xPixel - (double)xPixel1;
double yFrac = yPixel - (double)yPixel1;
double r[] = {
p_skyMapData[3 * (yPixel1 * m_skyMapWidth + xPixel1)],
p_skyMapData[3 * (yPixel1 * m_skyMapWidth + xPixel2)],
p_skyMapData[3 * (yPixel2 * m_skyMapWidth + xPixel1)],
p_skyMapData[3 * (yPixel2 * m_skyMapWidth + xPixel2)]
};
double g[] = {
p_skyMapData[3 * (yPixel1 * m_skyMapWidth + xPixel1) + 1],
p_skyMapData[3 * (yPixel1 * m_skyMapWidth + xPixel2) + 1],
p_skyMapData[3 * (yPixel2 * m_skyMapWidth + xPixel1) + 1],
p_skyMapData[3 * (yPixel2 * m_skyMapWidth + xPixel2) + 1]
};
double b[] = {
p_skyMapData[3 * (yPixel1 * m_skyMapWidth + xPixel1) + 2],
p_skyMapData[3 * (yPixel1 * m_skyMapWidth + xPixel2) + 2],
p_skyMapData[3 * (yPixel2 * m_skyMapWidth + xPixel1) + 2],
p_skyMapData[3 * (yPixel2 * m_skyMapWidth + xPixel2) + 2]
};
double rf[] = {
(1.0 - xFrac) * r[0] + xFrac * r[1],
(1.0 - xFrac) * r[2] + xFrac * r[3]
};
double gf[] = {
(1.0 - xFrac) * g[0] + xFrac * g[1],
(1.0 - xFrac) * g[2] + xFrac * g[3]
};
double bf[] = {
(1.0 - xFrac) * b[0] + xFrac * b[1],
(1.0 - xFrac) * b[2] + xFrac * b[3]
};
double r_ = (1.0 - yFrac) * rf[0] + yFrac * rf[1];
double g_ = (1.0 - yFrac) * gf[0] + yFrac * gf[1];
double b_ = (1.0 - yFrac) * bf[0] + yFrac * bf[1];
/*
int32_t xPixel = (int32_t)round((double)m_skyMapWidth * (1.0 - azimuth / MATH_TWO_PI));
int32_t yPixel = (int32_t)round((double)m_skyMapHeight * (zenith / MATH_PI));
if(xPixel < 0) {
xPixel += (int32_t)m_skyMapWidth;
xPixel += (int32_t)m_skyMapWidth;
}
if(xPixel >= (int32_t)m_skyMapWidth) {
xPixel -= (int32_t)m_skyMapWidth;
xPixel -= (int32_t)m_skyMapWidth;
}
if(yPixel < 0) {
yPixel = -yPixel;
yPixel = -yPixel;
}
if(yPixel >= (int32_t)m_skyMapHeight) {
yPixel = 2 * m_skyMapHeight - yPixel;
yPixel = 2 * m_skyMapHeight - yPixel;
}
// Set color
......@@ -1126,6 +1174,11 @@ void FrameRenderer::ApplySkyMap(PixelData* pixelData, Util::Vector4_double const
pixel.m_color.m_red = p_skyMapData[pixelIndex];
pixel.m_color.m_green = p_skyMapData[pixelIndex + 1];
pixel.m_color.m_blue = p_skyMapData[pixelIndex + 2];
*/
pixel.m_color.m_red = (unsigned char)r_;
pixel.m_color.m_green = (unsigned char)g_;
pixel.m_color.m_blue = (unsigned char)b_;
}
}
......
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment