Skip to content

Commit

Permalink
Adapt to SourceInputs argument in evaluate functions (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
usakhelo authored and dictoon committed Nov 15, 2017
1 parent 76c2ed0 commit 7495f95
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/appleseed-max-impl/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ namespace
: public ShadeContext
{
public:
explicit MaxShadeContext(const asf::Vector2f& uv)
explicit MaxShadeContext(const asr::SourceInputs& source_inputs)
{
doMaps = TRUE;
filterMaps = FALSE;
Expand All @@ -342,8 +342,8 @@ namespace
// todo: initialize `out`?

m_cur_time = GetCOREInterface()->GetTime();
m_uv.x = uv.x;
m_uv.y = uv.y;
m_uv.x = source_inputs.m_uv_x;
m_uv.y = source_inputs.m_uv_y;
}

BOOL InMtlEditor() override
Expand Down Expand Up @@ -544,69 +544,69 @@ namespace

virtual void evaluate(
asr::TextureCache& texture_cache,
const asf::Vector2f& uv,
const asr::SourceInputs& source_inputs,
float& scalar) const override
{
scalar = evaluate_float(uv);
scalar = evaluate_float(source_inputs);
}

virtual void evaluate(
asr::TextureCache& texture_cache,
const asf::Vector2f& uv,
const asr::SourceInputs& source_inputs,
asf::Color3f& linear_rgb) const override
{
evaluate_color(uv, linear_rgb.r, linear_rgb.g, linear_rgb.b);
evaluate_color(source_inputs, linear_rgb.r, linear_rgb.g, linear_rgb.b);
}

virtual void evaluate(
asr::TextureCache& texture_cache,
const asf::Vector2f& uv,
const asr::SourceInputs& source_inputs,
asr::Spectrum& spectrum) const override
{
DbgAssert(spectrum.size() == 3);
evaluate_color(uv, spectrum[0], spectrum[1], spectrum[2]);
evaluate_color(source_inputs, spectrum[0], spectrum[1], spectrum[2]);
}

virtual void evaluate(
asr::TextureCache& texture_cache,
const asf::Vector2f& uv,
const asr::SourceInputs& source_inputs,
asr::Alpha& alpha) const override
{
alpha.set(evaluate_float(uv));
alpha.set(evaluate_float(source_inputs));
}

virtual void evaluate(
asr::TextureCache& texture_cache,
const asf::Vector2f& uv,
const asr::SourceInputs& source_inputs,
asf::Color3f& linear_rgb,
asr::Alpha& alpha) const override
{
evaluate_color(uv, linear_rgb.r, linear_rgb.g, linear_rgb.b, alpha);
evaluate_color(source_inputs, linear_rgb.r, linear_rgb.g, linear_rgb.b, alpha);
}

virtual void evaluate(
asr::TextureCache& texture_cache,
const asf::Vector2f& uv,
const asr::SourceInputs& source_inputs,
asr::Spectrum& spectrum,
asr::Alpha& alpha) const override
{
DbgAssert(spectrum.size() == 3);
evaluate_color(uv, spectrum[0], spectrum[1], spectrum[2], alpha);
evaluate_color(source_inputs, spectrum[0], spectrum[1], spectrum[2], alpha);
}

private:
Texmap* m_texmap;

float evaluate_float(const asf::Vector2f& uv) const
float evaluate_float(const asr::SourceInputs& source_inputs) const
{
MaxShadeContext maxsc(uv);
MaxShadeContext maxsc(source_inputs);

return m_texmap->EvalMono(maxsc);
}

void evaluate_color(const asf::Vector2f& uv, float& r, float& g, float& b) const
void evaluate_color(const asr::SourceInputs& source_inputs, float& r, float& g, float& b) const
{
MaxShadeContext maxsc(uv);
MaxShadeContext maxsc(source_inputs);

const AColor tex_color = m_texmap->EvalColor(maxsc);

Expand All @@ -615,9 +615,9 @@ namespace
b = tex_color.b;
}

void evaluate_color(const asf::Vector2f& uv, float& r, float& g, float& b, asr::Alpha& alpha) const
void evaluate_color(const asr::SourceInputs& source_inputs, float& r, float& g, float& b, asr::Alpha& alpha) const
{
MaxShadeContext maxsc(uv);
MaxShadeContext maxsc(source_inputs);

const AColor tex_color = m_texmap->EvalColor(maxsc);

Expand Down

0 comments on commit 7495f95

Please sign in to comment.