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

[Feature] Add ColorRamp #821

Open
wants to merge 9 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
1 change: 1 addition & 0 deletions include/mitsuba/core/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ NAMESPACE_BEGIN(mitsuba)
* and has no overhead for references.
*/
class MI_EXPORT_LIB Object {

public:
/// Default constructor
Object() { }
Expand Down
4 changes: 3 additions & 1 deletion include/mitsuba/render/fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ template <typename Float_, typename Spectrum_> struct RenderAliases {
using ShapePtr = dr::replace_scalar_t<Float, const Shape *>;
using SensorPtr = dr::replace_scalar_t<Float, const Sensor *>;
using EmitterPtr = dr::replace_scalar_t<Float, const Emitter *>;
using TexturePtr = dr::replace_scalar_t<Float, const Texture *>;
};

#define MMI_USING_MEMBERS_MACRO2(x) \
Expand Down Expand Up @@ -186,6 +187,7 @@ template <typename Float_, typename Spectrum_> struct RenderAliases {
using MediumPtr = typename RenderAliases::MediumPtr; \
using ShapePtr = typename RenderAliases::ShapePtr; \
using EmitterPtr = typename RenderAliases::EmitterPtr; \
using SensorPtr = typename RenderAliases::SensorPtr;
using SensorPtr = typename RenderAliases::SensorPtr; \
using TexturePtr = typename RenderAliases::TexturePtr;

NAMESPACE_END(mitsuba)
22 changes: 22 additions & 0 deletions include/mitsuba/render/texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ class MI_EXPORT_LIB Texture : public Object {
/// Set a string identifier
void set_id(const std::string& id) override { m_id = id; };

DRJIT_VCALL_REGISTER(Float, mitsuba::Texture)

MI_DECLARE_CLASS()

protected:
Expand All @@ -238,3 +240,23 @@ class MI_EXPORT_LIB Texture : public Object {

MI_EXTERN_CLASS(Texture)
NAMESPACE_END(mitsuba)


// -----------------------------------------------------------------------
//! @{ \name Dr.Jit support for vectorized function calls
// -----------------------------------------------------------------------

DRJIT_VCALL_TEMPLATE_BEGIN(mitsuba::Texture)
DRJIT_VCALL_METHOD(eval)
DRJIT_VCALL_METHOD(sample_spectrum)
DRJIT_VCALL_METHOD(pdf_spectrum)
DRJIT_VCALL_METHOD(sample_position)
DRJIT_VCALL_METHOD(pdf_position)
DRJIT_VCALL_METHOD(eval_1)
DRJIT_VCALL_METHOD(eval_1_grad)
DRJIT_VCALL_METHOD(eval_3)
DRJIT_VCALL_METHOD(mean)
DRJIT_VCALL_TEMPLATE_END(mitsuba::Texture)

//! @}
// -----------------------------------------------------------------------
2 changes: 1 addition & 1 deletion src/bsdfs/principled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class Principled final : public BSDF<Float, Spectrum> {

/*Eta and specular has one to one correspondence, both of them can
* not be specified. */
if (props.has_property("eta") && props.has_property("specular")) {
if (props.has_property("eta") && props.has_property("specular")) { // TODO: ask
Throw("Specified an invalid index of refraction property "
"\"%s\", either use \"eta\" or \"specular\" !");
} else if (props.has_property("eta")) {
Expand Down
2 changes: 2 additions & 0 deletions src/core/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ const Class *PluginManager::get_plugin_class(const std::string &name,

auto it = std::find(d->m_python_plugins.begin(), d->m_python_plugins.end(),
name + "@" + variant);

if (it != d->m_python_plugins.end()) {
plugin_class = Class::for_name(name, variant);
} else {
Expand Down Expand Up @@ -178,6 +179,7 @@ ref<Object> PluginManager::create_object(const Properties &props,
return class_->construct(props);

std::string variant = class_->variant();

const Class *plugin_class = get_plugin_class(props.plugin_name(), variant);

/* Construct each plugin in its own scope to isolate them from each other.
Expand Down
1 change: 1 addition & 0 deletions src/textures/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ add_plugin(bitmap bitmap.cpp)
add_plugin(checkerboard checkerboard.cpp)
add_plugin(mesh_attribute mesh_attribute.cpp)
add_plugin(volume volume.cpp)
add_plugin(color_ramp color_ramp.cpp)

set(MI_PLUGIN_TARGETS "${MI_PLUGIN_TARGETS}" PARENT_SCOPE)
Loading