Commit 6e4a3eb2 authored by MURRAY David's avatar MURRAY David
Browse files

add base for multi and indexed material

parent 37b19e10
......@@ -302,8 +302,7 @@ void OptixGeometryHandler::loadMeshFromMRF(
//std::copy(mrf_mesh.faces().cbegin(), mrf_mesh.faces().cend(), mesh.tri_indices);
memcpy(mesh.tri_indices, &mrf_mesh.faces()[0], mrf_mesh.faces().size() * sizeof(unsigned int));
memset(mesh.mat_indices, 0, sizeof(int32_t) * mrf_mesh.faces().size() / 3);
memcpy(mesh.mat_indices, &mrf_mesh.materialPerFaces()[0], mrf_mesh.materialPerFaces().size() * sizeof(unsigned int));
applyLoadXForm(mesh, load_xform.getData());
......
......@@ -18,6 +18,7 @@ set(SOURCES
${CMAKE_CURRENT_LIST_DIR}/l_phong_textured.cpp
${CMAKE_CURRENT_LIST_DIR}/material_builder.cpp
${CMAKE_CURRENT_LIST_DIR}/measured_isotropic.cpp
${CMAKE_CURRENT_LIST_DIR}/multi_material.cpp
${CMAKE_CURRENT_LIST_DIR}/normal_shader.cpp
${CMAKE_CURRENT_LIST_DIR}/perfect_mirror.cpp
${CMAKE_CURRENT_LIST_DIR}/principled.cpp
......@@ -55,6 +56,7 @@ set(HEADERS
${CMAKE_CURRENT_LIST_DIR}/material_builder.hpp
${CMAKE_CURRENT_LIST_DIR}/materials.hpp
${CMAKE_CURRENT_LIST_DIR}/measured_isotropic.hpp
${CMAKE_CURRENT_LIST_DIR}/multi_material.hpp
${CMAKE_CURRENT_LIST_DIR}/normal_shader.hpp
${CMAKE_CURRENT_LIST_DIR}/perfect_mirror.hpp
${CMAKE_CURRENT_LIST_DIR}/principled.hpp
......
#include "multi_material.hpp"
namespace mrf
{
namespace materials
{
MultiMaterial::MultiMaterial(std::string const &name, unsigned int nb_mat) : BRDF(name){}
MultiMaterial::~MultiMaterial() {}
}
} // namespace mrf
\ No newline at end of file
#pragma once
#include <mrf_dll.hpp>
#include <mrf_core/mrf_types.hpp>
#include <mrf_core/materials/brdf.hpp>
namespace mrf
{
namespace materials
{
//-------------------------------------------------------------------//
//--------------- Physical Phong Model by Lafortune CLASS --//
//-------------------------------------------------------------------//
class MRF_CORE_EXPORT MultiMaterial: public BRDF
{
protected:
std::map<unsigned int, UMat *> _material_map;
unsigned int _index_offset;
unsigned int _material_count;
std::vector<unsigned int> _normalized_indices;
public:
MultiMaterial(std::string const &name, unsigned int nb_mat);
~MultiMaterial();
};
} // namespace materials
} // namespace mrf
\ No newline at end of file
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