Commit cec07523 authored by Jehferson Mello's avatar Jehferson Mello
Browse files

Streamlined colouring a bit by actually using constructors

parent cb59d9be
......@@ -280,11 +280,7 @@ __device__ RGBA getColour(const Vec4f& steps)
Vec3f position(steps.X(),steps.Y(),steps.Z());
RGBA background;
background.setR(bgValue);
background.setG(bgValue);
background.setB(bgValue);
background.setA(bgAlpha);
static RGBA background(bgValue,bgValue,bgValue,bgAlpha);
if(steps.W() == maxRaySteps)
{
......@@ -297,14 +293,10 @@ __device__ RGBA getColour(const Vec4f& steps)
colour = HSVtoRGB(hue, saturation, value);
// Simplest colouring, based only on steps (roughly distance from camera)
// colour.r = static_cast<uint8_t>(255*value);
// colour.g = static_cast<uint8_t>(255*value);
// colour.b = static_cast<uint8_t>(255*value);
// Simplest colouring, based only on steps (roughly distance from camera)
//colour = RGBA(value,value,value,1.0f);
return colour;
}
/******************************************************************************
......@@ -427,9 +419,9 @@ FracGen::FracGen(bool benching, size_t width, size_t height)
cam->AR = static_cast<double>(width)/static_cast<double>(height);
// Position here is more or less ignored. It's used for initial screen calculation but the
// rays are launched from a different distance, specified in the .cl file
cam->pos = Vec3d{0, 0, cameraZ};
cam->target = Vec3d{0,0,0};
cam->up = Vec3d{0,1,0};
cam->pos = Vec3f{0, 0, cameraZ};
cam->target = Vec3f{0,0,0};
cam->up = Vec3f{0,1,0};
cam->near = 0.1;
cam->fovY = 45;
......
......@@ -293,11 +293,7 @@ __device__ RGBA getColour(const Vec4f& steps)
Vec3f position(steps.X(),steps.Y(),steps.Z());
RGBA background;
background.setR(bgValue);
background.setG(bgValue);
background.setB(bgValue);
background.setA(bgAlpha);
static RGBA background(bgValue,bgValue,bgValue,bgAlpha);
if(steps.W() == maxRaySteps)
{
......@@ -311,13 +307,9 @@ __device__ RGBA getColour(const Vec4f& steps)
colour = HSVtoRGB(hue, saturation, value);
// Simplest colouring, based only on steps (roughly distance from camera)
// colour.r = static_cast<uint8_t>(255*value);
// colour.g = static_cast<uint8_t>(255*value);
// colour.b = static_cast<uint8_t>(255*value);
//colour = RGBA(value,value,value,1.0f);
return colour;
}
/******************************************************************************
......
......@@ -262,6 +262,11 @@ static void getColour(double steps[4], double out[4])
double value = valueRange*(1.0 - min(steps[3]*valueFactor/maxRaySteps, valueClamp));
HSVtoRGB(hue, saturation, value, out);
// out[0] = value;
// out[1] = value;
// out[2] = value;
// out[3] = 1.0f;
}
/******************************************************************************
......
......@@ -262,6 +262,10 @@ static void getColour(float steps[4], float out[4])
float value = valueRange*(1.0f - min(steps[3]*valueFactor/maxRaySteps, valueClamp));
HSVtoRGB(hue, saturation, value, out);
// out[0] = value;
// out[1] = value;
// out[2] = value;
// out[3] = 1.0f;
}
/******************************************************************************
......
......@@ -235,11 +235,7 @@ RGBA getColour(const Vec4f& steps)
Vec3f position(steps.X(),steps.Y(),steps.Z());
RGBA background;
background.setR(bgValue);
background.setG(bgValue);
background.setB(bgValue);
background.setA(bgAlpha);
static RGBA background(bgValue,bgValue,bgValue,bgAlpha);
if(steps.W() == maxRaySteps)
{
......@@ -263,10 +259,7 @@ RGBA getColour(const Vec4f& steps)
colour = HSVtoRGB(hue, saturation, value);
// Simplest colouring, based only on steps (roughly distance from camera)
// colour.r = static_cast<uint8_t>(255*value);
// colour.g = static_cast<uint8_t>(255*value);
// colour.b = static_cast<uint8_t>(255*value);
//colour = RGBA(value,value,value,1.0f);
return colour;
......
......@@ -223,9 +223,10 @@ float4 getColour(float4 steps)
// Simplest colouring, based only on steps (roughly distance from camera)
// colour.r = static_cast<uint8_t>(255*value);
// colour.g = static_cast<uint8_t>(255*value);
// colour.b = static_cast<uint8_t>(255*value);
// colour.x = value;
// colour.y = value;
// colour.z = value;
// colour.w = 1.0f;
return colour;
}
......
......@@ -238,11 +238,7 @@ RGBA getColour(const Vec4d& steps)
Vec3d position(steps.X(),steps.Y(),steps.Z());
RGBA background;
background.setR(bgValue);
background.setG(bgValue);
background.setB(bgValue);
background.setA(bgAlpha);
static RGBA background(bgValue,bgValue,bgValue,bgAlpha);
if(steps.W() == maxRaySteps)
{
......@@ -266,13 +262,9 @@ RGBA getColour(const Vec4d& steps)
colour = HSVtoRGB(hue, saturation, value);
// Simplest colouring, based only on steps (roughly distance from camera)
// colour.r = static_cast<uint8_t>(255*value);
// colour.g = static_cast<uint8_t>(255*value);
// colour.b = static_cast<uint8_t>(255*value);
//colour = RGBA(value,value,value,1.0f);
return colour;
}
/******************************************************************************
......
......@@ -238,11 +238,7 @@ RGBA getColour(const Vec4f& steps)
Vec3f position(steps.X(),steps.Y(),steps.Z());
RGBA background;
background.setR(bgValue);
background.setG(bgValue);
background.setB(bgValue);
background.setA(bgAlpha);
static RGBA background(bgValue,bgValue,bgValue,bgAlpha);
if(steps.W() == maxRaySteps)
{
......@@ -266,10 +262,7 @@ RGBA getColour(const Vec4f& steps)
colour = HSVtoRGB(hue, saturation, value);
// Simplest colouring, based only on steps (roughly distance from camera)
// colour.r = static_cast<uint8_t>(255*value);
// colour.g = static_cast<uint8_t>(255*value);
// colour.b = static_cast<uint8_t>(255*value);
//colour = RGBA(value,value,value,1.0f);
return colour;
......
......@@ -238,11 +238,7 @@ RGBA getColour(const Vec4f& steps)
Vec3f position(steps.X(),steps.Y(),steps.Z());
RGBA background;
background.setR(bgValue);
background.setG(bgValue);
background.setB(bgValue);
background.setA(bgAlpha);
static RGBA background(bgValue,bgValue,bgValue,bgAlpha);
if(steps.W() == maxRaySteps)
{
......@@ -266,13 +262,10 @@ RGBA getColour(const Vec4f& steps)
colour = HSVtoRGB(hue, saturation, value);
// Simplest colouring, based only on steps (roughly distance from camera)
//colour = RGBA(value,value,value,1.0f);
// colour.r = static_cast<uint8_t>(255*value);
// colour.g = static_cast<uint8_t>(255*value);
// colour.b = static_cast<uint8_t>(255*value);
return colour;
}
/******************************************************************************
......
......@@ -227,11 +227,7 @@ RGBA getColour(const Vec4f& steps)
Vec3f position(steps.X(),steps.Y(),steps.Z());
RGBA background;
background.setR(bgValue);
background.setG(bgValue);
background.setB(bgValue);
background.setA(bgAlpha);
static RGBA background(bgValue,bgValue,bgValue,bgAlpha);
if(steps.W() == maxRaySteps)
{
......@@ -245,14 +241,10 @@ RGBA getColour(const Vec4f& steps)
colour = HSVtoRGB(hue, saturation, value);
// Simplest colouring, based only on steps (roughly distance from camera)
// colour.r = static_cast<uint8_t>(255*value);
// colour.g = static_cast<uint8_t>(255*value);
// colour.b = static_cast<uint8_t>(255*value);
// Simplest colouring, based only on steps (roughly distance from camera)
//colour = RGBA(value,value,value,1.0f);
return colour;
}
/******************************************************************************
......
......@@ -236,13 +236,9 @@ RGBA getColour(const Vec4f& steps)
Vec3f position(steps.X(),steps.Y(),steps.Z());
RGBA background;
background.setR(bgValue);
background.setG(bgValue);
background.setB(bgValue);
background.setA(bgAlpha);
static RGBA background(bgValue,bgValue,bgValue,bgAlpha);
if(steps.W() == maxRaySteps)
if(steps.W() >= maxRaySteps)
{
return background;
}
......@@ -264,13 +260,9 @@ RGBA getColour(const Vec4f& steps)
colour = HSVtoRGB(hue, saturation, value);
// Simplest colouring, based only on steps (roughly distance from camera)
// colour.r = static_cast<uint8_t>(255*value);
// colour.g = static_cast<uint8_t>(255*value);
// colour.b = static_cast<uint8_t>(255*value);
//colour = RGBA(value,value,value,1.0f);
return colour;
}
/******************************************************************************
......
......@@ -223,9 +223,10 @@ vec4 getColour(vec4 steps)
colour = HSVtoRGB(hue, saturation, value);
// colour.r = uint(255*value);
// colour.g = uint(255*value);
// colour.b = uint(255*value);
// colour.x = value;
// colour.y = value;
// colour.z = value;
// colour.w = 1.0f;
return colour;
}
......
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