Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed build issues on Ubuntu #25

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
2 changes: 1 addition & 1 deletion Source/boundingbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class EXPOSURE_RENDER_DLL BoundingBox
{
}

HOST_DEVICE BoundingBox& BoundingBox::operator = (const BoundingBox& Other)
HOST_DEVICE BoundingBox& operator = (const BoundingBox& Other)
{
this->MinP = Other.MinP;
this->MaxP = Other.MaxP;
Expand Down
18 changes: 9 additions & 9 deletions Source/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class EXPOSURE_RENDER_DLL Buffer

HOST void SetName(const char* pName)
{
sprintf_s(this->Name, MAX_CHAR_SIZE, "%s", pName);
snprintf(this->Name, MAX_CHAR_SIZE, "%s", pName);
this->UpdateFullName();
}

Expand All @@ -60,22 +60,22 @@ class EXPOSURE_RENDER_DLL Buffer
switch (this->MemoryType)
{
case Enums::Host:
sprintf_s(MemoryTypeName, MAX_CHAR_SIZE, "%s", "H");
snprintf(MemoryTypeName, MAX_CHAR_SIZE, "%s", "H");
break;

case Enums::Device:
sprintf_s(MemoryTypeName, MAX_CHAR_SIZE, "%s", "D");
snprintf(MemoryTypeName, MAX_CHAR_SIZE, "%s", "D");
break;

default:
sprintf_s(MemoryTypeName, MAX_CHAR_SIZE, "%s", "U");
snprintf(MemoryTypeName, MAX_CHAR_SIZE, "%s", "U");
break;
}

sprintf_s(this->FullName, MAX_CHAR_SIZE, "['%s', %s]", this->Name, MemoryTypeName);
snprintf(this->FullName, MAX_CHAR_SIZE, "['%s', %s]", this->Name, MemoryTypeName);
}

HOST virtual int GetNoBytes() const
HOST_DEVICE virtual int GetNoBytes() const
{
return 0;
}
Expand All @@ -101,9 +101,9 @@ class EXPOSURE_RENDER_DLL Buffer
{
switch (MemoryUnit)
{
case Enums::KiloByte: sprintf_s(pMemoryString, MAX_CHAR_SIZE, "%0.2f KB", this->GetMemorySize(Enums::KiloByte)); break;
case Enums::MegaByte: sprintf_s(pMemoryString, MAX_CHAR_SIZE, "%0.2f MB", this->GetMemorySize(Enums::MegaByte)); break;
case Enums::GigaByte: sprintf_s(pMemoryString, MAX_CHAR_SIZE, "%0.2f GB", this->GetMemorySize(Enums::GigaByte)); break;
case Enums::KiloByte: snprintf(pMemoryString, MAX_CHAR_SIZE, "%0.2f KB", this->GetMemorySize(Enums::KiloByte)); break;
case Enums::MegaByte: snprintf(pMemoryString, MAX_CHAR_SIZE, "%0.2f MB", this->GetMemorySize(Enums::MegaByte)); break;
case Enums::GigaByte: snprintf(pMemoryString, MAX_CHAR_SIZE, "%0.2f GB", this->GetMemorySize(Enums::GigaByte)); break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/buffer1d.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class EXPOSURE_RENDER_DLL Buffer1D : public Buffer<T>
Other.Dirty = false;
}

sprintf_s(this->Name, MAX_CHAR_SIZE, "Copy of %s", Other.Name);
snprintf(this->Name, MAX_CHAR_SIZE, "Copy of %s", Other.Name);

return *this;
}
Expand Down
4 changes: 2 additions & 2 deletions Source/buffer2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class EXPOSURE_RENDER_DLL Buffer2D : public Buffer<T>
Other.Dirty = false;
}

sprintf_s(this->Name, MAX_CHAR_SIZE, "Copy of %s", Other.Name);
snprintf(this->Name, MAX_CHAR_SIZE, "Copy of %s", Other.Name);

return *this;
}
Expand Down Expand Up @@ -245,7 +245,7 @@ class EXPOSURE_RENDER_DLL Buffer2D : public Buffer<T>
T((*this)(Coord[0][1], Coord[1][1]))
};

return (1.0f - dv) * ((1.0f - du) * Values[0] + du * Values[1]) + dv * ((1.0f - du) * Values[2] + du * Values[3]);
return T::Mul((1.0f - dv), ((1.0f - du) * Values[0] + du * Values[1])) + T::Mul(dv, ((1.0f - du) * Values[2] + du * Values[3]));
}

HOST_DEVICE T& operator[](const int& ID) const
Expand Down
2 changes: 1 addition & 1 deletion Source/buffer3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class EXPOSURE_RENDER_DLL Buffer3D : public Buffer<T>
Other.Dirty = false;
}

sprintf_s(this->Name, MAX_CHAR_SIZE, "Copy of %s", Other.Name);
snprintf(this->Name, MAX_CHAR_SIZE, "Copy of %s", Other.Name);

return *this;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class EXPOSURE_RENDER_DLL Camera
{
}

HOST Camera& Camera::operator = (const Camera& Other)
HOST Camera& operator = (const Camera& Other)
{
this->FilmSize = Other.FilmSize;
this->Pos = Other.Pos;
Expand Down
56 changes: 53 additions & 3 deletions Source/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class EXPOSURE_RENDER_DLL ColorRGBf
static inline HOST_DEVICE ColorRGBf FromXYZf(const ColorXYZf& XYZ);
static inline HOST_DEVICE ColorRGBf FromXYZAf(const ColorXYZAf& XYZA);
static inline HOST_DEVICE ColorRGBf Black() { return ColorRGBf(); }
static inline HOST_DEVICE ColorRGBf Mul(const float a, const ColorRGBf& XYZ);

DATA(float, 3)
};
Expand All @@ -83,6 +84,7 @@ class EXPOSURE_RENDER_DLL ColorXYZf
static inline HOST_DEVICE ColorXYZf FromRGBuc(const ColorRGBuc& RGB);
static inline HOST_DEVICE ColorXYZf FromRGBAuc(const ColorRGBAuc& RGB);
static inline HOST_DEVICE ColorXYZf Black() { return ColorXYZf(); }
static inline HOST_DEVICE ColorXYZf Mul(const float a, const ColorXYZf& XYZ);

DATA(float, 3)
};
Expand All @@ -100,6 +102,7 @@ class EXPOSURE_RENDER_DLL ColorXYZAf

static inline HOST_DEVICE ColorXYZAf FromRGBf(const ColorRGBf& RGB);
static inline HOST_DEVICE ColorXYZAf Black() { return ColorXYZAf(); }
static inline HOST_DEVICE ColorXYZAf Mul(const float a, const ColorXYZAf& XYZ);

DATA(float, 4)
};
Expand All @@ -116,6 +119,7 @@ class EXPOSURE_RENDER_DLL ColorRGBuc

static inline HOST_DEVICE ColorRGBuc FromXYZf(const ColorXYZf& XYZ);
static inline HOST_DEVICE ColorRGBuc Black() { return ColorRGBuc(); }
static inline HOST_DEVICE ColorRGBuc Mul(const float a, const ColorRGBuc& XYZ);

DATA(unsigned char, 3)
};
Expand All @@ -132,6 +136,7 @@ class EXPOSURE_RENDER_DLL ColorRGBAuc

static inline HOST_DEVICE ColorRGBAuc FromXYZf(const ColorXYZf& XYZ);
static inline HOST_DEVICE ColorRGBAuc Black() { return ColorRGBAuc(); }
static inline HOST_DEVICE ColorRGBAuc Mul(const float a, const ColorRGBAuc& XYZ);

DATA(unsigned char, 4)
};
Expand All @@ -158,6 +163,15 @@ HOST_DEVICE ColorRGBf ColorRGBf::FromXYZAf(const ColorXYZAf& XYZA)
return Result;
};

HOST_DEVICE ColorRGBf ColorRGBf::Mul(const float a, const ColorRGBf& XYZ) {
ColorRGBf Result;
Result[0] = a * XYZ[0];
Result[1] = a * XYZ[1];
Result[2] = a * XYZ[2];
return Result;
}


HOST_DEVICE ColorXYZf ColorXYZf::FromRGBf(const ColorRGBf& RGB)
{
ColorXYZf Result;
Expand Down Expand Up @@ -205,6 +219,15 @@ HOST_DEVICE ColorXYZf ColorXYZf::FromRGBAuc(const ColorRGBAuc& RGBA)
return Result;
};

HOST_DEVICE ColorXYZf ColorXYZf::Mul(const float a, const ColorXYZf& XYZ)
{
ColorXYZf Result;
Result[0] = a * XYZ[0];
Result[1] = a * XYZ[1];
Result[2] = a * XYZ[2];
return Result;
}

HOST_DEVICE ColorXYZAf ColorXYZAf::FromRGBf(const ColorRGBf& RGB)
{
ColorXYZAf Result;
Expand All @@ -216,6 +239,16 @@ HOST_DEVICE ColorXYZAf ColorXYZAf::FromRGBf(const ColorRGBf& RGB)
return Result;
};

HOST_DEVICE ColorXYZAf ColorXYZAf::Mul(const float a, const ColorXYZAf& XYZA)
{
ColorXYZAf Result;
Result[0] = a * XYZA[0];
Result[1] = a * XYZA[1];
Result[2] = a * XYZA[2];
Result[3] = a * XYZA[3];
return Result;
}

HOST_DEVICE ColorRGBuc ColorRGBuc::FromXYZf(const ColorXYZf& XYZ)
{
ColorRGBuc Result;
Expand All @@ -234,6 +267,14 @@ HOST_DEVICE ColorRGBuc ColorRGBuc::FromXYZf(const ColorXYZf& XYZ)
return Result;
};

HOST_DEVICE ColorRGBuc ColorRGBuc::Mul(const float a, const ColorRGBuc& XYZ) {
ColorRGBuc Result;
Result[0] = a * XYZ[0];
Result[1] = a * XYZ[1];
Result[2] = a * XYZ[2];
return Result;
}

HOST_DEVICE ColorRGBAuc ColorRGBAuc::FromXYZf(const ColorXYZf& XYZ)
{
ColorRGBAuc Result;
Expand All @@ -252,13 +293,22 @@ HOST_DEVICE ColorRGBAuc ColorRGBAuc::FromXYZf(const ColorXYZf& XYZ)
return Result;
};

HOST_DEVICE ColorRGBAuc ColorRGBAuc::Mul(const float a, const ColorRGBAuc& XYZA) {
ColorRGBAuc Result;
Result[0] = a * XYZA[0];
Result[1] = a * XYZA[1];
Result[2] = a * XYZA[2];
Result[3] = a * XYZA[3];
return Result;
}

static inline HOST_DEVICE ColorRGBf operator * (ColorRGBf& RGB, const float& F) { return RGB *= F; };
static inline HOST_DEVICE ColorRGBf operator * (const float& F, ColorRGBf& RGB) { return RGB *= F; };
static inline HOST_DEVICE ColorRGBf Lerp(const float& LerpC, const ColorRGBf& A, const ColorRGBf& B) { return LerpC * (B - A); };
static inline HOST_DEVICE ColorRGBf Lerp(const float& LerpC, const ColorRGBf& A, const ColorRGBf& B) { return ColorRGBf::Mul(LerpC, (B - A)); };

static inline HOST_DEVICE ColorXYZf operator * (ColorXYZf& XYZ, const float& F) { return XYZ *= F; };
static inline HOST_DEVICE ColorXYZf operator * (const float& F, ColorXYZf& XYZ) { return XYZ *= F; };
static inline HOST_DEVICE ColorXYZf Lerp(const float& LerpC, const ColorXYZf& A, const ColorXYZf& B) { return LerpC * (B - A); };
static inline HOST_DEVICE ColorXYZf Lerp(const float& LerpC, const ColorXYZf& A, const ColorXYZf& B) { return ColorXYZf::Mul(LerpC, (B - A)); };

static inline HOST_DEVICE ColorXYZAf operator * (ColorXYZAf& XYZA, const float& F)
{
Expand All @@ -270,7 +320,7 @@ static inline HOST_DEVICE ColorXYZAf operator * (const float& F, ColorXYZAf& XYZ
return ColorXYZAf(XYZA[0] * F, XYZA[1] * F, XYZA[2] * F, XYZA[3] * F);
};

static inline HOST_DEVICE ColorXYZAf Lerp(const float& LerpC, const ColorXYZAf& A, const ColorXYZAf& B) { return LerpC * (B - A); };
static inline HOST_DEVICE ColorXYZAf Lerp(const float& LerpC, const ColorXYZAf& A, const ColorXYZAf& B) { return ColorXYZAf::Mul(LerpC, (B - A)); };

static inline HOST_DEVICE ColorRGBuc operator * (ColorRGBuc& RGB, const unsigned char& UC) { return RGB *= UC; };
static inline HOST_DEVICE ColorRGBuc operator * (const unsigned char& UC, ColorRGBuc& RGB) { return RGB *= UC; };
Expand Down
2 changes: 1 addition & 1 deletion Source/core.cu
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ExposureRender::Cuda::List<ExposureRender::Bitmap, ExposureRender::ErBitmap>
#include "singlescattering.cuh"
#include "filterframeestimate.cuh"
#include "estimate.cuh"
#include "toneMap.cuh"
#include "tonemap.cuh"

namespace ExposureRender
{
Expand Down
12 changes: 8 additions & 4 deletions Source/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@

using namespace std;

#ifdef _EXPORTING
#define EXPOSURE_RENDER_DLL __declspec(dllexport)
#else
#define EXPOSURE_RENDER_DLL __declspec(dllimport)
#ifdef WIN32
#ifdef _EXPORTING
#define EXPOSURE_RENDER_DLL __declspec(dllexport)
#else
#define EXPOSURE_RENDER_DLL __declspec(dllimport)
#endif
#else
#define EXPOSURE_RENDER_DLL
#endif

namespace ExposureRender
Expand Down
2 changes: 1 addition & 1 deletion Source/ertracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class EXPOSURE_RENDER_DLL ErTracer : public ErBindable
*this = Other;
}

HOST ErTracer& ErTracer::operator = (const ErTracer& Other)
HOST ErTracer& operator = (const ErTracer& Other)
{
ErBindable::operator=(Other);

Expand Down
2 changes: 1 addition & 1 deletion Source/ervolume.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class EXPOSURE_RENDER_DLL ErVolume : public ErBindable
*this = Other;
}

HOST ErVolume& ErVolume::operator = (const ErVolume& Other)
HOST ErVolume& operator = (const ErVolume& Other)
{
ErBindable::operator=(Other);

Expand Down
5 changes: 3 additions & 2 deletions Source/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#pragma once

#include <cstdio>
#include "defines.h"
#include "enums.h"

Expand All @@ -25,7 +26,7 @@ class EXPOSURE_RENDER_DLL Exception
HOST Exception(const Enums::ExceptionLevel& Level, const char* pMessage = "")
{
this->Level = Level;
sprintf_s(this->Message, MAX_CHAR_SIZE, "%s", pMessage);
snprintf(this->Message, MAX_CHAR_SIZE, "%s", pMessage);
}

HOST ~Exception()
Expand All @@ -40,7 +41,7 @@ class EXPOSURE_RENDER_DLL Exception
HOST Exception& operator = (const Exception& Other)
{
this->Level = Other.Level;
sprintf_s(this->Message, MAX_CHAR_SIZE, "%s", Other.Message);
snprintf(this->Message, MAX_CHAR_SIZE, "%s", Other.Message);

return *this;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/intersection.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Intersection
this->UV = Vec2f(0.0f);
}

HOST_DEVICE Intersection& Intersection::operator = (const Intersection& Other)
HOST_DEVICE Intersection& operator = (const Intersection& Other)
{
this->Valid = Other.Valid;
this->Front = Other.Front;
Expand Down
4 changes: 2 additions & 2 deletions Source/lights.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ HOST_DEVICE_NI void SampleLight(const Light& Light, LightSample& LS, SurfaceSamp

Wi = Normalize(SS.P - SE.P);

Le = Light.Multiplier * EvaluateTexture(Light.TextureID, SS.UV);
Le = ColorXYZf::Mul(Light.Multiplier, EvaluateTexture(Light.TextureID, SS.UV));

if (Light.Shape.OneSided && Dot(SE.P - SS.P, SS.N) < 0.0f)
Le = ColorXYZf::Black();
Expand Down Expand Up @@ -75,7 +75,7 @@ HOST_DEVICE_NI void IntersectLight(const Light& Light, const Ray& R, ScatterEven
SE.T = Length(SE.P - R.O);
SE.Wo = -R.D;
SE.UV = Int.UV;
SE.Le = Int.Front ? Light.Multiplier * EvaluateTexture(Light.TextureID, SE.UV) : ColorXYZf::Black();
SE.Le = Int.Front ? ColorXYZf::Mul(Light.Multiplier, EvaluateTexture(Light.TextureID, SE.UV)) : ColorXYZf::Black();

if (Light.Unit == 1)
SE.Le /= Light.Shape.Area;
Expand Down
4 changes: 2 additions & 2 deletions Source/list.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public:
DeviceSymbol()
{
DebugLog(__FUNCTION__);
sprintf_s(DeviceSymbol, MAX_CHAR_SIZE, "%s", pDeviceSymbol);
snprintf(DeviceSymbol, MAX_CHAR_SIZE, "%s", pDeviceSymbol);
}

HOST ~List()
Expand Down Expand Up @@ -150,7 +150,7 @@ public:
{
char Message[MAX_CHAR_SIZE];

sprintf_s(Message, MAX_CHAR_SIZE, "%s failed, resource item with ID:%d does not exist", __FUNCTION__, i);
snprintf(Message, MAX_CHAR_SIZE, "%s failed, resource item with ID:%d does not exist", __FUNCTION__, i);

throw(Exception(Enums::Warning, Message));
}
Expand Down
2 changes: 1 addition & 1 deletion Source/plane.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#pragma once

#include "Intersection.h"
#include "intersection.h"
#include "sample.h"

namespace ExposureRender
Expand Down
Loading