Maj terminée. Pour consulter la release notes associée voici le lien :
https://about.gitlab.com/releases/2021/07/07/critical-security-release-gitlab-14-0-4-released/

Commit e5258ab5 authored by MURRAY David's avatar MURRAY David
Browse files

format

parent 797b1ee3
......@@ -642,8 +642,10 @@ _renderer.setMaxRenderingTime(max_rendering_time);
Camera const *current_cam = cams[cam_index];
temp_file_name = dir + ss.str() + "_" + current_cam->idName() + "_" + temp_file_name + samples_information
/*+ env_info*/ + "." + temp_file_extension;
temp_file_name = dir + ss.str() + "_" + current_cam->idName() + "_" + temp_file_name
+ samples_information
/*+ env_info*/
+ "." + temp_file_extension;
}
else
{
......
......@@ -1445,7 +1445,7 @@ void OptixMaterialHandler::updateTextureIndexedUTIA(mrf::materials::IndexedUTIA
auto param_buffer = _context->createBuffer(RT_BUFFER_INPUT);
param_buffer->setFormat(RT_FORMAT_USER);
_loger.info(std::to_string(sizeof(int) * 6));
param_buffer->setElementSize(sizeof(int) * 8); //Padding to align on 32bit
param_buffer->setElementSize(sizeof(int) * 8); //Padding to align on 32bit
param_buffer->setSize(indices.size());
void *data = param_buffer->map();
int * int_data = (int *)(data);
......
......@@ -181,7 +181,7 @@ private:
//
std::map<mrf::materials::UMat *, optix::Material> _materials;
std::map<mrf::materials::UMat *, optix::TextureSampler> _mat_index_maps;
/**
......
......@@ -70,7 +70,7 @@ bool updateTextureFromImage(mrf::image::ColorImage const &image, optix::TextureS
int i = 0;
for (size_t j = 0; j < image.width() * image.height(); j++)
{
const size_t pixel_x = j % image.width();
const size_t pixel_x = j % image.width();
//const size_t pixel_y = image.height() - j / image.width() - 1;
const size_t pixel_y = j / image.width();
const size_t pixel_num = pixel_x + pixel_y * image.width();
......
//Parameterization
#define UTIA_2D 0
#define UTIA_4D 1
#define UTIA_4D_H 2
#define UTIA_4D_H_NL 3
#define RUSINKIEWICZ_2D 4
#define RUSINKIEWICZ_2D_COS 5
#define RUSINKIEWICZ_3D 6
#define RUSINKIEWICZ_3D_COS 7
#define RUSINKIEWICZ_4D 8
#define HEMISPHERICAL_ALBEDO 9 //TODO
#define UTIA_2D 0
#define UTIA_4D 1
#define UTIA_4D_H 2
#define UTIA_4D_H_NL 3
#define RUSINKIEWICZ_2D 4
#define RUSINKIEWICZ_2D_COS 5
#define RUSINKIEWICZ_3D 6
#define RUSINKIEWICZ_3D_COS 7
#define RUSINKIEWICZ_4D 8
#define HEMISPHERICAL_ALBEDO 9 //TODO
float3 toLocalFrame(float3 dir, float3 normal, float3 tangent, float3 bitangent)
{
......@@ -41,10 +41,10 @@ float azimuthAngle2(float3 local_dir)
}
float directionToPhi(float3 normal, float3 direction)
{
{
float3 local_dir = toLocalFrame(direction, normal, tangent, cross(normal, tangent));
float phi = atan2f(local_dir.y, local_dir.x) + M_PIf;
float phi = atan2f(local_dir.y, local_dir.x) + M_PIf;
return phi;
}
......@@ -57,12 +57,12 @@ float directionToTheta(float3 normal, float3 direction)
float2 directionToSpherical(float3 normal, float3 direction)
{
float theta = acos(dot(normal, direction));
//Map theta from 0;pi/2 to 0;1
//Map theta from 0;pi/2 to 0;1
theta *= 2.f / M_PIf;
float phi = directionToPhi(normal, direction);
//Map phi from 0;2pi to 0;1
//Map phi from 0;2pi to 0;1
phi *= 0.5f / M_PIf;
return make_float2(theta, phi);
}
......@@ -298,7 +298,7 @@ public:
#ifdef MRF_RENDERING_MODE_SPECTRAL
static constexpr char const *const REF_ENVMAP_AT = "ref_envmap_spectral";
#else
static constexpr char const *const REF_ENVMAP_AT = "ref_envmap";
static constexpr char const *const REF_ENVMAP_AT = "ref_envmap";
#endif
static constexpr char const *const NORMALIZATION_AT = "normalized";
......
......@@ -1278,7 +1278,7 @@ SceneParser::addMesh(XMLElement *a_mesh_element, mrf::rendering::Scene &scene, i
enforced_materials.resize(per_face_material.size());
#pragma omp parallel for schedule(static)
#pragma omp parallel for schedule(static)
for (int i = 0; i < enforced_materials.size(); ++i)
{
unsigned int prev = per_face_material[i];
......
......@@ -126,7 +126,10 @@ protected:
bool parseUTIATexture(tinyxml2::XMLElement *a_tex_element, mrf::materials::UTIA *utia_mat);
bool parseUTIA(tinyxml2::XMLElement *a_mat_element, mrf::materials::UTIA *utia_mat);
bool parseIndexedUTIATexture(tinyxml2::XMLElement *a_tex_element, mrf::materials::IndexedUTIA *idx_utia_mat, int tex_index = 0);
bool parseIndexedUTIATexture(
tinyxml2::XMLElement * a_tex_element,
mrf::materials::IndexedUTIA *idx_utia_mat,
int tex_index = 0);
bool parseIndexedUTIA(tinyxml2::XMLElement *a_mat_element, mrf::materials::IndexedUTIA *idx_utia_mat);
void parsePrincipled(tinyxml2::XMLElement *a_mat_element, mrf::materials::PrincipledDisney *principled_mat);
......
......@@ -32,12 +32,12 @@ char const *BRDFTypes::ANISOTROPIC_PHONG = "AnisotropicPhong";
char const *BRDFTypes::AS = "AS";
char const *BRDFTypes::AS_NGAN = "AS_NGAN";
char const *BRDFTypes::AS_ISO = "AS_ISO";
char const *BRDFTypes::POULIN = "POULIN";
char const *BRDFTypes::MEASURED_ANISO_NGAN = "MeasuredAnisoNgan";
char const *BRDFTypes::MEASURED_ISOTROPIC = "MeasuredIsotropic";
char const *BRDFTypes::UTIA = "UTIA";
char const *BRDFTypes::UTIA_INDEXED = "IndexedUTIA";
char const *BRDFTypes::AS_ISO = "AS_ISO";
char const *BRDFTypes::POULIN = "POULIN";
char const *BRDFTypes::MEASURED_ANISO_NGAN = "MeasuredAnisoNgan";
char const *BRDFTypes::MEASURED_ISOTROPIC = "MeasuredIsotropic";
char const *BRDFTypes::UTIA = "UTIA";
char const *BRDFTypes::UTIA_INDEXED = "IndexedUTIA";
char const *BRDFTypes::DBRDF = "d-brdf";
......
......@@ -37,7 +37,7 @@ mrf::image::IMAGE_LOAD_SAVE_FLAGS UTIA::loadUTIAData(std::string const &filename
#ifdef MRF_RENDERING_MODE_SPECTRAL
//_data = mrf::image::loadSpectralImage(filename, true);
#else
_utia_data = mrf::image::loadColorImage(filename, true);
_utia_data = mrf::image::loadColorImage(filename, true);
#endif
}
catch (mrf::image::IMAGE_LOAD_SAVE_FLAGS &error)
......@@ -60,7 +60,8 @@ IndexedUTIA::IndexedUTIA(std::string const &name): BRDF(name)
//, _phiIdiv(1)
{}
IndexedUTIA::~IndexedUTIA() {
IndexedUTIA::~IndexedUTIA()
{
//for (auto it = _utia_materials.begin(); it != _utia_materials.end(); ++it)
//{
// auto mat = it->second;
......@@ -85,7 +86,7 @@ mrf::image::IMAGE_LOAD_SAVE_FLAGS IndexedUTIA::loadUTIAMap(std::string const &fi
#ifdef MRF_RENDERING_MODE_SPECTRAL
//_data = mrf::image::loadSpectralImage(filename, true);
#else
_utia_index_map = mrf::image::loadColorImage(filename, true);
_utia_index_map = mrf::image::loadColorImage(filename, true);
#endif
}
catch (mrf::image::IMAGE_LOAD_SAVE_FLAGS &error)
......
......@@ -69,7 +69,7 @@ public:
#ifdef MRF_RENDERING_MODE_SPECTRAL
mrf::image::UniformSpectralImage const &getUTIAData() const { return *_utia_data.get(); }
#else
mrf::image::ColorImage const &getUTIAData() const { return *_utia_data.get(); }
mrf::image::ColorImage const & getUTIAData() const { return *_utia_data.get(); }
#endif
mrf::image::IMAGE_LOAD_SAVE_FLAGS loadUTIAData(std::string const &filename);
......@@ -93,7 +93,7 @@ public:
class MRF_CORE_EXPORT IndexedUTIA: public BRDF
{
protected:
std::map<int, UTIA*> _utia_materials;
std::map<int, UTIA *> _utia_materials;
std::unique_ptr<mrf::image::ColorImage> _utia_index_map;
......@@ -148,7 +148,7 @@ public:
return _utia_materials.at(index).getUTIAData();
}
#else
mrf::image::ColorImage const &getUTIAData(const int index = 0) const
mrf::image::ColorImage const & getUTIAData(const int index = 0) const
{
return _utia_materials.at(index)->getUTIAData();
}
......
/*
*
* author : Romain Pacanowski @ institutoptique.fr
* Copyright CNRS 2016
* Copyright CNRS 2017
*
**/
/*
*
* author : Romain Pacanowski @ institutoptique.fr
* Copyright CNRS 2016
* Copyright CNRS 2017
*
**/
#include <mrf_core/materials/measured_material.hpp>
#include <mrf_core/sampling/random_generator.hpp>
#include <mrf_core/materials/measured_material.hpp>
#include <mrf_core/sampling/random_generator.hpp>
namespace mrf
{
namespace materials
{
using namespace mrf::sampling;
using namespace math;
MeasuredMaterial::MeasuredMaterial(std::string const &name): BRDF(name)
{
}
MeasuredMaterial::~MeasuredMaterial()
{
}
namespace mrf
{
namespace materials
{
using namespace mrf::sampling;
using namespace math;
float MeasuredMaterial::diffuseAlbedo() const
{
return 0.f;
}
float MeasuredMaterial::diffuseAlbedo(mrf::geom::LocalFrame const & /*lf*/) const
{
return diffuseAlbedo();
}
bool MeasuredMaterial::diffuseComponent() const
{
return true;
}
float MeasuredMaterial::specularAlbedo() const
{
return 0.0f;
}
float MeasuredMaterial::specularAlbedo(mrf::geom::LocalFrame const &) const
{
return 0.0;
}
bool MeasuredMaterial::specularComponent() const
{
return false;
}
float MeasuredMaterial::transmissionAlbedo() const
{
return 0.0f;
}
float MeasuredMaterial::transmissionAlbedo(mrf::geom::LocalFrame const &) const
{
return 0.0;
}
bool MeasuredMaterial::transmissionComponent() const
{
return false;
}
float MeasuredMaterial::nonDiffuseAlbedo() const
{
return 0.0f;
}
bool MeasuredMaterial::nonDiffuseComponent() const
{
return false;
}
float MeasuredMaterial::totalAlbedo() const
{
return 0.f;
}
//-------------------------------------------------------------------
// float MeasuredMaterial::diffPDF(
// mrf::geom::LocalFrame const &lf,
// mrf::math::Vec3f const & in_dir,
// mrf::math::Vec3f const & out_dir) const
// {
// return 0.f;
// }
// float MeasuredMaterial::specPDF(
// mrf::geom::LocalFrame const &lf,
// mrf::math::Vec3f const & in_dir,
// mrf::math::Vec3f const & out_dir) const
// {
// return 0.0f;
// }
// float MeasuredMaterial::transPDF(
// mrf::geom::LocalFrame const &lf,
// mrf::math::Vec3f const & in_dir,
// mrf::math::Vec3f const & out_dir) const
// {
// return 0.0f;
// }
// float MeasuredMaterial::nonDiffusePDF(
// mrf::geom::LocalFrame const &lf,
// mrf::math::Vec3f const & in_dir,
// mrf::math::Vec3f const & out_dir) const
// {
// return 0.0f;
// }
//-------------------------------------------------------------------
ScatterEvent::SCATTER_EVT MeasuredMaterial::generateScatteringDirection(
mrf::geom::LocalFrame const &lf,
mrf::math::Vec3f const & /*in_dir*/,
RADIANCE_TYPE & /*incident_radiance*/,
Vec3f &outgoing_dir) const
{
float e1 = RandomGenerator::Instance().getFloat();
//TODO IMPROVE ME : check whether or not the norma of
// incident_radiance * _color is > EPSILON
// if not RETURN IMMEDIATELY ON ABSORPTION EVENT !!!
if (e1 < diffuseAlbedo()) // TOTAL ALBEDO = DIFFUSE ALBEDO FOR
// LAMBERTIAN SURFACE
{
//#ifdef DEBUG
// std::cout << " HEere = " << __FILE__ << " "<< __LINE__ << std::endl;
// std::cout << " _color = " << _color << std::endl ;
//#endif
//We use a pdf proportional to the cosine
//incident_radiance *= _color;
e1 /= diffuseAlbedo();
float e2 = RandomGenerator::Instance().getFloat();
outgoing_dir = randomHemiCosDirection(lf, e1, e2);
//#ifdef DEBUG
// std::cout << " outgoing_dir = " << outgoing_dir << std::endl ;
//#endif
return ScatterEvent::DIFFUSE_REFL;
}
else
{
return ScatterEvent::ABSORPTION;
}
}
ScatterEvent::SCATTER_EVT MeasuredMaterial::scatteringDirection(
mrf::geom::LocalFrame const &lf,
mrf::math::Vec3f const & /*in_dir*/,
mrf::math::Vec3f &outgoing_dir,
float & proba_outgoing_dir,
float e1,
float e2) const
{
if (e1 < diffuseAlbedo()) // TOTAL ALBEDO = DIFFUSE ALBEDO FOR
// LAMBERTIAN SURFACE
{
//We use a pdf proportional to the cosine
float const e3 = e1 / diffuseAlbedo();
outgoing_dir = randomHemiCosDirection(lf, e2, e3);
proba_outgoing_dir = static_cast<float>(Math::INV_PI) * diffuseAlbedo();
return ScatterEvent::DIFFUSE_REFL;
}
else
{
return ScatterEvent::ABSORPTION;
}
}
ScatterEvent::SCATTER_EVT MeasuredMaterial::scatteringDirectionWithBRDF(
mrf::geom::LocalFrame const &lf,
mrf::math::Vec3f const & /*in_dir*/,
float e1,
float e2,
mrf::math::Vec3f &outgoing_dir,
RADIANCE_TYPE & brdf_corrected_by_pdf) const
{
if (e1 < diffuseAlbedo()) // TOTAL ALBEDO = DIFFUSE ALBEDO FOR LAMBERTIAN SURFACE
{
//We use a pdf proportional to the cosine
float const e3 = e1 / diffuseAlbedo();
outgoing_dir = randomHemiCosDirection(lf, e2, e3);
//proba_outgoing_dir = Math::INV_PI * diffuseAlbedo();
// Since the BRDF / pdf = 1.0, we just return the _color (which is normalized)
float const dot_NL = outgoing_dir.dot(lf.normal());
if (dot_NL <= 0.0f)
{
brdf_corrected_by_pdf = RADIANCE_TYPE(0.0);
return ScatterEvent::ABSORPTION;
#ifdef MRF_DEBUG
std::cout << " dot_NL = " << dot_NL << " outgoing_dir = " << outgoing_dir << " lf = " << lf
<< " in_dir = " << in_dir << std::endl;
std::cout << " e1= " << e1 << " e2= " << e2 << std::endl;
assert(0);
#endif
}
brdf_corrected_by_pdf = 0.f; // _color / dot_NL;
return ScatterEvent::DIFFUSE_REFL;
}
return ScatterEvent::ABSORPTION;
}
} // namespace materials
} // namespace mrf
MeasuredMaterial::MeasuredMaterial(std::string const &name): BRDF(name) {}
MeasuredMaterial::~MeasuredMaterial() {}
float MeasuredMaterial::diffuseAlbedo() const
{
return 0.f;
}
float MeasuredMaterial::diffuseAlbedo(mrf::geom::LocalFrame const & /*lf*/) const
{
return diffuseAlbedo();
}
bool MeasuredMaterial::diffuseComponent() const
{
return true;
}
float MeasuredMaterial::specularAlbedo() const
{
return 0.0f;
}
float MeasuredMaterial::specularAlbedo(mrf::geom::LocalFrame const &) const
{
return 0.0;
}
bool MeasuredMaterial::specularComponent() const
{
return false;
}
float MeasuredMaterial::transmissionAlbedo() const
{
return 0.0f;
}
float MeasuredMaterial::transmissionAlbedo(mrf::geom::LocalFrame const &) const
{
return 0.0;
}
bool MeasuredMaterial::transmissionComponent() const
{
return false;
}
float MeasuredMaterial::nonDiffuseAlbedo() const
{
return 0.0f;
}
bool MeasuredMaterial::nonDiffuseComponent() const
{
return false;
}
float MeasuredMaterial::totalAlbedo() const
{
return 0.f;
}
//-------------------------------------------------------------------
// float MeasuredMaterial::diffPDF(
// mrf::geom::LocalFrame const &lf,
// mrf::math::Vec3f const & in_dir,
// mrf::math::Vec3f const & out_dir) const
// {
// return 0.f;
// }
// float MeasuredMaterial::specPDF(
// mrf::geom::LocalFrame const &lf,
// mrf::math::Vec3f const & in_dir,
// mrf::math::Vec3f const & out_dir) const
// {
// return 0.0f;
// }
// float MeasuredMaterial::transPDF(
// mrf::geom::LocalFrame const &lf,
// mrf::math::Vec3f const & in_dir,
// mrf::math::Vec3f const & out_dir) const
// {
// return 0.0f;
// }
// float MeasuredMaterial::nonDiffusePDF(
// mrf::geom::LocalFrame const &lf,
// mrf::math::Vec3f const & in_dir,
// mrf::math::Vec3f const & out_dir) const
// {
// return 0.0f;
// }
//-------------------------------------------------------------------
ScatterEvent::SCATTER_EVT MeasuredMaterial::generateScatteringDirection(
mrf::geom::LocalFrame const &lf,
mrf::math::Vec3f const & /*in_dir*/,
RADIANCE_TYPE & /*incident_radiance*/,
Vec3f &outgoing_dir) const
{
float e1 = RandomGenerator::Instance().getFloat();
//TODO IMPROVE ME : check whether or not the norma of
// incident_radiance * _color is > EPSILON
// if not RETURN IMMEDIATELY ON ABSORPTION EVENT !!!
if (e1 < diffuseAlbedo()) // TOTAL ALBEDO = DIFFUSE ALBEDO FOR
// LAMBERTIAN SURFACE
{
//#ifdef DEBUG
// std::cout << " HEere = " << __FILE__ << " "<< __LINE__ << std::endl;
// std::cout << " _color = " << _color << std::endl ;
//#endif
//We use a pdf proportional to the cosine
//incident_radiance *= _color;
e1 /= diffuseAlbedo();
float e2 = RandomGenerator::Instance().getFloat();
outgoing_dir = randomHemiCosDirection(lf, e1, e2);
//#ifdef DEBUG
// std::cout << " outgoing_dir = " << outgoing_dir << std::endl ;
//#endif
return ScatterEvent::DIFFUSE_REFL;
}