Skip to content
Snippets Groups Projects
Commit 23f1c62a authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

start moving refined stack out of IFresnelMap

parent db8375bb
No related branches found
No related tags found
1 merge request!196hold only refined slices; roughness-only slicing is temporary
...@@ -114,6 +114,7 @@ SliceStack refineStack(const SliceStack& stack, const std::vector<ProcessedLayou ...@@ -114,6 +114,7 @@ SliceStack refineStack(const SliceStack& stack, const std::vector<ProcessedLayou
result[i_slice].setMaterial(createAveragedMaterial(slice_mat, entry.second)); result[i_slice].setMaterial(createAveragedMaterial(slice_mat, entry.second));
} }
} }
ASSERT(result.size()==stack.size());
return result; return result;
} }
...@@ -199,22 +200,6 @@ std::vector<ProcessedLayout> collectLayouts(const MultiLayer& sample, const Slic ...@@ -199,22 +200,6 @@ std::vector<ProcessedLayout> collectLayouts(const MultiLayer& sample, const Slic
return result; return result;
} }
//! Returns a Fresnel map, for use in ProcessedSample constructor.
std::unique_ptr<IFresnelMap> fresnelify(const MultiLayer& sample, const SliceStack& slices,
const std::vector<ProcessedLayout>& layouts,
const SimulationOptions& options)
{
SliceStack fresnelStack = options.useAvgMaterials() ? refineStack(slices, layouts) : slices;
if (slices.containsMagneticMaterial())
return std::make_unique<MatrixFresnelMap>(
fresnelStack,
SampleUtils::SpecularStrategyBuilder::buildMagnetic(sample.roughnessModel()));
return std::make_unique<ScalarFresnelMap>(
fresnelStack, SampleUtils::SpecularStrategyBuilder::buildScalar(sample.roughnessModel()));
}
} // namespace } // namespace
...@@ -228,7 +213,14 @@ ProcessedSample::ProcessedSample(const MultiLayer& sample, const SimulationOptio ...@@ -228,7 +213,14 @@ ProcessedSample::ProcessedSample(const MultiLayer& sample, const SimulationOptio
, m_polarized{forcePolarized || sample.isMagnetic()} , m_polarized{forcePolarized || sample.isMagnetic()}
, m_slices{slicify(sample, options).setBField(sample.externalField())} , m_slices{slicify(sample, options).setBField(sample.externalField())}
, m_layouts{collectLayouts(sample, m_slices, m_polarized)} , m_layouts{collectLayouts(sample, m_slices, m_polarized)}
, m_fresnel_map{fresnelify(sample, m_slices, m_layouts, options)} , m_refined_stack(options.useAvgMaterials() ? refineStack(m_slices, m_layouts) : m_slices)
, m_fresnel_map(m_slices.containsMagneticMaterial()
? (std::unique_ptr<IFresnelMap>)std::make_unique<MatrixFresnelMap>(
m_refined_stack,
SampleUtils::SpecularStrategyBuilder::buildMagnetic(sample.roughnessModel()))
: (std::unique_ptr<IFresnelMap>)std::make_unique<ScalarFresnelMap>(
m_refined_stack,
SampleUtils::SpecularStrategyBuilder::buildScalar(sample.roughnessModel())))
{ {
} }
......
...@@ -63,6 +63,7 @@ private: ...@@ -63,6 +63,7 @@ private:
const bool m_polarized; const bool m_polarized;
const SliceStack m_slices; const SliceStack m_slices;
const std::vector<ProcessedLayout> m_layouts; const std::vector<ProcessedLayout> m_layouts;
const SliceStack m_refined_stack;
const std::unique_ptr<const IFresnelMap> m_fresnel_map; const std::unique_ptr<const IFresnelMap> m_fresnel_map;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment